diff --git a/sf_maintenance/views/maintenance_logs_views.xml b/sf_maintenance/views/maintenance_logs_views.xml index b0d6af79..087f6ffb 100644 --- a/sf_maintenance/views/maintenance_logs_views.xml +++ b/sf_maintenance/views/maintenance_logs_views.xml @@ -8,7 +8,6 @@ - diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index c4fd6b87..221d620b 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -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) diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 185817e9..0ce21c8f 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -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)) diff --git a/sf_manufacturing/models/mrp_routing_workcenter.py b/sf_manufacturing/models/mrp_routing_workcenter.py index c8e7d8aa..d989f233 100644 --- a/sf_manufacturing/models/mrp_routing_workcenter.py +++ b/sf_manufacturing/models/mrp_routing_workcenter.py @@ -10,7 +10,7 @@ class ResMrpRoutingWorkcenter(models.Model): ('装夹预调', '装夹预调'), # ('前置三元定位检测', '前置三元定位检测'), ('CNC加工', 'CNC加工'), - ('后置三元质量检测', '后置三元质量检测'), + # ('后置三元质量检测', '后置三元质量检测'), ('解除装夹', '解除装夹'), ('切割', '切割'), ('表面工艺', '表面工艺') diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index feb37787..e1589bd9 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -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 diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 8a9214e9..d7c911fa 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -398,6 +398,21 @@ + + + + + + + + +
+
+
+
@@ -423,20 +438,6 @@ - - - - - - - -
-
-
-