json = require("json") mobox = require("OILua_JavelinExt") m3 = require("oi_base_mobox") wms_task = require("wms_task") function test(strLuaDEID) -- 获取作业信息 local condition = "S_CODE = ''" nRet, operation = m3.GetDataObjByCondition(strLuaDEID, "Operation", condition) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), operation) end -- 获取扩展数据参数 local ext_data = json.decode(operation.ext_data) local delivery_no = ext_data.delivery_no -- 业务单号为 出库单号 --获取出库单信息 local stock_out condition = "S_DO_NO = '" .. delivery_no .. "'" nRet, stock_out = m3.GetDataObjByCondition(strLuaDEID, "GT_Stock_Out", condition) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), stock_out) end -- 获取容器货品明细 local cg_detail condition = "S_CNTR_CODE = '" .. operation.cntr_code .. "'" nRet, cg_detail = m3.GetDataObjByCondition(strLuaDEID, "CG_Detail", condition) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), cg_detail) end -- 获取入库单据行信息 local label_crad local strCondition = "S_SERIAL_NO = '" .. cg_detail.serial_no .. "'" if (tonumber(cg_detail.is_tl) == 1) then nRet, label_crad = m3.GetDataObjByCondition(strLuaDEID, "GT_ROM", strCondition, "T_CREATE DESC") if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "获取流水号信息失败!" .. label_crad) end else nRet, label_crad = m3.GetDataObjByCondition(strLuaDEID, "GT_Label_Crad", strCondition, "T_CREATE DESC") if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "获取流水号信息失败!" .. label_crad) end end -- 获取入库单据头信息 local incoming_Info condition = "S_DELIVERY_NO = '" .. label_crad.delivery_no .. "' AND N_DELIVERY_ROW_NO = '" .. label_crad.delivery_row_no .. "'" nRet, incoming_Info = m3.GetDataObjByCondition(strLuaDEID, "GT_Incoming_Info", condition, "T_CREATE DESC") if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "获取入库单据头信息失败!" .. incoming_Info) end -- 出库结果回传 local data local source = "GTWMS出库回传" nRet, data = StorageResult(strLuaDEID, operation.code, source) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "出库结果回传失败!" .. data) end lua.Debug(strLuaDEID, debug.getinfo(1), 'data', data) -- 调用GT-WMS的回传接口 local url = wms_base.Get_sConst(strLuaDEID, "GTWMS-url") local strurl = url local strHeader = "" local strBody = { application = "GITI", code = "WCS_SO_WMS", data = data } nRet, strRetInfo = CreateInterfaceExc(strLuaDEID, strurl, strHeader, strBody, "GTWMS", source) if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "调用接口失败!" .. strRetInfo) end end