鼎捷T100—二次开发:利用开窗多选实现批量插入单身

最近解决系统bug的同时,发现了系统作业中可以通过开窗多选勾选的方式,一次性批量插入对应的料号的数据进入单身表,特此记录一

ON ACTION controlp INFIELD xmzzucdoc001

LET g_qryparam.state = "c" #多选
LET g_qryparam.reqry = TRUE #全部展示

CALL cq_xmzzuc001() #料号开窗

IF g_qryparam.str_array.getLength() <= 1 THEN

	IF g_qryparam.str_array.getLength()=1 THEN #如果只有一笔时
		LET g_xmzzuc_d[l_ac].xmzzuc001 = g_qryparam.str_array[1]
		DISPLAY g_xmzzuc_d[l_ac].sfeb001 TO sfeb001
	ELSE
		LET g_xmzzuc_d[l_ac].sfeb001 = g_qryparam.return1
		DISPLAY g_xmzzuc_d[l_ac].xmzzuc001 TO xmzzuc001
	END IF
	INITIALIZE g_qryparam.str_array TO NULL
ELSE
	LET l_multi_xmzzuc_ins = TRUE
	CALL cxmt666_unlock_b("xmzzuc","'1'") #关闭游标
	CALL s_transaction_end('Y','0')#结束事务
END IF
	



#如果l_multi_xmzzuc_ins = TRUE 表示开窗多选,执行多选的方案
IF l_multi_xmzzuc_ins THEN
	LET g_errshow = 0
	CALL cl_err_collect_init()
	CALL s_transaction_begin()
	IF cxmt666_multi_xmzzuc_ins(g_xmza_m.xmzadocno) THEN #将料件编号开窗勾选资料,整批写入单身中
	CALL s_transaction_end('Y','0')
	ELSE
	CALL s_transaction_end('N','0')
	END IF





#定义asft340_multi_sfeb_ins()方法
PRIVATE FUNCTION cxmt666_multi_xmzzuc_ins(p_xmzzucent)
DEFINE p_xmzzucdocno LIKE xmzzuc_t.xmzzucdocno
DEFINE l_xmzzuc RECORD
	xmzzucent LIKE xmzzuc_t.xmzzucent,
	xmzzucsite LIKE xmzzuc_t.xmzzucsite,
	xmzzucdocno LIKE xmzzuc_t.xmzzucdocno,
	xmzzucseq LIKE xmzzuc_t.xmzzucseq,
	xmzzuc001 LIKE xmzzuc_t.xmzzuc001,
	xmzzuc002 LIKE xmzzuc_t.xmzzuc002,
	xmzzuc003 LIKE xmzzuc_t.xmzzuc003,
	xmzzuc004 LIKE xmzzuc_t.xmzzuc004,
	xmzzuc005 LIKE xmzzuc_t.xmzzuc005,
	xmzzuc006 LIKE xmzzuc_t.xmzzuc006,
	xmzzuc007 LIKE xmzzuc_t.xmzzuc007,
	xmzzuc008 LIKE xmzzuc_t.xmzzuc008,
	xmzzuc009 LIKE xmzzuc_t.xmzzuc009,
	xmzzuc010 LIKE xmzzuc_t.xmzzuc010,
	xmzzuc011 LIKE xmzzuc_t.xmzzuc011,
	xmzzuc012 LIKE xmzzuc_t.xmzzuc012
END RECORD

DEFINE  l_i           LIKE type_t.num10
DEFINE r_success LIKE type_t.num5
DEFINE l_xmzzucseq LIKE xmzzuc_t.xmzzucseq

LET r_success = TRUE
	
	SELECT MAX(xmzzucseq) INTO l_xmzzucseq FROM sfeb_t
    	WHERE xmzzucent = g_enterprise AND xmzzucdocno = p_xmzzucdocno
    	
    IF cl_null(l_xmzzucseq) THEN
    	LET l_xmzzucseq = 0
    END IF
    
    
    FOR l_i TO g_qryparam.str_array.getLength()
    	##初始化
    	INITIALIZE l_xmzzuc TO NULL
    	LET l_xmzzuc.xmzzuc001 = g_qryparam.str_array[l_i]
    	LET l_xmzzuc.xmzzuc002 = ""
    	LET l_xmzzuc.xmzzuc003 = 0
    	LET l_xmzzuc.xmzzuc004 = ""
    	LET l_xmzzuc.xmzzuc005 = ""
    	LET l_xmzzuc.xmzzuc006 = 0
    	LET l_xmzzuc.xmzzuc007 = 0
    	LET l_xmzzuc.xmzzuc008 = 0
    	LET l_xmzzuc.xmzzuc009 = 0
    	LET l_xmzzuc.xmzzuc010 = 0
    	LET l_xmzzuc.xmzzuc011 = ""
    	LET l_xmzzuc.xmzzuc012 = ""
    	LET l_xmzzucseq = l_xmzzucseq + 1
    	
    	
    	
    	##自定义校验
    	
    	
    	##INSERT
    	
    	INSERT INTO xmzzuc_t (xmzzucent,xmzzucsite,xmzzucdocno,xmzzucseq,xmzzuc001,xmzzuc002,xmzzuc003,xmzzuc004,xmzzuc005,xmzzuc006,xmzzuc007,xmzzuc008,xmzzuc009,xmzzuc010,xmzzuc011,xmzzuc012)
    	VALUES (g_enterprise,l_xmzzuc.xmzzucseq,p_xmzzucdocno,l_xmzzucseq,l_xmzzuc.xmzzuc001,l_xmzzuc.xmzzuc002,l_xmzzuc.xmzzuc003,l_xmzzuc.xmzzuc005,l_xmzzuc.xmzzuc006,l_xmzzuc.xmzzuc007,l_xmzzuc.xmzzuc008,l_xmzzuc.xmzzuc009,l_xmzzuc.xmzzuc010,l_xmzzuc.xmzzuc011,l_xmzzuc.xmzzuc012)
    	
    	IF SQL.sqlcode THEN
    		INITALIZE g_errparam TO NULL
    		LET g_errparam.code=SQLCA.sqlcode
    		LET g_errparam.extend="xmzzuc_t"
    		LET g_errparam.popup=FALSE
    		CALL cl_err()
    		CONTINUE FOR
    	END IF
    	
    END FOR
    
    RETURN r_success
    	
END FUNCTION

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值