产品和制造订单新增模型和occ查看模型模块

This commit is contained in:
jinling.yang
2022-12-30 10:00:17 +08:00
parent 5fcb17d048
commit a3e39d4fac
33 changed files with 1497 additions and 119 deletions

View File

@@ -29,6 +29,8 @@ class ResMrpWorkOrder(models.Model):
('后置三元质量检测', '后置三元质量检测'),
('解除装夹', '解除装夹'),
], string="工序类型")
programming_no = fields.Char('编程单号')
is_programming = fields.Boolean('是否编程', default=False)
cnc_worksheet = fields.Binary(
'工作指令', readonly=True)
material_center_point = fields.Char(string='配料中心点')
@@ -245,20 +247,21 @@ class ResMrpWorkOrder(models.Model):
'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
# 'factory_code': self.env.user.company_id.partner_id.
'order_no': cnc.production_id.origin,
'user': self.env.user.name,
'model_file': 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={"result": res_str}, data=None, headers=config_header)
# res_str = json.dumps(res)
ret = requests.post(config_url, json={}, data=res, headers=config_header)
ret = ret.json()
result = json.loads(ret['result'])
if result['status'] == 1:
return self.write({'state': 'progress'})
return self.write({'programming_no': result['programming_no'], 'is_programming': True})
def json_workorder_str1(self, k, production, route):
workorders_values_str = [0, '', {