--[[
|
编码: WMS-56-23
|
名称: 组盘明细-拣料箱输入变化后
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: AfterUPCChange
|
|
功能:
|
-- 根据扫描的拣料箱号,判断当前扫码的货品是否可以放到扫描的拣料箱中
|
|
更改记录:
|
V2.0 HAN 20250422 JX_Material_Barcode 改为 Material_Barcode
|
|
--]]
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function AfterUPCChange ( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 获取UPC
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "UPC","S_ITEM_CODE","F_ACT_QTY" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end
|
local obj_attrs = json.decode( strRetInfo )
|
local upc = lua.Get_StrAttrValue( obj_attrs[1].value )
|
local item_code = lua.Get_StrAttrValue( obj_attrs[2].value )
|
local act_qty = lua.Get_NumAttrValue( obj_attrs[3].value )
|
if ( upc == '' ) then return end
|
|
-- 通过条码找到物料编码
|
local material_barcode
|
nRet, material_barcode = m3.GetDataObjectByKey(strLuaDEID, "Material_Barcode", "S_BARCODE", upc)
|
|
if (nRet ~= 0 ) then
|
if ( nRet == 1 ) then
|
mobox.setInfo( strLuaDEID, "条码'"..upc.."'没有对应的货品,请检查物料条码对照表!")
|
goto set_dlg_attr
|
end
|
lua.Error( strLuaDEID, debug.getinfo(1), "获取【物料条码】信息失败! " .. material_barcode )
|
end
|
|
-- 判断扫码的货品是否是目前的入库任务
|
if ( item_code ~= material_barcode.item_code ) then
|
mobox.setInfo( strLuaDEID, "条码'"..upc.."'对应的货品编码='"..material_barcode.item_code.."不是当前入库任务中的货物!")
|
goto set_dlg_attr
|
end
|
act_qty = act_qty + 1
|
|
::set_dlg_attr::
|
local action =
|
{
|
{
|
action_type = "set_panel_dlg_attr",
|
value = {
|
panel_name = "组盘输入",
|
attrs = {
|
{
|
attr = "F_ACT_QTY",
|
value = act_qty
|
},
|
{
|
attr = "UPC",
|
value = ""
|
}
|
}
|
}
|
|
}
|
}
|
lua.Debug( strLuaDEID, debug.getinfo(1), "action-AfterUPCChange", action )
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end
|
|
end
|