12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- $PBExportHeader$f_oa_update_html.srf
- global type f_oa_update_html from function_object
- end type
- forward prototypes
- global function integer f_oa_update_html (long ll_powerid, long ll_scid, long ll_taskid, long ll_billtype, string ls_html, ref string arg_msg, boolean if_commit)
- end prototypes
- global function integer f_oa_update_html (long ll_powerid, long ll_scid, long ll_taskid, long ll_billtype, string ls_html, ref string arg_msg, boolean if_commit);Int rslt = 1
- Long ll_docid
- SELECT top 1 docid
- INTO :ll_docid
- FROM oa_doc
- WHERE dtype = 1
- AND powerid = :ll_powerid
- AND scid = :ll_scid
- And BILLID = :ll_taskid
- ORDER BY docid desc;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '查询订单对应公文失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- Long arr_fileid[], ll_fileid
- String arr_filename[], ls_filename
- Long i = 0
- IF sys_filedb_sqlca.DBHandle() > 0 THEN
-
- DECLARE cur1 CURSOR FOR
- SELECT FileID, FileName
- FROM u_File
- WHERE billtype = :ll_billtype
- AND relid = :ll_taskid
- AND scid = :ll_scid
- Order By FileName
- Using sys_filedb_sqlca;
-
- OPEN cur1;
- FETCH cur1 Into :ll_fileid, :ls_filename;
- DO WHILE sys_filedb_sqlca.SQLCode = 0
- i++
- arr_fileid[i] = ll_fileid
- arr_filename[i] = ls_filename
- FETCH cur1 Into :ll_fileid, :ls_filename;
- LOOP
- CLOSE cur1;
-
- END IF
- DELETE From oa_doc_bill_fj Where docid = :ll_docid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '删除旧的公文附件连接失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- FOR i = 1 To UpperBound(arr_fileid)
- INSERT INTO oa_doc_bill_fj(docid, printid, fileid, filename)
- Values(:ll_docid, :i, :arr_fileid[i], :arr_filename[i]);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '插入公文附件连接失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- NEXT
- // DONE: 更新html
- Blob lb_html
- lb_html = Blob(ls_html)
- UpdateBlob oa_doc
- Set HTML = :lb_html
- Where docid = :ll_docid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新公文HTML失败,' + sqlca.SQLErrText
- GOTO ext
- END IF
- ext:
- IF rslt = 1 and if_commit THEN
- COMMIT;
- ELSE
- ROLLBACK;
- END IF
- RETURN rslt
- end function
|