--[[
|
编码: AMS-24-03
|
名称:
|
作者:
|
日期:2025-05-07
|
|
函数: BeforeDataObjDelete
|
功能:
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require ("oi_base_mobox")
|
|
function BeforeDataObjDelete( strLuaDEID )
|
|
m3.PrintLuaDEInfo( strLuaDEID )
|
local nRet, strRetInfo
|
local outbound_order = {}
|
nRet, outbound_order = m3.GetCurEditDataObj( strLuaDEID )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败!"..outbound_order ) end
|
|
if (outbound_order.state == '发布') then
|
-- 用于校验入库单的状态值,料箱库的入库单看N_B_STATE,人工库的看累计入库数量是否有值
|
strCondition = "S_BS_NO = '"..outbound_order.bs_no.."' AND N_B_STATE <> 0 AND S_AREA_CODE = '料箱库' "
|
nRet, outbound_date = m3.QueryDataObject(strLuaDEID, "Outbound_Order", strCondition)
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID,"查询对应的入库单失败!:"..outbound_order.no)
|
return
|
end
|
if (outbound_date ~= "") then
|
lua.Stop(strLuaDEID,"该来源单号对应的入库单有非新建状态,不可删除!"..outbound_order.no)
|
return
|
end
|
|
-- 这个是校验入库单明细有已入库的数据
|
Condition = "S_IO_NO IN (SELECT S_NO FROM TN_Outbound_Order WHERE S_BS_NO = '"..outbound_order.bs_no.."') AND F_ACC_O_QTY <> 0 "
|
nRet, container_data = m3.QueryDataObject(strLuaDEID, "Outbound_Detail", Condition)
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID,"查询对应的入库单失败!:!"..outbound_order.no)
|
return
|
end
|
|
if (container_data ~= "") then
|
lua.Stop(strLuaDEID,"该来源单号对应的入库单明细有已入库的数据,不可删除!"..outbound_order.no)
|
return
|
end
|
end
|
|
|
if(outbound_order.state ~= '新建' and outbound_order.state ~= '发布') then
|
lua.Stop(strLuaDEID,"该单据非新建状态不可删除"..outbound_order.no)
|
return
|
end
|
|
end
|