1、优化 托盘绑定工单逻辑优化 ;2 完成 整体式刀具批次/序列号生成的优化需求; 3、完成 坯料序列号生成规则优化需求1。
This commit is contained in:
@@ -25,6 +25,9 @@
|
|||||||
<filter string="人工编程" name="manual_quotation" domain="[('manual_quotation', '=', True)]"/>
|
<filter string="人工编程" name="manual_quotation" domain="[('manual_quotation', '=', True)]"/>
|
||||||
<filter string="自动编程" name="no_manual_quotation" domain="[('manual_quotation', '=', False)]"/>
|
<filter string="自动编程" name="no_manual_quotation" domain="[('manual_quotation', '=', False)]"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='production_id']" position="before">
|
||||||
|
<field name="product_tmpl_name"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -21,6 +21,8 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
_inherit = 'mrp.workorder'
|
_inherit = 'mrp.workorder'
|
||||||
_order = 'sequence asc,create_date desc'
|
_order = 'sequence asc,create_date desc'
|
||||||
|
|
||||||
|
product_tmpl_name = fields.Char('坯料产品名称', related='production_bom_id.bom_line_ids.product_id.name')
|
||||||
|
|
||||||
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
|
product_tmpl_id_length = fields.Float(related='production_id.product_tmpl_id.length', readonly=True, store=True,
|
||||||
string="坯料长度(mm)")
|
string="坯料长度(mm)")
|
||||||
product_tmpl_id_width = fields.Float(related='production_id.product_tmpl_id.width', readonly=True, store=True,
|
product_tmpl_id_width = fields.Float(related='production_id.product_tmpl_id.width', readonly=True, store=True,
|
||||||
@@ -48,6 +50,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
|
|
||||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('users_ids')
|
@api.onchange('users_ids')
|
||||||
def get_user_permissions(self):
|
def get_user_permissions(self):
|
||||||
uid = self.env.uid
|
uid = self.env.uid
|
||||||
@@ -849,12 +852,12 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
limit=1, order='id asc')
|
limit=1, order='id asc')
|
||||||
if not cnc_workorder.cnc_ids:
|
if not cnc_workorder.cnc_ids:
|
||||||
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||||
else:
|
# else:
|
||||||
for item in cnc_workorder.cnc_ids:
|
# for item in cnc_workorder.cnc_ids:
|
||||||
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
# functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||||
[('tool_name_id.name', '=', item.cutting_tool_name)])
|
# [('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||||
if not functional_cutting_tool:
|
# if not functional_cutting_tool:
|
||||||
raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
|
# raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具' % item.cutting_tool_name))
|
||||||
if self.routing_type == '解除装夹':
|
if self.routing_type == '解除装夹':
|
||||||
'''
|
'''
|
||||||
记录开始时间
|
记录开始时间
|
||||||
@@ -1011,8 +1014,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
is_production_id = False
|
is_production_id = False
|
||||||
if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺']:
|
if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺']:
|
||||||
for workorder in record.production_id.workorder_ids:
|
for workorder in record.production_id.workorder_ids:
|
||||||
workorder.rfid_code_old = workorder.rfid_code
|
if workorder.processing_panel == record.processing_panel:
|
||||||
workorder.rfid_code = None
|
workorder.rfid_code_old = workorder.rfid_code
|
||||||
|
workorder.rfid_code = None
|
||||||
for move_raw_id in record.production_id.move_raw_ids:
|
for move_raw_id in record.production_id.move_raw_ids:
|
||||||
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
move_raw_id.quantity_done = move_raw_id.product_uom_qty
|
||||||
record.process_state = '已完工'
|
record.process_state = '已完工'
|
||||||
@@ -1254,11 +1258,12 @@ class SfWorkOrderBarcodes(models.Model):
|
|||||||
workorder.write(val)
|
workorder.write(val)
|
||||||
self.write(val)
|
self.write(val)
|
||||||
workorder_rfid = self.env['mrp.workorder'].search(
|
workorder_rfid = self.env['mrp.workorder'].search(
|
||||||
[('production_id', '=', workorder.production_id.id)])
|
[('production_id', '=', workorder.production_id.id),
|
||||||
|
('processing_panel', '=', workorder.processing_panel)])
|
||||||
if workorder_rfid:
|
if workorder_rfid:
|
||||||
for item in workorder_rfid:
|
for item in workorder_rfid:
|
||||||
item.write({'rfid_code': barcode})
|
item.write({'rfid_code': barcode})
|
||||||
logging.info("Rfid绑定成功!!!")
|
logging.info("Rfid[%s]绑定成功!!!" % barcode)
|
||||||
else:
|
else:
|
||||||
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
|
raise UserError('该Rfid【%s】绑定的是【%s】, 不是托盘!!!' % (barcode, lot.product_id.name))
|
||||||
self.process_state = '待检测'
|
self.process_state = '待检测'
|
||||||
|
|||||||
@@ -675,6 +675,7 @@ class ReStockMove(models.Model):
|
|||||||
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
|
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
|
||||||
else:
|
else:
|
||||||
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
||||||
|
# self.action_assign_serial_show_details()
|
||||||
elif self.product_id.tracking == "lot":
|
elif self.product_id.tracking == "lot":
|
||||||
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
||||||
|
|
||||||
@@ -704,10 +705,16 @@ class ReStockMove(models.Model):
|
|||||||
def _put_tool_lot(self, company, product, origin):
|
def _put_tool_lot(self, company, product, origin):
|
||||||
if product.tracking == "lot" and self.product_id.categ_id.name == '刀具':
|
if product.tracking == "lot" and self.product_id.categ_id.name == '刀具':
|
||||||
if not self.move_line_nosuggest_ids:
|
if not self.move_line_nosuggest_ids:
|
||||||
lot_names = self.env['stock.lot'].generate_lot_names(
|
lot_code = '%s-%s-%s' % ('%s-T-DJWL-%s' % (
|
||||||
'%s-%s-%s' % ('%s-T-DJWL-%s' % (
|
product.cutting_tool_model_id.code.split('-')[0], product.cutting_tool_material_id.code),
|
||||||
product.cutting_tool_model_id.code.split('-')[0], product.cutting_tool_material_id.code),
|
datetime.now().strftime("%Y%m%d"), origin)
|
||||||
datetime.now().strftime("%Y%m%d"), origin), 1)
|
move_line_ids = self.env['stock.move.line'].sudo().search([('lot_name', 'like', lot_code)], limit=1,
|
||||||
|
order='id desc')
|
||||||
|
if not move_line_ids:
|
||||||
|
lot_code = '%s-001' % lot_code
|
||||||
|
else:
|
||||||
|
lot_code = '%s-%03d' % (lot_code, int(move_line_ids.lot_name[-3:]) + 1)
|
||||||
|
lot_names = self.env['stock.lot'].generate_lot_names(lot_code, 1)
|
||||||
move_lines_commands = self._generate_serial_move_line_commands_tool_lot(lot_names)
|
move_lines_commands = self._generate_serial_move_line_commands_tool_lot(lot_names)
|
||||||
self.write({'move_line_nosuggest_ids': move_lines_commands})
|
self.write({'move_line_nosuggest_ids': move_lines_commands})
|
||||||
for item in self.move_line_nosuggest_ids:
|
for item in self.move_line_nosuggest_ids:
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
</field>
|
</field>
|
||||||
<field name="state" position="after">
|
<field name="state" position="after">
|
||||||
<field name="work_state" optional="hide"/>
|
<field name="work_state" optional="hide"/>
|
||||||
|
<field name="product_tmpl_name" invisible="1"/>
|
||||||
</field>
|
</field>
|
||||||
<field name="product_id" position="after">
|
<field name="product_id" position="after">
|
||||||
<field name="equipment_id" optional="hide"/>
|
<field name="equipment_id" optional="hide"/>
|
||||||
@@ -214,7 +215,7 @@
|
|||||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
<field name="functional_fixture_type_id"
|
<field name="functional_fixture_type_id"
|
||||||
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
attrs='{"invisible": [("routing_type","!=","装夹预调")]}'/>
|
||||||
<field name="rfid_code" cache="True"
|
<field name="rfid_code" force_save="1" readonly="1" cache="True"
|
||||||
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
attrs="{'invisible': [('rfid_code_old', '!=', False)]}"/>
|
||||||
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
<field name="rfid_code_old" readonly="1" attrs="{'invisible': [('rfid_code_old', '=', False)]}"/>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user