Accept Merge Request #1541: (feature/采购优化 -> develop)
Merge Request: 1、优化返工按钮;2、优化工单状态;3、采购单优化 Created By: @禹翔辉 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1541
This commit is contained in:
@@ -1126,6 +1126,14 @@ class MrpProduction(models.Model):
|
||||
cloud_programming = None
|
||||
if self.programming_state in ['已编程']:
|
||||
cloud_programming = self._cron_get_programming_state()
|
||||
result_ids = self.detection_result_ids.filtered(lambda dr: dr.handle_result == '待处理')
|
||||
work_ids = []
|
||||
if result_ids:
|
||||
for result_id in result_ids:
|
||||
work_ids.append(self.workorder_ids.filtered(
|
||||
lambda wk: (wk.name == result_id.routing_type
|
||||
and wk.processing_panel == result_id.processing_panel
|
||||
and wk.state == 'done')).id)
|
||||
return {
|
||||
'name': _('返工'),
|
||||
'type': 'ir.actions.act_window',
|
||||
@@ -1134,7 +1142,7 @@ class MrpProduction(models.Model):
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_production_id': self.id,
|
||||
'default_workorder_ids': self.workorder_ids.filtered(lambda wk: wk.state == 'done').ids,
|
||||
'default_workorder_ids': work_ids,
|
||||
'default_reprogramming_num': cloud_programming['reprogramming_num'],
|
||||
'default_programming_state': cloud_programming['programming_state'],
|
||||
'default_is_reprogramming': True if cloud_programming['programming_state'] in ['已下发'] else False
|
||||
|
||||
@@ -1096,7 +1096,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# if purchase_order.picking_ids.filtered(lambda p: p.state in ['waiting', 'confirmed', 'assigned']):
|
||||
# workorder.state = 'waiting'
|
||||
# continue
|
||||
if workorder.routing_type == '表面工艺':
|
||||
if workorder.technology_design_id.routing_tag == 'special':
|
||||
if workorder.is_subcontract is False:
|
||||
workorder.state = 'ready'
|
||||
else:
|
||||
|
||||
@@ -475,6 +475,8 @@ class ProductionLot(models.Model):
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id),
|
||||
('name', 'ilike', product.name.split('[')[0])],
|
||||
limit=1, order='name desc')
|
||||
if not last_serial:
|
||||
return "%s-%03d" % (product.name, 1)
|
||||
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1]
|
||||
now = datetime.now().strftime("%Y%m%d")
|
||||
if product.cutting_tool_model_id:
|
||||
|
||||
@@ -51,18 +51,6 @@ class ReworkWizard(models.TransientModel):
|
||||
self.workorder_id.button_finish()
|
||||
else:
|
||||
if self.workorder_ids:
|
||||
# handle_result = self.production_id.detection_result_ids.filtered(
|
||||
# lambda dr: dr.handle_result == '待处理')
|
||||
# if handle_result:
|
||||
# processing_panels_to_handle = set(handle_item.processing_panel for handle_item in handle_result)
|
||||
# processing_panels_choice = set(dr_panel.name for dr_panel in self.processing_panel_id)
|
||||
# # 使用集合的差集操作找出那些待处理结果中有但实际可用加工面中没有的加工面
|
||||
# processing_panels_missing = processing_panels_to_handle - processing_panels_choice
|
||||
# # 存在不一致的加工面
|
||||
# if processing_panels_missing:
|
||||
# processing_panels_str = ','.join(processing_panels_missing)
|
||||
# raise UserError('您还有待处理的检测结果中为%s的加工面未选择' % processing_panels_str)
|
||||
|
||||
rework_workorder_ids = self.production_id.workorder_ids.filtered(
|
||||
lambda ap: ap.id in self.workorder_ids.ids)
|
||||
clamp_workorder_ids = None
|
||||
@@ -87,8 +75,9 @@ class ReworkWizard(models.TransientModel):
|
||||
(item.route_id.name == work.name and item.panel
|
||||
and item.panel == work.processing_panel))
|
||||
if route:
|
||||
workorders_values.append(
|
||||
self.env['mrp.workorder'].json_workorder_str(self.production_id, route[0]))
|
||||
work_list = self.env['mrp.workorder'].json_workorder_str(self.production_id, route[0])
|
||||
work_list[2].update({'tag_type': '重新加工'})
|
||||
workorders_values.append(work_list)
|
||||
# 创建新工单,并进行返工配置的相关操作
|
||||
if workorders_values:
|
||||
# 创建新工单、工序排序、完成检测结果单据
|
||||
|
||||
Reference in New Issue
Block a user