From 3e7bef095c11f3c0928a5b683b49bc1604384330 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 24 Apr 2024 14:23:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/controllers/controllers.py | 50 --------------------- sf_warehouse/models/model.py | 11 +---- 2 files changed, 1 insertion(+), 60 deletions(-) diff --git a/sf_manufacturing/controllers/controllers.py b/sf_manufacturing/controllers/controllers.py index c7af1b09..4c2b4a15 100644 --- a/sf_manufacturing/controllers/controllers.py +++ b/sf_manufacturing/controllers/controllers.py @@ -381,41 +381,6 @@ class Manufacturing_Connect(http.Controller): temp_val_sn_id = None old_localtion = None - # Part、Tool - # if ChangeType == 'Part': - # workorder = request.env['mrp.workorder'].sudo().search( - # [('rfid_code', '=', RfidCode)], limit=1) - # if not workorder: - # res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未根据RfidCode找到该工单'} - # return json.JSONEncoder().encode(res) - # old_localtion = request.env['sf.shelf.location'].sudo().search( - # [('barcode', '=', OldPosition)], limit=1) - # new_localtion = request.env['sf.shelf.location'].sudo().search( - # [('barcode', '=', NewPosition)], limit=1) - # if not new_localtion: - # res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'} - # return json.JSONEncoder().encode(res) - # if old_localtion: - # old_localtion.location_status = '空闲' - # old_localtion.production_id = False - # new_localtion.location_status = '占用' - # new_localtion.production_id = workorder.production_id.id - # if ChangeType == 'Tool': - # old_localtion = request.env['sf.shelf.location'].sudo().search( - # [('barcode', '=', OldPosition)], limit=1) - # equipment_id = request.env['maintenance.equipment'].sudo().search( - # [('name', '=', NewPosition)], limit=1) - # equipment_id.register_equipment_tool() - # if not equipment_id: - # res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'} - # return json.JSONEncoder().encode(res) - # if old_localtion: - # old_localtion.location_status = '空闲' - # old_localtion.production_id = False - # - # # return json.JSONEncoder().encode(res) - # # else: - # # res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'} if ChangeType == 'Part' or ChangeType == 'Tool': stock_lot_obj = request.env['stock.lot'].sudo().search( [('rfid', '=', RfidCode)], limit=1) @@ -436,21 +401,6 @@ class Manufacturing_Connect(http.Controller): new_localtion.product_sn_id = temp_val_sn_id else: new_localtion.product_sn_id = stock_lot_obj.id - # if ChangeType == 'Tool': - # old_localtion = request.env['sf.shelf.location'].sudo().search( - # [('barcode', '=', OldPosition)], limit=1) - # equipment_id = request.env['maintenance.equipment'].sudo().search( - # [('name', '=', NewPosition)], limit=1) - # equipment_id.register_equipment_tool() - # if not equipment_id: - # res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'} - # return json.JSONEncoder().encode(res) - # if old_localtion: - # old_localtion.product_sn_id = None - - # return json.JSONEncoder().encode(res) - # else: - # res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'} except Exception as e: res = {'Succeed': False, 'ErrorCode': 202, 'Error': e} logging.info('LocationChange error:%s' % e) diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 3a98116a..b5c0d099 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -495,19 +495,10 @@ class ShelfLocation(models.Model): # 调取获取货位信息接口 def get_sf_shelf_location_info(self): - # sf_sync_config = self.env['res.config.settings'].get_values() - # token = sf_sync_config['token'] - # sf_secret_key = sf_sync_config['sf_secret_key'] - # headers = Common.get_headers(self, token, sf_secret_key) - # strurl = sf_sync_config['sf_url'] + self.crea_url + 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/GetLocationInfos" - # headers = {'Authorization': 'Ba F2CF5DCC-1A00-4234-9E95-65603'} - # crea_url = 'https://x24467i973.zicp.fun/AutoDeviceApi/GetLocationInfos' - # objs_all = self.env['maintenance.equipment'].search([('id', '=', self.id)]) - # machine_tool_list = [] params = {'DeviceId': 'Cabinet-AL'} r = requests.get(crea_url, params=params, headers=headers)