装夹预调工单,要带图纸和模型文件及坯料长宽高参数的优化需求2:状态变化逻辑
This commit is contained in:
@@ -202,6 +202,8 @@ class Manufacturing_Connect(http.Controller):
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
workorder.button_finish()
|
||||
workorder.process_state = '待解除装夹'
|
||||
workorder.sudo().production_id.work_order_state = 'pending_era_cam'
|
||||
|
||||
# 根据工单的实际结束时间修改排程单的结束时间、状态,同时修改销售订单的状态
|
||||
if workorder.date_finished:
|
||||
|
||||
@@ -32,7 +32,9 @@ class MrpProduction(models.Model):
|
||||
('draft', 'Draft'),
|
||||
('confirmed', 'Confirmed'),
|
||||
('progress', '待排程'),
|
||||
('pending_cam', '待装夹'),
|
||||
('pending_processing', '待加工'),
|
||||
('pending_era_cam', '待解除装夹'),
|
||||
('completed', '已完工'),
|
||||
('to_close', 'To Close'),
|
||||
('done', 'Done'),
|
||||
@@ -56,14 +58,15 @@ class MrpProduction(models.Model):
|
||||
plan_start_processing_time = fields.Datetime('计划开始加工时间')
|
||||
production_line_state = fields.Selection([('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
|
||||
string='上/下产线', default='待上产线')
|
||||
# 加工状态
|
||||
# 工序状态
|
||||
# Todo 研究下用法
|
||||
process_state = fields.Selection([
|
||||
('待排程', '待排程'),
|
||||
('待装夹', '待装夹'),
|
||||
('待CNC加工', '待CNC加工'),
|
||||
('待检测', '待检测'),
|
||||
('待加工', '待加工'),
|
||||
('待解除装夹', '待解除装夹'),
|
||||
('已完成', '已完成')
|
||||
], string='加工状态', default='待排程')
|
||||
('已完工', '已完工'),
|
||||
], string='工序状态', related='workorder_ids.process_state', store=True)
|
||||
|
||||
# 零件图号
|
||||
part_number = fields.Char('零件图号')
|
||||
@@ -106,10 +109,13 @@ class MrpProduction(models.Model):
|
||||
|
||||
# 新添加的状态逻辑
|
||||
if production.state == 'progress' and production.schedule_state == '已排':
|
||||
# production.state = 'pending_processing'
|
||||
production.state = 'pending_cam'
|
||||
elif production.state == 'pending_cam' and production.process_state == '待加工':
|
||||
production.state = 'pending_processing'
|
||||
# elif production.state == 'progress' and production.schedule_state == '已完成':
|
||||
# production.state = 'completed'
|
||||
elif production.state == 'pending_processing' and production.work_order_state == '已完成':
|
||||
elif production.state == 'pending_processing' and production.process_state == '待解除装夹':
|
||||
production.state = 'pending_era_cam'
|
||||
elif production.state == 'pending_era_cam' and production.process_state == '已完工':
|
||||
production.state = 'completed'
|
||||
elif production.state == 'progress' and production.work_order_state == '已完成':
|
||||
production.state = 'completed'
|
||||
|
||||
@@ -131,8 +131,12 @@ class ResMrpWorkOrder(models.Model):
|
||||
process_state = fields.Selection([
|
||||
('待装夹', '待装夹'),
|
||||
('待检测', '待检测'),
|
||||
('已完工', '已完工')
|
||||
('待加工', '待加工'),
|
||||
('待解除装夹', '待解除装夹'),
|
||||
('已完工', '已完工'),
|
||||
], string='工序状态', default='待装夹')
|
||||
# 加工图纸
|
||||
processing_drawing = fields.Binary(string='加工图纸', related='production_id.part_drawing')
|
||||
|
||||
@api.depends('production_id')
|
||||
def _compute_save_name(self):
|
||||
@@ -401,6 +405,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
work.compensation_value_x = eval(self.material_center_point)[0]
|
||||
work.compensation_value_y = eval(self.material_center_point)[1]
|
||||
workorder.button_finish()
|
||||
self.process_state = '待加工'
|
||||
# self.sudo().production_id.state = 'pending_processing'
|
||||
except Exception as e:
|
||||
# 重新抛出捕获到的异常信息
|
||||
raise UserError(str(e))
|
||||
@@ -823,6 +829,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
workorder.rfid_code = None
|
||||
for move_raw_id in self.production_id.move_raw_ids:
|
||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||
self.process_state = '已完工'
|
||||
self.production_id.button_mark_done1()
|
||||
# self.production_id.state = 'done'
|
||||
|
||||
@@ -1032,6 +1039,7 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
for item in workorder_rfid:
|
||||
item.write({'rfid_code': barcode})
|
||||
logging.info("Rfid绑定成功!!!")
|
||||
self.process_state = '待检测'
|
||||
else:
|
||||
embryo_stock_lot = self.env['stock.lot'].search([('name', '=', barcode)])
|
||||
if embryo_stock_lot:
|
||||
|
||||
@@ -62,11 +62,14 @@
|
||||
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='state']" position="attributes">
|
||||
<attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done
|
||||
<!-- <attribute name="statusbar_visible">draft,confirmed,progress,pending_processing,completed,done -->
|
||||
<!-- </attribute> -->
|
||||
<attribute name="statusbar_visible">progress,pending_cam,pending_processing,pending_era_cam,completed,done
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group[2]//label" position="before">
|
||||
<field name="process_state"/>
|
||||
<!-- <field name="process_state"/> -->
|
||||
<field name="state"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//sheet//group//group//div[3]" position="after">
|
||||
|
||||
@@ -264,6 +264,10 @@
|
||||
<field name="preset_program_information" colspan="2" nolabel="1"
|
||||
placeholder="如有预调程序信息请在此处输入....."/>
|
||||
</group>
|
||||
<group string="加工图纸">
|
||||
<!-- 隐藏加工图纸字段名 -->
|
||||
<field name="processing_drawing" widget="pdf_viewer" string=""/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="前置三元检测定位参数" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user