Compare commits
55 Commits
feature/临时
...
feature/wo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97a26dfa06 | ||
|
|
1224e0e094 | ||
|
|
a571a870d3 | ||
|
|
451e70b7c7 | ||
|
|
6c1c2ca0fc | ||
|
|
e7420365cf | ||
|
|
736a18518c | ||
|
|
41b287d559 | ||
|
|
5d8e0bda08 | ||
|
|
e9dbbaedf4 | ||
|
|
92ae6be3bd | ||
|
|
b00038aaed | ||
|
|
86c1880cdb | ||
|
|
cfd2dda4e6 | ||
|
|
c01e9a4d39 | ||
|
|
88ff4bbaa9 | ||
|
|
f62c70d354 | ||
|
|
22c9de86f6 | ||
|
|
b362f74336 | ||
|
|
81cfbfb540 | ||
|
|
668db4475f | ||
|
|
2af21bc4ee | ||
|
|
e6614a624f | ||
|
|
124bc8478e | ||
|
|
1a3a178ec6 | ||
|
|
cae5149fba | ||
|
|
5c4c036948 | ||
|
|
4003d6a652 | ||
|
|
0e8e81e4cb | ||
|
|
b132771c92 | ||
|
|
cbaf0d79c1 | ||
|
|
953d675dcf | ||
|
|
182eb83090 | ||
|
|
67a607b053 | ||
|
|
33d23c28b1 | ||
|
|
571fb29482 | ||
|
|
1dae20e055 | ||
|
|
8a459e7e90 | ||
|
|
4c486e53aa | ||
|
|
19509a3ce2 | ||
|
|
4d424e90d3 | ||
|
|
f5ea0ec153 | ||
|
|
ea6c0f7d0b | ||
|
|
763009a3c0 | ||
|
|
cf34ac5bbc | ||
|
|
0faedd35d7 | ||
|
|
135b97d4f8 | ||
|
|
61f3aff768 | ||
|
|
9e369f0150 | ||
|
|
16d50f5bf2 | ||
|
|
80f0454996 | ||
|
|
9b9d811594 | ||
|
|
008ae20329 | ||
|
|
80b3b4b0f7 | ||
|
|
d64b480496 |
@@ -21,8 +21,8 @@ class WorkorderExceptionConroller(http.Controller):
|
|||||||
try:
|
try:
|
||||||
res = {'Succeed': True, 'ErrorCode': 0, 'Error': ''}
|
res = {'Succeed': True, 'ErrorCode': 0, 'Error': ''}
|
||||||
datas = request.httprequest.data
|
datas = request.httprequest.data
|
||||||
ret = json.loads(datas)['Datas']
|
ret = json.loads(datas)
|
||||||
if not ret.get('RfidCode') or not ret.get('ErrorType'):
|
if not ret.get('RfidCode') or not ret.get('coding'):
|
||||||
res = {'Succeed': False, 'ErrorCode': 400, 'Error': '参数错误'}
|
res = {'Succeed': False, 'ErrorCode': 400, 'Error': '参数错误'}
|
||||||
return json.JSONEncoder().encode(res)
|
return json.JSONEncoder().encode(res)
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class WorkorderExceptionConroller(http.Controller):
|
|||||||
# 创建工单异常记录,关联工单
|
# 创建工单异常记录,关联工单
|
||||||
request.env['jikimo.workorder.exception'].sudo().create({
|
request.env['jikimo.workorder.exception'].sudo().create({
|
||||||
'workorder_id': workorder.id,
|
'workorder_id': workorder.id,
|
||||||
'exception_code': ret.get('ErrorType'),
|
'exception_code': ret.get('coding'),
|
||||||
'exception_content': ret.get('Error', '')
|
'exception_content': ret.get('Error', '')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<field name="urgency">urgent</field>
|
<field name="urgency">urgent</field>
|
||||||
<field name="content">### 生产线无功能刀具提醒
|
<field name="content">### 生产线无功能刀具提醒
|
||||||
单号:工单[{{workorder_id.production_id.name}}]({{url}})
|
单号:工单[{{workorder_id.production_id.name}}]({{url}})
|
||||||
原因:生产线无加工程序用的{{function_tool_name}}名称功能刀具</field>
|
原因:生产线无加工程序要用的功能刀具</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="template_no_position_data" model="jikimo.message.template">
|
<record id="template_no_position_data" model="jikimo.message.template">
|
||||||
<field name="name">工单无定位数据提醒</field>
|
<field name="name">工单无定位数据提醒</field>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<field name="bussiness_node_id" ref="bussiness_no_position_data"/>
|
<field name="bussiness_node_id" ref="bussiness_no_position_data"/>
|
||||||
<field name="msgtype">markdown</field>
|
<field name="msgtype">markdown</field>
|
||||||
<field name="urgency">urgent</field>
|
<field name="urgency">urgent</field>
|
||||||
<field name="content">### 生产线无功能刀具提醒
|
<field name="content">### 工单无定位数据提醒
|
||||||
单号:工单[{{workorder_id.production_id.name}}]({{url}})
|
单号:工单[{{workorder_id.production_id.name}}]({{url}})
|
||||||
原因:无装夹定位测量数据</field>
|
原因:无装夹定位测量数据</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class JikimoWorkorderException(models.Model):
|
|||||||
rec.add_queue('无定位数据')
|
rec.add_queue('无定位数据')
|
||||||
elif rec.exception_code == 'YC0004':
|
elif rec.exception_code == 'YC0004':
|
||||||
# 无FTP文件,调用cloud接口
|
# 无FTP文件,调用cloud接口
|
||||||
data = {'name': rec.workorder_id.programming_no, 'exception_code': 'YC0004'}
|
data = {'name': rec.workorder_id.production_id.programming_no, 'exception_code': 'YC0004'}
|
||||||
configsettings = self.env['res.config.settings'].sudo().get_values()
|
configsettings = self.env['res.config.settings'].sudo().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'])
|
||||||
url = '/api/message/workorder_exception'
|
url = '/api/message/workorder_exception'
|
||||||
|
|||||||
@@ -14,12 +14,25 @@ class TestJikimoWorkorderExceptionNotify(TestJikimoWorkorderExceptionNotifyCommo
|
|||||||
('model', '=', 'jikimo.workorder.exception')
|
('model', '=', 'jikimo.workorder.exception')
|
||||||
]))
|
]))
|
||||||
self.assertTrue(self.env['jikimo.message.template'].search([
|
self.assertTrue(self.env['jikimo.message.template'].search([
|
||||||
('name', '=', '加工失败'),
|
('name', '=', '工单加工失败提醒'),
|
||||||
('model', '=', 'jikimo.workorder.exception')
|
('model', '=', 'jikimo.workorder.exception')
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
def test_create_message_queue_yc0001(self):
|
||||||
|
exception_record = self.env['jikimo.workorder.exception'].create({
|
||||||
|
'workorder_id': self.workorder.id,
|
||||||
|
'exception_code': 'YC0001',
|
||||||
|
'exception_content': '无CNC程序'
|
||||||
|
})
|
||||||
|
|
||||||
def test_create_message_queue(self):
|
message_record = self.env['jikimo.message.queue'].search([
|
||||||
|
('res_id', '=', exception_record.id),
|
||||||
|
('model', '=', 'jikimo.workorder.exception'),
|
||||||
|
('message_status', '=', 'pending')
|
||||||
|
])
|
||||||
|
self.assertFalse(message_record)
|
||||||
|
|
||||||
|
def test_create_message_queue_yc0002(self):
|
||||||
exception_record = self.env['jikimo.workorder.exception'].create({
|
exception_record = self.env['jikimo.workorder.exception'].create({
|
||||||
'workorder_id': self.workorder.id,
|
'workorder_id': self.workorder.id,
|
||||||
'exception_code': 'YC0002',
|
'exception_code': 'YC0002',
|
||||||
@@ -43,7 +56,45 @@ class TestJikimoWorkorderExceptionNotify(TestJikimoWorkorderExceptionNotifyCommo
|
|||||||
('message_template_id', '=', message_template.id)
|
('message_template_id', '=', message_template.id)
|
||||||
])
|
])
|
||||||
self.assertTrue(message_record)
|
self.assertTrue(message_record)
|
||||||
|
|
||||||
|
def test_create_message_queue_yc0003(self):
|
||||||
|
exception_record = self.env['jikimo.workorder.exception'].create({
|
||||||
|
'workorder_id': self.workorder.id,
|
||||||
|
'exception_code': 'YC0003',
|
||||||
|
'exception_content': '无定位数据'
|
||||||
|
})
|
||||||
|
|
||||||
|
bussiness_node = self.env['jikimo.message.bussiness.node'].search([
|
||||||
|
('name', '=', '无定位数据'),
|
||||||
|
('model', '=', 'jikimo.workorder.exception')
|
||||||
|
])
|
||||||
|
|
||||||
|
message_template = self.env['jikimo.message.template'].search([
|
||||||
|
('bussiness_node_id', '=', bussiness_node.id),
|
||||||
|
('model', '=', 'jikimo.workorder.exception')
|
||||||
|
])
|
||||||
|
|
||||||
|
message_record = self.env['jikimo.message.queue'].search([
|
||||||
|
('res_id', '=', exception_record.id),
|
||||||
|
('model', '=', 'jikimo.workorder.exception'),
|
||||||
|
('message_status', '=', 'pending'),
|
||||||
|
('message_template_id', '=', message_template.id)
|
||||||
|
])
|
||||||
|
self.assertTrue(message_record)
|
||||||
|
|
||||||
|
def test_create_message_queue_yc0004(self):
|
||||||
|
exception_record = self.env['jikimo.workorder.exception'].create({
|
||||||
|
'workorder_id': self.workorder.id,
|
||||||
|
'exception_code': 'YC0004',
|
||||||
|
'exception_content': '无CNC程序'
|
||||||
|
})
|
||||||
|
|
||||||
|
message_record = self.env['jikimo.message.queue'].search([
|
||||||
|
('res_id', '=', exception_record.id),
|
||||||
|
('model', '=', 'jikimo.workorder.exception'),
|
||||||
|
('message_status', '=', 'pending')
|
||||||
|
])
|
||||||
|
self.assertFalse(message_record)
|
||||||
|
|
||||||
def test_get_message(self):
|
def test_get_message(self):
|
||||||
exception_record = self.env['jikimo.workorder.exception'].create({
|
exception_record = self.env['jikimo.workorder.exception'].create({
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
<field name='is_bfm' invisible="1"/>
|
<field name='is_bfm' invisible="1"/>
|
||||||
<field name='categ_type' invisible="1"/>
|
<field name='categ_type' invisible="1"/>
|
||||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||||
<!-- <field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="image"/>-->
|
<field name='machining_drawings' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="adaptive_viewer"/>
|
||||||
<!-- <field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>-->
|
<field name='quality_standard' attrs="{'invisible': [('categ_type', '!=', '成品')]}" widget="adaptive_viewer"/>
|
||||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||||
<field name="upload_model_file"
|
<field name="upload_model_file"
|
||||||
widget="many2many_binary"
|
widget="many2many_binary"
|
||||||
|
|||||||
@@ -1272,6 +1272,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
time_threshold = datetime.now() - timedelta(days=1)
|
time_threshold = datetime.now() - timedelta(days=1)
|
||||||
|
|
||||||
alarm_last_24_time = 0.0
|
alarm_last_24_time = 0.0
|
||||||
|
alarm_all_time = 0.0
|
||||||
|
|
||||||
def fetch_result_as_dict(cursor):
|
def fetch_result_as_dict(cursor):
|
||||||
"""辅助函数:将查询结果转为字典"""
|
"""辅助函数:将查询结果转为字典"""
|
||||||
@@ -1332,6 +1333,35 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
alarm_last_24_time += float(result[0])
|
alarm_last_24_time += float(result[0])
|
||||||
else:
|
else:
|
||||||
alarm_last_24_time += 0.0
|
alarm_last_24_time += 0.0
|
||||||
|
|
||||||
|
alarm_all_nums = []
|
||||||
|
with conn.cursor() as cur:
|
||||||
|
cur.execute("""
|
||||||
|
SELECT DISTINCT ON (alarm_start_time) alarm_time, alarm_start_time
|
||||||
|
FROM device_data
|
||||||
|
WHERE device_name = %s
|
||||||
|
AND alarm_start_time IS NOT NULL;
|
||||||
|
""", (item,))
|
||||||
|
results = cur.fetchall()
|
||||||
|
for result in results:
|
||||||
|
alarm_all_nums.append(result[1])
|
||||||
|
if result[0]:
|
||||||
|
if float(result[0]) >= 1000:
|
||||||
|
continue
|
||||||
|
alarm_all_time += float(result[0])
|
||||||
|
else:
|
||||||
|
alarm_all_time += 0.0
|
||||||
|
|
||||||
|
# with conn.cursor() as cur:
|
||||||
|
# cur.execute("""
|
||||||
|
# SELECT * FROM device_data
|
||||||
|
# WHERE device_name = %s
|
||||||
|
# AND total_count IS NOT NULL
|
||||||
|
# ORDER BY time ASC
|
||||||
|
# LIMIT 1;
|
||||||
|
# """, (item, ))
|
||||||
|
# total_count = fetch_result_as_dict(cur)
|
||||||
|
|
||||||
# 返回数据
|
# 返回数据
|
||||||
res['data'][item] = {
|
res['data'][item] = {
|
||||||
'wait_time': last_all_time['run_time'] if last_all_time['run_time'] is not None else 0,
|
'wait_time': last_all_time['run_time'] if last_all_time['run_time'] is not None else 0,
|
||||||
@@ -1343,6 +1373,9 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
'alarm_last_24_nums': len(list(set(alarm_last_24_nums))),
|
'alarm_last_24_nums': len(list(set(alarm_last_24_nums))),
|
||||||
'idle_count': idle_count,
|
'idle_count': idle_count,
|
||||||
'first_online_time': first_online_duration,
|
'first_online_time': first_online_duration,
|
||||||
|
'alarm_all_time': alarm_all_time,
|
||||||
|
'alarm_all_nums': len(list(set(alarm_all_nums)))
|
||||||
|
# 'total_count': total_count['total_count'] if total_count else 0
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
'security/group_security.xml',
|
'security/group_security.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/ir_rule_data.xml',
|
'security/ir_rule_data.xml',
|
||||||
|
'data/scheduled_actions.xml',
|
||||||
'views/maintenance_logs_views.xml',
|
'views/maintenance_logs_views.xml',
|
||||||
'views/maintenance_equipment_oee_views.xml',
|
'views/maintenance_equipment_oee_views.xml',
|
||||||
'views/maintenance_views.xml',
|
'views/maintenance_views.xml',
|
||||||
|
|||||||
14
sf_maintenance/data/scheduled_actions.xml
Normal file
14
sf_maintenance/data/scheduled_actions.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="ir_cron_oee_get_running_datas" model="ir.cron">
|
||||||
|
<field name="name">设备运行数据</field>
|
||||||
|
<field name="model_id" ref="model_maintenance_equipment_oee"/>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">model.get_running_datas()</field>
|
||||||
|
<field name="interval_number">15</field>
|
||||||
|
<field name="interval_type">minutes</field>
|
||||||
|
<field name="numbercall">-1</field>
|
||||||
|
<field name="active" eval="True"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
@@ -88,6 +88,69 @@ class SfMaintenanceEquipmentOEE(models.Model):
|
|||||||
begin_time = fields.Date('开始时间')
|
begin_time = fields.Date('开始时间')
|
||||||
end_time = fields.Date('结束时间')
|
end_time = fields.Date('结束时间')
|
||||||
|
|
||||||
|
def get_running_datas(self):
|
||||||
|
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
|
url_time = base_url + '/api/RunningTimeDetail'
|
||||||
|
cnc_list_obj = self.env['maintenance.equipment'].sudo().search(
|
||||||
|
[('function_type', '!=', False), ('active', '=', True)])
|
||||||
|
machine_list = list(map(lambda x: x.code, cnc_list_obj))
|
||||||
|
# print('machine_list: %s' % machine_list)
|
||||||
|
|
||||||
|
data_time = {
|
||||||
|
"machine_list": str(machine_list)
|
||||||
|
}
|
||||||
|
# 发送POST请求
|
||||||
|
response_time = requests.post(url_time, json={}, data=data_time)
|
||||||
|
# print(response_time.json())
|
||||||
|
if response_time.status_code == 200:
|
||||||
|
result_time = response_time.json()
|
||||||
|
if result_time['status'] == 1:
|
||||||
|
real_dict = result_time['data']
|
||||||
|
for key in real_dict:
|
||||||
|
# print(key)
|
||||||
|
equipment_obj = self.env['maintenance.equipment.oee'].sudo().search([('equipment_code', '=', key)])
|
||||||
|
if real_dict[key]['power_on_time'] == 0:
|
||||||
|
equipment_obj.online_time = 0
|
||||||
|
equipment_obj.idle_time = 0
|
||||||
|
equipment_obj.idle_rate = 0
|
||||||
|
equipment_obj.work_rate = 0
|
||||||
|
equipment_obj.fault_time = 0
|
||||||
|
equipment_obj.fault_rate = 0
|
||||||
|
equipment_obj.fault_nums = 0
|
||||||
|
equipment_obj.idle_nums = 0
|
||||||
|
equipment_obj.work_time = 0
|
||||||
|
else:
|
||||||
|
equipment_obj.online_time = round(convert_to_seconds(real_dict[key]['power_on_time']) / 3600, 2)
|
||||||
|
equipment_obj.work_time = round(convert_to_seconds(real_dict[key]['cut_time']) / 3600, 2)
|
||||||
|
equipment_obj.fault_nums = real_dict[key]['alarm_all_nums']
|
||||||
|
equipment_obj.idle_nums = real_dict[key]['idle_count']
|
||||||
|
equipment_obj.fault_time = round((float(real_dict[key]['alarm_all_time']) if real_dict[key][
|
||||||
|
'alarm_all_time'] else 0) / 3600, 2)
|
||||||
|
equipment_obj.idle_time = float(equipment_obj.online_time) - float(
|
||||||
|
equipment_obj.work_time) if equipment_obj.online_time and equipment_obj.work_time else 0
|
||||||
|
equipment_obj.idle_rate = round(
|
||||||
|
float(equipment_obj.idle_time) / (
|
||||||
|
float(equipment_obj.online_time) if equipment_obj.online_time else 1) * 100, 2)
|
||||||
|
equipment_obj.work_rate = round(
|
||||||
|
float(equipment_obj.work_time) / (
|
||||||
|
float(equipment_obj.online_time) if equipment_obj.online_time else 1) * 100, 2)
|
||||||
|
|
||||||
|
equipment_obj.fault_rate = round(
|
||||||
|
float(equipment_obj.fault_time) / (
|
||||||
|
float(equipment_obj.online_time) if equipment_obj.online_time else 1) * 100, 2)
|
||||||
|
|
||||||
|
# 获取当前时间的时间戳
|
||||||
|
current_timestamp = datetime.datetime.now().timestamp()
|
||||||
|
# 机床上线时间段
|
||||||
|
first_online_duration = current_timestamp - int(equipment_obj.equipment_id.first_online_time.timestamp())
|
||||||
|
|
||||||
|
if equipment_obj.online_time:
|
||||||
|
equipment_obj.offline_time = round((first_online_duration - float(equipment_obj.online_time)) / 3600, 2)
|
||||||
|
else:
|
||||||
|
equipment_obj.offline_time = False
|
||||||
|
# equipment_obj.offline_time = equipment_obj.equipment_id.first_online_time - (
|
||||||
|
# float(equipment_obj.online_time) if equipment_obj.online_time else 0)
|
||||||
|
|
||||||
# 获取日志详情
|
# 获取日志详情
|
||||||
def get_day_logs(self):
|
def get_day_logs(self):
|
||||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
@@ -150,12 +213,11 @@ class SfMaintenanceEquipmentOEE(models.Model):
|
|||||||
self.fault_nums = real_dict['alarm_last_24_nums']
|
self.fault_nums = real_dict['alarm_last_24_nums']
|
||||||
self.idle_nums = real_dict['idle_count']
|
self.idle_nums = real_dict['idle_count']
|
||||||
self.work_time = round(
|
self.work_time = round(
|
||||||
(convert_to_seconds(real_dict['cut_time']) - convert_to_seconds(real_dict['cut_24_time'])) / 3600,
|
(convert_to_seconds(real_dict['cut_time']) - convert_to_seconds(
|
||||||
|
real_dict['cut_24_time'])) / 3600,
|
||||||
2)
|
2)
|
||||||
self.offline_time = 24 - (float(self.online_time) if self.online_time else 0)
|
self.offline_time = 24 - (float(self.online_time) if self.online_time else 0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
result = response.json()
|
result = response.json()
|
||||||
print('============', result)
|
print('============', result)
|
||||||
|
|||||||
@@ -79,12 +79,12 @@
|
|||||||
</group>
|
</group>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<!-- <notebook> -->
|
||||||
<page string="24H日志详情">
|
<!-- <page string="24H日志详情"> -->
|
||||||
<group>
|
<!-- <group> -->
|
||||||
<button name="get_day_logs" type="object" string="查看24H日志" t-attf-style="white-space:nowrap;"/>
|
<!-- <button name="get_day_logs" type="object" string="查看24H日志" t-attf-style="white-space:nowrap;"/> -->
|
||||||
</group>
|
<!-- </group> -->
|
||||||
<field name="day_logs_detail" readonly="1" widget="html"/>
|
<!-- <field name="day_logs_detail" readonly="1" widget="html"/> -->
|
||||||
<!-- <field name="page_num"/> -->
|
<!-- <field name="page_num"/> -->
|
||||||
<!-- <group> -->
|
<!-- <group> -->
|
||||||
<!-- <group> -->
|
<!-- <group> -->
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
<!-- </group> -->
|
<!-- </group> -->
|
||||||
</page>
|
<!-- </page> -->
|
||||||
<!-- <page string="历史日志详情"> -->
|
<!-- <page string="历史日志详情"> -->
|
||||||
<!-- <group> -->
|
<!-- <group> -->
|
||||||
<!-- <group> -->
|
<!-- <group> -->
|
||||||
@@ -132,7 +132,7 @@
|
|||||||
<!-- </group> -->
|
<!-- </group> -->
|
||||||
<!-- <field name="history_logs_detail"/> -->
|
<!-- <field name="history_logs_detail"/> -->
|
||||||
<!-- </page> -->
|
<!-- </page> -->
|
||||||
</notebook>
|
<!-- </notebook> -->
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class MrpProduction(models.Model):
|
|||||||
_inherit = 'mrp.production'
|
_inherit = 'mrp.production'
|
||||||
_description = "制造订单"
|
_description = "制造订单"
|
||||||
_order = 'create_date desc'
|
_order = 'create_date desc'
|
||||||
|
deadline_of_delivery = fields.Date('订单交期', tracking=True, compute='_compute_deadline_of_delivery')
|
||||||
# tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
|
# tray_ids = fields.One2many('sf.tray', 'production_id', string="托盘")
|
||||||
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
|
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
|
||||||
request_ids = fields.One2many('maintenance.request', 'production_id')
|
request_ids = fields.One2many('maintenance.request', 'production_id')
|
||||||
@@ -34,6 +34,16 @@ class MrpProduction(models.Model):
|
|||||||
tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True)
|
tool_state_remark = fields.Text(string='功能刀具状态备注(缺刀)', compute='_compute_tool_state_remark', store=True)
|
||||||
tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True)
|
tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True)
|
||||||
|
|
||||||
|
@api.depends('procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id')
|
||||||
|
def _compute_deadline_of_delivery(self):
|
||||||
|
for production in self:
|
||||||
|
sale_order_ids = production.procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id.ids
|
||||||
|
if not sale_order_ids or len(sale_order_ids) < 1:
|
||||||
|
continue
|
||||||
|
sale_id = self.env['sale.order'].sudo().browse(sale_order_ids[0])
|
||||||
|
if sale_id:
|
||||||
|
production.deadline_of_delivery = sale_id.deadline_of_delivery
|
||||||
|
|
||||||
@api.depends('workorder_ids.tool_state_remark')
|
@api.depends('workorder_ids.tool_state_remark')
|
||||||
def _compute_tool_state_remark(self):
|
def _compute_tool_state_remark(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
@@ -118,10 +128,12 @@ class MrpProduction(models.Model):
|
|||||||
], string='工序状态', default='待装夹')
|
], string='工序状态', default='待装夹')
|
||||||
|
|
||||||
# 零件图号
|
# 零件图号
|
||||||
part_number = fields.Char('零件图号')
|
part_number = fields.Char('零件图号', readonly=True)
|
||||||
|
|
||||||
# 上传零件图纸
|
# 上传零件图纸
|
||||||
part_drawing = fields.Binary('零件图纸')
|
part_drawing = fields.Binary('零件图纸', readonly=True)
|
||||||
|
|
||||||
|
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||||
|
|
||||||
@api.depends('product_id.manual_quotation')
|
@api.depends('product_id.manual_quotation')
|
||||||
def _compute_manual_quotation(self):
|
def _compute_manual_quotation(self):
|
||||||
@@ -948,6 +960,8 @@ class MrpProduction(models.Model):
|
|||||||
if production.programming_no in program_to_production_names:
|
if production.programming_no in program_to_production_names:
|
||||||
productions_not_delivered = self.env['mrp.production'].search(
|
productions_not_delivered = self.env['mrp.production'].search(
|
||||||
[('programming_no', '=', production.programming_no), ('programming_state', '=', '已编程未下发')])
|
[('programming_no', '=', production.programming_no), ('programming_state', '=', '已编程未下发')])
|
||||||
|
productions = self.env['mrp.production'].search(
|
||||||
|
[('programming_no', '=', production.programming_no), ('state', 'not in', ('cancel', 'done'))])
|
||||||
rework_workorder = production.workorder_ids.filtered(lambda m: m.state == 'rework')
|
rework_workorder = production.workorder_ids.filtered(lambda m: m.state == 'rework')
|
||||||
if rework_workorder:
|
if rework_workorder:
|
||||||
for rework_item in rework_workorder:
|
for rework_item in rework_workorder:
|
||||||
@@ -960,12 +974,12 @@ class MrpProduction(models.Model):
|
|||||||
productions_not_delivered.write(
|
productions_not_delivered.write(
|
||||||
{'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
{'state': 'progress', 'programming_state': '已编程', 'is_rework': False})
|
||||||
|
|
||||||
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
# 对制造订单所以面的cnc工单的程序用刀进行校验
|
||||||
try:
|
try:
|
||||||
logging.info(f'已更新制造订单:{productions_not_delivered}')
|
logging.info(f'已更新制造订单:{productions_not_delivered}')
|
||||||
productions_not_delivered.production_cnc_tool_checkout()
|
productions.production_cnc_tool_checkout()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
logging.info(f'对cnc工单的程序用刀进行校验报错:{e}')
|
||||||
|
|
||||||
# 从cloud获取重新编程过的最新程序
|
# 从cloud获取重新编程过的最新程序
|
||||||
def get_new_program(self, processing_panel):
|
def get_new_program(self, processing_panel):
|
||||||
|
|||||||
@@ -225,6 +225,9 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
material_height = fields.Float(string='高')
|
material_height = fields.Float(string='高')
|
||||||
# 零件图号
|
# 零件图号
|
||||||
part_number = fields.Char(related='production_id.part_number', string='零件图号')
|
part_number = fields.Char(related='production_id.part_number', string='零件图号')
|
||||||
|
machining_drawings = fields.Binary('2D加工图纸', related='production_id.part_drawing', readonly=True)
|
||||||
|
quality_standard = fields.Binary('质检标准', related='production_id.quality_standard', readonly=True)
|
||||||
|
|
||||||
# 工序状态
|
# 工序状态
|
||||||
process_state = fields.Selection([
|
process_state = fields.Selection([
|
||||||
('待装夹', '待装夹'),
|
('待装夹', '待装夹'),
|
||||||
|
|||||||
@@ -774,8 +774,8 @@ class ResProductMo(models.Model):
|
|||||||
# bfm下单
|
# bfm下单
|
||||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||||
part_number = fields.Char(string='零件图号', readonly=True)
|
part_number = fields.Char(string='零件图号', readonly=True)
|
||||||
# machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||||
# quality_standard = fields.Binary('质检标准', readonly=True)
|
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||||
|
|
||||||
@api.constrains('tool_length')
|
@api.constrains('tool_length')
|
||||||
def _check_tool_length_size(self):
|
def _check_tool_length_size(self):
|
||||||
@@ -875,8 +875,8 @@ class ResProductMo(models.Model):
|
|||||||
'manual_quotation': item['manual_quotation'] or False,
|
'manual_quotation': item['manual_quotation'] or False,
|
||||||
'part_number': item.get('part_number') or '',
|
'part_number': item.get('part_number') or '',
|
||||||
'active': True,
|
'active': True,
|
||||||
# 'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(item['machining_drawings']),
|
'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(item['machining_drawings']),
|
||||||
# 'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
|
'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
|
||||||
}
|
}
|
||||||
tax_id = self.env['account.tax'].sudo().search(
|
tax_id = self.env['account.tax'].sudo().search(
|
||||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||||
|
|||||||
@@ -272,6 +272,10 @@ class StockRule(models.Model):
|
|||||||
if quick_easy_order:
|
if quick_easy_order:
|
||||||
production.write({'part_number': quick_easy_order.part_drawing_number,
|
production.write({'part_number': quick_easy_order.part_drawing_number,
|
||||||
'part_drawing': quick_easy_order.machining_drawings})
|
'part_drawing': quick_easy_order.machining_drawings})
|
||||||
|
else:
|
||||||
|
production.write({'part_number': production.product_id.part_number,
|
||||||
|
'part_drawing': production.product_id.machining_drawings,
|
||||||
|
'quality_standard': production.product_id.quality_standard})
|
||||||
if sale_order:
|
if sale_order:
|
||||||
# sale_order.write({'schedule_status': 'to schedule'})
|
# sale_order.write({'schedule_status': 'to schedule'})
|
||||||
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ access_mrp_production_split_multi_group_sf_mrp_user,access.mrp.production.split.
|
|||||||
access_mrp_production_split_group_sf_mrp_user,access.mrp.production.split,mrp.model_mrp_production_split,sf_base.group_sf_mrp_user,1,1,1,0
|
access_mrp_production_split_group_sf_mrp_user,access.mrp.production.split,mrp.model_mrp_production_split,sf_base.group_sf_mrp_user,1,1,1,0
|
||||||
access_mrp_production_split_line_group_sf_mrp_user,access.mrp.production.split.line,mrp.model_mrp_production_split_line,sf_base.group_sf_mrp_user,1,1,1,0
|
access_mrp_production_split_line_group_sf_mrp_user,access.mrp.production.split.line,mrp.model_mrp_production_split_line,sf_base.group_sf_mrp_user,1,1,1,0
|
||||||
access_mrp_workcenter_capacity_manager_group_sf_mrp_user,mrp.workcenter.capacity.manager,mrp.model_mrp_workcenter_capacity,sf_base.group_sf_mrp_user,1,1,1,0
|
access_mrp_workcenter_capacity_manager_group_sf_mrp_user,mrp.workcenter.capacity.manager,mrp.model_mrp_workcenter_capacity,sf_base.group_sf_mrp_user,1,1,1,0
|
||||||
|
access_mrp_workcenter_group_quality,mrp_workcenter_group_quality,model_mrp_workcenter,sf_base.group_quality,1,0,0,0
|
||||||
|
access_mrp_workcenter_group_quality_director,mrp_workcenter_group_quality_director,model_mrp_workcenter,sf_base.group_quality_director,1,0,0,0
|
||||||
|
access_sf_detection_result_group_quality,sf_detection_result_group_quality,model_sf_detection_result,sf_base.group_quality,1,0,1,0
|
||||||
|
access_sf_detection_result_group_quality_director,sf_detection_result_group_quality_director,model_sf_detection_result,sf_base.group_quality_director,1,0,1,0
|
||||||
access_mrp_workcenter_productivity_loss_group_quality,mrp_workcenter_productivity_loss_group_quality,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality,1,0,0,0
|
access_mrp_workcenter_productivity_loss_group_quality,mrp_workcenter_productivity_loss_group_quality,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality,1,0,0,0
|
||||||
access_mrp_workcenter_productivity_loss_group_quality_director,mrp_workcenter_productivity_loss_group_quality_director,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality_director,1,0,0,0
|
access_mrp_workcenter_productivity_loss_group_quality_director,mrp_workcenter_productivity_loss_group_quality_director,mrp.model_mrp_workcenter_productivity_loss,sf_base.group_quality_director,1,0,0,0
|
||||||
access_mrp_workcenter_productivity_group_quality,mrp_workcenter_productivity_group_quality,mrp.model_mrp_workcenter_productivity,sf_base.group_quality,1,1,1,0
|
access_mrp_workcenter_productivity_group_quality,mrp_workcenter_productivity_group_quality,mrp.model_mrp_workcenter_productivity,sf_base.group_quality,1,1,1,0
|
||||||
|
|||||||
|
@@ -98,9 +98,11 @@
|
|||||||
<field name="production_line_id" readonly="1"/>
|
<field name="production_line_id" readonly="1"/>
|
||||||
<!-- <field name="production_line_state" readonly="1"/>-->
|
<!-- <field name="production_line_state" readonly="1"/>-->
|
||||||
<field name="part_number" string="成品的零件图号"/>
|
<field name="part_number" string="成品的零件图号"/>
|
||||||
<field name="part_drawing"/>
|
<field name="part_drawing" widget="adaptive_viewer"/>
|
||||||
|
<field name="quality_standard" widget="adaptive_viewer"/>
|
||||||
<field name="tool_state"/>
|
<field name="tool_state"/>
|
||||||
<field name="tool_state_remark" string="备注" attrs="{'invisible': [('tool_state', '!=', '1')]}"/>
|
<field name="tool_state_remark" string="备注" attrs="{'invisible': [('tool_state', '!=', '1')]}"/>
|
||||||
|
<field name="deadline_of_delivery" readonly="1"/>
|
||||||
<field name="tool_state_remark2" invisible="1"/>
|
<field name="tool_state_remark2" invisible="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//header//button[@name='action_cancel']" position="replace">
|
<xpath expr="//header//button[@name='action_cancel']" position="replace">
|
||||||
|
|||||||
@@ -268,6 +268,8 @@
|
|||||||
<field name="material_height" class="o_address_zip"/>
|
<field name="material_height" class="o_address_zip"/>
|
||||||
</div>
|
</div>
|
||||||
<field name="part_number" string="成品的零件图号"/>
|
<field name="part_number" string="成品的零件图号"/>
|
||||||
|
<field name="machining_drawings" widget="adaptive_viewer" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||||
|
<field name="quality_standard" widget="adaptive_viewer" attrs="{'invisible': [('routing_type', '!=', 'CNC加工')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//label[1]" position="attributes">
|
<xpath expr="//label[1]" position="attributes">
|
||||||
<attribute name="string">计划加工时间</attribute>
|
<attribute name="string">计划加工时间</attribute>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
'data/cron_data.xml',
|
'data/cron_data.xml',
|
||||||
'data/template_data.xml',
|
'data/template_data.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
|
'views/mrp_workorder_views.xml',
|
||||||
],
|
],
|
||||||
'test': [
|
'test': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ class SFMessageMaintenanceLogs(models.Model):
|
|||||||
_name = 'sf.maintenance.logs'
|
_name = 'sf.maintenance.logs'
|
||||||
_inherit = ['sf.maintenance.logs', 'jikimo.message.dispatch']
|
_inherit = ['sf.maintenance.logs', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
@api._model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
res = super(SFMessageMaintenanceLogs, self).create(vals_list)
|
||||||
for rec in res:
|
for rec in res:
|
||||||
rec.add_queue()
|
rec.add_queue('设备故障')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def _get_message(self, message_queue_ids):
|
def _get_message(self, message_queue_ids):
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class SFMessageWork(models.Model):
|
|||||||
_name = 'mrp.workorder'
|
_name = 'mrp.workorder'
|
||||||
_inherit = ['mrp.workorder', 'jikimo.message.dispatch']
|
_inherit = ['mrp.workorder', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
@api.depends('production_availability', 'blocked_by_workorder_ids.state')
|
@api.depends('production_availability', 'blocked_by_workorder_ids.state', 'production_id.tool_state')
|
||||||
def _compute_state(self):
|
def _compute_state(self):
|
||||||
super(SFMessageWork, self)._compute_state()
|
super(SFMessageWork, self)._compute_state()
|
||||||
for workorder in self:
|
for workorder in self:
|
||||||
@@ -73,7 +73,7 @@ class SFMessageWork(models.Model):
|
|||||||
if record:
|
if record:
|
||||||
i += 1
|
i += 1
|
||||||
if i >= 1:
|
if i >= 1:
|
||||||
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
|
action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id
|
||||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||||
content_template = content.replace('{{url}}', url_with_id)
|
content_template = content.replace('{{url}}', url_with_id)
|
||||||
if bussiness_node in template_names['预警']:
|
if bussiness_node in template_names['预警']:
|
||||||
@@ -85,7 +85,7 @@ class SFMessageWork(models.Model):
|
|||||||
|
|
||||||
def request_url(self):
|
def request_url(self):
|
||||||
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||||
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
|
action_id = self.env.ref('sf_message.mrp_workorder_action_notify').id
|
||||||
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id
|
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id
|
||||||
# 查询参数
|
# 查询参数
|
||||||
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
params = {'menu_id': menu_id, 'action': action_id, 'model': 'mrp.workorder',
|
||||||
@@ -153,6 +153,6 @@ class SFMessageWork(models.Model):
|
|||||||
getattr(item, queue_method_name)(*args)
|
getattr(item, queue_method_name)(*args)
|
||||||
|
|
||||||
def _recover_time_warning_func(self):
|
def _recover_time_warning_func(self):
|
||||||
workorder_done = self.env['mrp.workorder'].search([("state", "=", "done")])
|
workorder_done = self.env['mrp.workorder'].search([("state", "in", ["done", "rework", "cancel"])])
|
||||||
workorder_overdue = workorder_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
|
workorder_overdue = workorder_done.filtered(lambda x: x.delivery_warning in ['overdue', 'warning'])
|
||||||
workorder_overdue.write({'delivery_warning': 'normal'})
|
workorder_overdue.write({'delivery_warning': 'normal'})
|
||||||
|
|||||||
34
sf_message/views/mrp_workorder_views.xml
Normal file
34
sf_message/views/mrp_workorder_views.xml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record model="ir.actions.act_window" id="mrp_workorder_action_notify">
|
||||||
|
<field name="name">工单</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">mrp.workorder</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_ids" eval="[(5, 0, 0),
|
||||||
|
(0, 0, {'view_mode': 'tree', 'view_id': ref('mrp.mrp_production_workorder_tree_editable_view')}) ]"/>
|
||||||
|
<!-- (0, 0, {'view_mode': 'kanban', 'view_id': ref('mrp.workcenter_line_kanban')})-->
|
||||||
|
<!-- <field name="target">fullscreen</field>-->
|
||||||
|
<field name="target">current</field>
|
||||||
|
<field name="domain">[('state', '!=', 'cancel'),('schedule_state', '=', '已排')]</field>
|
||||||
|
<field name="context">{'search_default_product': 1, 'search_default_workcenter_id':
|
||||||
|
active_id,'search_default_filter_order_warning':1,'search_default_filter_order_overdue':1,
|
||||||
|
'search_default_ready': 1, 'search_default_progress': 1}
|
||||||
|
</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_workorder">
|
||||||
|
没有工单要做!
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
工作订单是作为制造订单的一部分执行的操作。
|
||||||
|
工序在物料清单中定义或直接添加到制造订单中。
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
使用工作台工作中心控制面板直接登记车间中的操作.
|
||||||
|
平板电脑为您的工人提供工作表,并允许他们报废产品,跟踪时间,
|
||||||
|
发起维护请求,执行质量测试等.
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -175,7 +175,9 @@ class MrpProduction(models.Model):
|
|||||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', invalid_tool)])
|
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', invalid_tool)])
|
||||||
if cnc_ids:
|
if cnc_ids:
|
||||||
cnc_ids.write({'tool_state': '2'})
|
for cnc_id in cnc_ids:
|
||||||
|
cnc_id.tool_state = '2'
|
||||||
|
# cnc_ids.write({'tool_state': '2'})
|
||||||
# 创建制造订单无效刀检测结果记录
|
# 创建制造订单无效刀检测结果记录
|
||||||
for production_id in self:
|
for production_id in self:
|
||||||
for processing_panel in list(set(invalid_tool_processing_panel)):
|
for processing_panel in list(set(invalid_tool_processing_panel)):
|
||||||
@@ -204,12 +206,14 @@ class MrpProduction(models.Model):
|
|||||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||||
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', missing_tool_1)])
|
[('workorder_id', 'in', workorder_ids.ids), ('cutting_tool_name', 'in', missing_tool_1)])
|
||||||
if cnc_ids:
|
if cnc_ids:
|
||||||
cnc_ids.write({'tool_state': '1'})
|
for cnc_id in cnc_ids:
|
||||||
|
cnc_id.tool_state = '1'
|
||||||
|
# cnc_ids.write({'tool_state': '1'})
|
||||||
if missing_tool_2 and invalid_tool == []:
|
if missing_tool_2 and invalid_tool == []:
|
||||||
logging.info(f'库存缺刀:{missing_tool_2}')
|
logging.info(f'库存缺刀:{missing_tool_2}')
|
||||||
# 调用CAM工单程序用刀计划创建方法
|
# 调用CAM工单程序用刀计划创建方法
|
||||||
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
cnc_ids = self.env['sf.cnc.processing'].sudo().search(
|
||||||
[('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0].id).ids),
|
[('workorder_id', 'in', workorder_ids.filtered(lambda a: a.production_id == self[0]).ids),
|
||||||
('cutting_tool_name', 'in', missing_tool_2)])
|
('cutting_tool_name', 'in', missing_tool_2)])
|
||||||
if cnc_ids:
|
if cnc_ids:
|
||||||
logging.info('调用CAM工单程序用刀计划创建方法!!!')
|
logging.info('调用CAM工单程序用刀计划创建方法!!!')
|
||||||
|
|||||||
Reference in New Issue
Block a user