Compare commits
6 Commits
feature/工单
...
master_sf_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3a1e9b341 | ||
|
|
8db80e1ed6 | ||
|
|
fc378df597 | ||
|
|
0575d89227 | ||
|
|
39afc99b8f | ||
|
|
f230ad55fb |
@@ -62,7 +62,7 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
|
|||||||
const dom1 = buttonsDom.children('.o_form_button_save')
|
const dom1 = buttonsDom.children('.o_form_button_save')
|
||||||
const dom2 = buttonsDom.children('.o_form_button_cancel')
|
const dom2 = buttonsDom.children('.o_form_button_cancel')
|
||||||
dom1.append('保存')
|
dom1.append('保存')
|
||||||
dom2.append('不保存')
|
dom2.append('放弃保存')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
from odoo.addons.sf_mrs_connect.controllers.controllers import Sf_Mrs_Connect
|
from odoo.addons.sf_mrs_connect.controllers.controllers import Sf_Mrs_Connect
|
||||||
from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect
|
from odoo.addons.sf_manufacturing.controllers.controllers import Manufacturing_Connect
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@ class WorkorderExceptionConroller(http.Controller):
|
|||||||
workorder = request.env['mrp.workorder'].sudo().search([
|
workorder = request.env['mrp.workorder'].sudo().search([
|
||||||
('rfid_code', '=', ret['RfidCode']),
|
('rfid_code', '=', ret['RfidCode']),
|
||||||
('routing_type', '=', 'CNC加工'),
|
('routing_type', '=', 'CNC加工'),
|
||||||
('state', '!=', 'rework')
|
|
||||||
])
|
])
|
||||||
if not workorder:
|
if not workorder:
|
||||||
res = {'Succeed': False, 'ErrorCode': 401, 'Error': '无效的工单'}
|
res = {'Succeed': False, 'ErrorCode': 401, 'Error': '无效的工单'}
|
||||||
@@ -43,10 +41,7 @@ class WorkorderExceptionConroller(http.Controller):
|
|||||||
'exception_code': ret.get('coding'),
|
'exception_code': ret.get('coding'),
|
||||||
'exception_content': ret.get('Error', '')
|
'exception_content': ret.get('Error', '')
|
||||||
})
|
})
|
||||||
# 申请重新编程
|
|
||||||
workorder.production_id.update_programming_state(trigger_time=datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
|
||||||
reprogramming_reason=ret.get('Error', ''))
|
|
||||||
workorder.production_id.write({'programming_state': '编程中', 'work_state': '编程中', 'is_rework': False})
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': e}
|
||||||
_logger.info('workder_exception error:%s' % e)
|
_logger.info('workder_exception error:%s' % e)
|
||||||
|
|||||||
@@ -577,19 +577,16 @@ class MrpProduction(models.Model):
|
|||||||
|
|
||||||
# 编程单更新
|
# 编程单更新
|
||||||
# 增加触发时间参数
|
# 增加触发时间参数
|
||||||
def update_programming_state(self, trigger_time=None, reprogramming_reason=None):
|
def update_programming_state(self, trigger_time=None):
|
||||||
try:
|
try:
|
||||||
manufacturing_type = None
|
manufacturing_type = 'rework'
|
||||||
if self.is_scrap:
|
if self.is_scrap:
|
||||||
manufacturing_type = 'scrap'
|
manufacturing_type = 'scrap'
|
||||||
elif self.tool_state == '2':
|
elif self.tool_state == '2':
|
||||||
manufacturing_type = 'invalid_tool_rework'
|
manufacturing_type = 'invalid_tool_rework'
|
||||||
elif self.is_rework:
|
|
||||||
manufacturing_type = 'rework'
|
|
||||||
res = {'programming_no': self.programming_no,
|
res = {'programming_no': self.programming_no,
|
||||||
'manufacturing_type': manufacturing_type,
|
'manufacturing_type': manufacturing_type,
|
||||||
'trigger_time': trigger_time,
|
'trigger_time': trigger_time}
|
||||||
'reprogramming_reason': reprogramming_reason}
|
|
||||||
logging.info('res=%s:' % res)
|
logging.info('res=%s:' % res)
|
||||||
configsettings = self.env['res.config.settings'].get_values()
|
configsettings = self.env['res.config.settings'].get_values()
|
||||||
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
||||||
|
|||||||
@@ -455,32 +455,6 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
("technology", "工艺"), ("customer redrawing", "客户改图")], string="原因", tracking=True)
|
||||||
detailed_reason = fields.Text('详细原因')
|
detailed_reason = fields.Text('详细原因')
|
||||||
is_rework = fields.Boolean(string='是否返工', default=False)
|
is_rework = fields.Boolean(string='是否返工', default=False)
|
||||||
# rework_flag = fields.Boolean(string='返工标志', compute='_compute_rework_flag')
|
|
||||||
#
|
|
||||||
# @api.depends('state', 'production_line_state')
|
|
||||||
# def _compute_rework_flag(self):
|
|
||||||
# for record in self:
|
|
||||||
# if record.state == 'done' and record.routing_type == '装夹预调':
|
|
||||||
# next_workorder = record.production_id.workorder_ids.filtered(
|
|
||||||
# lambda w: w.sequence == record.sequence + 1)
|
|
||||||
# if next_workorder and next_workorder.routing_type == 'CNC加工' and next_workorder.state in ['ready',
|
|
||||||
# 'waiting',
|
|
||||||
# 'pending'] and next_workorder.production_line_state == '待上产线':
|
|
||||||
# record.rework_flag = False
|
|
||||||
# elif next_workorder and next_workorder.routing_type == '表面工艺' and next_workorder.state in ['ready',
|
|
||||||
# 'waiting',
|
|
||||||
# 'pending']:
|
|
||||||
# record.rework_flag = False
|
|
||||||
# else:
|
|
||||||
# record.rework_flag = True
|
|
||||||
# else:
|
|
||||||
# record.rework_flag = True
|
|
||||||
#
|
|
||||||
# def button_rework(self):
|
|
||||||
# for item in self:
|
|
||||||
# item.state = 'progress'
|
|
||||||
# for time_id in item.time_ids:
|
|
||||||
# time_id.write({'date_end': None})
|
|
||||||
|
|
||||||
def button_change_env(self):
|
def button_change_env(self):
|
||||||
self.is_test_env = not self.is_test_env
|
self.is_test_env = not self.is_test_env
|
||||||
|
|||||||
@@ -180,14 +180,14 @@ class StockRule(models.Model):
|
|||||||
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
||||||
productions_values)
|
productions_values)
|
||||||
# 将这一批制造订单的采购组根据成品设置为不同的采购组
|
# 将这一批制造订单的采购组根据成品设置为不同的采购组
|
||||||
# product_group_id = {}
|
product_group_id = {}
|
||||||
# for index, production in enumerate(productions):
|
for index, production in enumerate(productions):
|
||||||
# if production.product_id.id not in product_group_id.keys():
|
if production.product_id.id not in product_group_id.keys():
|
||||||
# product_group_id[production.product_id.id] = production.procurement_group_id.id
|
product_group_id[production.product_id.id] = production.procurement_group_id.id
|
||||||
# else:
|
else:
|
||||||
# productions_values[index].update({'name': production.name})
|
productions_values[index].update({'name': production.name})
|
||||||
# procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
|
procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
|
||||||
# production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
|
production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
|
||||||
|
|
||||||
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||||
|
|||||||
@@ -163,7 +163,6 @@
|
|||||||
<field name='is_delivery' invisible="1"/>
|
<field name='is_delivery' invisible="1"/>
|
||||||
<field name="is_trayed" invisible="1"/>
|
<field name="is_trayed" invisible="1"/>
|
||||||
<field name="is_inspect" invisible="1"/>
|
<field name="is_inspect" invisible="1"/>
|
||||||
<!-- <field name="rework_flag" invisible="1"/>-->
|
|
||||||
<!-- <field name='is_send_program_again' invisible="1"/>-->
|
<!-- <field name='is_send_program_again' invisible="1"/>-->
|
||||||
<!-- 工单form页面的开始停工按钮等 -->
|
<!-- 工单form页面的开始停工按钮等 -->
|
||||||
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
<!-- <button name="button_start" type="object" string="开始" class="btn-success" -->
|
||||||
@@ -212,9 +211,6 @@
|
|||||||
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
|
attrs="{'invisible': ['|', '|', '|', ('routing_type','!=','装夹预调'),('state','!=','progress'), ('is_trayed', '=', False), ('state', 'in', ('done'))]}"/>
|
||||||
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
|
<button name="print_method" type="object" string="打印二维码" class="btn-primary"
|
||||||
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
|
attrs="{'invisible': ['|',('routing_type','!=','解除装夹'),('state','!=','done')]}"/>
|
||||||
<!-- <button type="object" class="oe_highlight jikimo_button_confirm" name="button_rework"-->
|
|
||||||
<!-- string="返工"-->
|
|
||||||
<!-- attrs='{"invisible": [("rework_flag","=",True)]}' confirm="是否返工"/>-->
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//page[1]" position="before">
|
<xpath expr="//page[1]" position="before">
|
||||||
<page string="开料要求" attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'>
|
<page string="开料要求" attrs='{"invisible": [("routing_type","not in",("切割", "线切割", "人工线下加工"))]}'>
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class SFMessageProduct(models.Model):
|
|||||||
mrp_production_list = self.env['mrp.production'].sudo().search(
|
mrp_production_list = self.env['mrp.production'].sudo().search(
|
||||||
[('product_id', '=', product_product.id)])
|
[('product_id', '=', product_product.id)])
|
||||||
production_num = 0
|
production_num = 0
|
||||||
routing_type = None
|
|
||||||
for mrp_production_info in mrp_production_list:
|
for mrp_production_info in mrp_production_list:
|
||||||
routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调'
|
routing_type = '人工线下加工' if mrp_production_info.production_type == '人工线下加工' else '装夹预调'
|
||||||
mrp_production_ready = mrp_production_info.workorder_ids.filtered(
|
mrp_production_ready = mrp_production_info.workorder_ids.filtered(
|
||||||
@@ -24,7 +23,7 @@ class SFMessageProduct(models.Model):
|
|||||||
if mrp_production_ready:
|
if mrp_production_ready:
|
||||||
production_num += 1
|
production_num += 1
|
||||||
if production_num >= 1:
|
if production_num >= 1:
|
||||||
url = self.get_request_url(routing_type)
|
url = self.get_request_url()
|
||||||
content = content.replace('{{product_id}}', product_product.name).replace(
|
content = content.replace('{{product_id}}', product_product.name).replace(
|
||||||
'{{number}}', str(production_num)).replace(
|
'{{number}}', str(production_num)).replace(
|
||||||
'{{request_url}}', url)
|
'{{request_url}}', url)
|
||||||
@@ -43,15 +42,11 @@ class SFMessageProduct(models.Model):
|
|||||||
contents.append(content)
|
contents.append(content)
|
||||||
return contents, message_queue_ids
|
return contents, message_queue_ids
|
||||||
|
|
||||||
def get_request_url(self, routing_type):
|
def get_request_url(self):
|
||||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id
|
action_id = self.env.ref('sf_message.mrp_workorder_issued_action').id
|
||||||
menu_id = self.env.ref('mrp.menu_mrp_root').id
|
menu_id = self.env.ref('mrp.menu_mrp_root').id
|
||||||
if routing_type == '人工线下加工':
|
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', '工件装夹中心')]).id
|
||||||
routing_name = '线下工作中心'
|
|
||||||
else:
|
|
||||||
routing_name = '工件装夹中心'
|
|
||||||
active_id = self.env['mrp.workcenter'].sudo().search([('name', '=', routing_name)]).id
|
|
||||||
# 查询参数
|
# 查询参数
|
||||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||||
'view_type': 'list', 'active_id': active_id}
|
'view_type': 'list', 'active_id': active_id}
|
||||||
|
|||||||
@@ -200,17 +200,6 @@ class Sf_Mrs_Connect(http.Controller, MultiInheritController):
|
|||||||
'send_time': ret['send_time'],
|
'send_time': ret['send_time'],
|
||||||
})
|
})
|
||||||
logging.info('已创建无效功能刀具的编程记录:%s' % production.name)
|
logging.info('已创建无效功能刀具的编程记录:%s' % production.name)
|
||||||
elif ret['reprogramming_reason']:
|
|
||||||
production.programming_record_ids.create({
|
|
||||||
'number': len(production.programming_record_ids) + 1,
|
|
||||||
'production_id': production.id,
|
|
||||||
'reason': ret['reprogramming_reason'],
|
|
||||||
'programming_method': ret['programme_way'],
|
|
||||||
'current_programming_count': ret['reprogramming_num'],
|
|
||||||
'target_production_id': productions_reprogram,
|
|
||||||
'apply_time': ret['trigger_time'],
|
|
||||||
'send_time': ret['send_time'],
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
logging.info('无对应状态,不需更新编程记录')
|
logging.info('无对应状态,不需更新编程记录')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user