修复表面工艺外协及工艺设计
This commit is contained in:
@@ -1204,21 +1204,21 @@ class ResMrpWorkOrder(models.Model):
|
||||
|
||||
if self.sequence == 1:
|
||||
# 判断工单状态是否为等待组件
|
||||
if self.state == 'waiting':
|
||||
raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
||||
# 判断是否有坯料的序列号信息
|
||||
boolean = False
|
||||
if self.production_id.move_raw_ids:
|
||||
if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
boolean = True
|
||||
else:
|
||||
boolean = True
|
||||
if not boolean:
|
||||
raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
# if self.state == 'waiting':
|
||||
# raise UserError('制造订单【%s】缺少组件信息!' % self.production_id.name)
|
||||
# # 判断是否有坯料的序列号信息
|
||||
# boolean = False
|
||||
# if self.production_id.move_raw_ids:
|
||||
# if self.production_id.move_raw_ids[0].product_id.categ_type == '坯料':
|
||||
# if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
# if self.production_id.move_raw_ids[0].move_line_ids:
|
||||
# if self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
# boolean = True
|
||||
# else:
|
||||
# boolean = True
|
||||
# if not boolean:
|
||||
# raise UserError('制造订单【%s】缺少组件的序列号信息!' % self.production_id.name)
|
||||
# self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
# cnc校验
|
||||
if self.production_id.production_type == '自动化产线加工':
|
||||
cnc_workorder = self.search(
|
||||
@@ -1247,10 +1247,14 @@ class ResMrpWorkOrder(models.Model):
|
||||
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
|
||||
('location_dest_id', '=', self.env['stock.location'].search(
|
||||
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
||||
('origin', '=', self.production_id.name)])
|
||||
if move_out.state != 'done':
|
||||
move_out.write({'state': 'assigned', 'production_id': False})
|
||||
self.env['stock.move.line'].create(move_out.get_move_line(self.production_id, self))
|
||||
('origin', '=', self.production_id.name), ('state', 'not in', ['cancel', 'done'])])
|
||||
for mo in move_out:
|
||||
pick = self.env['stock.picking'].search([('id', '=', mo.picking_id.id), ('name', 'ilike', 'OCOUT'),
|
||||
('partner_id', '=', self.supplier_id.id)])
|
||||
if pick:
|
||||
if mo.state != 'done':
|
||||
mo.write({'state': 'assigned', 'production_id': False})
|
||||
self.env['stock.move.line'].create(mo.get_move_line(self.production_id, self))
|
||||
|
||||
# move_out._action_assign()
|
||||
if self.state == 'waiting' or self.state == 'ready' or self.state == 'progress':
|
||||
@@ -1315,11 +1319,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
def button_finish(self):
|
||||
for record in self:
|
||||
if record.routing_type == '装夹预调':
|
||||
if not record.rfid_code and record.is_rework is False:
|
||||
raise UserError("请扫RFID码进行绑定")
|
||||
if record.is_rework is False:
|
||||
if not record.material_center_point:
|
||||
raise UserError("坯料中心点为空,请检查")
|
||||
# if not record.rfid_code and record.is_rework is False:
|
||||
# raise UserError("请扫RFID码进行绑定")
|
||||
# if record.is_rework is False:
|
||||
# if not record.material_center_point:
|
||||
# raise UserError("坯料中心点为空,请检查")
|
||||
# if record.X_deviation_angle <= 0:
|
||||
# raise UserError("X偏差角度小于等于0,请检查!本次计算的X偏差角度为:%s" % record.X_deviation_angle)
|
||||
record.process_state = '待加工'
|
||||
|
||||
Reference in New Issue
Block a user