Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化sf
# Conflicts: # sf_manufacturing/models/__init__.py # sf_manufacturing/models/mrp_workcenter.py # sf_manufacturing/models/mrp_workorder.py # sf_manufacturing/views/mrp_workorder_view.xml
This commit is contained in:
@@ -11,4 +11,3 @@ from . import res_user
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,13 @@ class ResWorkcenter(models.Model):
|
||||
|
||||
users_ids = fields.Many2many("res.users", 'users_workcenter')
|
||||
|
||||
# @api.onchange('machine_tool_id')
|
||||
# def get_machine_tool_is_binding(self):
|
||||
# print('1111111')
|
||||
# for item in self:
|
||||
# item.machine_tool_id.is_binding = False
|
||||
|
||||
|
||||
equipment_ids = fields.One2many(
|
||||
'maintenance.equipment', 'workcenter_id', string="Maintenance Equipment",
|
||||
check_company=True)
|
||||
|
||||
@@ -258,9 +258,6 @@ class ResMrpWorkOrder(models.Model):
|
||||
else:
|
||||
return True
|
||||
|
||||
# def fetchCNCing(self):
|
||||
# return None
|
||||
|
||||
# cnc程序获取
|
||||
def fetchCNC(self):
|
||||
try:
|
||||
@@ -316,14 +313,50 @@ class ResMrpWorkOrder(models.Model):
|
||||
logging.info('fetchCNC error:%s' % e)
|
||||
raise UserError(e)
|
||||
|
||||
# return {
|
||||
# 'name': _("工单"),
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'mrp.workorder',
|
||||
# 'res_id': self.id,
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'target': 'new'
|
||||
# }
|
||||
# cnc程序获取
|
||||
def fetchCNC(self):
|
||||
cnc = self.env['mrp.workorder'].search(
|
||||
[('routing_type', '=', 'CNC加工'), ('production_id', '=', self.production_id.id)], limit=1)
|
||||
if cnc.product_id.upload_model_file:
|
||||
attachment = cnc.product_id.upload_model_file[0]
|
||||
base64_data = base64.b64encode(attachment.datas)
|
||||
base64_datas = base64_data.decode('utf-8')
|
||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||
res = {'model_code': '' if not cnc.product_id.upload_model_file else model_code,
|
||||
'production_no': self.production_id.name,
|
||||
'machine_tool_code': cnc.workcenter_id.machine_tool_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,
|
||||
'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()
|
||||
if ret['status'] == 1:
|
||||
self.write({'programming_no': ret['programming_no'], 'programming_state': '编程中', 'work_state': '编程中'})
|
||||
return {
|
||||
'name': _("工单"),
|
||||
'view_mode': 'form',
|
||||
'res_model': 'mrp.workorder',
|
||||
'res_id': self.id,
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
def json_workorder_str1(self, k, production, route):
|
||||
workorders_values_str = [0, '', {
|
||||
@@ -436,7 +469,7 @@ class CNCprocessing(models.Model):
|
||||
cnc_workorder.state = 'done'
|
||||
cnc_workorder.work_state = '已编程'
|
||||
cnc_workorder.programming_state = '已编程'
|
||||
cnc_workorder.time_ids.date_end = datetime.now()
|
||||
# cnc_workorder.time_ids.date_end = datetime.now()
|
||||
|
||||
def get_cnc_processing_file(self, folder_name, cnc_processing):
|
||||
logging.info('folder_name:%s' % folder_name)
|
||||
@@ -501,6 +534,9 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
self.tray_code = tray_code.code
|
||||
# 在这里,用等号赋值只是一次性的,只是一种展示
|
||||
# self.tray_code = tray_code.code
|
||||
# 用write方法写入数据库是永久的
|
||||
self.write({'tray_code': tray_code.code})
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
workorder.gettray_auto(barcode)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<field name="name" position="before">
|
||||
<field name="sequence"/>
|
||||
<field name='user_permissions'/>
|
||||
<field name='user_permissions'/>
|
||||
</field>
|
||||
<field name="name" position="after">
|
||||
<field name="processing_panel"/>
|
||||
@@ -31,6 +32,22 @@
|
||||
<attribute name="multi_edit"></attribute>
|
||||
<attribute name="editable"></attribute>
|
||||
</tree>
|
||||
<xpath expr="//button[@name='button_start']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '|', '|','|', ('production_state','in', ('draft', 'done',
|
||||
'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
|
||||
('is_user_working', '!=', False),("user_permissions","=",False)]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<!-- <button name="button_start" type="object" string="Start" class="btn-success"-->
|
||||
<!-- attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}"/>-->
|
||||
<!-- <button name="button_pending" type="object" string="Pause" class="btn-warning"-->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>-->
|
||||
<!-- <button name="button_finish" type="object" string="Done" class="btn-success"-->
|
||||
<!-- attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>-->
|
||||
<tree position="attributes">
|
||||
<attribute name="multi_edit"></attribute>
|
||||
<attribute name="editable"></attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -80,8 +97,6 @@
|
||||
<xpath expr="field[@name='is_user_working']" position="before">
|
||||
<field name='user_permissions' invisible="1"/>
|
||||
</xpath>
|
||||
|
||||
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="获取CNC加工程序" attrs='{"invisible": [("routing_type","!=","获取CNC加工程序")]}'>
|
||||
<group>
|
||||
@@ -99,7 +114,9 @@
|
||||
</div>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="field[@name='is_user_working']" position="before">
|
||||
<field name='user_permissions' invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="装夹托盘" attrs='{"invisible": [("routing_type","!=","装夹")]}'>
|
||||
@@ -221,6 +238,10 @@
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
|
||||
<button type="object" class="oe_highlight" name="getcenter" string="计算定位"
|
||||
attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
|
||||
<button type="object" class="oe_highlight" name="getcenter" string="计算定位"
|
||||
attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
</div>
|
||||
@@ -260,7 +281,6 @@
|
||||
<page string="后置三元检测" attrs='{"invisible": [("routing_type","!=","后置三元质量检测")]}'>
|
||||
<group>
|
||||
<field name="test_results" widget="selection"/>
|
||||
|
||||
</group>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="recreateManufacturingOrWorkerOrder"
|
||||
@@ -271,6 +291,7 @@
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="解除装夹" attrs='{"invisible": [("routing_type","!=","解除装夹")]}'>
|
||||
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"
|
||||
attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
@@ -280,6 +301,16 @@
|
||||
string="打印标签" attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="object" class="oe_highlight" name="unbindtray" string="解除装夹"
|
||||
attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
</div>
|
||||
<div class="col-12 col-lg-6 o_setting_box">
|
||||
<button type="action" class="oe_highlight" name="sf_manufacturing.label_sf_tray_code1"
|
||||
string="打印标签" attrs='{"invisible": [("user_permissions","=",False)]}'/>
|
||||
</div>
|
||||
>>>>>>> 3d882f5492685cfdb3cd9960bd24cdf9ef247f79
|
||||
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user