Pārlūkot izejas kodu

采购管理测试流程

sunyiyue 1 nedēļu atpakaļ
vecāks
revīzija
6e2917d96f

+ 3 - 2
tests/page_test/test_generate_bill_page.py

@@ -12,10 +12,11 @@ from tests.page_test.test_data.data_generate_bill_page import DataGenerateBillPa
 import pytest
 
 @pytest.fixture(scope="module", autouse=True)
-def setup_teardown(orcl_handler):
-    print(orcl_handler.execute_update(DataGenerateBillPage.CREATE_REQUESTION_TEST_DATA))
+def setup_teardown(orcl_helper):
+    print(orcl_helper.execute_update(DataGenerateBillPage.CREATE_REQUESTION_TEST_DATA))
     yield
 
+
 def test_head_page(generate_bill_page, home_page, list_page, filter_page, push_page):
     home_page.search_bill("采购申请单列表")
     list_page.click_button("过滤")

+ 14 - 0
tests/test_case/pur/test_data/data_pur_product.py

@@ -0,0 +1,14 @@
+class DataPurProduct:
+    # 创建委外订单,单据编号=SUB00002415
+    CREATE_SUBREQORDER_TEST_DATA = """
+        BEGIN
+        DELETE FROM T_SUB_REQORDER WHERE (FID IN (668517));
+        INSERT INTO T_SUB_REQORDER (FID, FFORMID, FBILLNO, FBILLTYPE, FSUBORGID, FWORKGROUPID, FPLANNERID, FOWNERID, FDOCUMENTSTATUS, FCREATORID, FCREATEDATE, FMODIFIERID, FMODIFYDATE, FAPPROVERID, FAPPROVEDATE, FCANCELER, FCANCELDATE, FCANCELSTATUS, FDATE, FOWNERTYPEID, FISREWORK, FISQCSUB, FPPBOMTYPE) VALUES (668517, 'SUB_SUBREQORDER', N'SUB00002415', '93904bf745d84ae0ad08da30949754e0', 1, 0, 0, 0, 'C', 46255743, TO_DATE('2025-01-20 13:49:29', 'YYYY-MM-DD HH24:MI:SS'), 46255743, TO_DATE('2025-01-20 13:49:34', 'YYYY-MM-DD HH24:MI:SS'), 46255743, TO_DATE('2025-01-20 13:49:32', 'YYYY-MM-DD HH24:MI:SS'), 0, NULL, 'A', TO_DATE('2025-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 'BD_OwnerOrg', '0', '0', '1');
+        DELETE FROM T_SUB_REQORDER_L WHERE (FID IN (668517));
+        DELETE FROM T_SUB_REQORDERENTRY WHERE (FID IN (668517));
+        INSERT INTO T_SUB_REQORDERENTRY (FID, FENTRYID, FSEQ, FGROUP, FPRODUCTTYPE, FMATERIALID, FUNITID, FQTY, FPLANSTARTDATE, FPLANFINISHDATE, FBOMID, FSUPPLIERID, FMTONO, FPROJECTNO, FROUTINGID, FYIELDRATE, FREQUESTORGID, FSTOCKINLIMITH, FSTOCKINLIMITL, FISSUSPEND, FSTOCKINORGID, FSTOCKID, FSTOCKLOCID, FAUXPROPID, FOPERID, FPROCESSID, FCOSTRATE, FSTOCKINQTY, FPURSELQTY, FPURQTY, FSTATUS, FPLANCONFIRMDATE, FSCHEDULEDATE, FCONVEYDATE, FSTARTDATE, FFINISHDATE, FCLOSEDATE, FCOSTDATE, FROWID, FPARENTROWID, FROWEXPANDTYPE, FPURORGID, FCOPYENTRYID, FLOT, FLOT_TEXT, FBFLOWID, FPRIORITY, FSETTLEORGID, FCUSTSTYLENO, FSELFSTYLENO, FPO, FSHIRTORDNO, FIDENTITY_LT, FOUTSTOCKLMTH_LT, FOUTSTOCKLMTL_LT, FBASEYIELDQTY, FPRDTRACKNO_LT, FISCUTDETAIL_LT, FPROCESSENTRYID_LT, FSALESCATEGORY_LT, FSPECIALART_TXT, FFZHOURSNO, FORGPRDTRACKNO_LT) VALUES (668517, 673329, 1, 1, 1, 51551198, 10101, 5, TO_DATE('2025-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2025-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 52243975, 45703810, N'20250102', N' ', 0, 100, 100004, 5, 5, '0', 1, 0, 0, 106006, 0, 0, 100, 5, 5, 5, '5', TO_DATE('2025-01-20 13:49:32', 'YYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2025-01-20 13:49:32', 'YYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2025-01-20 13:51:12', 'YYYY-MM-DD HH24:MI:SS'), NULL, NULL, '00505694-99ea-9409-11ef-d6f074157655', ' ', 0, 1, 0, 0, N' ', '432a0daa-dd5d-435d-b46d-8934927de0f8', 0, 1, N' ', N' ', N' ', N'41324033', ' ', 0.00, 0.00, 5, 0.00, '0', 0, '207d0c594a04443d8cccb5def56c532d', N' ', N' ', 0);
+        INSERT INTO T_SUB_REQORDERENTRY (FID, FENTRYID, FSEQ, FGROUP, FPRODUCTTYPE, FMATERIALID, FUNITID, FQTY, FPLANSTARTDATE, FPLANFINISHDATE, FBOMID, FSUPPLIERID, FMTONO, FPROJECTNO, FROUTINGID, FYIELDRATE, FREQUESTORGID, FSTOCKINLIMITH, FSTOCKINLIMITL, FISSUSPEND, FSTOCKINORGID, FSTOCKID, FSTOCKLOCID, FAUXPROPID, FOPERID, FPROCESSID, FCOSTRATE, FSTOCKINQTY, FPURSELQTY, FPURQTY, FSTATUS, FPLANCONFIRMDATE, FSCHEDULEDATE, FCONVEYDATE, FSTARTDATE, FFINISHDATE, FCLOSEDATE, FCOSTDATE, FROWID, FPARENTROWID, FROWEXPANDTYPE, FPURORGID, FCOPYENTRYID, FLOT, FLOT_TEXT, FBFLOWID, FPRIORITY, FSETTLEORGID, FCUSTSTYLENO, FSELFSTYLENO, FPO, FSHIRTORDNO, FIDENTITY_LT, FOUTSTOCKLMTH_LT, FOUTSTOCKLMTL_LT, FBASEYIELDQTY, FPRDTRACKNO_LT, FISCUTDETAIL_LT, FPROCESSENTRYID_LT, FSALESCATEGORY_LT, FSPECIALART_TXT, FFZHOURSNO, FORGPRDTRACKNO_LT) VALUES (668517, 673330, 2, 2, 1, 51549576, 10101, 5, TO_DATE('2025-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), TO_DATE('2025-01-20 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), 52243971, 45703810, N'20250102', N' ', 0, 100, 100004, 5, 5, '0', 1, 0, 0, 106006, 0, 0, 100, 5, 5, 5, '5', TO_DATE('2025-01-20 13:49:32', 'YYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2025-01-20 13:49:32', 'YYYY-MM-DD HH24:MI:SS'), NULL, TO_DATE('2025-01-20 13:51:12', 'YYYY-MM-DD HH24:MI:SS'), NULL, NULL, '00505694-99ea-9409-11ef-d6f07d8d1a37', ' ', 0, 1, 0, 0, N' ', '432a0daa-dd5d-435d-b46d-8934927de0f8', 0, 1, N' ', N' ', N' ', N'41324033', ' ', 0.00, 0.00, 5, 0.00, '0', 0, '207d0c594a04443d8cccb5def56c532d', N' ', N' ', 0);
+        DELETE FROM T_SUB_REQORDERENTRY_L WHERE FEntryId IN (SELECT FEntryId FROM T_SUB_REQORDERENTRY WHERE (FID IN (668517)));
+        DELETE FROM T_SUB_SCHEDULEDETAIL WHERE (FID IN (668517));
+        END;
+    """

+ 214 - 0
tests/test_case/pur/test_pur_auxiliary.py

@@ -0,0 +1,214 @@
+from datetime import datetime
+from playwright.sync_api import expect
+from common.condition_row import ConditionRow
+
+TODAY = datetime.now().strftime('%Y-%m-%d')
+cgdddjbh = ""  # 采购订单 单据编号
+
+
+# 执行时间:6min  有时分单单据保存超时;有时过滤采购订单加载超时;采购入库单审核后弹框加载超时
+def test_requisition(home_page, head_page, body_page, push_page):
+    """
+        【辅料采购,自备】新增采购申请单
+    """
+    home_page.change_org("鲁泰纺织")
+    home_page.close_all_opening_bills()
+    home_page.search_bill("采购申请单")
+
+    head_page.set_value("申请部门", "制衣计划调度科")
+    head_page.set_value("分管部门", "制衣计划调度科")
+    head_page.set_value("申请人", "段士超")
+    head_page.set_value("是否保税", "否")
+
+    body_page.set_value(1, "物料编码", "T1002-1405863")
+    body_page.set_value(2, "物料编码", "T1002-1405863")
+    body_page.set_value(3, "物料编码", "T1002-1405863")
+    body_page.set_value(4, "物料编码", "T1008-2204496")
+    body_page.set_value(5, "物料编码", "T1008-2204497")
+
+    body_page.set_value(1, "尺码", "15")
+    body_page.set_value(2, "尺码", "19")
+    body_page.set_value(3, "尺码", "19")
+    body_page.set_value(1, "袖长身长", "34/35")
+    body_page.set_value(2, "袖长身长", "34/35")
+    body_page.set_value(3, "袖长身长", "34/35")
+
+    body_page.set_value(1, "申请数量", "2")
+    body_page._activate_field(1, "申请数量")
+    body_page.click_button("批量填充")
+
+    body_page.set_value(1, "计划跟踪号", "2025auxilisry")
+    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(3, "建议供应商") == "青岛皓远商标织造有限公司"
+    assert body_page.get_value(4, "建议供应商") == "南通海汇科技发展有限公司"
+    assert body_page.get_value(5, "建议供应商") == "南通海汇科技发展有限公司"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_purchaseorder(home_page, head_page, body_page, push_page, generate_bill_page):
+    """
+        【辅料采购,自备】采购申请单 下推 采购订单,分单
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("采购订单")
+
+    generate_bill_page.click_line(1)
+
+    head_page.set_value("采购员", "张连贺")
+
+    assert head_page.get_value("供应商") != ""
+    assert head_page.get_value("采购部门") != ""
+    assert head_page.get_value("采购组") != ""
+    assert body_page.get_row_count() == "2"
+
+    assert body_page.get_value(1, "采购数量") == "2"
+    assert body_page.get_value(2, "采购数量") == "4"
+    assert body_page.get_value(1, "单价") != ""
+    assert body_page.get_value(2, "单价") != ""
+    assert body_page.get_value(1, "计划跟踪号") != ""
+    assert body_page.get_value(2, "计划跟踪号") != ""
+
+    generate_bill_page.head_page.click_button("保存")
+    generate_bill_page.head_page.click_button("提交")
+    generate_bill_page.head_page.click_button("审核")
+    # assert "成功" in generate_bill_page.head_page.get_hint_message("确定")  # 定位不到
+
+    global cgdddjbh
+    cgdddjbh = generate_bill_page.head_page.get_value("单据编号")
+    assert cgdddjbh != ""
+
+    generate_bill_page.click_line(2)
+
+    head_page.set_value("采购员", "张连贺")
+
+    assert head_page.get_value("供应商") != ""
+    assert body_page.get_row_count() == "2"
+
+    assert body_page.get_value(1, "采购数量") == "2.0000"
+    assert body_page.get_value(2, "采购数量") == "2.0000"
+    assert body_page.get_value(1, "单价") != ""
+    assert body_page.get_value(2, "单价") != ""
+    assert body_page.get_value(1, "计划跟踪号") != ""
+    assert body_page.get_value(2, "计划跟踪号") != ""
+
+    generate_bill_page.head_page.click_button("保存")
+    generate_bill_page.head_page.click_button("提交")
+    generate_bill_page.head_page.click_button("审核")
+    # assert "成功" in generate_bill_page.head_page.get_hint_message("确定")
+
+
+def test_receivebill(home_page, list_page, filter_page, head_page, body_page, push_page):
+    """
+        【辅料采购,自备】采购订单 下推 收料通知单
+    """
+    home_page.close_bill_by_name("采购订单")
+    home_page.search_bill("标准采购订单列表")
+    list_page.click_button("过滤")
+
+    global cgdddjbh
+    cond1 = ConditionRow(1, "基本信息-单据编号", cgdddjbh)
+    filter_page.filter(cond1)
+
+    list_page.wait_list_loaded()    #
+    list_page.open_bill_by_row(1)
+
+    head_page.click_button("下推")
+    push_page.push_draw_bill("收料通知单")
+
+    head_page.set_value("付费方式", "付费")
+    head_page.set_value("物料来源", "自备")
+    head_page.set_value("报检属性", "其他")
+
+    assert body_page.get_value(1, "交货数量") != ""
+    assert body_page.get_value(2, "交货数量") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_inspectbill(page, home_page, list_page, filter_page, head_page, body_page, push_page):
+    """
+        【辅料采购,自备】收料通知单 下推 来料检验单(外观)(内在)
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("检验单", "收料通知单推检验单(外观)转换规则", "来料检验单(外观)", "鲁泰纺织股份有限公司")
+
+    head_page.set_value("检验部门", "制衣品质科")
+    head_page.set_value("质检员", "刘明华")
+
+    body_page.set_value(1, "检验日期", TODAY)
+    body_page.set_value(2, "检验日期", TODAY)
+    body_page.set_value(1, "检验依据", "无工艺/样卡")
+    body_page.set_value(2, "检验依据", "无工艺/样卡")
+
+    assert body_page.get_value(1, "合格数") != ""
+    assert body_page.get_value(2, "合格数") != ""
+    assert body_page.get_value(1, "检验结果") == "合格"
+    assert body_page.get_value(2, "检验结果") == "合格"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+    home_page.close_bill_by_name("检验单")
+    home_page.change_bill_tab("收料通知单")
+    head_page.click_button("下推")
+    push_page.push_draw_bill("检验单", "收料通知单推检验单(内在)转换规则", "来料检验单(内在)", "鲁泰纺织股份有限公司")
+
+    body_page.wait_time(1000)
+
+    body_page.set_value(1, "检验日期", TODAY)
+    body_page.set_value(2, "检验日期", TODAY)
+    body_page.set_value(1, "质检方案", "唛内在质量检验")
+    body_page.set_value(2, "质检方案", "唛内在质量检验")
+
+    assert body_page.get_value(1, "合格数") != ""
+    assert body_page.get_value(2, "合格数") != ""
+    assert body_page.get_value(1, "检验结果") == "合格"
+    assert body_page.get_value(2, "检验结果") == "合格"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_instock(page, home_page, list_page, filter_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("仓管员", "谭晶晶2")
+
+    body_page.set_value(1, "仓库", "总公司辅料仓库")
+    body_page.set_value(1, "辅料仓库", "30340101")
+
+    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, "批号") != ""
+
+    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

+ 142 - 0
tests/test_case/pur/test_pur_auxiliary_oem.py

@@ -0,0 +1,142 @@
+import time
+from datetime import datetime
+from playwright.sync_api import expect
+
+TODAY = datetime.now().strftime('%Y-%m-%d')
+
+
+# 执行时间:<3min
+def test_requisition(home_page, head_page, body_page, push_page):
+    """
+        【受托辅料采购】新增受托加工入库申请单
+    """
+    home_page.change_org("鲁泰纺织")
+    home_page.close_all_opening_bills()
+    home_page.search_bill("采购申请单")
+
+    head_page.set_value("单据类型", "受托加工入库申请")
+    head_page.get_hint_message("确定")
+    head_page.set_value("申请部门", "服装营销二科")
+    head_page.set_value("分管部门", "服装营销二科")
+    head_page.set_value("申请人", "吕文明")
+    head_page.set_value("是否保税", "否")
+    head_page.set_value("客户", "利郎(中国)有限公司")
+    head_page.set_value("采购合同交期", TODAY)
+
+    body_page.set_value(1, "物料编码", "T1001-2305791")
+    body_page.set_value(1, "尺码", "39")
+    body_page.set_value(1, "申请数量", "70")
+    body_page.set_value(2, "物料编码", "T1003-2305795")
+    body_page.set_value(2, "申请数量", "80")
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_oemreceive(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("付费方式", "免费")
+    head_page.set_value("物料来源", "客供免费")
+    head_page.set_value("报检属性", "其他")
+
+    assert body_page.get_value(1, "实到数量") != ""
+    assert body_page.get_value(2, "实到数量") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_inspectbill(page, home_page, head_page, body_page, push_page):
+    """
+        【受托辅料采购】受托加工材料收料单 下推 受托材料检验单(外观)(内在)
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("检验单", "受托材料收料单推检验单(外观)转换规则", "受托材料检验单(外观)", "鲁泰纺织股份有限公司")
+
+    head_page.set_value("检验部门", "制衣品质科")
+    head_page.set_value("质检员", "张伟6")
+
+    body_page.set_value(1, "检验日期", TODAY)
+    body_page.set_value(1, "检验依据", "无工艺/样卡")
+    body_page.set_value(2, "检验日期", TODAY)
+    body_page.set_value(2, "检验依据", "无工艺/样卡")
+
+    # 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, "检验结果") == "合格"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+    home_page.close_bill_by_name("检验单")
+    home_page.change_bill_tab("受托加工材料收料单")
+    head_page.click_button("下推")
+    push_page.push_draw_bill("检验单", "受托材料收料单推检验单(内在)转换规则", "受托材料检验单(内在)", "鲁泰纺织股份有限公司")
+
+    body_page.wait_time(1000)
+
+    body_page.set_value(1, "检验日期", TODAY)
+    body_page.set_value(1, "质检方案", "唛内在质量检验")
+    body_page.set_value(2, "检验日期", TODAY)
+    body_page.set_value(2, "质检方案", "唛内在质量检验")
+
+    # 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, "检验结果") == "合格"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_oeminstock(home_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("仓管员", "陈燕")
+
+    body_page.set_value(1, "收货仓库", "客供辅料仓库(制衣七厂)")
+    body_page.set_value(1, "辅料仓库", "700101")
+
+    body_page._activate_field(1, "收货仓库")
+    body_page.click_button("批量填充")
+    body_page._activate_field(1, "辅料仓库")
+    body_page.click_button("批量填充")
+
+    body_page.click_button("获取批号")
+
+    assert head_page.get_value("收料部门") != ""
+    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("确定")

+ 179 - 0
tests/test_case/pur/test_pur_auxiliary_workshop_store.py

@@ -0,0 +1,179 @@
+from datetime import datetime
+from playwright.sync_api import expect
+from common.condition_row import ConditionRow
+
+TODAY = datetime.now().strftime('%Y-%m-%d')
+yfddjbh = ""  # 应付单 单据编号
+
+
+# 执行时间:3min  发票号可以定位到了
+def test_requisition(home_page, head_page, body_page, push_page):
+    """
+        【辅料采购,自备,车间仓库】新增采购申请单
+    """
+    home_page.change_org("鲁泰纺织")
+    home_page.close_all_opening_bills()
+    home_page.search_bill("采购申请单")
+
+    head_page.set_value("申请部门", "制衣计划调度科")
+    head_page.set_value("分管部门", "制衣计划调度科")
+    head_page.set_value("申请人", "许志颖2")
+    head_page.set_value("是否保税", "否")
+
+    body_page.set_value(1, "物料编码", "T2006-2205678")
+    body_page.set_value(1, "申请数量", "2")
+    body_page.set_value(1, "生产车间", "制衣四厂")
+    body_page.set_value(1, "计划跟踪号", "2025auxilisry01")
+
+    body_page.set_value(2, "物料编码", "T2006-0000063")
+    body_page.set_value(2, "申请数量", "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("审核")
+
+
+def test_purchaseorder(head_page, body_page, push_page):
+    """
+        【辅料采购,自备,车间仓库】采购申请单 下推 采购订单,不分单
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("采购订单")
+
+    head_page.set_value("采购组", "国内采购组")
+    head_page.set_value("采购员", "郭涛")
+
+    assert head_page.get_value("供应商") == "淄博和裕服装辅料厂"
+    assert head_page.get_value("采购部门") != ""
+    assert body_page.get_row_count() == "2"
+    assert body_page.get_value(1, "采购数量") != "0.0000000000"
+    assert body_page.get_value(1, "单价") != ""
+    assert body_page.get_value(1, "计划跟踪号") != ""
+    assert body_page.get_value(2, "采购数量") != "0.0000000000"
+    assert body_page.get_value(2, "单价") != ""
+    assert body_page.get_value(2, "计划跟踪号") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_receivebill(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("报检属性", "其他")
+
+    assert body_page.get_value(1, "交货数量") != ""
+    assert body_page.get_value(2, "交货数量") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_inspectbill(head_page, body_page, push_page):
+    """
+        【辅料采购,自备,车间仓库】收料通知单 下推 来料检验单(外观)
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("检验单", "收料通知单推检验单(外观)转换规则", "来料检验单(外观)", "鲁泰纺织股份有限公司")
+
+    assert body_page.get_value(1, "合格数") != ""
+    assert body_page.get_value(2, "合格数") != ""
+    assert body_page.get_value(1, "检验结果") == "合格"
+    assert body_page.get_value(2, "检验结果") == "合格"
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def extract_between_chars(s, start, end):
+    start_index = s.find(start) + len(start)
+    end_index = s.find(end)
+    if start_index < end_index:
+        result = s[start_index:end_index]
+        return result
+    else:
+        return None
+
+
+def test_instock(page, home_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, "仓库", "辅料仓库(制衣四厂)")
+    body_page.set_value(1, "辅料仓库", "20201")
+
+    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, "批号") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+    # expect(page.locator("//span[text()='普通']").first).to_be_visible(timeout=60000)  # 需要等待
+    msg = head_page.get_multi_error_message()
+    assert "采购入库单,审核成功" in msg
+    assert "应付单,审核成功" in msg
+    # 获取应付单单据编号,提示信息:...单据编号为“AP00324572”的应付单,审核成功!
+    start = "AP"
+    end = "”的应付单"
+    result = extract_between_chars(msg, start, end)
+    global yfddjbh
+    yfddjbh = "AP" + result
+
+
+def test_purchaseic(home_page, list_page, filter_page, head_page, body_page, push_page):
+    """
+        【辅料采购,自备,车间仓库】应付单 下推 采购增值税专用发票
+    """
+    home_page.search_bill("应付单列表")
+    list_page.click_button("过滤")
+
+    global yfddjbh
+    cond1 = ConditionRow(1, "单据头-单据编号", yfddjbh)
+
+    # cond1 = ConditionRow(1, "单据头-单据编号", "AP00324598")
+    filter_page.filter(cond1)
+
+    list_page.wait_list_loaded()
+    list_page.open_bill_by_row(1)
+
+    head_page.click_button("下推")
+    push_page.push_draw_bill("采购增值税专用发票")
+
+    head_page.set_value("发票号", "24372000000999765001")
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+    assert "成功" in head_page.get_hint_message("确定")
+

+ 188 - 0
tests/test_case/pur/test_pur_fabric.py

@@ -0,0 +1,188 @@
+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("确定")

+ 135 - 0
tests/test_case/pur/test_pur_product.py

@@ -0,0 +1,135 @@
+from datetime import datetime
+from playwright.sync_api import expect
+from common.condition_row import ConditionRow
+from pages.locator.body_page_locator import BodyPageLocator
+from tests.test_case.pur.test_data.data_pur_product import DataPurProduct
+import pytest
+
+
+TODAY = datetime.now().strftime('%Y-%m-%d')
+wwdddjbh = "SUB00002415"  # 委外订单 单据编号
+
+
+# 执行时间:4min 首次运行,选择物料加载超时。加等待。
+
+
+@pytest.fixture(scope="module", autouse=True)
+def setup_teardown(orcl_helper):
+    print(orcl_helper.execute_update(DataPurProduct.CREATE_SUBREQORDER_TEST_DATA))  # 单据编号=SUB00002415
+    yield
+
+
+# def test_subreqorder(page, home_page, head_page, body_page):
+#     """
+#         【委外成品采购】新增委外订单
+#     """
+#     home_page.change_org("鲁泰纺织")
+#     home_page.close_all_opening_bills()
+#     home_page.search_bill("委外订单")
+#
+#     body_page.set_value(1, "物料编码", "P01C24-04904")
+#     # body_page.get_value()
+#     loc = page.locator(BodyPageLocator.FIELD_VALUE_ARGS_LOC % ("物料编码", 0, 1))  # 行号(从0开始),重名时第几个(从1开始)
+#     expect(loc).to_contain_text("P01C24-04904", timeout=60000)  # 等待 默认5000ms
+#
+#     body_page.set_value(1, "数量", "5")
+#     body_page.set_value(1, "供应商", "滨州市鑫笑服饰有限公司")
+#     body_page.set_value(1, "衬衣订单号", "41324033")
+#     body_page.set_value(1, "计划跟踪号", "20250102")
+#     body_page.set_value(1, "尺码", "均码")
+#     body_page.set_value(1, "销售类别", "外销")
+#
+#     body_page.set_value(2, "物料编码", "P01C24-04906")
+#     loc = page.locator(BodyPageLocator.FIELD_VALUE_ARGS_LOC % ("物料编码", 1, 1))
+#     expect(loc).to_contain_text("P01C24-04906")  # 等待
+#
+#     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.set_value(2, "尺码", "均码")  # 尺码批量填充无效,只能set
+#     body_page._activate_field(1, "销售类别")
+#     body_page.click_button("批量填充")
+#
+#     head_page.click_button("保存")
+#     head_page.click_button("提交")
+#     head_page.click_button("审核")
+#
+#     global wwdddjbh
+#     wwdddjbh = head_page.get_value("单据编号")
+#     assert wwdddjbh != ""
+
+
+def test_purchaseorder(page, home_page, list_page, filter_page, head_page, body_page, push_page):
+    """
+        【委外成品采购】委外订单 下推 采购订单(标准委外订单)
+    """
+    home_page.search_bill("委外订单列表")
+    list_page.click_button("过滤")
+
+    global wwdddjbh
+
+    cond1 = ConditionRow(1, "单据头-单据编号", wwdddjbh)
+    filter_page.filter(cond1)
+
+    list_page.wait_list_loaded()
+    list_page.check_line_by_rows(1, 2)
+    list_page.click_button("下推")
+    push_page.push_draw_bill("采购订单")
+
+    head_page.set_value("采购部门", "制衣计划调度科")
+    head_page.set_value("采购组", "委外采购组")
+    head_page.set_value("采购员", "蒙顺德")
+    head_page.set_value("采购合同交期", TODAY)
+    head_page.set_value("是否保税", "否")
+
+    body_page.set_value(1, "含税单价", "27")
+    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("批量填充")
+
+    assert body_page.get_row_count() == "2"
+    assert body_page.get_value(1, "采购数量") != ""
+    assert body_page.get_value(2, "采购数量") != ""
+
+    head_page.click_button("保存")
+    head_page.click_button("提交")
+    head_page.click_button("审核")
+
+
+def test_instock(page, home_page, head_page, body_page, push_page):
+    """
+        【委外成品采购】采购订单 下推 采购入库单(委外入库单)
+    """
+    head_page.click_button("下推")
+    push_page.push_draw_bill("采购入库单")
+
+    head_page.set_value("收料部门", "仓储管理部")
+    head_page.set_value("仓管员", "翟丽芹")
+
+    body_page.set_value(1, "仓库", "成品仓库(国外)")
+    body_page.set_value(1, "成品仓库仓位", "1311")
+
+    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("审核")
+
+    # expect(page.locator("//span[text()='普通']").first).to_be_visible(timeout=30000)
+    msg = head_page.get_multi_error_message()
+    assert "采购入库单,审核成功" in msg
+    assert "应付单,审核成功" in msg