产品和制造订单新增模型和occ查看模型模块
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import api, fields, models,_
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class MrpProduction(models.Model):
|
||||
@@ -10,6 +9,8 @@ class MrpProduction(models.Model):
|
||||
tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
|
||||
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
|
||||
request_ids = fields.One2many('maintenance.request', 'production_id')
|
||||
# model_file = fields.Binary('模型文件', related='product_id.model_file')
|
||||
# model_information = fields.Char('模型信息', related='product_id.model_information')
|
||||
|
||||
@api.depends('request_ids')
|
||||
def _compute_maintenance_count(self):
|
||||
@@ -130,6 +131,9 @@ class MrpProduction(models.Model):
|
||||
'location_src_id': production.location_src_id.id,
|
||||
'location_dest_id': production.location_dest_id.id,
|
||||
'bom_id': production.bom_id.id,
|
||||
'model_file': base64.b64decode(production.product_id.model_file),
|
||||
'model_information': '%s/%s' % (
|
||||
production.product_id.model_processing_panel, production.product_id.materials_id.name),
|
||||
'date_deadline': production.date_deadline,
|
||||
'date_planned_start': production.date_planned_start,
|
||||
'date_planned_finished': production.date_planned_finished,
|
||||
|
||||
@@ -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, '', {
|
||||
|
||||
@@ -74,13 +74,17 @@ class StockRule(models.Model):
|
||||
Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
|
||||
'product_uom', 'location_id', 'name', 'origin',
|
||||
'company_id',
|
||||
'values'])
|
||||
'values', 'model_file',
|
||||
'model_information'])
|
||||
s = Procurement(product_id=item[0].product_id, product_qty=1.0, product_uom=item[0].product_uom,
|
||||
location_id=item[0].location_id,
|
||||
name=item[0].name,
|
||||
origin=item[0].origin,
|
||||
company_id=item[0].company_id,
|
||||
values=item[0].values,
|
||||
model_file=base64.b64decode(item[0].product_id.model_file),
|
||||
model_information='%s/%s' % (item[0].product_id.model_processing_panel,
|
||||
item[0].product_id.materials_id.name),
|
||||
)
|
||||
item1 = list(item)
|
||||
item1[0] = s
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import base64
|
||||
from io import BytesIO
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from pystrich.code128 import Code128Encoder
|
||||
# from pystrich.code128 import Code128Encoder
|
||||
|
||||
|
||||
class Tray(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user