-
-
+
+
+
+
@@ -189,6 +192,7 @@
+
diff --git a/sf_warehouse/models/sync_common.py b/sf_warehouse/models/sync_common.py
index a5a1dc86..ea90d06f 100644
--- a/sf_warehouse/models/sync_common.py
+++ b/sf_warehouse/models/sync_common.py
@@ -96,7 +96,8 @@ class MrsShelfLocationDataSync(models.Model):
return None # 如果没有找到对应的值,返回None或适当的默认值
# 定时更新所有设备机床刀库信息
- equipment_ids = self.env['maintenance.equipment'].search([('equipment_type', '=', '机床')])
+ equipment_ids = self.env['maintenance.equipment'].search(
+ [('equipment_type', '=', '机床'), ('function_type', '!=', False)])
for equipment_id in equipment_ids:
if equipment_id:
equipment_id.register_equipment_tool()
@@ -108,7 +109,8 @@ class MrsShelfLocationDataSync(models.Model):
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
if location_id:
if 'Tool' in item['Postion']:
- tool = self.env['sf.functional.cutting.tool.entity'].search(['rfid', '=', item['RfidCode']])
+ tool = self.env['sf.functional.cutting.tool.entity'].sudo().search(
+ [('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')])
tool.tool_in_out_stock_location(location_id)
if tool:
location_id.product_sn_id = tool.barcode_id.id
From 9c6ca3758b4739f6c5c987056663ef32b442bb67 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Thu, 13 Jun 2024 14:59:49 +0800
Subject: [PATCH 41/53] 1
---
sf_tool_management/models/functional_tool.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py
index 1badbefa..09b2e973 100644
--- a/sf_tool_management/models/functional_tool.py
+++ b/sf_tool_management/models/functional_tool.py
@@ -67,7 +67,7 @@ class FunctionalCuttingToolEntity(models.Model):
else:
record.current_location = '线边刀库'
else:
- record.current_location = quant_id.location_id.name
+ record.current_location = '刀具房'
if record.current_location_id:
record.sudo().get_location_num()
else:
From aa0b6a9b21202411772182b3c1bf85dd70261691 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Thu, 13 Jun 2024 16:01:27 +0800
Subject: [PATCH 42/53] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E7=A7=BB=E5=8A=A8=E5=88=B0=E7=BA=BF?=
=?UTF-8?q?=E8=BE=B9=E5=88=80=E5=BA=93=E7=9A=84=E5=87=BA=E5=85=A5=E5=BA=93?=
=?UTF-8?q?=E8=AE=B0=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/functional_tool.py | 5 +----
.../models/maintenance_equipment.py | 3 +--
.../views/functional_tool_views.xml | 21 ++++++++++---------
sf_warehouse/models/sync_common.py | 1 +
4 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py
index 09b2e973..73ee0896 100644
--- a/sf_tool_management/models/functional_tool.py
+++ b/sf_tool_management/models/functional_tool.py
@@ -113,7 +113,6 @@ class FunctionalCuttingToolEntity(models.Model):
item.tool_in_out_stock_location_1(location_id, tool_room_id)
# 新刀入库到线边
item.create_stock_move(pre_manufacturing_id, location_id)
- item.current_location_id = tool_room_id.id
item.current_shelf_location_id = location_id.id
# 中控反馈该位置没有刀
@@ -128,7 +127,6 @@ class FunctionalCuttingToolEntity(models.Model):
if tool.current_location == '线边刀库':
tool.create_stock_move(tool_room_id, False)
# 修改功能刀具的当前位置
- tool.current_location_id = tool_room_id.id
tool.current_shelf_location_id = False
def create_stock_move(self, location_dest_id, destination_location_id):
@@ -150,7 +148,6 @@ class FunctionalCuttingToolEntity(models.Model):
'move_id': stock_move_id.id,
'current_location_id': False if not self.current_shelf_location_id else self.current_shelf_location_id.id,
'destination_location_id': False if not destination_location_id else destination_location_id.id,
- 'install_tool_time': fields.Datetime.now(),
'qty_done': 1.0,
'state': 'done',
'functional_tool_type_id': self.sf_cutting_tool_type_id.id,
@@ -379,7 +376,7 @@ class StockMoveLine(models.Model):
functional_tool_name = fields.Char('刀具名称')
diameter = fields.Float(string='刀具直径(mm)')
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)')
- install_tool_time = fields.Datetime("刀具组装时间", default=fields.Datetime.now())
+ install_tool_time = fields.Datetime("刀具组装时间")
code = fields.Char('编码')
rfid = fields.Char('Rfid')
tool_groups_id = fields.Many2one('sf.tool.groups', '刀具组')
diff --git a/sf_tool_management/models/maintenance_equipment.py b/sf_tool_management/models/maintenance_equipment.py
index d47369bc..ed6b09a1 100644
--- a/sf_tool_management/models/maintenance_equipment.py
+++ b/sf_tool_management/models/maintenance_equipment.py
@@ -99,8 +99,7 @@ class SfMaintenanceEquipment(models.Model):
'functional_tool_name_id': functional_tool_id.id,
'tool_install_time': time
})
- if (functional_tool_id.current_location_id.name != '制造前' or
- functional_tool_id.current_shelf_location_id):
+ if functional_tool_id.current_location != '机内刀库':
# 对功能刀具进行移动到生产线
functional_tool_id.tool_inventory_displacement_out()
functional_tool_id.write({
diff --git a/sf_tool_management/views/functional_tool_views.xml b/sf_tool_management/views/functional_tool_views.xml
index fa4a99bb..8d07bc70 100644
--- a/sf_tool_management/views/functional_tool_views.xml
+++ b/sf_tool_management/views/functional_tool_views.xml
@@ -202,9 +202,9 @@
-
+
@@ -468,7 +468,9 @@
+
+
@@ -483,21 +485,20 @@
stock.move.line
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -511,7 +512,7 @@
ref="sf_tool_management.sf_inbound_and_outbound_records_of_functional_tools_view_tree"/>
-
[('functional_tool_name_id', '!=', False)]
+
[('functional_tool_name', '!=', False)]
diff --git a/sf_warehouse/models/sync_common.py b/sf_warehouse/models/sync_common.py
index ea90d06f..28f82313 100644
--- a/sf_warehouse/models/sync_common.py
+++ b/sf_warehouse/models/sync_common.py
@@ -108,6 +108,7 @@ class MrsShelfLocationDataSync(models.Model):
shelf_barcode = find_our_code(item['Postion'], total_data)
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
if location_id:
+ # 如果是线边刀库信息,则对功能刀具移动生成记录
if 'Tool' in item['Postion']:
tool = self.env['sf.functional.cutting.tool.entity'].sudo().search(
[('rfid', '=', item['RfidCode']), ('functional_tool_status', '!=', '已拆除')])
From 642877ff45c7390b7b3c789cdf6f0a49d7c4b59b Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Thu, 13 Jun 2024 17:28:44 +0800
Subject: [PATCH 43/53] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=95=B4=E4=BD=93?=
=?UTF-8?q?=E5=BC=8F=E5=88=80=E4=BA=A7=E5=93=81=E7=9A=84=E3=80=90=E7=B2=97?=
=?UTF-8?q?/=E4=B8=AD/=E7=B2=BE=E3=80=91=E5=AD=97=E6=AE=B5=E7=9A=84?=
=?UTF-8?q?=E5=BF=85=E5=A1=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_dlm_management/views/product_template_management_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index 8842f8bf..dea0150d 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -292,7 +292,7 @@
+ attrs="{'invisible': [('cutting_tool_type', 'not in', ('整体式刀具','刀片'))],'readonly': [('id', '!=', False)]}"/>
From a86ceb951b0dca963187399f9a0644ffe66a254c Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Fri, 14 Jun 2024 15:00:30 +0800
Subject: [PATCH 44/53] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E5=AE=89=E5=85=A8=E5=BA=93=E5=AD=98?=
=?UTF-8?q?=E6=95=B0=E9=87=8F=E8=AE=A1=E7=AE=97=E6=96=B9=E6=B3=95=EF=BC=9B?=
=?UTF-8?q?2=E3=80=81=E8=B4=A7=E4=BD=8D=E7=9C=8B=E6=9D=BF=E6=A8=A1?=
=?UTF-8?q?=E5=9E=8B=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?=
=?UTF-8?q?Rfid=E3=80=81=E5=90=8D=E7=A7=B0=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/__manifest__.py | 1 +
sf_tool_management/models/__init__.py | 1 +
sf_tool_management/models/functional_tool.py | 127 +++++++++--------
.../models/maintenance_equipment.py | 134 +++++++++---------
sf_tool_management/models/stock.py | 22 +++
sf_tool_management/views/stock.xml | 14 ++
6 files changed, 176 insertions(+), 123 deletions(-)
create mode 100644 sf_tool_management/models/stock.py
create mode 100644 sf_tool_management/views/stock.xml
diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py
index 64d08d05..a1a88fb0 100644
--- a/sf_tool_management/__manifest__.py
+++ b/sf_tool_management/__manifest__.py
@@ -22,6 +22,7 @@
'views/tool_material_search.xml',
'views/fixture_material_search_views.xml',
'views/menu_view.xml',
+ 'views/stock.xml',
'data/tool_data.xml',
],
'demo': [
diff --git a/sf_tool_management/models/__init__.py b/sf_tool_management/models/__init__.py
index b6020280..90776ca7 100644
--- a/sf_tool_management/models/__init__.py
+++ b/sf_tool_management/models/__init__.py
@@ -7,4 +7,5 @@ from . import functional_tool_enroll
from . import fixture_material_search
from . import fixture_enroll
from . import temporary_data_processing_methods
+from . import stock
diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py
index 73ee0896..b0be343a 100644
--- a/sf_tool_management/models/functional_tool.py
+++ b/sf_tool_management/models/functional_tool.py
@@ -33,9 +33,9 @@ class FunctionalCuttingToolEntity(models.Model):
handle_length = fields.Float(string='刀柄长度(mm)', readonly=True, digits=(10, 3))
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True, digits=(10, 3))
effective_length = fields.Float(string='有效长(mm)', readonly=True)
- tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
- line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True)
- machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True)
+ tool_room_num = fields.Integer(string='刀具房数量', compute='_compute_num', store=True)
+ line_edge_knife_library_num = fields.Integer(string='线边刀库数量', compute='_compute_num', store=True)
+ machine_knife_library_num = fields.Integer(string='机内刀库数量', compute='_compute_num', store=True)
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
alarm_value = fields.Integer(string='报警值(min)', readonly=True)
used_value = fields.Integer(string='已使用值(min)', readonly=True)
@@ -57,44 +57,46 @@ class FunctionalCuttingToolEntity(models.Model):
@api.depends('barcode_id.quant_ids', 'functional_tool_status')
def _compute_current_location_id(self):
for record in self:
- if record.barcode_id.quant_ids:
- for quant_id in record.barcode_id.quant_ids:
- if quant_id.inventory_quantity_auto_apply > 0:
- record.current_location_id = quant_id.location_id
- if quant_id.location_id.name == '制造前':
- if not record.current_shelf_location_id:
- record.current_location = '机内刀库'
- else:
- record.current_location = '线边刀库'
- else:
- record.current_location = '刀具房'
- if record.current_location_id:
- record.sudo().get_location_num()
- else:
- record.current_location_id = False
- record.current_location = False
if record.functional_tool_status == '已拆除':
record.current_location_id = False
record.current_location = False
- record.tool_room_num = 0
- record.line_edge_knife_library_num = 0
- record.machine_knife_library_num = 0
+ else:
+ if record.barcode_id.quant_ids:
+ for quant_id in record.barcode_id.quant_ids:
+ if quant_id.inventory_quantity_auto_apply > 0:
+ record.current_location_id = quant_id.location_id
+ if quant_id.location_id.name == '制造前':
+ if not record.current_shelf_location_id:
+ record.current_location = '机内刀库'
+ else:
+ record.current_location = '线边刀库'
+ else:
+ record.current_location = '刀具房'
+ else:
+ record.current_location_id = False
+ record.current_location = False
- def get_location_num(self):
+ @api.depends('current_location', 'functional_tool_status')
+ def _compute_num(self):
"""
计算库存位置数量
"""
for obj in self:
- if obj.current_location_id:
+ if obj.functional_tool_status == '已拆除':
obj.tool_room_num = 0
obj.line_edge_knife_library_num = 0
obj.machine_knife_library_num = 0
- if obj.current_location in ['刀具房']:
- obj.tool_room_num = 1
- elif "线边刀库" in obj.current_location:
- obj.line_edge_knife_library_num = 1
- elif "机内刀库" in obj.current_location:
- obj.machine_knife_library_num = 1
+ else:
+ if obj.current_location_id:
+ obj.tool_room_num = 0
+ obj.line_edge_knife_library_num = 0
+ obj.machine_knife_library_num = 0
+ if obj.current_location in ['刀具房']:
+ obj.tool_room_num = 1
+ elif "线边刀库" in obj.current_location:
+ obj.line_edge_knife_library_num = 1
+ elif "机内刀库" in obj.current_location:
+ obj.machine_knife_library_num = 1
def tool_in_out_stock_location(self, location_id):
tool_room_id = self.env['stock.location'].search([('name', '=', '刀具房')])
@@ -398,10 +400,10 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
group_expand='_read_mrs_cutting_tool_type_ids', store=True)
diameter = fields.Float(string='刀具直径(mm)', readonly=False)
knife_tip_r_angle = fields.Float(string='刀尖R角(mm)', readonly=False)
- tool_stock_num = fields.Integer(string='刀具房数量')
- side_shelf_num = fields.Integer(string='线边刀库数量')
- on_tool_stock_num = fields.Integer(string='机内刀库数量')
- tool_stock_total = fields.Integer(string='当前库存量', readonly=True)
+ tool_stock_num = fields.Integer(string='刀具房数量', compute='_compute_stock_num', store=True)
+ side_shelf_num = fields.Integer(string='线边刀库数量', compute='_compute_stock_num', store=True)
+ on_tool_stock_num = fields.Integer(string='机内刀库数量', compute='_compute_stock_num', store=True)
+ tool_stock_total = fields.Integer(string='当前库存量', compute='_compute_tool_stock_total', store=True)
min_stock_num = fields.Integer('最低库存量')
max_stock_num = fields.Integer('最高库存量')
batch_replenishment_num = fields.Integer('批次补货量', readonly=True, compute='_compute_batch_replenishment_num',
@@ -474,10 +476,6 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
def _compute_batch_replenishment_num(self):
for tool in self:
if tool:
- # 计算刀具房数量、线边刀库数量、机内刀库数量
- tool.sudo().get_stock_num(tool)
- # 计算当前库存量
- tool.sudo().tool_stock_total = tool.tool_stock_num + tool.side_shelf_num + tool.on_tool_stock_num
# 如果当前库存量小于最低库存量,计算批次补货量
tool.sudo().open_batch_replenishment_num(tool)
@@ -496,6 +494,38 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
else:
tool.sudo().batch_replenishment_num = 0
+ @api.depends('sf_functional_tool_entity_ids.tool_room_num',
+ 'sf_functional_tool_entity_ids.line_edge_knife_library_num',
+ 'sf_functional_tool_entity_ids.machine_knife_library_num')
+ def _compute_stock_num(self):
+ """
+ 计算刀具房数量、线边刀库数量、机内刀库数量
+ """
+ for tool in self:
+ if tool:
+ tool.tool_stock_num = 0
+ tool.side_shelf_num = 0
+ tool.on_tool_stock_num = 0
+ if tool.sf_functional_tool_entity_ids:
+ for cutting_tool in tool.sf_functional_tool_entity_ids:
+ if cutting_tool.tool_room_num > 0:
+ tool.tool_stock_num += 1
+ elif cutting_tool.line_edge_knife_library_num > 0:
+ tool.side_shelf_num += 1
+ elif cutting_tool.machine_knife_library_num > 0:
+ tool.on_tool_stock_num += 1
+ else:
+ tool.tool_stock_num = 0
+ tool.side_shelf_num = 0
+ tool.on_tool_stock_num = 0
+
+ @api.depends('tool_stock_num', 'side_shelf_num', 'on_tool_stock_num')
+ def _compute_tool_stock_total(self):
+ for tool in self:
+ if tool:
+ # 计算当前库存量
+ tool.tool_stock_total = tool.tool_stock_num + tool.side_shelf_num + tool.on_tool_stock_num
+
def create_functional_tool_assembly(self, tool):
"""
创建功能刀具组装单
@@ -516,27 +546,6 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
})
tool.sudo().sf_functional_tool_assembly_ids = [(4, functional_tool_assembly.id)]
- def get_stock_num(self, tool):
- """
- 计算刀具房数量、线边刀库数量、机内刀库数量
- """
- if tool:
- tool.tool_stock_num = 0
- tool.side_shelf_num = 0
- tool.on_tool_stock_num = 0
- if tool.sf_functional_tool_entity_ids:
- for cutting_tool in tool.sf_functional_tool_entity_ids:
- if cutting_tool.tool_room_num > 0:
- tool.tool_stock_num += 1
- elif cutting_tool.line_edge_knife_library_num > 0:
- tool.side_shelf_num += 1
- elif cutting_tool.machine_knife_library_num > 0:
- tool.on_tool_stock_num += 1
- else:
- tool.tool_stock_num = 0
- tool.side_shelf_num = 0
- tool.on_tool_stock_num = 0
-
def create_or_edit_safety_stock(self, vals, sf_functional_tool_entity_ids):
"""
根据传入的信息新增或者更新功能刀具安全库存的信息
diff --git a/sf_tool_management/models/maintenance_equipment.py b/sf_tool_management/models/maintenance_equipment.py
index ed6b09a1..32c153d7 100644
--- a/sf_tool_management/models/maintenance_equipment.py
+++ b/sf_tool_management/models/maintenance_equipment.py
@@ -44,73 +44,79 @@ class SfMaintenanceEquipment(models.Model):
# ==========机床当前刀库实时信息接口==========
def register_equipment_tool(self):
- config = self.env['res.config.settings'].get_values()
- # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
- headers = {'Authorization': config['center_control_Authorization']}
- crea_url = config['center_control_url'] + "/AutoDeviceApi/GetToolInfos"
- params = {"DeviceId": self.name}
- r = requests.get(crea_url, params=params, headers=headers)
- ret = r.json()
- logging.info('register_equipment_tool:%s' % ret)
- datas = ret['Datas']
- self.write_maintenance_equipment_tool(datas)
- if ret['Succeed']:
- return "机床当前刀库实时信息指令发送成功"
- else:
- raise ValidationError("机床当前刀库实时信息指令发送失败")
+ try:
+ config = self.env['res.config.settings'].get_values()
+ # token = sf_sync_config['token'Ba F2CF5DCC-1A00-4234-9E95-65603F70CC8A]
+ headers = {'Authorization': config['center_control_Authorization']}
+ crea_url = config['center_control_url'] + "/AutoDeviceApi/GetToolInfos"
+ params = {"DeviceId": self.name}
+ r = requests.get(crea_url, params=params, headers=headers)
+ ret = r.json()
+ logging.info('register_equipment_tool:%s' % ret)
+ datas = ret['Datas']
+ self.write_maintenance_equipment_tool(datas)
+ if ret['Succeed']:
+ return "机床当前刀库实时信息指令发送成功"
+ else:
+ raise ValidationError("机床当前刀库实时信息指令发送失败")
+ except Exception as e:
+ logging.info("register_equipment_tool()捕获错误信息:%s" % e)
def write_maintenance_equipment_tool(self, datas):
- if datas:
- # 清除设备机床刀位的刀具信息
- for obj in self.product_template_ids:
- obj.write({
- 'functional_tool_name_id': False,
- 'tool_install_time': None
- })
- for data in datas:
- maintenance_equipment_id = self.search([('name', '=', data['DeviceId'])])
- if maintenance_equipment_id:
- tool_id = '%s%s' % (data['ToolId'][0:1], data['ToolId'][1:].zfill(2))
- equipment_tool_id = self.env['maintenance.equipment.tool'].sudo().search(
- [('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)])
- functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
- [('rfid', '=', data['RfidCode'])])
- if functional_tool_id:
- if len(functional_tool_id) > 1:
- functional_tool_id = functional_tool_id[-1]
- # 查询该功能刀具是否已经装在机床内其他位置,如果是就删除
- equipment_tools = self.env['maintenance.equipment.tool'].sudo().search(
- [('functional_tool_name_id', '=', functional_tool_id.id), ('code', '!=', tool_id)])
- if equipment_tools:
- for item in equipment_tools:
- item.write({
- 'functional_tool_name_id': False,
- 'tool_install_time': None
- })
+ try:
+ if datas:
+ # 清除设备机床刀位的刀具信息
+ for obj in self.product_template_ids:
+ obj.write({
+ 'functional_tool_name_id': False,
+ 'tool_install_time': None
+ })
+ for data in datas:
+ maintenance_equipment_id = self.search([('name', '=', data['DeviceId'])])
+ if maintenance_equipment_id:
+ tool_id = '%s%s' % (data['ToolId'][0:1], data['ToolId'][1:].zfill(2))
+ equipment_tool_id = self.env['maintenance.equipment.tool'].sudo().search(
+ [('equipment_id', '=', maintenance_equipment_id.id), ('code', '=', tool_id)])
+ functional_tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
+ [('rfid', '=', data['RfidCode'])])
+ if functional_tool_id:
+ if len(functional_tool_id) > 1:
+ functional_tool_id = functional_tool_id[-1]
+ # 查询该功能刀具是否已经装在机床内其他位置,如果是就删除
+ equipment_tools = self.env['maintenance.equipment.tool'].sudo().search(
+ [('functional_tool_name_id', '=', functional_tool_id.id), ('code', '!=', tool_id)])
+ if equipment_tools:
+ for item in equipment_tools:
+ item.write({
+ 'functional_tool_name_id': False,
+ 'tool_install_time': None
+ })
+ else:
+ logging.info('Rfid为【%s】的功能刀具不存在!' % data['RfidCode'])
+ time = None
+ if data['AddDatetime']:
+ datatime = str(data['AddDatetime'])
+ time = fields.Datetime.from_string(datatime[0:10] + ' ' + datatime[11:19])
+ if equipment_tool_id and functional_tool_id:
+ tool_install_time = {'Nomal': '正常', 'Warning': '报警'}
+ equipment_tool_id.write({
+ 'functional_tool_name_id': functional_tool_id.id,
+ 'tool_install_time': time
+ })
+ if functional_tool_id.current_location != '机内刀库':
+ # 对功能刀具进行移动到生产线
+ functional_tool_id.tool_inventory_displacement_out()
+ functional_tool_id.write({
+ 'max_lifetime_value': data['MaxLife'],
+ 'used_value': data['UseLife'],
+ 'functional_tool_status': tool_install_time.get(data['State'])
+ })
else:
- logging.info('Rfid为【%s】的功能刀具不存在!' % data['RfidCode'])
- time = None
- if data['AddDatetime']:
- datatime = str(data['AddDatetime'])
- time = fields.Datetime.from_string(datatime[0:10] + ' ' + datatime[11:19])
- if equipment_tool_id and functional_tool_id:
- tool_install_time = {'Nomal': '正常', 'Warning': '报警'}
- equipment_tool_id.write({
- 'functional_tool_name_id': functional_tool_id.id,
- 'tool_install_time': time
- })
- if functional_tool_id.current_location != '机内刀库':
- # 对功能刀具进行移动到生产线
- functional_tool_id.tool_inventory_displacement_out()
- functional_tool_id.write({
- 'max_lifetime_value': data['MaxLife'],
- 'used_value': data['UseLife'],
- 'functional_tool_status': tool_install_time.get(data['State'])
- })
- else:
- logging.info('获取的【%s】设备不存在!!!' % data['DeviceId'])
- else:
- logging.info('没有获取到【%s】设备的刀具库信息!!!' % self.name)
+ logging.info('获取的【%s】设备不存在!!!' % data['DeviceId'])
+ else:
+ logging.info('没有获取到【%s】设备的刀具库信息!!!' % self.name)
+ except Exception as e:
+ logging.info("write_maintenance_equipment_tool()捕获错误信息:%s" % e)
class StockLot(models.Model):
diff --git a/sf_tool_management/models/stock.py b/sf_tool_management/models/stock.py
new file mode 100644
index 00000000..c55cda97
--- /dev/null
+++ b/sf_tool_management/models/stock.py
@@ -0,0 +1,22 @@
+from odoo import api, fields, models, _
+
+
+class ShelfLocation(models.Model):
+ _inherit = 'sf.shelf.location'
+
+ tool_rfid = fields.Char('Rfid', compute='_compute_tool', store=True)
+ tool_name_id = fields.Many2one('sf.functional.cutting.tool.entity', string='功能刀具名称', compute='_compute_tool',
+ store=True)
+
+ @api.depends('product_id')
+ def _compute_tool(self):
+ for item in self:
+ if item.product_id:
+ if item.product_id.categ_id.name == '功能刀具':
+ tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
+ [('barcode_id', '=', item.product_sn_id.id)])
+ item.tool_rfid = tool_id.rfid
+ item.tool_name_id = tool_id.id
+ return True
+ item.tool_rfid = ''
+ item.tool_name_id = False
diff --git a/sf_tool_management/views/stock.xml b/sf_tool_management/views/stock.xml
new file mode 100644
index 00000000..063e3ccd
--- /dev/null
+++ b/sf_tool_management/views/stock.xml
@@ -0,0 +1,14 @@
+
+
+
+ sf.shelf.location.form.tool
+ sf.shelf.location
+
+
+
+
+
+
+
+
+
\ No newline at end of file
From 904c63bfcbb0af5364f253a7d76d0ddc86c8c323 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Fri, 14 Jun 2024 15:38:52 +0800
Subject: [PATCH 45/53] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E5=AE=89=E5=85=A8=E5=BA=93=E5=AD=98?=
=?UTF-8?q?=E6=95=B0=E9=87=8F=E8=AE=A1=E7=AE=97=E6=96=B9=E6=B3=95=EF=BC=9B?=
=?UTF-8?q?2=E3=80=81=E8=B4=A7=E4=BD=8D=E7=9C=8B=E6=9D=BF=E6=A8=A1?=
=?UTF-8?q?=E5=9E=8B=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?=
=?UTF-8?q?Rfid=E3=80=81=E5=90=8D=E7=A7=B0=E5=AD=97=E6=AE=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/stock.py | 7 ++++---
sf_tool_management/views/stock.xml | 4 ++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/sf_tool_management/models/stock.py b/sf_tool_management/models/stock.py
index c55cda97..be0f2e45 100644
--- a/sf_tool_management/models/stock.py
+++ b/sf_tool_management/models/stock.py
@@ -15,8 +15,9 @@ class ShelfLocation(models.Model):
if item.product_id.categ_id.name == '功能刀具':
tool_id = self.env['sf.functional.cutting.tool.entity'].sudo().search(
[('barcode_id', '=', item.product_sn_id.id)])
- item.tool_rfid = tool_id.rfid
- item.tool_name_id = tool_id.id
- return True
+ if tool_id:
+ item.tool_rfid = tool_id.rfid
+ item.tool_name_id = tool_id.id
+ continue
item.tool_rfid = ''
item.tool_name_id = False
diff --git a/sf_tool_management/views/stock.xml b/sf_tool_management/views/stock.xml
index 063e3ccd..81783631 100644
--- a/sf_tool_management/views/stock.xml
+++ b/sf_tool_management/views/stock.xml
@@ -6,8 +6,8 @@
-
-
+
+
From 1e90b9a18aa7c888229a4de434afcc2585b02015 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Fri, 14 Jun 2024 17:01:02 +0800
Subject: [PATCH 46/53] =?UTF-8?q?1=E3=80=81=E5=8A=9F=E8=83=BD=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E4=BD=8D=E7=BD=AE=E8=AE=A1=E7=AE=97=E6=96=B9=E6=B3=95?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=A6=E5=8F=91=E6=9D=A1=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/functional_tool.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sf_tool_management/models/functional_tool.py b/sf_tool_management/models/functional_tool.py
index b0be343a..de8106c4 100644
--- a/sf_tool_management/models/functional_tool.py
+++ b/sf_tool_management/models/functional_tool.py
@@ -54,7 +54,7 @@ class FunctionalCuttingToolEntity(models.Model):
safe_inventory_id = fields.Many2one('sf.real.time.distribution.of.functional.tools',
string='功能刀具安全库存', readonly=True)
- @api.depends('barcode_id.quant_ids', 'functional_tool_status')
+ @api.depends('barcode_id.quant_ids', 'functional_tool_status', 'current_shelf_location_id')
def _compute_current_location_id(self):
for record in self:
if record.functional_tool_status == '已拆除':
@@ -494,7 +494,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
else:
tool.sudo().batch_replenishment_num = 0
- @api.depends('sf_functional_tool_entity_ids.tool_room_num',
+ @api.depends('sf_functional_tool_entity_ids', 'sf_functional_tool_entity_ids.tool_room_num',
'sf_functional_tool_entity_ids.line_edge_knife_library_num',
'sf_functional_tool_entity_ids.machine_knife_library_num')
def _compute_stock_num(self):
From 2862c5a888eecdae7aa69bf905e92c4175481cdc Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Mon, 17 Jun 2024 09:52:18 +0800
Subject: [PATCH 47/53] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=AE=A2=E6=88=B7?=
=?UTF-8?q?=E9=83=A8=E5=88=86=E5=AD=97=E6=AE=B5=E5=BF=85=E5=A1=AB=E6=A0=A1?=
=?UTF-8?q?=E9=AA=8C=E5=92=8C=E8=BF=94=E5=B7=A5=E6=8A=A5=E5=BA=9F=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/controllers/controllers.py | 3 +-
sf_manufacturing/models/mrp_production.py | 21 +++------
sf_manufacturing/models/mrp_workorder.py | 18 ++++----
sf_sale/models/sale_order.py | 12 +++---
sf_sale/views/res_partner_view.xml | 42 +++++++++---------
sf_sale/views/sale_order_view.xml | 48 ---------------------
6 files changed, 44 insertions(+), 100 deletions(-)
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index c85a559e..ddbf4048 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -215,7 +215,8 @@ class Manufacturing_Connect(http.Controller):
if workorder.state != 'progress':
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'}
return json.JSONEncoder().encode(res)
- workorder.write({'date_finished': datetime.now()})
+ # workorder.write({'date_finished': datetime.now()})
+ workorder.button_finish()
# workorder.process_state = '待解除装夹'
# workorder.sudo().production_id.process_state = '待解除装夹'
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 4b9de955..0f428d43 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -293,7 +293,7 @@ class MrpProduction(models.Model):
# 则根据设备找到工作中心;否则采用前面描述的工作中心分配机制;
# 其他规则限制: 默认只分配给工作中心状态为非故障的工作中心;
- def _create_workorder3(self, is_fetchcnc=False, scrap_production=False):
+ def _create_workorder3(self):
# 根据product_id对self进行分组
grouped_product_ids = {k: list(g) for k, g in groupby(self, key=lambda x: x.product_id.id)}
# 初始化一个字典来存储每个product_id对应的生产订单名称列表
@@ -336,12 +336,9 @@ class MrpProduction(models.Model):
production_programming = self.search(
[('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
limit=1, order='id asc')
- if not production_programming.programming_no or (is_fetchcnc is True and scrap_production):
- # 制造订单报废/返工也需重新编程
- if (is_fetchcnc is True and scrap_production is False) or (
- is_fetchcnc is False and scrap_production is False):
- production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]),
- scrap_production)
+ if not production_programming.programming_no:
+ production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]),
+ scrap_production)
else:
production.write({'programming_no': production_programming.programming_no,
'programming_state': '编程中'})
@@ -409,12 +406,6 @@ class MrpProduction(models.Model):
workorders_values.append(
self.env['mrp.workorder'].json_workorder_str('', production, route))
production.workorder_ids = workorders_values
- if production_programming.programming_state == '已编程':
- logging.info("production_programming: %s" % production_programming.name)
- production.workorder_ids.filtered(lambda t: t.routing_type == 'CNC加工').write({
- 'cnc_ids': production_programming.workorder_ids.filtered(
- lambda
- t1: t1.routing_type == 'CNC加工').cnc_ids})
for workorder in production.workorder_ids:
workorder.duration_expected = workorder._get_duration_expected()
@@ -557,8 +548,8 @@ class MrpProduction(models.Model):
# work.button_finish()
# 创建工单并进行排序
- def _create_workorder(self, is_fetchcnc=False, scrap_production=False):
- self._create_workorder3(is_fetchcnc=is_fetchcnc, scrap_production=scrap_production)
+ def _create_workorder(self):
+ self._create_workorder3()
self._reset_work_order_sequence()
return True
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 7eea98da..1d65c0ae 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -996,15 +996,15 @@ class ResMrpWorkOrder(models.Model):
record.write({
'date_planned_finished': tem_date_planned_finished # 保持原值
})
- if record.routing_type == 'CNC加工':
- record.write({
- 'date_finished': tem_date_finished # 保持原值
- })
- if record.routing_type == 'CNC加工' and record.test_results in ['返工', '报废']:
- record.production_id.action_cancel()
- record.production_id.workorder_ids.write({'rfid_code': False, 'rfid_code_old': record.rfid_code})
- if record.is_remanufacture is True:
- record.recreateManufacturingOrWorkerOrder()
+ # if record.routing_type == 'CNC加工':
+ # record.write({
+ # 'date_finished': tem_date_finished # 保持原值
+ # })
+ # if record.routing_type == 'CNC加工' and record.test_results in ['返工', '报废']:
+ # record.production_id.action_cancel()
+ # record.production_id.workorder_ids.write({'rfid_code': False, 'rfid_code_old': record.rfid_code})
+ # if record.is_remanufacture is True:
+ # record.recreateManufacturingOrWorkerOrder()
is_production_id = True
for workorder in record.production_id.workorder_ids:
if workorder.state != 'done':
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index e168292b..9486f73c 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -233,12 +233,12 @@ class ResPartnerToSale(models.Model):
if obj:
raise UserError('该税ID已存在,请重新输入')
- @api.constrains('email')
- def _check_email(self):
- if self.customer_rank > 0:
- obj = self.sudo().search([('email', '=', self.email), ('id', '!=', self.id), ('active', '=', True)])
- if obj:
- raise UserError('该邮箱已存在,请重新输入')
+ # @api.constrains('email')
+ # def _check_email(self):
+ # if self.customer_rank > 0:
+ # obj = self.sudo().search([('email', '=', self.email), ('id', '!=', self.id), ('active', '=', True)])
+ # if obj:
+ # raise UserError('该邮箱已存在,请重新输入')
@api.model
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
diff --git a/sf_sale/views/res_partner_view.xml b/sf_sale/views/res_partner_view.xml
index cc8f49fb..a680bd7c 100644
--- a/sf_sale/views/res_partner_view.xml
+++ b/sf_sale/views/res_partner_view.xml
@@ -24,18 +24,18 @@
1
{'readonly': [('id','!=', False)]}
-
-
-
-
- {'required': [('phone', '=', False)],'readonly': [('id','!=', False)]}
-
-
-
- {'required': [('mobile', '=', False)],'readonly': [('id','!=', False)]}
-
-
+
+
+
+
+
+
+
+
+
+
+
+
{'readonly': [('id','!=', False)]}
@@ -56,10 +56,10 @@
-
- 1
- {'readonly': [('id','!=', False)]}
-
+
+
+
+
{'readonly': [('id','!=', False)]}
@@ -101,7 +101,7 @@
+ attrs="{'required' : [('supplier_rank','>', 0)]}"/>
{'readonly': [('id','!=', False)]}
@@ -195,10 +195,10 @@
{'invisible': [('customer_rank','=', 0)]}
-
-
-
+
+
+
+
diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml
index 0981ff59..647cf8ef 100644
--- a/sf_sale/views/sale_order_view.xml
+++ b/sf_sale/views/sale_order_view.xml
@@ -1,54 +1,6 @@
-
- sale.order.search.inherit.sf
- sale.order
- primary
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 报价
- ir.actions.act_window
- sale.order
-
- tree,kanban,form,calendar,pivot,graph,activity
-
- {'search_default_my_quotation': 1}
-
-
- Create a new quotation, the first step of a new sale!
-
-
- Once the quotation is confirmed by the customer, it becomes a sales order.
-
- You will be able to create an invoice and collect the payment.
-
-
-
-
-
-
-
-
-
-
-
sale.order.form.inherit.sf
sale.order
From 77ad0dd63541ec14b170c063840a9d5a39e6b6ff Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Mon, 17 Jun 2024 11:40:12 +0800
Subject: [PATCH 48/53] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8A=A8=E6=80=81?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E6=8C=89=E6=89=B9=E6=AC=A1=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E5=90=8C=E6=AD=A5=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/functional_tool_enroll.py | 9 +++------
sf_tool_management/views/tool_material_search.xml | 1 +
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sf_tool_management/models/functional_tool_enroll.py b/sf_tool_management/models/functional_tool_enroll.py
index cad8bd20..25c31710 100644
--- a/sf_tool_management/models/functional_tool_enroll.py
+++ b/sf_tool_management/models/functional_tool_enroll.py
@@ -80,7 +80,7 @@ class StockLot(models.Model):
headers = Common.get_headers(self, token, sf_secret_key)
str_url = sf_sync_config['sf_url'] + "/api/tool_material_stock/create"
product_ids = self.env['product.product'].sudo().search([('categ_type', '=', '刀具')]).ids
- objs_all = self.env['stock.lot'].search([('rfid', '!=', False), ('product_id', 'in', product_ids)])
+ objs_all = self.env['stock.lot'].search([('product_id', 'in', product_ids)])
self._get_sync_stock_lot(objs_all, str_url, token, headers)
def _get_sync_stock_lot(self, objs_all, str_url, token, headers):
@@ -90,6 +90,7 @@ class StockLot(models.Model):
for item in objs_all:
val = {
'name': item.name,
+ 'qty': item.product_qty,
'tool_material_status': item.tool_material_status,
'location': [] if not item.quant_ids else item.quant_ids[-1].location_id.name,
'tool_material_search_id': item.tool_material_search_id.id,
@@ -105,7 +106,7 @@ class StockLot(models.Model):
logging.info("没有刀具物料序列号信息")
except Exception as e:
logging.info("刀具物料序列号同步失败:%s" % e)
-
+
class ToolMaterial(models.Model):
_inherit = 'sf.tool.material.search'
@@ -163,8 +164,6 @@ class ToolMaterial(models.Model):
logging.info("刀具物料同步失败:%s" % e)
-
-
class FunctionalCuttingToolEntity(models.Model):
_inherit = 'sf.functional.cutting.tool.entity'
_description = '功能刀具列表注册'
@@ -251,8 +250,6 @@ class FunctionalCuttingToolEntity(models.Model):
logging.info("功能刀具同步失败:%s" % e)
-
-
class FunctionalToolWarning(models.Model):
_inherit = 'sf.functional.tool.warning'
_description = '功能刀具预警注册'
diff --git a/sf_tool_management/views/tool_material_search.xml b/sf_tool_management/views/tool_material_search.xml
index eb7a2418..8a740676 100644
--- a/sf_tool_management/views/tool_material_search.xml
+++ b/sf_tool_management/views/tool_material_search.xml
@@ -62,6 +62,7 @@
+
From 9202409a8995cdf10bbba43d61deeae97342b639 Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Mon, 17 Jun 2024 11:53:38 +0800
Subject: [PATCH 49/53] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=94=E5=B7=A5?=
=?UTF-8?q?=E6=8A=A5=E5=BA=9F=E7=9A=84=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/views/mrp_workorder_view.xml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 083eca14..11219363 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -477,13 +477,13 @@
-
-
-
-
-
+
+
+
+
+
+
+
From 8ade3b43c4d14bacc8dc86dd54caa4eae02c7e2d Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Mon, 17 Jun 2024 16:06:49 +0800
Subject: [PATCH 50/53] =?UTF-8?q?=E4=B8=AD=E6=8E=A7=E6=96=B0=E5=A2=9E?=
=?UTF-8?q?=E6=98=AF=E5=90=A6=E5=AE=8C=E6=88=90=E5=AD=97=E6=AE=B5,?=
=?UTF-8?q?=E8=AF=A5=E6=8E=A5=E5=8F=A3=E6=A0=B9=E6=8D=AE=E8=AF=A5=E5=AD=97?=
=?UTF-8?q?=E6=AE=B5=E5=AF=B9cnc=E5=8A=A0=E5=B7=A5=E5=B7=A5=E5=8D=95?=
=?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=AE=8C=E6=88=90=E6=93=8D=E4=BD=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/controllers/controllers.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index ddbf4048..61bc83ea 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -8,7 +8,7 @@ from odoo.http import request
class Manufacturing_Connect(http.Controller):
- @http.route('/AutoDeviceApi/GetWoInfo', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
+ @http.route('/AutoDeviceApi/GetWoInfo', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
cors="*")
def get_Work_Info(self, **kw):
"""
@@ -216,7 +216,8 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '该工单未开始'}
return json.JSONEncoder().encode(res)
# workorder.write({'date_finished': datetime.now()})
- workorder.button_finish()
+ if ret['IsComplete'] is True:
+ workorder.button_finish()
# workorder.process_state = '待解除装夹'
# workorder.sudo().production_id.process_state = '待解除装夹'
From 7dea8c7c1e2bfdae9af4a68d99132f0130808ec2 Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Mon, 17 Jun 2024 16:16:22 +0800
Subject: [PATCH 51/53] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=94=E5=B7=A5?=
=?UTF-8?q?=E5=92=8C=E6=8A=A5=E5=BA=9F=E7=9A=84=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_workorder.py | 2 +-
sf_manufacturing/models/stock.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 1d65c0ae..002c83aa 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -684,7 +684,7 @@ class ResMrpWorkOrder(models.Model):
values)
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
- productions._create_workorder(is_fetchcnc=self.is_fetchcnc, scrap_production=self.production_id)
+ productions._create_workorder()
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
(
p.move_dest_ids.procure_method != 'make_to_order' and
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index 03ec8d0e..95d877b3 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -208,7 +208,7 @@ class StockRule(models.Model):
'''
创建工单
'''
- productions._create_workorder(is_fetchcnc=False, scrap_production=False)
+ productions._create_workorder()
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
(
From 3258b6cc75008f8f2e45a0b822bfb0cf4c526cd2 Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Mon, 17 Jun 2024 16:38:14 +0800
Subject: [PATCH 52/53] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BF=AB=E9=80=9F?=
=?UTF-8?q?=E8=AE=A2=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_production.py | 8 +++-----
sf_manufacturing/models/product_template.py | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 0f428d43..32124b28 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -178,7 +178,7 @@ class MrpProduction(models.Model):
raise UserError("更新程单失败,请联系管理员")
# cnc程序获取
- def fetchCNC(self, production_names, scrap_production):
+ def fetchCNC(self, production_names):
cnc = self.env['mrp.production'].search([('id', '=', self.id)])
quick_order = self.env['quick.easy.order'].search(
[('name', '=', cnc.product_id.default_code.rsplit('-', 1)[0])])
@@ -194,8 +194,7 @@ class MrpProduction(models.Model):
'production_no': production_names,
'machine_tool_code': '',
'product_name': cnc.product_id.name,
- 'remanufacture_type': '' if not scrap_production else scrap_production.workorder_ids.filtered(
- lambda b: b.routing_type == "CNC加工").test_results,
+ 'remanufacture_type': '',
'model_code': cnc.product_id.model_code,
'material_code': self.env['sf.production.materials'].search(
[('id', '=', cnc.product_id.materials_id.id)]).materials_no,
@@ -337,8 +336,7 @@ class MrpProduction(models.Model):
[('product_id.id', '=', production.product_id.id), ('origin', '=', production.origin)],
limit=1, order='id asc')
if not production_programming.programming_no:
- production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]),
- scrap_production)
+ production.fetchCNC(', '.join(product_id_to_production_names[production.product_id.id]))
else:
production.write({'programming_no': production_programming.programming_no,
'programming_state': '编程中'})
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 0753d556..cea53c64 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -636,7 +636,7 @@ class ResProductMo(models.Model):
'model_remark': item['remark'],
'default_code': '%s-%s' % (order_number, i),
'manual_quotation': item['manual_quotation'] or False,
- 'part_number': item['part_number'] or '',
+ 'part_number': item.get('part_number') or '',
'active': True,
}
copy_product_id.sudo().write(vals)
From 5bec3d60616bfeb3bf32fb39079b18fa92d92112 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Mon, 17 Jun 2024 17:24:23 +0800
Subject: [PATCH 53/53] 1
---
sf_tool_management/controllers/controllers.py | 1 +
sf_tool_management/models/functional_tool_enroll.py | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sf_tool_management/controllers/controllers.py b/sf_tool_management/controllers/controllers.py
index baba93fc..b6adb6b7 100644
--- a/sf_tool_management/controllers/controllers.py
+++ b/sf_tool_management/controllers/controllers.py
@@ -109,6 +109,7 @@ class Manufacturing_Connect(http.Controller):
res = {'Succeed': True, 'Datas': []}
try:
datas = request.httprequest.data
+ logging.info('datas: %s' % datas)
ret = str(datas, 'utf-8')
data_lists = ret.split(",")
data_list = [data.replace('+', '') for data in data_lists]
diff --git a/sf_tool_management/models/functional_tool_enroll.py b/sf_tool_management/models/functional_tool_enroll.py
index 25c31710..9c5b1417 100644
--- a/sf_tool_management/models/functional_tool_enroll.py
+++ b/sf_tool_management/models/functional_tool_enroll.py
@@ -234,8 +234,7 @@ class FunctionalCuttingToolEntity(models.Model):
'blade_tip_characteristics_name': item.blade_tip_characteristics_id.name,
'handle_type_name': item.handle_type_id.name,
'cutting_direction_names': get_cutting_direction_names(item),
- 'suitable_coolant_names': get_suitable_coolant_names(item),
- 'active': item.active,
+ 'suitable_coolant_names': get_suitable_coolant_names(item)
}
functional_tool_list.append(val)
kw = json.dumps(functional_tool_list, ensure_ascii=False)