|
@@ -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
|