调整加工订单匹配条件

This commit is contained in:
mgw
2025-03-20 15:34:17 +08:00
parent 134c68abc8
commit 98644a4b57
2 changed files with 10 additions and 4 deletions

View File

@@ -477,8 +477,8 @@ class QualityCheck(models.Model):
if not self.report_content: if not self.report_content:
raise UserError(_('当前质检单没有出厂检验报告,请先发布报告')) raise UserError(_('当前质检单没有出厂检验报告,请先发布报告'))
if not self.part_number: if not self.product_id.model_name:
raise UserError(_('零件图号不能为空')) raise UserError(_('产品模型名称为空'))
if not self.picking_id or not self.picking_id.origin: if not self.picking_id or not self.picking_id.origin:
raise UserError(_('无法找到相关的调拨单或来源单据')) raise UserError(_('无法找到相关的调拨单或来源单据'))
@@ -490,7 +490,7 @@ class QualityCheck(models.Model):
# 准备请求数据 # 准备请求数据
payload = { payload = {
"order_ref": order_ref, "order_ref": order_ref,
"part_number": self.part_number, "model_name": self.product_id.model_name,
"report_file": self.report_content.decode('utf-8') if isinstance(self.report_content, bytes) else self.report_content "report_file": self.report_content.decode('utf-8') if isinstance(self.report_content, bytes) else self.report_content
} }
@@ -542,11 +542,17 @@ class QualityCheck(models.Model):
# 获取订单号(从调拨单的来源字段获取) # 获取订单号(从调拨单的来源字段获取)
order_ref = self.picking_id.retrospect_ref order_ref = self.picking_id.retrospect_ref
if not order_ref:
raise UserError(_('无法找到相关的调拨单或来源单据'))
if not self.product_id.model_name:
raise UserError(_('产品模型名称为空'))
try: try:
# 准备请求数据 # 准备请求数据
payload = { payload = {
"order_ref": order_ref, "order_ref": order_ref,
"part_number": self.part_number "model_name": self.product_id.model_name
} }
# 将Python字典转换为JSON字符串 # 将Python字典转换为JSON字符串