Accept Merge Request #854: (feature/修改机床参数bug -> develop)
Merge Request: 修改库位变更接口 Created By: @龚启豪 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/854#mr-854-review-127659
This commit is contained in:
@@ -330,23 +330,39 @@ class Manufacturing_Connect(http.Controller):
|
|||||||
NewPosition = ret['NewPosition']
|
NewPosition = ret['NewPosition']
|
||||||
OldDeciveStart = ret['OldDeciveStart']
|
OldDeciveStart = ret['OldDeciveStart']
|
||||||
OldDeciveEnd = ret['OldDeciveEnd']
|
OldDeciveEnd = ret['OldDeciveEnd']
|
||||||
workorder = request.env['mrp.workorder'].sudo().search(
|
# Part、Tool
|
||||||
[('rfid_code', '=', RfidCode)], limit=1)
|
if ChangeType == 'Part':
|
||||||
if not workorder:
|
workorder = request.env['mrp.workorder'].sudo().search(
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未根据RfidCode找到该工单'}
|
[('rfid_code', '=', RfidCode)], limit=1)
|
||||||
return json.JSONEncoder().encode(res)
|
if not workorder:
|
||||||
old_localtion = request.env['sf.shelf.location'].sudo().search(
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '未根据RfidCode找到该工单'}
|
||||||
[('barcode', '=', OldPosition)], limit=1)
|
return json.JSONEncoder().encode(res)
|
||||||
new_localtion = request.env['sf.shelf.location'].sudo().search(
|
old_localtion = request.env['sf.shelf.location'].sudo().search(
|
||||||
[('barcode', '=', NewPosition)], limit=1)
|
[('barcode', '=', OldPosition)], limit=1)
|
||||||
if not new_localtion:
|
new_localtion = request.env['sf.shelf.location'].sudo().search(
|
||||||
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'}
|
[('barcode', '=', NewPosition)], limit=1)
|
||||||
return json.JSONEncoder().encode(res)
|
if not new_localtion:
|
||||||
if old_localtion:
|
res = {'Succeed': False, 'ErrorCode': 202, 'Error': '没有该目标位置'}
|
||||||
old_localtion.location_status = '空闲'
|
return json.JSONEncoder().encode(res)
|
||||||
old_localtion.production_id = False
|
if old_localtion:
|
||||||
new_localtion.location_status = '占用'
|
old_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
|
||||||
|
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 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
|
||||||
|
|
||||||
|
|
||||||
# return json.JSONEncoder().encode(res)
|
# return json.JSONEncoder().encode(res)
|
||||||
# else:
|
# else:
|
||||||
# res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'}
|
# res = {'Succeed': False, 'ErrorCode': 201, 'Error': '未传RfidCode字段'}
|
||||||
|
|||||||
Reference in New Issue
Block a user