Accept Merge Request #749: (feature/修改机床参数bug -> develop)

Merge Request: 修改获取cnc从工单到制造订单

Created By: @龚启豪
Reviewed By: @马广威
Approved By: @马广威 
Accepted By: @龚启豪
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/749
This commit is contained in:
龚启豪
2024-01-05 14:03:31 +08:00
committed by Coding
11 changed files with 122 additions and 31 deletions

View File

@@ -450,7 +450,7 @@ class ResMrpWorkOrder(models.Model):
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
'order_no': cnc.production_id.origin,
'model_order_no': cnc.product_id.default_code.rsplit('-', 1)[0],
'model_order_no': cnc.product_id.default_code.rsplit(' -', 1)[0],
'user': self.env.user.name,
'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
cnc.product_id.model_file).decode('utf-8')
@@ -574,6 +574,18 @@ class ResMrpWorkOrder(models.Model):
'order_line': order_line_ids,
})
super().button_finish()
is_production_id = True
for workorder in self.production_id.workorder_ids:
if workorder.state != 'done':
is_production_id = False
if is_production_id == True and self.name == '解除装夹':
for move_raw_id in self.production_id.move_raw_ids:
move_raw_id.quantity_done = move_raw_id.product_uom_qty
self.production_id.state = 'done'
class CNCprocessing(models.Model):
@@ -595,6 +607,7 @@ class CNCprocessing(models.Model):
estimated_processing_time = fields.Char('预计加工时间')
remark = fields.Text('备注')
workorder_id = fields.Many2one('mrp.workorder', string="工单")
workorder_id = fields.Many2one('mrp.production', string="制造定单")
button_state = fields.Boolean(string='是否已经下发')
# mrs下发编程单创建CNC加工
@@ -620,11 +633,11 @@ class CNCprocessing(models.Model):
'remark': obj['remark']
})
self.get_cnc_processing_file(ret['folder_name'], cnc_processing, workorder.processing_panel)
cnc_workorder.state = 'done'
# cnc_workorder.state = 'done'
cnc_workorder.work_state = '已编程'
cnc_workorder.programming_state = '已编程'
cnc_workorder.time_ids.date_end = datetime.now()
cnc_workorder.button_finish()
# cnc_workorder.time_ids.date_end = datetime.now()
# cnc_workorder.button_finish()
# 根据程序名和加工面匹配到ftp里对应的Nc程序名
def get_cnc_processing_file(self, folder_name, cnc_processing, processing_panel):