Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
This commit is contained in:
@@ -1025,20 +1025,20 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
# 查询工序最小的非完工、非返工的装夹预调工单
|
# 查询工序最小的非完工、非返工的装夹预调工单
|
||||||
work_id = self.search(
|
work_id = self.search(
|
||||||
[('production_id', '=', workorder.production_id.id),
|
[('production_id', '=', workorder.production_id.id),
|
||||||
('routing_type', '=', '装夹预调'),
|
|
||||||
('state', 'not in', ['rework', 'done', 'cancel'])],
|
('state', 'not in', ['rework', 'done', 'cancel'])],
|
||||||
limit=1,
|
limit=1,
|
||||||
order="sequence")
|
order="sequence")
|
||||||
if workorder == work_id:
|
if work_id.routing_type == '装夹预调':
|
||||||
if workorder.production_id.reservation_state == 'assigned':
|
if workorder == work_id:
|
||||||
workorder.state = 'ready'
|
if workorder.production_id.reservation_state == 'assigned':
|
||||||
elif workorder.production_id.reservation_state != 'assigned':
|
workorder.state = 'ready'
|
||||||
workorder.state = 'waiting'
|
elif workorder.production_id.reservation_state != 'assigned':
|
||||||
continue
|
workorder.state = 'waiting'
|
||||||
elif (workorder.name == '装夹预调' and
|
continue
|
||||||
workorder.state not in ['rework', 'done', 'cancel']):
|
elif (workorder.name == '装夹预调' and
|
||||||
if workorder.state != 'pending':
|
workorder.state not in ['rework', 'done', 'cancel']):
|
||||||
workorder.state = 'pending'
|
if workorder.state != 'pending':
|
||||||
|
workorder.state = 'pending'
|
||||||
if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready':
|
if workorder.production_id.tool_state in ['1', '2'] and workorder.state == 'ready':
|
||||||
workorder.state = 'waiting'
|
workorder.state = 'waiting'
|
||||||
continue
|
continue
|
||||||
@@ -1342,6 +1342,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
arch = etree.fromstring(tree_view['arch'])
|
arch = etree.fromstring(tree_view['arch'])
|
||||||
# 查找 tree 标签
|
# 查找 tree 标签
|
||||||
tree_element = arch.xpath("//tree")[0]
|
tree_element = arch.xpath("//tree")[0]
|
||||||
|
tree_element.set('js_class', 'remove_focus_list_view')
|
||||||
|
|
||||||
# 查找或创建 header 标签
|
# 查找或创建 header 标签
|
||||||
header_element = tree_element.find('header')
|
header_element = tree_element.find('header')
|
||||||
|
|||||||
@@ -70,6 +70,27 @@ class sf_production_plan(models.Model):
|
|||||||
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
|
||||||
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
|
||||||
|
|
||||||
|
@api.onchange('date_planned_start')
|
||||||
|
def date_planned_start_onchange(self):
|
||||||
|
if self.date_planned_start:
|
||||||
|
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
|
||||||
|
|
||||||
|
#处理计划状态非代排程,计划结束时间为空的数据处理
|
||||||
|
def deal_no_date_planned_finished(self):
|
||||||
|
plans = self.env['sf.production.plan'].search(
|
||||||
|
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
|
||||||
|
for item in plans:
|
||||||
|
if item.date_planned_start:
|
||||||
|
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
|
||||||
|
if not item.order_deadline and item.date_planned_start:
|
||||||
|
item.order_deadline = item.date_planned_start + timedelta(days=7)
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
||||||
|
|
||||||
|
info = super(sf_production_plan, self).search_read(domain, fields, offset, limit, order)
|
||||||
|
return info
|
||||||
|
|
||||||
# 计算实际加工时长
|
# 计算实际加工时长
|
||||||
@api.depends('actual_start_time', 'actual_end_time')
|
@api.depends('actual_start_time', 'actual_end_time')
|
||||||
def _compute_actual_process_time(self):
|
def _compute_actual_process_time(self):
|
||||||
@@ -221,6 +242,8 @@ class sf_production_plan(models.Model):
|
|||||||
record.date_planned_start, record.date_planned_finished = \
|
record.date_planned_start, record.date_planned_finished = \
|
||||||
item.date_planned_start, item.date_planned_finished
|
item.date_planned_start, item.date_planned_finished
|
||||||
record.state = 'done'
|
record.state = 'done'
|
||||||
|
record.date_planned_finished = record.date_planned_start + timedelta(
|
||||||
|
minutes=60) if not record.date_planned_finished else record.date_planned_finished
|
||||||
# record.production_id.schedule_state = '已排'
|
# record.production_id.schedule_state = '已排'
|
||||||
record.sudo().production_id.schedule_state = '已排'
|
record.sudo().production_id.schedule_state = '已排'
|
||||||
record.sudo().production_id.process_state = '待装夹'
|
record.sudo().production_id.process_state = '待装夹'
|
||||||
|
|||||||
@@ -88,8 +88,8 @@
|
|||||||
|
|
||||||
<group string="加工信息">
|
<group string="加工信息">
|
||||||
|
|
||||||
<field name="date_planned_start" placeholder="如果不选择计划开始时间,会取当前时间来做排程"/>
|
<field name="date_planned_start" placeholder="如果不选择计划开始时间,会取当前时间来做排程" required="1"/>
|
||||||
<field name="date_planned_finished"/>
|
<field name="date_planned_finished" required="1"/>
|
||||||
<field name="actual_process_time"/>
|
<field name="actual_process_time"/>
|
||||||
<field name="actual_start_time"/>
|
<field name="actual_start_time"/>
|
||||||
<field name="actual_end_time"/>
|
<field name="actual_end_time"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user