diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 04b4d913..4b915392 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -135,7 +135,8 @@ class MrpProduction(models.Model):
# cnc程序获取
def fetchCNC(self):
cnc = self.env['mrp.production'].search([('id', '=', self.id)])
- quick_order = self.env['quick.easy.order'].search([('id', '=', cnc.product_id.id)])
+ quick_order = self.env['quick.easy.order'].search(
+ [('name', '=', cnc.product_id.default_code.rsplit('-', 1)[0])])
programme_way = False
if cnc.manual_quotation is True:
programme_way = 'manual operation'
@@ -157,7 +158,6 @@ class MrpProduction(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.origin,
- 'quick_order_no': quick_order.name if quick_order else False,
'model_order_no': cnc.product_id.default_code,
'user': cnc.env.user.name,
'programme_way': programme_way,
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 20369d9b..14471baf 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -652,47 +652,6 @@ class ResMrpWorkOrder(models.Model):
else:
self.results = '合格'
- # cnc程序获取
- def fetchCNC(self):
- try:
- cnc = self.env['mrp.workorder'].search(
- [('routing_type', '=', 'CNC加工'), ('production_id', '=', self.production_id.id)], limit=1)
- res = {'model_code': '' if not cnc.product_id.model_code else cnc.product_id.model_code,
- 'production_no': self.production_id.name,
- 'machine_tool_code': cnc.workcenter_id.equipment_id.code,
- 'material_code': cnc.env['sf.production.materials'].search(
- [('id', '=', cnc.product_id.materials_id.id)]).materials_no,
- 'material_type_code': cnc.env['sf.materials.model'].search(
- [('id', '=', cnc.product_id.materials_type_id.id)]).materials_no,
- 'machining_processing_panel': cnc.product_id.model_processing_panel,
- 'machining_precision': cnc.product_id.model_machining_precision,
- 'embryo_long': cnc.product_id.bom_ids.bom_line_ids.product_id.length,
- '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],
- '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')
- }
- logging.info('res:%s' % res)
- configsettings = self.env['res.config.settings'].get_values()
- config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
- url = '/api/intelligent_programming/create'
- config_url = configsettings['sf_url'] + url
- # res_str = json.dumps(res)
- ret = requests.post(config_url, json={}, data=res, headers=config_header)
- ret = ret.json()
- logging.info('fetchCNC-ret:%s' % ret)
- if ret['status'] == 1:
- self.write(
- {'programming_no': ret['programming_no'], 'programming_state': '编程中', 'work_state': '编程中'})
- else:
- raise UserError(ret['message'])
- except Exception as e:
- logging.info('fetchCNC error:%s' % e)
- raise UserError("cnc程序获取编程单失败,请联系管理员")
-
def json_workorder_str1(self, k, production, route):
workorders_values_str = [0, '', {
'product_uom_id': production.product_uom_id.id,
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index f3e2faef..65fbd973 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -210,12 +210,12 @@
-
-
-
-
-
+
+
+
+
+
+