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 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/sf_sale/models/quick_easy_order_old.py b/sf_sale/models/quick_easy_order_old.py
index 21fc3f5e..be9bae3d 100644
--- a/sf_sale/models/quick_easy_order_old.py
+++ b/sf_sale/models/quick_easy_order_old.py
@@ -128,18 +128,18 @@ class QuickEasyOrder(models.Model):
# # print(volume)
# item.model_volume = volume
# # 长宽高/体积
- # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(library_of_models.code) + '.stl')
+ # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
output_file = os.path.join('/tmp', str(model_code) + '.stl')
- your_mesh = mesh.Mesh.from_file(output_file)
- volume, cog, inertia = your_mesh.get_mass_properties()
- xyz = (your_mesh.max_ - your_mesh.min_)
- item.model_length = xyz[0] # 长 单位mm
- item.model_width = xyz[1] # 宽
- item.model_height = xyz[2] # 高
- item.model_volume = volume
+ # your_mesh = mesh.Mesh.from_file(output_file)
+ # volume, cog, inertia = your_mesh.get_mass_properties()
+ # xyz = (your_mesh.max_ - your_mesh.min_)
+ # item.model_length = xyz[0] # 长 单位mm
+ # item.model_width = xyz[1] # 宽
+ # item.model_height = xyz[2] # 高
+ # item.model_volume = volume
write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
# 转化为glb
- # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(library_of_models.code) + '.glb')
+ # output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
util_path = get_resource_path('sf_base', 'static/util')
cmd = 'python3 %s/stl2gltf.py %s %s -b' % (util_path, output_file, output_glb_file)
@@ -189,6 +189,7 @@ class QuickEasyOrder(models.Model):
'number': item.quantity,
'total_amount': item.price,
'remark': '',
+ 'manual_quotation': True,
'barcode': barcode
})
# res['bfm_process_order_list'] = json.dumps(res['bfm_process_order_list'])
@@ -292,7 +293,7 @@ class QuickEasyOrder(models.Model):
'model_height': order.model_height,
'model_volume': order.model_volume,
'color_model_path': '/tmp/' + str(model_code) + ".step",
- 'model_order_no': order.name,
+ 'model_order_no': '%s-%s' % (order.name, 1),
'remark': '订单号:%s 客户:%s' % (order.name, order.customer_id.name)
}
try: