--[[
|
编码: JX-100-01
|
名称: 空料箱呼出算法
|
作者:HAN
|
日期:2024-8-5
|
|
级别:巨星项目定制
|
|
函数:EmptyBoxCellOutPlan
|
|
功能:
|
空料箱呼出算法
|
|
更改记录:
|
|
]]
|
|
require ("JX-EmptyBoxOutPlan")
|
|
function EmptyBoxCellOutPlan ( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- step1 获取当前点中的任务
|
nRet, objs = GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then Error( strLuaDEID, debug.getinfo(1), objs ) end
|
-- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
|
local nCount = #objs
|
if (nCount == 0) then return end
|
|
-- 获取【入库单】信息
|
local obj_attrs = KeyValueAttrsToObjAttr( objs[1].attrs )
|
local strOpNo = obj_attrs.S_NO
|
local strCondition = "S_IO_NO = '"..obj_attrs.S_NO.."'"
|
local wh_code = obj_attrs.S_WH_CODE
|
local area_code = obj_attrs.S_AREA_CODE
|
|
nRet, data_objs = QueryDataObject(strLuaDEID, "Inbound_Detail", strCondition, "N_ROW_NO" )
|
if (nRet ~= 0) then Error( strLuaDEID, debug.getinfo(1),"QueryDataObject失败!"..data_objs ) end
|
if ( data_objs == '' ) then return end
|
|
local n
|
local item_list = {} -- 需要入库的货品
|
local obj_attrs
|
|
-- 生成要入库的货品链表 item_list
|
for n = 1, #data_objs do
|
obj_attrs = KeyValueAttrsToObjAttr(data_objs[n].attrs)
|
local item = {
|
item_code = obj_attrs.S_ITEM_CODE,
|
item_name = obj_attrs.S_ITEM_NAME,
|
volume = StrToNumber( obj_attrs.F_VOLUME ),
|
weight = StrToNumber( obj_attrs.F_WEIGHT ),
|
cell_type = obj_attrs.S_CELL_TYPE,
|
qty = StrToNumber( obj_attrs.F_QTY ),
|
alloc_qty = 0,
|
cntr_cell_list = {},
|
empty_cell_type = "",
|
Q = 0,
|
ok = false -- true 表示这个货品已经分配好入库料箱
|
}
|
table.insert( item_list, item )
|
end
|
|
local station = 'A' -- 入库单测试用
|
|
local ps_cntr_list = {}
|
local ps_detail_list = {}
|
|
nRet, strRetInfo = JX_EmptyBoxCellOutPlan( strLuaDEID, item_list, wh_code, area_code, station, "入库单", strOpNo, ps_cntr_list, ps_detail_list )
|
if ( nRet ~= 0 ) then
|
if (nRet == 1) then
|
mobox.setInfo( strLuaDEID, strRetInfo )
|
return
|
end
|
Error( strLuaDEID, debug.getinfo(1), "JX_EmptyBoxCellOutPlan错误: "..strRetInfo)
|
end
|
|
local action = {}
|
action[1] =
|
{
|
action_type = "refresh_cur_row",
|
value = ""
|
}
|
|
action[2] =
|
{
|
action_type = "open_html_dlg",
|
value = {
|
dlg_name = "空料箱呼出确认",
|
cls_id = "Inbound_Order",
|
data_json = {
|
cntr_count = #ps_cntr_list,
|
cntr_cell_list = ps_detail_list
|
}
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, table2str(action) )
|
if ( nRet ~= 0 ) then Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end
|
|
end
|