--[[
|
编码: JX-105-11
|
名称: 出库波次-创建空料箱出库作业
|
作者:HAN
|
日期: 2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: CreateOutOperation
|
|
功能:
|
-- 适用于行、页面按钮调用
|
-- 获取【出库波次】中的配盘数据对象,
|
-- 每个配盘对象创建一个{货品出库}作业,容器加出库锁
|
|
更改记录:
|
|
--]]
|
|
wms_wh = require( "wms_wh" )
|
jx_base= require( "jx_base" )
|
|
function CreateOutOperation( strLuaDEID )
|
local nRet, strRetInfo, n, m
|
local data_json, obj_attrs
|
|
nRet, data_json = m3.GetSysDataJson( strLuaDEID )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), data_json ) end
|
|
local strCondition, strUpdateSql
|
local distribution_objs, distribution
|
|
for n = 1, #data_json do
|
obj_attrs = m3.KeyValueAttrsToObjAttr( data_json[1].attrs )
|
|
strCondition = "S_BS_NO = '"..obj_attrs.S_WAVE_NO.."'"
|
nRet, distribution_objs = m3.QueryDataObject(strLuaDEID, "Distribution_CNTR", strCondition, "" )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1),"QueryDataObject失败!"..distribution_objs ) end
|
|
-- 根据每个配盘生成出库作业
|
for m = 1, #distribution_objs do
|
distribution = m3.KeyValueAttrsToObjAttr(distribution_objs[m].attrs)
|
nRet, strRetInfo = jx_base.Create_Distribution_OutOperation ( strLuaDEID, distribution )
|
if ( nRet ~= 0 ) then
|
mobox.stopProgram( strLuaDEID, strRetInfo )
|
return
|
end
|
end
|
|
-- 更新出库波次的状态 N_B_STATE = 3 表示已经创建作业
|
strUpdateSql = "N_B_STATE = 3"
|
strCondition = "S_WAVE_NO = '"..obj_attrs.S_WAVE_NO.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Outbound_Wave", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【出库波次】状态失败!"..strRetInfo ) end
|
|
-- 更新出库单状态为 作业中3
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Outbound_Order", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【出库单】状态失败!"..strRetInfo ) end
|
|
end
|
|
local action = {
|
{
|
action_type = "refresh",
|
value = ""
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str( action ))
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end
|
end
|