from datetime import datetime from playwright.sync_api import expect TODAY = datetime.now().strftime('%Y-%m-%d') BATCHNO = "" # 采购入库单 单据体-批号 # 执行时间:4min def test_purchaseorder(home_page, list_page, head_page, body_page, push_page): """ 【面料采购,客供付费】新增采购订单 """ home_page.change_org("鲁泰纺织") home_page.close_all_opening_bills() home_page.search_bill("标准采购订单列表") list_page.click_button("新增") head_page.set_value("采购员", "宋伟锋") head_page.set_value("供应商", "1170109") head_page.set_value("客户", "418") head_page.set_value("是否保税", "是") head_page.set_value("外发国外", "否") head_page.set_value("采购合同交期", TODAY) head_page.set_checked("含税") # 取消勾选含税 assert head_page.get_value("采购部门") != "" assert head_page.get_value("采购组") != "" body_page.set_value(1, "物料编码", "AQW04041-1415554-1") body_page.set_value(2, "物料编码", "B04043-1800079-W1") body_page.set_value(1, "等级", "一等") body_page.set_value(2, "等级", "一等") body_page.set_value(1, "采购数量", "2") body_page.set_value(1, "原产国", "中国") body_page.set_value(1, "单价", "2.8") body_page.set_value(1, "需求部门", "服装营销一科") body_page.set_value(1, "物料来源", "客供付费") body_page._activate_field(1, "采购数量") body_page.click_button("批量填充") body_page._activate_field(1, "原产国") body_page.click_button("批量填充") body_page._activate_field(1, "单价") body_page.click_button("批量填充") body_page._activate_field(1, "需求部门") body_page.click_button("批量填充") body_page._activate_field(1, "物料来源") body_page.click_button("批量填充") head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") def test_importdeclare_process(home_page, list_page, head_page, body_page, push_page): """ 【面料采购,客供付费】采购订单 下推 进口报关单(加工贸易) """ head_page.click_button("下推") push_page.push_draw_bill("进口报关单") head_page.set_value("报关口岸", "瑞丽海关8603") head_page.set_value("贸易方式", "进料对口") body_page.set_value(1, "报关项号", "LT82") body_page._activate_field(1, "报关项号") body_page.click_button("批量填充") head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") assert "成功" in head_page.get_hint_message("确定") def test_instock(page, home_page, list_page, head_page, body_page, push_page): """ 【面料采购,客供付费】采购订单 下推 采购入库单 """ home_page.close_bill_by_name("进口报关单") home_page.close_bill_by_name("标准采购订单列表") home_page.change_bill_tab("采购订单") head_page.click_button("下推") push_page.push_draw_bill("采购入库单") head_page.set_value("仓管员", "高绪丽") assert head_page.get_value("收料部门") != "" body_page.set_value(1, "仓库", "总公司进口衬衣面料保税材料仓库") body_page.set_value(1, "面料仓库", "301080115-3") body_page._activate_field(1, "仓库") body_page.click_button("批量填充") body_page._activate_field(1, "面料仓库") body_page.click_button("批量填充") assert body_page.get_value(1, "实收数量") != "" assert body_page.get_value(2, "实收数量") != "" assert body_page.get_value(1, "批号") != "" assert body_page.get_value(2, "批号") != "" global BATCHNO BATCHNO = body_page.get_value(1, "批号") head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") # expect(page.locator("//span[text()='普通']").first).to_be_visible(timeout=30000) # 需要等待 msg = head_page.get_multi_error_message() assert "采购入库单,审核成功" in msg assert "应付单,审核成功" in msg def test_mrapp(page, home_page, list_page, head_page, body_page, push_page): """ 【面料退料】采购订单 下推 退料申请单 """ home_page.close_bill_by_name("采购入库单") home_page.change_bill_tab("采购订单") head_page.click_button("下推") push_page.push_draw_bill("退料申请单") head_page.set_value("申请人", "朱芸") head_page.set_value("退料方式", "退料并扣款") body_page.set_value(1, "申请退料数量", "1") global BATCHNO body_page.set_value(1, "批号", BATCHNO) body_page._activate_field(1, "申请退料数量") body_page.click_button("批量填充") body_page._activate_field(1, "批号") body_page.click_button("批量填充") assert head_page.get_value("退料类型") != "" assert head_page.get_value("采购部门") != "" assert head_page.get_value("采购组") != "" assert head_page.get_value("采购员") != "" head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") def test_mrb(page, home_page, list_page, head_page, body_page, push_page): """ 【面料退料】退料申请单 下推 采购退料单 """ head_page.click_button("下推") push_page.push_draw_bill("采购退料单") head_page.set_value("退料部门", "仓储管理部") head_page.set_value("仓管员", "高绪丽") head_page.set_value("退料原因", "进料料件复出") body_page.set_value(1, "仓库", "总公司进口衬衣面料保税材料仓库") body_page.set_value(1, "面料仓库", "301080115-3") body_page._activate_field(1, "仓库") body_page.click_button("批量填充") body_page._activate_field(1, "面料仓库") body_page.click_button("批量填充") assert body_page.get_value(1, "批号") != "" assert body_page.get_value(2, "批号") != "" head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") assert "成功" in head_page.get_hint_message("确定") def test_importdeclare_return(page, home_page, list_page, head_page, body_page, push_page): """ 【面料退料】采购退料单 下推 进口报关单(料件复出) """ head_page.click_button("下推") push_page.push_draw_bill("进口报关单", "采购退料单下推来料料件复出业务", "料件复出", "鲁泰纺织股份有限公司") head_page.set_value("报关口岸", "瑞丽海关8603") head_page.set_value("贸易方式", "进料料件复出") head_page.click_button("保存") head_page.click_button("提交") head_page.click_button("审核") assert "成功" in head_page.get_hint_message("确定")