1.修改工单的托盘序列号,托盘名称,托盘品牌,托盘类型,托盘型号字段类型,且页面对应字段改为只读
2.装夹预调工单新增扫条形码,扫码时对该工单进行自动开始并将条码里对应的托盘产品信息回填到托盘序列号,托盘名称,托盘品牌,托盘类型,托盘型号字段上,点击完成时对前置三元定位检测参数进行验证 3.研究打印序列号(多个)
This commit is contained in:
@@ -122,10 +122,10 @@ class ResMrpWorkOrder(models.Model):
|
||||
chuck_type_id = fields.Char(string="卡盘类型")
|
||||
chuck_model_id = fields.Char(string="卡盘型号")
|
||||
tray_serial_number = fields.Char(string="托盘序列号")
|
||||
tray_name = fields.Char(string="托盘名称")
|
||||
tray_product_id = fields.Many2one('product.product', string="托盘名称")
|
||||
tray_brand_id = fields.Many2one('sf.machine.brand', string="托盘品牌")
|
||||
tray_type_id = fields.Char(string="托盘类型")
|
||||
tray_model_id = fields.Char(string="托盘型号")
|
||||
tray_type_id = fields.Many2one('sf.fixture.material', string="托盘类型")
|
||||
tray_model_id = fields.Many2one('sf.fixture.model', string="托盘型号")
|
||||
total_wight = fields.Float(string="总重量")
|
||||
maximum_carrying_weight = fields.Char(string="最大承载重量[kg]")
|
||||
maximum_clamping_force = fields.Char(string="最大夹持力[n]")
|
||||
@@ -552,6 +552,9 @@ class ResMrpWorkOrder(models.Model):
|
||||
raise UserError(_('请先完成上一步工单'))
|
||||
|
||||
def button_finish(self):
|
||||
if self.routing_type == '装夹预调':
|
||||
if not self.material_center_point and self.X_deviation_angle > 0:
|
||||
raise UserError("请对前置三元检测定位参数进行计算定位")
|
||||
if self.picking_out_id:
|
||||
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||
if picking_out.workorder_out_id:
|
||||
@@ -721,54 +724,22 @@ class SfWorkOrderBarcodes(models.Model):
|
||||
_name = "mrp.workorder"
|
||||
_inherit = ["mrp.workorder", "barcodes.barcode_events_mixin"]
|
||||
|
||||
# def on_barcode_scanned(self, barcode):
|
||||
# workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
# if "*" not in barcode:
|
||||
# if self.routing_type == '装夹':
|
||||
# tray_code = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
# self.tray_code = tray_code.code
|
||||
# self.tray_id = workorder.gettray_auto(barcode)
|
||||
# elif self.routing_type == '前置三元定位检测':
|
||||
# print('我是前置三元检测')
|
||||
# logging.info('我是前置三元检测')
|
||||
# elif self.routing_type == 'CNC加工':
|
||||
# if barcode == 'UP-ALL':
|
||||
# print("我是一键合并下发")
|
||||
# logging.info('我是一键合并下发')
|
||||
# self.up_merge_all()
|
||||
# else:
|
||||
# print('CNC加工')
|
||||
# # print(barcode)
|
||||
# # a = self.env['sf.tray'].search([('code', '=', barcode)])
|
||||
# # print(a)
|
||||
# # # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)], limit=1)
|
||||
# # workorder_obj = self.env['mrp.workorder'].search([('tray_code', '=', barcode)])
|
||||
# # e = workorder_obj.id
|
||||
# # print(workorder_obj)
|
||||
# # action = {
|
||||
# # 'name': '工单',
|
||||
# # 'type': 'ir.actions.act_window',
|
||||
# # # 'view_type': 'form',
|
||||
# # 'view_mode': 'form',
|
||||
# # 'res_model': 'mrp.workorder',
|
||||
# # 'view_id': self.env.ref('mrp.mrp_production_workorder_form_view_inherit').id,
|
||||
# # # 'res_id': workorder_obj.id,
|
||||
# # 'res_id': 1023,
|
||||
# # 'target': 'current',
|
||||
# # # 'context': self.env.context,
|
||||
# # # 'flags': {'initial_mode': 'edit'},
|
||||
# # }
|
||||
# # return action
|
||||
#
|
||||
# elif self.routing_type == '后置三元质量检测':
|
||||
# print('后置三元检测')
|
||||
# elif self.routing_type == '解除装夹':
|
||||
# print("我是解除装夹")
|
||||
# else:
|
||||
# pass
|
||||
#
|
||||
# else:
|
||||
# self.pro_code_ok = workorder.pro_code_is_ok(barcode)
|
||||
def on_barcode_scanned(self, barcode):
|
||||
workorder = self.env['mrp.workorder'].browse(self.ids)
|
||||
# workorder = self.env['mrp.workorder'].search(
|
||||
# [('routing_type', '=', '装夹预调'), ('production_id', '=', self.production_id.id)])
|
||||
if workorder:
|
||||
if workorder.routing_type == '装夹预调':
|
||||
stock_move_line = self.env['stock.move.line'].search([('lot_name', '=', barcode)])
|
||||
if stock_move_line:
|
||||
workorder.write({
|
||||
'tray_serial_number': stock_move_line.lot_name,
|
||||
'tray_product_id': stock_move_line.product_id.id,
|
||||
'tray_brand_id': stock_move_line.product_id.brand_id.id,
|
||||
'tray_type_id': stock_move_line.product_id.fixture_material_id.id,
|
||||
'tray_model_id': stock_move_line.product_id.fixture_model_id.id
|
||||
})
|
||||
workorder.button_start()
|
||||
|
||||
|
||||
class WorkPieceDelivery(models.Model):
|
||||
|
||||
@@ -375,8 +375,18 @@ class ReStockMove(models.Model):
|
||||
def print_serial_numbers(self):
|
||||
if not self.next_serial:
|
||||
raise UserError(_("请先分配序列号再进行打印"))
|
||||
label_data = []
|
||||
for item in self.move_line_ids:
|
||||
print(item.lot_name)
|
||||
label_data.append({
|
||||
'item_id': item.id,
|
||||
})
|
||||
if label_data:
|
||||
report_template = self.env.ref('stock.label_package_template')
|
||||
res = report_template.report_action(label_data)
|
||||
res['id'] = report_template.id
|
||||
return res
|
||||
else:
|
||||
raise UserError(_("没有可打印的标签数据"))
|
||||
|
||||
|
||||
class ReStockQuant(models.Model):
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="停工"
|
||||
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
groups="sf_base.group_sf_mrp_user"
|
||||
groups="sf_base.group_sf_mrp_user" comfirm="请确定是否停工?"
|
||||
attrs="{'invisible': ['|', '|','|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'),('user_permissions','=',False),('name','=','获取CNC加工程序')]}"/>
|
||||
<button name="button_unblock" type="object" string="Unblock"
|
||||
context="{'default_workcenter_id': workcenter_id}" class="btn-danger"
|
||||
@@ -234,11 +234,12 @@
|
||||
<field name="chuck_model_id"/>
|
||||
</group>
|
||||
<group string="托盘">
|
||||
<field name="tray_serial_number"/>
|
||||
<field name="tray_name"/>
|
||||
<field name="tray_brand_id"/>
|
||||
<field name="tray_type_id"/>
|
||||
<field name="tray_model_id"/>
|
||||
<field name="_barcode_scanned" widget="barcode_handler"/>
|
||||
<field name="tray_serial_number" readonly="1" string="序列号"/>
|
||||
<field name="tray_product_id" readonly="1" string="名称"/>
|
||||
<field name="tray_brand_id" readonly="1" string="品牌"/>
|
||||
<field name="tray_type_id" readonly="1" string="类型"/>
|
||||
<field name="tray_model_id" readonly="1" string="型号"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="预调程序信息">
|
||||
@@ -395,8 +396,8 @@
|
||||
</div>
|
||||
|
||||
<group>
|
||||
<field name="material_center_point"/>
|
||||
<field name='X_deviation_angle'/>
|
||||
<field name="material_center_point" readonly="1"/>
|
||||
<field name='X_deviation_angle' readonly="1"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="工件配送" attrs='{"invisible": [("routing_type","!=","装夹预调")]}'>
|
||||
|
||||
Reference in New Issue
Block a user