$PBExportHeader$w_mtrl_storage.srw forward global type w_mtrl_storage from w_publ_base end type type dw_1 from u_dw_rbtnfilter within w_mtrl_storage end type end forward global type w_mtrl_storage from w_publ_base integer width = 1787 integer height = 1516 string title = "物料仓库设定" boolean minbox = false windowtype windowtype = response! dw_1 dw_1 end type global w_mtrl_storage w_mtrl_storage type variables long cur_mtrlid end variables forward prototypes public subroutine readinfo () public function integer whiteinfo (ref string arg_msg) public function integer wf_find_nullstorage (ref string arg_msg) end prototypes public subroutine readinfo ();long ll_storageid long ll_dft int ls_i=1,ls_rowcount ls_rowcount=dw_1.rowcount() DECLARE cur_mtrl CURSOR FOR select storageid,dft from u_mtrl_storage where mtrlid=:cur_mtrlid order by storageid; open cur_mtrl; FETCH cur_mtrl INTO :ll_storageid,:ll_dft; do while sqlca.sqlcode=0 for ls_i=1 to ls_rowcount if (ll_storageid=dw_1.object.storageid[ls_i]) then dw_1.object.checkbox[ls_i]=1 dw_1.object.dft[ls_i]=ll_dft exit end if next FETCH cur_mtrl INTO :ll_storageid,:ll_dft; loop close cur_mtrl; dw_1.accepttext() end subroutine public function integer whiteinfo (ref string arg_msg);long ll_storageid[],ll_dft[] int ls_i,ls_rowcount,count int rslt=1 uo_mtrldef uo_mtrl uo_mtrl = create uo_mtrldef uo_mtrl.commit_transaction = sqlca dw_1.accepttext() ls_rowcount=dw_1.rowcount() count = 0 for ls_i=1 to ls_rowcount if dw_1.object.checkbox[ls_i]=1 then count++ ll_storageid[count]=dw_1.object.storageid[ls_i] ll_dft[count]=dw_1.object.dft[ls_i] end if next if uo_mtrl.p_insert_storage(cur_mtrlid, ll_storageid,ll_dft,true, arg_msg) = 0 then rslt = 0 goto ext end if destroy uo_mtrl ext: return rslt end function public function integer wf_find_nullstorage (ref string arg_msg);int ls_i,ls_rowcount,cnt int rslt=1 dw_1.accepttext() ls_rowcount=dw_1.rowcount() ls_i=1 do while (ls_i<=ls_rowcount) if (dw_1.object.checkbox[ls_i]=1) then exit end if ls_i++ loop if ls_i>ls_rowcount then rslt=0 arg_msg="请选择仓库" goto ext end if for ls_i=1 to ls_rowcount if dw_1.object.dft[ls_i]= 1 then cnt ++ end if next if cnt > 1 then rslt=0 arg_msg="默认反扣仓库不能选择多个" goto ext end if ext: return rslt end function on w_mtrl_storage.create int iCurrent call super::create this.dw_1=create dw_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 end on on w_mtrl_storage.destroy call super::destroy destroy(this.dw_1) end on event open;call super::open;dw_1.settransobject (sqlca) dw_1.retrieve() cur_mtrlid=message.DoubleParm int ls_mtrlcount=0 select count(*) into :ls_mtrlcount from u_mtrldef where mtrlid=:cur_mtrlid; if sqlca.sqlcode<>0 or ls_mtrlcount<=0 then messagebox('提示','错误的物料ID', Information!, OK! ) close(this) end if readinfo() end event type cb_func from w_publ_base`cb_func within w_mtrl_storage integer x = 1106 integer y = 1316 integer width = 311 integer height = 96 string text = "确定" string normalpicname = "ok.bmp" toolbaralignment pic_align = alignatleft! boolean border = true end type event cb_func::clicked;call super::clicked;string ls_msg='' if wf_find_nullstorage(ls_msg)=0 then messagebox('提示',ls_msg , Information!, OK! ) return end if if whiteinfo(ls_msg)=0 then messagebox('提示',ls_msg , Information!, OK! ) rollback; return else commit; messagebox('提示','保存成功!', Information!, OK! ) close(parent) end if end event type cb_exit from w_publ_base`cb_exit within w_mtrl_storage integer x = 1426 integer y = 1316 end type type dw_1 from u_dw_rbtnfilter within w_mtrl_storage integer width = 1765 integer height = 1288 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_choose_storage" boolean vscrollbar = true end type