diff --git a/sf_dlm/data/product_data.xml b/sf_dlm/data/product_data.xml index 7338ea7f..847e6a80 100644 --- a/sf_dlm/data/product_data.xml +++ b/sf_dlm/data/product_data.xml @@ -1,9 +1,9 @@ - + CNC加工产品模板 - + delivery product false @@ -53,7 +53,5 @@ False - - \ No newline at end of file diff --git a/sf_dlm/models/product_template.py b/sf_dlm/models/product_template.py index 8b174d25..6ec7720e 100644 --- a/sf_dlm/models/product_template.py +++ b/sf_dlm/models/product_template.py @@ -29,6 +29,12 @@ class ResProductTemplate(models.Model): materials_id = fields.Many2one('sf.production.materials', string='材料') materials_type_id = fields.Many2one('sf.materials.model', string='材料型号') # volume = fields.Float(compute='_compute_volume', store=True) + single_manufacturing = fields.Boolean(string="单个制造") + + # @api.depends('long', 'width', 'height') + # def _compute_volume(self): + # self.volume = self.long * self.width * self.height + single_manufacturing = fields.Boolean(string="单个制造") @@ -60,6 +66,11 @@ class ResProductTemplate(models.Model): 'model_long': item['model_long'], 'model_width': item['model_width'], 'model_height': item['model_height'], + 'length': item['long'], + 'width': item['width'], + 'height': item['height'], + 'volume': item['long'] * item['width'] * item['height'], + 'model_price': item['price'], 'length': item['model_long'], 'width': item['model_width'], 'height': item['model_height'], @@ -161,6 +172,10 @@ class ResMrpBom(models.Model): # 二、胚料的材料型号与生成产品的材料型号一致; # 三、胚料的长宽高均要大于模型的长宽高; # 四、如果匹配成功多个胚料,则选取体积最小的胚料; + def bom_create_Line(self, product): + logging.info('bom_create_Line:%s' % product) + embryo = self.env['product.product'].search( + [('categ_id.is_embryo', '=', True), ('materials_type_id', '=', product.materials_type_id.id), # 创建新的胚料,根据胚料材料型号的获取方式( # 自加工,外协,采购) 的配置, 选择不同的库存路线,一种材料型号配置一个路线相关的配置: # 材料型号配置不同的获取方式: (自加工, 外协, 采购); @@ -185,6 +200,8 @@ class ResMrpBom(models.Model): limit=1, order='volume desc' ) + logging.info('bom_create_Line1:%s' % product) + return self.env['mrp.bom.line'].create(vals) if embryo: rate_of_waste = ((embryo.volume - product.model_volume) % embryo.volume) * 100 if rate_of_waste <= 20: diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 4d6e2e0a..882f687f 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -63,7 +63,8 @@ class ResMrpWorkOrder(models.Model): Y10_axis = fields.Float(default=0) Z10_axis = fields.Float(default=0) X_deviation_angle = fields.Integer(string="X轴偏差度", default=0) - test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], string="检测结果") + test_results = fields.Selection([("合格", "合格"), ("返工", "返工"), ("报废", "报废")], default='合格', + string="检测结果") cnc_ids = fields.One2many("sf.cnc.processing", 'workorder_id', string="CNC加工") tray_code = fields.Char(string="托盘") @@ -346,7 +347,7 @@ class CNCprocessing(models.Model): # mrs下发编程单创建CNC加工 def cnc_processing_create(self, obj): - workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['production_order_no']), + workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['manufacturing_order_no']), ('processing_panel', '=', obj['processing_panel']), ('routing_type', '=', 'CNC加工')]) vals = { diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 38618e11..9049f5d2 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -71,11 +71,12 @@ -
+ + +
- @@ -86,121 +87,107 @@ - -
左面:
+
左面:
+
+
+
前面:
+
+
+
右面:
+
+
+
后面:
+
+
+
上面:
+
+
+ +
+
+ @@ -235,17 +222,18 @@ - -
+ + + +
- - +
@@ -253,7 +241,7 @@
-
+