From c57daa2c52cc1707670716b351b1865636e53d66 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 20 Aug 2024 16:13:30 +0800
Subject: [PATCH 1/4] =?UTF-8?q?1=E3=80=81=E5=A4=84=E7=90=86=E9=94=80?=
=?UTF-8?q?=E5=94=AE=E8=AE=A2=E5=8D=95=E7=A1=AE=E8=AE=A4=E6=8E=A5=E5=8D=95?=
=?UTF-8?q?=E5=90=8E=EF=BC=8C=E7=A1=AE=E8=AE=A4=E6=8E=A5=E5=8D=95=E3=80=81?=
=?UTF-8?q?=E5=8F=96=E6=B6=88=E6=8C=89=E9=92=AE=E6=B2=A1=E6=9C=89=E9=9A=90?=
=?UTF-8?q?=E8=97=8F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_sale/views/sale_order_view.xml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sf_sale/views/sale_order_view.xml b/sf_sale/views/sale_order_view.xml
index ce27a4df..d5af8ebd 100644
--- a/sf_sale/views/sale_order_view.xml
+++ b/sf_sale/views/sale_order_view.xml
@@ -10,7 +10,8 @@
sf_base.group_sale_salemanager,sf_base.group_sale_director
- mrp.group_mrp_user,sf_base.group_sale_salemanager,sf_base.group_sale_director
+
+ mrp.group_mrp_user,sf_base.group_sale_salemanager,sf_base.group_sale_director
@@ -42,12 +43,12 @@
+ attrs="{'invisible': ['|', ('state', 'in', ['cancel']), '|','&',('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False)]}"/>
- {'invisible': ['|','&','|', ('check_status', '!=', 'approved'),('state',
- 'in', ['draft','cancel']),'&','&',('check_status', '=', 'approved'),('state', 'in',
- ['sale','cancel']),('delivery_status', '!=', False), ('state', 'in', ['cancel'])]}
+ {'invisible': ['|', ('state', 'in', ['cancel']), '|','&',
+ ('check_status', '!=', 'approved'),('state', 'in', ['draft','cancel']),'&','&',('check_status',
+ '=', 'approved'),('state', 'in', ['sale','cancel']),('delivery_status', '!=', False)]}
From 3d2c62f5dbf4d7c37d41dc0b0a7c31c54a08b7b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?=
Date: Wed, 21 Aug 2024 20:16:41 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E9=80=81?=
=?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BB=B6=E9=85=8D?=
=?UTF-8?q?=E9=80=81=E5=8D=95=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/agv_scheduling.py | 4 ++--
sf_manufacturing/models/mrp_workorder.py | 16 ++++++++--------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/sf_manufacturing/models/agv_scheduling.py b/sf_manufacturing/models/agv_scheduling.py
index f2ac517b..7902b469 100644
--- a/sf_manufacturing/models/agv_scheduling.py
+++ b/sf_manufacturing/models/agv_scheduling.py
@@ -242,13 +242,13 @@ class AgvScheduling(models.Model):
elif vals['state'] == '已配送':
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
'status': '已配送',
- 'feeder_station_destination_id': self.end_site_id,
+ 'feeder_station_destination_id': self.end_site_id.id,
'route_id': self.agv_route_id.id,
'task_completion_time': fields.Datetime.now()
})
elif vals['state'] == '配送中':
self.env['sf.workpiece.delivery'].search([('agv_scheduling_id', '=', self.id)]).write({
- 'feeder_station_destination_id': self.end_site_id,
+ 'feeder_station_destination_id': self.end_site_id.id,
'route_id': self.agv_route_id.id,
'task_delivery_time': fields.Datetime.now()
})
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index bb1cfce3..40382c39 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -1657,14 +1657,14 @@ class WorkPieceDelivery(models.Model):
obj.feeder_station_start_id.name, obj.feeder_station_destination_id.name)
return obj
- @api.constrains('route_id')
- def _check_route_id(self):
- if self.type == '运送空料架':
- if self.route_id and self.name is False:
- route = self.sudo().search(
- [('route_id', '=', self.route_id.id), ('id', '!=', self.id), ('name', 'ilike', '运送空料架路线')])
- if route:
- raise UserError("该任务路线已存在,请重新选择")
+ # @api.constrains('route_id')
+ # def _check_route_id(self):
+ # if self.type == '运送空料架':
+ # if self.route_id and self.name is False:
+ # route = self.sudo().search(
+ # [('route_id', '=', self.route_id.id), ('id', '!=', self.id), ('name', 'ilike', '运送空料架路线')])
+ # if route:
+ # raise UserError("该任务路线已存在,请重新选择")
# @api.constrains('name')
# def _check_name(self):
From 9e356682dc806e47b7e59f46771b46138d2b50e7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?=
Date: Thu, 22 Aug 2024 10:22:35 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E9=A9=B3?=
=?UTF-8?q?=E7=AB=99=E7=8A=B6=E6=80=81=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/controllers/controllers.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 95bb52c6..af5e1a1f 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -638,9 +638,14 @@ class Manufacturing_Connect(http.Controller):
request.env['center_control.interface.log'].sudo().create(
{'content': ret, 'name': 'AutoDeviceApi/AGVStationState'})
logging.info('ret:%s' % ret)
- if 'DeviceId' in ret and 'AtHome' in ret:
- logging.info('DeviceId:%s, AtHome:%s' % (ret['DeviceId'], ret['AtHome']))
- request.env['sf.agv.site'].update_site_state({ret['DeviceId']: '占用' if ret['AtHome'] else '空闲'})
+ ret = ret['param']
+ params = {}
+ for i in range(len(ret)):
+ if 'DeviceId' in ret[i] and 'AtHome' in ret[i]:
+ logging.info('DeviceId:%s, AtHome:%s' % (ret[i]['DeviceId'], ret[i]['AtHome']))
+ params[ret[i]['DeviceId']] = '占用' if ret[i]['AtHome'] else '空闲'
+ if params:
+ request.env['sf.agv.site'].update_site_state(params)
except Exception as e:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': str(e)}
logging.info('AGVDownProduct error:%s' % e)
From 39bc206344abfad09a6a37140956ac39bba33e1c Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Thu, 22 Aug 2024 10:31:22 +0800
Subject: [PATCH 4/4] =?UTF-8?q?1=E3=80=81=E4=BC=98=E5=8C=96=E8=B4=A7?=
=?UTF-8?q?=E4=BD=8D=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E3=80=81=E5=BA=93?=
=?UTF-8?q?=E4=BD=8D=E5=8F=98=E6=9B=B4=E6=8E=A5=E5=8F=A3=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/controllers/controllers.py | 11 ++++++-----
sf_warehouse/models/sync_common.py | 11 ++++++-----
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py
index 6319c050..f35e47ed 100644
--- a/sf_manufacturing/controllers/controllers.py
+++ b/sf_manufacturing/controllers/controllers.py
@@ -436,6 +436,7 @@ class Manufacturing_Connect(http.Controller):
DeciveId)))
total_data = request.env['sf.shelf.location.datasync'].sudo().get_total_data()
for item in shelfinfo:
+ logging.info('货架已获取信息:%s' % item)
shelf_barcode = request.env['sf.shelf.location.datasync'].sudo().find_our_code(
total_data, item['Postion'])
location_id = request.env['sf.shelf.location'].sudo().search(
@@ -450,15 +451,15 @@ class Manufacturing_Connect(http.Controller):
if tool:
location_id.product_sn_id = tool.barcode_id.id
# 修改功能刀具状态
- tool_state = {'Nomal': '正常', 'Warning': '报警'}
- if tool_state.get(item.get('State')):
- if tool_state.get(item.get('State')) != tool.functional_tool_status:
+ if item.get('State') == '报警':
+ if tool.functional_tool_status != item.get('State'):
tool.write({
- 'functional_tool_status': tool_state.get(item['State'])
+ 'functional_tool_status': item['State']
})
else:
location_id.product_sn_id = False
- logging.info('货架已获取信息:%s' % item)
+ if item['RfidCode']:
+ logging.info('Rfid为【%s】的功能刀具在系统中不存在!' % item['RfidCode'])
else:
equipment_id = request.env['maintenance.equipment'].sudo().search([('name', '=', DeciveId)])
if equipment_id:
diff --git a/sf_warehouse/models/sync_common.py b/sf_warehouse/models/sync_common.py
index 3d28583c..aaa186f9 100644
--- a/sf_warehouse/models/sync_common.py
+++ b/sf_warehouse/models/sync_common.py
@@ -110,6 +110,7 @@ class MrsShelfLocationDataSync(models.Model):
total_data = self.get_total_data()
print('shelfinfo:', shelfinfo)
for item in shelfinfo:
+ logging.info('货架已获取信息:%s' % item)
shelf_barcode = self.find_our_code(total_data, item['Postion'])
location_id = self.env['sf.shelf.location'].search([('barcode', '=', shelf_barcode)], limit=1)
if location_id:
@@ -121,14 +122,15 @@ class MrsShelfLocationDataSync(models.Model):
if tool:
location_id.product_sn_id = tool.barcode_id.id
# 修改功能刀具状态
- tool_state = {'Nomal': '正常', 'Warning': '报警'}
- if tool_state.get(item.get('State')):
- if tool_state.get(item.get('State')) != tool.functional_tool_status:
+ if item.get('State') == '报警':
+ if tool.functional_tool_status != item.get('State'):
tool.write({
- 'functional_tool_status': tool_state.get(item['State'])
+ 'functional_tool_status': item['State']
})
else:
location_id.product_sn_id = False
+ if item['RfidCode']:
+ logging.info('Rfid为【%s】的功能刀具在系统中不存在!' % item['RfidCode'])
else:
stock_lot_obj = self.env['stock.lot'].search([('rfid', '=', item['RfidCode'])], limit=1)
if stock_lot_obj:
@@ -136,7 +138,6 @@ class MrsShelfLocationDataSync(models.Model):
else:
location_id.product_sn_id = False
- logging.info('货架已获取信息:%s' % item)
except Exception as e:
logging.info("捕获错误信息:%s" % e)
raise ValidationError("数据错误导致同步失败,请联系管理员")