$PBExportHeader$dbauo_mtrlware.sru forward global type dbauo_mtrlware from nonvisualobject end type end forward global type dbauo_mtrlware from nonvisualobject end type global dbauo_mtrlware dbauo_mtrlware type variables //==================================================================== // 事件: .Declare Instance Variables() //-------------------------------------------------------------------- // 描述: //-------------------------------------------------------------------- // 参数: //-------------------------------------------------------------------- // 返回: (none) //-------------------------------------------------------------------- // 作者: lwl 日期: 2011年05月20日 //-------------------------------------------------------------------- // LONGJOE //-------------------------------------------------------------------- // 修改历史: // //==================================================================== long ins_mtrlid string ins_mtrlcuscode string ins_status string ins_pcode string ins_woodcode decimal ins_noallocqty decimal ins_tempqty dbauo_mtrlwaremx mx[] end variables forward prototypes public subroutine f_init (long arg_mtrlid, string arg_mtrlcuscode, string arg_status, string arg_pcode, string arg_woodcode) public subroutine f_clear () public function dbauo_mtrlwaremx f_find (long arg_mtrlwareid) end prototypes public subroutine f_init (long arg_mtrlid, string arg_mtrlcuscode, string arg_status, string arg_pcode, string arg_woodcode);ins_mtrlid = arg_mtrlid ins_mtrlcuscode = arg_mtrlcuscode ins_status = arg_status ins_pcode = arg_pcode ins_woodcode = arg_woodcode ins_noallocqty = 0 Long ll_scid, arr_scid[], ll_mtrlwareid, arr_mtrlwareid[] Decimal ld_noallocqty, arr_noallocqty[] Long ll_cnt = 0 DECLARE cur1 CURSOR FOR SELECT u_mtrlware.scid, u_mtrlware.mtrlwareid, u_mtrlware.noallocqty FROM u_mtrlware INNER JOIN u_storage ON u_mtrlware.storageid = u_storage.storageid WHERE u_storage.storagetype = 1 AND u_mtrlware.noallocqty > 0 AND u_mtrlware.mtrlid = :ins_mtrlid AND u_mtrlware.mtrlcuscode = :ins_mtrlcuscode AND u_mtrlware.status = :ins_status AND u_mtrlware.pcode = :ins_pcode AND u_mtrlware.woodcode = :ins_woodcode Order By u_mtrlware.scid, u_mtrlware.mtrlwareid; OPEN cur1; FETCH cur1 Into :ll_scid, :ll_mtrlwareid, :ld_noallocqty; DO WHILE sqlca.SQLCode = 0 ll_cnt++ arr_scid[ll_cnt] = ll_scid arr_mtrlwareid[ll_cnt] = ll_mtrlwareid arr_noallocqty[ll_cnt] = ld_noallocqty ins_noallocqty += ld_noallocqty FETCH cur1 Into :ll_scid, :ll_mtrlwareid, :ld_noallocqty; LOOP CLOSE cur1; Long ll_i f_clear() FOR ll_i = 1 To ll_cnt mx[ll_i] = Create dbauo_mtrlwaremx mx[ll_i].f_init(This, arr_scid[ll_i], arr_mtrlwareid[ll_i], arr_noallocqty[ll_i]) NEXT end subroutine public subroutine f_clear ();long ll_i for ll_i = 1 to upperbound(mx) destroy mx[ll_i] next dbauo_mtrlwaremx mx_empty[] mx = mx_empty end subroutine public function dbauo_mtrlwaremx f_find (long arg_mtrlwareid);dbauo_mtrlwaremx rslt Long ll_i SetNull(rslt) FOR ll_i = 1 To UpperBound(mx) IF mx[ll_i].ins_mtrlwareid = arg_mtrlwareid THEN rslt = mx[ll_i] EXIT END IF NEXT RETURN rslt end function on dbauo_mtrlware.create call super::create TriggerEvent( this, "constructor" ) end on on dbauo_mtrlware.destroy TriggerEvent( this, "destructor" ) call super::destroy end on event destructor;f_clear() end event