diff --git a/quality_control/models/quality.py b/quality_control/models/quality.py index 8670005d..df4a11b2 100644 --- a/quality_control/models/quality.py +++ b/quality_control/models/quality.py @@ -477,8 +477,8 @@ class QualityCheck(models.Model): if not self.report_content: raise UserError(_('当前质检单没有出厂检验报告,请先发布报告')) - if not self.part_number: - raise UserError(_('零件图号不能为空')) + if not self.product_id.model_name: + raise UserError(_('产品模型名称为空')) if not self.picking_id or not self.picking_id.origin: raise UserError(_('无法找到相关的调拨单或来源单据')) @@ -490,7 +490,7 @@ class QualityCheck(models.Model): # 准备请求数据 payload = { "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 } @@ -541,12 +541,18 @@ class QualityCheck(models.Model): """ # 获取订单号(从调拨单的来源字段获取) order_ref = self.picking_id.retrospect_ref + + if not order_ref: + raise UserError(_('无法找到相关的调拨单或来源单据')) + if not self.product_id.model_name: + raise UserError(_('产品模型名称为空')) + try: # 准备请求数据 payload = { "order_ref": order_ref, - "part_number": self.part_number + "model_name": self.product_id.model_name } # 将Python字典转换为JSON字符串 diff --git a/quality_control/static/src/binary/出厂检验报告上传模版.xlsx b/quality_control/static/src/binary/出厂检验报告上传模版.xlsx index cd43894a..181e921f 100644 Binary files a/quality_control/static/src/binary/出厂检验报告上传模版.xlsx and b/quality_control/static/src/binary/出厂检验报告上传模版.xlsx differ