合并cnc加工和后置检测工单,新增工单开始结束接口
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="type" optional="hide"/>
|
||||
<field name="brand"/>
|
||||
<field name="maintenance_equipment_id"/>
|
||||
|
||||
@@ -40,3 +40,72 @@ class Manufacturing_Connect(http.Controller):
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_Work_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
|
||||
@http.route('/AutoDeviceApi/FeedBackStart', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def button_Work_START(self, **kw):
|
||||
"""
|
||||
工单任务开始
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_Work_Info:%s' % kw)
|
||||
try:
|
||||
res = {'Succeed': True, 'Datas': []}
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
if not ret['BillId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传制造订单号'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
if not ret['CraftId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传工序名称'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
if not ret['DeviceId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传设备号'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
production_id = ret['BillId']
|
||||
routing_type = ret['CraftId']
|
||||
workorder = request.env['mrp.workorder'].sudo().search(
|
||||
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
||||
workorder.button_start()
|
||||
|
||||
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_Work_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@http.route('/AutoDeviceApi/FeedBackEnd', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def button_Work_End(self, **kw):
|
||||
"""
|
||||
工单任务结束
|
||||
:param kw:
|
||||
:return:
|
||||
"""
|
||||
logging.info('get_Work_Info:%s' % kw)
|
||||
try:
|
||||
res = {'Succeed': True, 'Datas': []}
|
||||
datas = request.httprequest.data
|
||||
ret = json.loads(datas)
|
||||
if not ret['BillId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传制造订单号'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
if not ret['CraftId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传工序名称'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
if not ret['DeviceId']:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未传设备号'}
|
||||
return json.JSONEncoder().encode(res)
|
||||
production_id = ret['BillId']
|
||||
routing_type = ret['CraftId']
|
||||
workorder = request.env['mrp.workorder'].sudo().search(
|
||||
[('production_id', '=', production_id), ('routing_type', '=', routing_type)], limit=1)
|
||||
workorder.button_finish()
|
||||
|
||||
|
||||
except Exception as e:
|
||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||
logging.info('get_Work_Info error:%s' % e)
|
||||
return json.JSONEncoder().encode(res)
|
||||
|
||||
@@ -453,10 +453,10 @@ class MrpProduction(models.Model):
|
||||
|
||||
for route in routingworkcenter:
|
||||
|
||||
if route.routing_type == '后置三元质量检测':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str1(k, production, route)
|
||||
)
|
||||
# if route.routing_type == '后置三元质量检测':
|
||||
# workorders_values.append(
|
||||
# self.env['mrp.workorder'].json_workorder_str1(k, production, route)
|
||||
# )
|
||||
if route.routing_type == 'CNC加工':
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str1(k, production, route))
|
||||
|
||||
@@ -10,7 +10,7 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
('装夹预调', '装夹预调'),
|
||||
# ('前置三元定位检测', '前置三元定位检测'),
|
||||
('CNC加工', 'CNC加工'),
|
||||
('后置三元质量检测', '后置三元质量检测'),
|
||||
# ('后置三元质量检测', '后置三元质量检测'),
|
||||
('解除装夹', '解除装夹'),
|
||||
('切割', '切割'),
|
||||
('表面工艺', '表面工艺')
|
||||
|
||||
@@ -35,7 +35,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
('装夹预调', '装夹预调'),
|
||||
# ('前置三元定位检测', '前置三元定位检测'),
|
||||
('CNC加工', 'CNC加工'),
|
||||
('后置三元质量检测', '后置三元质量检测'),
|
||||
# ('后置三元质量检测', '后置三元质量检测'),
|
||||
('解除装夹', '解除装夹'),
|
||||
('切割', '切割'), ('表面工艺', '表面工艺')
|
||||
], string="工序类型")
|
||||
@@ -216,9 +216,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
elif route.routing_type == 'CNC加工':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle
|
||||
elif route.routing_type == '后置三元质量检测':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '后置三元质量检测')]).time_cycle
|
||||
# elif route.routing_type == '后置三元质量检测':
|
||||
# duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
# [('name', '=', '后置三元质量检测')]).time_cycle
|
||||
elif route.routing_type == '解除装夹':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '解除装夹')]).time_cycle
|
||||
|
||||
@@ -398,6 +398,21 @@
|
||||
</xpath>
|
||||
|
||||
|
||||
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<field name="results" invisible="1"/>
|
||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<group>
|
||||
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
|
||||
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
||||
string="检测确认"
|
||||
attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>
|
||||
</div>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="CNC程序" attrs='{"invisible": [("routing_type","!=","CNC加工")]}'>
|
||||
<field name="cnc_ids" widget="one2many" string="工作程序">
|
||||
@@ -423,20 +438,6 @@
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<field name="results" invisible="1"/>
|
||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
||||
<group>
|
||||
<field name="test_results" widget="selection" attrs='{"invisible":[("results","!=",False)]}'/>
|
||||
<field name="results" readonly="1" attrs='{"invisible":[("results","!=","合格")]}'/>
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
||||
string="检测确认"
|
||||
attrs='{"invisible": ["|","|",("state","!=","progress"),("user_permissions","=",False),("results","=","合格")]}'/>
|
||||
</div>
|
||||
</page>
|
||||
</xpath>
|
||||
<xpath expr="//page[1]" position="before">
|
||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
||||
<!-- <field name="tray_id" readonly="1"/>-->
|
||||
|
||||
Reference in New Issue
Block a user