1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- $PBExportHeader$f_setwarebalc_log.srf
- global type f_setwarebalc_log from function_object
- end type
- forward prototypes
- global function integer f_setwarebalc_log (long arg_balcdateint, long arg_storageid, integer arg_type, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- global function integer f_setwarebalc_log (long arg_balcdateint, long arg_storageid, integer arg_type, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
- DateTime server_datetime
- SELECT Top 1 getdate() INTO :server_datetime FROM u_user;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = "查询操作失败,日期 "
- GOTO ext
- END IF
- IF arg_type = 0 THEN //结存
- INSERT INTO u_warebalc_log
- (balcdateint,
- storageid,
- opemp,
- opdate)
- VALUES
- (:arg_balcdateint,
- :arg_storageid,
- :publ_operator,
- :server_datetime);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '插入结存日志失败'+'~n'+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSE //反结存
- DELETE FROM u_warebalc_log
- WHERE balcdateint = :arg_balcdateint
- AND storageid = :arg_storageid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除结存日志失败'+'~n'+sqlca.SQLErrText
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
|