--[[
|
编码: AMS-90-02
|
名称: SKU-修改前
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: BeforeDataObjModify
|
来源:
|
巨星二期料箱库
|
功能:
|
根据输入的长中短边计算料箱类型
|
|
更改记录:
|
|
--]]
|
prj_base= require( "prj_base" )
|
|
function BeforeDataObjModify ( strLuaDEID )
|
local nRet, strRetInfo
|
local sku
|
nRet, sku = m3.GetSysCurEditDataObj( strLuaDEID, "SKU" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..cg_detail ) end
|
|
-- 设置【料箱类型】信息
|
-- local str_cell_type = ''
|
|
-- nRet, strRetInfo = prj_base.GetBoxStyle( strLuaDEID, sku.long, sku.middle, sku.short )
|
-- if ( nRet ~= 0 ) then
|
-- strRetInfo = ''
|
-- else
|
-- -- 获取最小的 cell_type
|
-- local box_style = json.decode( strRetInfo )
|
-- local n = #box_style
|
-- if ( n > 0 ) then str_cell_type = box_style[n] end
|
-- end
|
local abc_type
|
if sku.abc_type == 'D' then
|
abc_type = "D"
|
else
|
abc_type = "ABC"
|
end
|
|
if(sku.loading_limit == nil or sku.loading_limit == '' or tonumber(sku.loading_limit) == 0)then
|
if(sku.weight == nil or sku.weight == '' or tonumber(sku.weight) == 0)then
|
lua.Stop( strLuaDEID, "数量上限和单件重量必须有一个有值!")
|
return
|
end
|
else
|
if(tonumber(sku.weight) > 0)then
|
lua.Stop( strLuaDEID, "数量上限和单件重量有且只有一个有值!")
|
return
|
end
|
end
|
|
local attr_value = {
|
-- { attr = "S_AVL_SPEC", value = strRetInfo },
|
-- { attr = "S_CELL_TYPE", value = str_cell_type },
|
{ attr = "S_UDF19", value = abc_type },
|
{ attr = "S_UDF20", value = sku.count_method },
|
{ attr = "F_VOLUME", value = sku.long * sku.middle * sku.short }
|
}
|
nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【物料】信息失败! "..strRetInfo ) end
|
end
|