--[[
|
编码: AMS-20-31
|
名称:
|
作者:
|
日期:2025-04-28
|
|
函数: InitialNewAddDlg
|
功能:
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require ("oi_base_mobox")
|
wms_base = require ("wms_base")
|
|
function InitialNewAddDlg( strLuaDEID )
|
|
local nRet, strRetInfo, factory, data_objs, n
|
|
local nRet,factory = wms_base.Get_sConst2( strLuaDEID, "默认工厂标识" )
|
if ( nRet ~= 0 ) then
|
lua.Stop(strLuaDEID, "系统常量:默认工厂标识不存在:")
|
return
|
end
|
if ( factory == '' ) then
|
lua.Stop(strLuaDEID, "系统常量'默认工厂标识'必须有值!:")
|
return
|
end
|
|
lua.Debug( strLuaDEID, debug.getinfo(1), "factory1 --> ", factory )
|
local choice_list = {}
|
if ( factory ~= '' ) then
|
local strCondition
|
local strOrder = 'S_CODE'
|
strCondition = "S_FACTORY = '"..factory.."'"
|
nRet, data_objs = m3.QueryDataObject( strLuaDEID, "Warehouse", strCondition, strOrder )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【Warehouse】信息失败! " .. data_objs) end
|
|
lua.Debug( strLuaDEID, debug.getinfo(1), "data_objs --> ", data_objs )
|
|
local obj_attrs
|
for n = 1, #data_objs do
|
obj_attrs = m3.KeyValueAttrsToObjAttr(data_objs[n].attrs)
|
table.insert( choice_list, obj_attrs.S_CODE )
|
end
|
end
|
|
-- 获取结算报表有多少种时间段
|
nRet, strRetInfo = mobox.groupDataObjAttr(strLuaDEID, "SKU", "1 = 1", "S_UDF01")
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "无法从【Material】获取信息!" .. strRetInfo)
|
end
|
|
local groups_serial = json.decode(strRetInfo)
|
local serial_list = {}
|
for n = 1, #groups_serial do
|
table.insert(serial_list, groups_serial[n].value)
|
end
|
lua.Debug( strLuaDEID, debug.getinfo(1), "serial_list --> ", serial_list )
|
lua.Debug( strLuaDEID, debug.getinfo(1), "choice_list --> ", choice_list )
|
local action_array = {}
|
action_array[1] = {
|
action_type = "set_dlg_attr",
|
value = {
|
{attr = "S_AREA_CODE", value = serial_list[1], choice_list = serial_list },
|
{attr = "S_WH_CODE", value = choice_list[1], choice_list = choice_list }
|
}
|
}
|
|
local strRetInfo
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "setAction失败! " .. strRetInfo)
|
return
|
end
|
end
|