Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/优化表面工艺
This commit is contained in:
@@ -255,7 +255,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
sql = """
|
||||
SELECT *
|
||||
FROM mrp_workorder
|
||||
WHERE
|
||||
WHERE state!='rework'
|
||||
to_char(date_planned_start::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')>= %s
|
||||
AND to_char(date_planned_finished::timestamp + '8 hour','YYYY-MM-DD HH:mm:SS')<= %s
|
||||
"""
|
||||
@@ -753,10 +753,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
('processing_panel', '=', workorder.processing_panel),
|
||||
('routing_type', '=', 'CNC加工'), ('state', 'in', ['done', 'rework']),
|
||||
('test_results', '=', '返工')])
|
||||
cnc_workorder_pending = self.env['mrp.workorder'].search(
|
||||
[('production_id', '=', workorder.production_id.id),
|
||||
('processing_panel', '=', workorder.processing_panel),
|
||||
('routing_type', '=', 'CNC加工'), ('state', 'in', ['pending'])])
|
||||
if workorder.state not in ['cancel', 'progress', 'rework']:
|
||||
if workorder.production_id.state == 'rework':
|
||||
logging.info('len(re_work):%s' % len(re_work))
|
||||
logging.info('len(cnc_workorder):%s' % len(cnc_workorder))
|
||||
logging.info('len(cnc_workorder_pending):%s' % len(cnc_workorder_pending))
|
||||
logging.info('工序:%s' % workorder.routing_type)
|
||||
logging.info('状态:%s' % workorder.state)
|
||||
logging.info('is_rework:%s' % workorder.is_rework)
|
||||
@@ -771,7 +776,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# 新工单
|
||||
if workorder.is_rework is False:
|
||||
if workorder.production_id.programming_state == '已编程' and workorder.production_id.is_rework is False:
|
||||
if re_work:
|
||||
if re_work or cnc_workorder:
|
||||
workorder.state = 'ready'
|
||||
else:
|
||||
if workorder.production_id.is_rework is True:
|
||||
@@ -790,13 +795,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
workorder.state = 'waiting'
|
||||
elif workorder.routing_type == '解除装夹' and workorder.state not in ['done', 'rework', 'cancel']:
|
||||
if cnc_workorder:
|
||||
workorder.state = 'waiting'
|
||||
if not cnc_workorder_pending:
|
||||
workorder.state = 'waiting'
|
||||
# else:
|
||||
# if workorder.production_id.is_rework is True:
|
||||
# workorder.state = 'waiting'
|
||||
elif workorder.production_id.state == 'progress':
|
||||
logging.info('len(re_work):%s' % len(re_work))
|
||||
logging.info('len(cnc_workorder):%s' % len(cnc_workorder))
|
||||
logging.info('len(cnc_workorder_pending):%s' % len(cnc_workorder_pending))
|
||||
logging.info('工序:%s' % workorder.routing_type)
|
||||
logging.info('状态:%s' % workorder.state)
|
||||
logging.info('is_rework:%s' % workorder.is_rework)
|
||||
@@ -808,7 +815,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
workorder.is_rework is False and workorder.state not in [
|
||||
'done', 'rework',
|
||||
'cancel']:
|
||||
if re_work and workorder.production_id.is_rework is False:
|
||||
if (re_work or cnc_workorder) and workorder.production_id.is_rework is False:
|
||||
workorder.state = 'ready'
|
||||
if workorder.routing_type == '表面工艺' and workorder.state not in ['done', 'progress']:
|
||||
unclamp_workorder = self.env['mrp.workorder'].search(
|
||||
@@ -817,9 +824,11 @@ class ResMrpWorkOrder(models.Model):
|
||||
('state', 'in', ['done'])])
|
||||
if unclamp_workorder:
|
||||
workorder.state = 'ready'
|
||||
# else:
|
||||
# if workorder.state not in ['cancel', 'rework']:
|
||||
# workorder.state = 'rework'
|
||||
logging.info('工序:%s' % workorder.sequence)
|
||||
logging.info('工单最终状态:%s' % workorder.state)
|
||||
# else:
|
||||
# if workorder.state not in ['cancel', 'rework']:
|
||||
# workorder.state = 'rework'
|
||||
# elif workorder.routing_type == 'CNC加工' and workorder.state not in ['done', 'cancel', 'progress',
|
||||
# 'rework']:
|
||||
# per_work = self.env['mrp.workorder'].search(
|
||||
|
||||
Reference in New Issue
Block a user