新增获取库区信息定时器

修改库存变更接口
This commit is contained in:
qihao.gong@jikimo.com
2024-02-23 15:31:25 +08:00
parent 99ba2d0a4d
commit c726bb614c
8 changed files with 57 additions and 14 deletions

View File

@@ -320,22 +320,20 @@ class Manufacturing_Connect(http.Controller):
workorder = request.env['mrp.workorder'].sudo().search(
[('rfid_code', '=', RfidCode)], limit=1)
if not workorder:
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未找到该工单'}
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': '没有该存储位置'}
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'}
return json.JSONEncoder().encode(res)
if workorder and old_localtion and new_localtion:
if old_localtion:
old_localtion.location_status = '空闲'
new_localtion.location_status = '占用'
new_localtion.production_id = workorder.production_id.id
if old_localtion == 'None':
new_localtion.location_status = '占用'
new_localtion.production_id = workorder.production_id.id
old_localtion.production_id = False
new_localtion.location_status = '占用'
new_localtion.production_id = workorder.production_id.id
# return json.JSONEncoder().encode(res)
# else:
# res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'}