Jianw
2025-05-14 29f8b36ebb718d2051bf0e7e701973ec4419ee80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--[[
    编码: WMS-13-06
    名称: 预收货通知-新增界面选择来源单号前
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeSelectBSNo
 
    功能:
        1)新增ASN的时候根据来源类型获取来源单号,便于根据来源单中的物料明细生成ASN明细
        2)设置弹出选择面板及查询条件
 
    更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function BeforeSelectBSNo ( strLuaDEID )
    local nRet, strRetInfo
    local strBSType = ''
    local strClsID = ''
 
    -- 获取界面上输入的 业务类型
    nRet, strBSType = m3.GetSysCurEditDataOneAttr( strLuaDEID, "S_BS_TYPE" ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetSysCurEditDataOneAttr失败! "..strBSType ) end
    -- 如果业务类型为空,不能做查询
    if ( strBSType == '') then lua.Error( strLuaDEID, debug.getinfo(1), "请先选来源类型!") end
    if ( strBSType == '采购订单') then
        strClsID = 'Purchase_Order'
    else
        lua.Error( strLuaDEID, debug.getinfo(1), "不合法的来源类型!")
    end
    local strCondition = "S_STATE = '执行'"      -- 只列出还没有执行完成的采购订单
    local strOrder = "S_NO"                      -- 根据采购订单编码进行排序
    
    local action = '[{"action_type":"open_data_query_dlg","value":{"multi_choice":false,"cls_name":"'..strClsID..'","grid_style":"选择面板用","order":"'..strOrder..'","condition":"'..strCondition..'"}}]'
    nRet, strRetInfo = mobox.setAction( strLuaDEID, action )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
end