PB实现库房批次收发料,先进先出管理功能

前几天发了博客,库房先进先出,实现原理很简单,写了个存储过程判断批次。

文章地址:https://blog.csdn.net/qq_37545120/article/details/83416526

现在我把先进先出的原理和大家分享一下,其实也是超简单,可能因为我是个小白,几百行代码写了三天哈哈哈。

 

首先库房的人跟管事儿的经理肯定都要审核单据。所以得分两种情况。

1.让库房做单子的人看到     2.让库房经理看到。

让库房做单子的人看到,首先他可能做完这个单子审核给他的部门经理,如果不分情况,这个发料单回退的话库房台账还得算库存。所以我分情况来写的


1.让库房做单子的人看到

让库房走发料单的人看,写了一个function:wf_selectmatfrommir

一开始打算写个结构体。后来想想用循环好像比较方便,代码如下,大家可以参考

long ll_row,ll_rows,ll_item
long ll_line
decimal ldec_unit_price,ldec_amount
string ls_po_sn, ls_material_code, ls_bin_sn
datawindow ldw_dw

//edit by zxx :2018-11-8 17:43:57
long ll_item2,ll_line2
string ls_material_code2,ls_po_sn2
decimal req_quantity,rec_price,req_balance_qty,ldec_totalissueqty
string ls_po_sn3,ls_item_code3,ls_batch_no3,ls_bin_sn3
long ll_findmateriallist,ll_mainlistnewrow

ll_rows = tab_1.tabpage_1.dw_requireitem.rowcount()
ldw_dw = tab_1.tabpage_1.dw_requireitem

//将选中需要导入的物资放到结构体中
us_materialforreceive lar_material[]
string ls_mirsn[] //MIR SN
string ls_mircode[] //MIR Code
//string ls_matcode 

//处理选择的物资
//ll_item = 1
ldec_totalissueqty = 0 //该物资累计发料量
for ll_row = 1 to ll_rows
	if ldw_dw.object.selectflag[ll_row] = 'Y' then

		ls_material_code2 = ldw_dw.object.material_code[ll_row] //物资编码

		ls_po_sn2 =	 ldw_dw.object.po_sn[ll_row]
		req_quantity = ldw_dw.object.quantity[ll_row]

		DECLARE INV_WarehouseAccount_Cur CURSOR  FOR
					SELECT  po_sn,item_code,batch_no,bin_sn,price,inv_balance_qty
					FROM INV_WarehouseAccount 
				WHERE db_center =  :gs_dbname
				AND po_sn = :ls_po_sn2
				AND Item_Code = :ls_material_code2
				and inv_balance_qty>0;
				OPEN INV_WarehouseAccount_Cur;
		//循环取到需求量
		FETCH  INV_WarehouseAccount_Cur INTO :ls_po_sn3,:ls_item_code3,:ls_batch_no3,:ls_bin_sn3,:rec_price,:req_balance_qty;
		
		req_balance_qty = req_balance_qty - ldec_totalissueqty
		
			do while sqlca.sqlcode=0
				if req_quantity<=req_balance_qty then
					//	//查找界面中是否有该物资记录,如果有则覆盖
						ll_findmateriallist = adw_issuedet.find(" material_sn = " +string(ldw_dw.object.material_sn[ll_row]),1,ll_rows)
//						if ll_findmateriallist > 0 then
//							ll_mainlistnewrow = ll_findmateriallist
//						else
							//ll_mainlistnewrow = adw_issuedet.insertrow(0)
//						end if
			
					ll_mainlistnewrow = adw_issuedet.insertrow(0)
					adw_issuedet.object.line[ll_mainlistnewrow]=ll_line2
					adw_issuedet.
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值