消息提醒
This commit is contained in:
@@ -12,36 +12,43 @@ class SFMessageStockPicking(models.Model):
|
||||
@api.model_create_multi
|
||||
def create(self, vals):
|
||||
result = super(SFMessageStockPicking, self).create(vals)
|
||||
for obj in result:
|
||||
if obj.location_id.name == '进货' and obj.location_dest_id.name == '刀具房':
|
||||
obj.add_queue('调拨入库')
|
||||
try:
|
||||
for obj in result:
|
||||
if obj.location_id.name == '进货' and obj.location_dest_id.name == '刀具房':
|
||||
obj.add_queue('调拨入库')
|
||||
except Exception as e:
|
||||
logging.info('add_queue调拨入库 error:%s' % e)
|
||||
return result
|
||||
|
||||
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||
def _compute_state(self):
|
||||
super(SFMessageStockPicking, self)._compute_state()
|
||||
for record in self:
|
||||
if record.state == 'assigned' and record.picking_type_id.sequence_code == 'PC':
|
||||
record.add_queue('坯料发料提醒')
|
||||
try:
|
||||
for record in self:
|
||||
if record.state == 'assigned' and record.picking_type_id.sequence_code == 'PC':
|
||||
record.add_queue('坯料发料提醒')
|
||||
|
||||
if record.picking_type_id.sequence_code == 'SFP' and record.state == 'done':
|
||||
stock_picking_sfp = record.env['stock.picking'].search(
|
||||
[('origin', '=', record.origin), ('state', '!=', 'done'),
|
||||
('picking_type_id.sequence_code', '=', 'SFP')])
|
||||
if not stock_picking_sfp:
|
||||
stock_picking_send = self.env["jikimo.message.queue"].sudo().search([('res_id', '=', record.id)])
|
||||
if not stock_picking_send:
|
||||
record.add_queue('订单发货提醒')
|
||||
if record.picking_type_id.sequence_code == 'OCOUT' and record.state == 'assigned':
|
||||
mrp_production = self.env['mrp.production'].sudo().search([('name', '=', record.origin)])
|
||||
production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', mrp_production.product_id.id)])
|
||||
manufacturing_order_names = production_list.mapped('name')
|
||||
stock_picking_list = self.env['stock.picking'].sudo().search(
|
||||
[('origin', 'in', manufacturing_order_names), ('picking_type_id.sequence_code', '=', 'OCOUT')])
|
||||
all_ready_or_done = all(picking.state in ['assigned', 'done'] for picking in stock_picking_list)
|
||||
if all_ready_or_done:
|
||||
mrp_production.add_queue('工序外协发料通知')
|
||||
if record.picking_type_id.sequence_code == 'SFP' and record.state == 'done':
|
||||
stock_picking_sfp = record.env['stock.picking'].search(
|
||||
[('origin', '=', record.origin), ('state', '!=', 'done'),
|
||||
('picking_type_id.sequence_code', '=', 'SFP')])
|
||||
if not stock_picking_sfp:
|
||||
stock_picking_send = self.env["jikimo.message.queue"].sudo().search(
|
||||
[('res_id', '=', record.id)])
|
||||
if not stock_picking_send:
|
||||
record.add_queue('订单发货提醒')
|
||||
if record.picking_type_id.sequence_code == 'OCOUT' and record.state == 'assigned':
|
||||
mrp_production = self.env['mrp.production'].sudo().search([('name', '=', record.origin)])
|
||||
production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', mrp_production.product_id.id)])
|
||||
manufacturing_order_names = production_list.mapped('name')
|
||||
stock_picking_list = self.env['stock.picking'].sudo().search(
|
||||
[('origin', 'in', manufacturing_order_names), ('picking_type_id.sequence_code', '=', 'OCOUT')])
|
||||
all_ready_or_done = all(picking.state in ['assigned', 'done'] for picking in stock_picking_list)
|
||||
if all_ready_or_done:
|
||||
mrp_production.add_queue('工序外协发料通知')
|
||||
except Exception as e:
|
||||
logging.info('add_queue_compute_state error:%s' % e)
|
||||
|
||||
def deal_stock_picking_sfp(self, message_queue_id): # 处理订单发货提醒
|
||||
content = None
|
||||
|
||||
Reference in New Issue
Block a user