uo_workprice_change.sru 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552
  1. $PBExportHeader$uo_workprice_change.sru
  2. forward
  3. global type uo_workprice_change from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_workprice_change from nonvisualobject
  7. end type
  8. global uo_workprice_change uo_workprice_change
  9. type variables
  10. long uo_billid
  11. string uo_billcode
  12. long audit_buildtype
  13. string oppreason = ''
  14. end variables
  15. forward prototypes
  16. public function integer updatebegin (long arg_billid, ref string arg_msg)
  17. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  18. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit)
  19. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  20. public function integer getinfo (long arg_billid, ref s_workprice_changemx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg)
  21. public function integer save (s_workprice_change arg_s_workprice, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  22. public function integer uof_mod_rsltflag (long arg_billid, long arg_printid, integer arg_rsltflag, ref string arg_msg, boolean arg_ifcommit)
  23. public function integer priceaudit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit)
  24. public function integer c_priceaudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit)
  25. public function integer p_getflag (long arg_billid, ref integer arg_flag, ref integer arg_priceflag, ref string arg_msg)
  26. end prototypes
  27. public function integer updatebegin (long arg_billid, ref string arg_msg);Int rslt = 1
  28. Int li_flag,li_priceflag
  29. Long cnt
  30. IF arg_billid <= 0 THEN
  31. rslt = 0
  32. arg_msg = '错误单据唯一码'
  33. GOTO ext
  34. END IF
  35. IF p_getflag(arg_billid,li_flag,li_priceflag,arg_msg) = 0 THEN
  36. rslt = 0
  37. GOTO ext
  38. END IF
  39. if li_priceflag = 1 then
  40. rslt = 0
  41. arg_msg = '单据已经确认,不可以再修改'
  42. GOTO ext
  43. END IF
  44. IF li_flag = 1 THEN
  45. rslt = 0
  46. arg_msg = '单据已经审核,不可以再修改'
  47. GOTO ext
  48. END IF
  49. ext:
  50. RETURN rslt
  51. end function
  52. public function integer del (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  53. Int li_flag,li_priceflag
  54. Long cnt
  55. If arg_billid <= 0 Then
  56. rslt = 0
  57. arg_msg = '错误单据唯一码'
  58. Goto ext
  59. End If
  60. If p_getflag(arg_billid,li_flag,li_priceflag,arg_msg) = 0 Then
  61. rslt = 0
  62. Goto ext
  63. End If
  64. If li_priceflag = 1 Then
  65. rslt = 0
  66. arg_msg = '单据已经确认,不可以删除'
  67. Goto ext
  68. End If
  69. If li_flag = 1 Then
  70. rslt = 0
  71. arg_msg = '单据不是在待审状态,不可以删除'
  72. Goto ext
  73. End If
  74. s_workprice_changemx s_workprice_mx[]
  75. Long ll_arr_cnt,ll_i
  76. If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,arg_msg) = 0 Then
  77. rslt = 0
  78. Goto ext
  79. End If
  80. Delete From u_workprice_change
  81. Where billid = :arg_billid;
  82. If sqlca.SQLCode <> 0 Then
  83. rslt = 0
  84. arg_msg = "删除单据操作失败"+"~n"+sqlca.SQLErrText
  85. Goto ext
  86. End If
  87. Delete From u_workprice_changemx
  88. Where billid = :arg_billid;
  89. If sqlca.SQLCode <> 0 Then
  90. rslt = 0
  91. arg_msg = "删除单据明细操作失败"+"~n"+sqlca.SQLErrText
  92. Goto ext
  93. End If
  94. For ll_i = 1 To ll_arr_cnt
  95. If s_workprice_mx[ll_i].editflag = 0 Then //变更
  96. If s_workprice_mx[ll_i].workqty > 0 Then
  97. Select count(*)
  98. Into :cnt
  99. From u_workprice_changemx
  100. Where (editflag = 0)
  101. And (workqty > 0)
  102. and (rsltflag = 0)
  103. And (mtrlid = :s_workprice_mx[ll_i].mtrlid)
  104. And (procode = :s_workprice_mx[ll_i].procode)
  105. And (wpcode = :s_workprice_mx[ll_i].wpcode);
  106. If sqlca.SQLCode <> 0 Then cnt = 0
  107. If cnt = 0 Then
  108. Update u_sc_workprice
  109. Set ifchangebill = 0
  110. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  111. And procode = :s_workprice_mx[ll_i].procode
  112. And wpcode = :s_workprice_mx[ll_i].wpcode;
  113. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
  114. rslt = 0
  115. arg_msg = '更新工价表是否有相关变更单字段失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  116. Goto ext
  117. End If
  118. End If
  119. End If
  120. End If
  121. Next
  122. ext:
  123. If rslt = 0 Then
  124. Rollback;
  125. ElseIf rslt = 1 And arg_ifcommit Then
  126. Commit;
  127. End If
  128. Return rslt
  129. end function
  130. public function integer add_dscrp (long arg_billid, string arg_newdescppart, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  131. Int li_flag,li_priceflag
  132. IF arg_newdescppart = '' THEN
  133. rslt = 0
  134. arG_MSG = "要添加内容为空,操作取消"
  135. GOTO ext
  136. END IF
  137. IF p_getflag(arg_billid,li_flag,li_priceflag,arG_MSG) = 0 THEN
  138. rslt = 0
  139. GOTO ext
  140. END IF
  141. if li_priceflag = 0 then
  142. rslt = 0
  143. arG_MSG = "待审核状态下不可用"
  144. GOTO ext
  145. END IF
  146. IF li_flag = 0 THEN
  147. rslt = 0
  148. arG_MSG = "待审核状态下不可用"
  149. GOTO ext
  150. END IF
  151. UPDATE u_workprice_change
  152. SET DSCRP = DSCRP+' '+:arg_newdescppart
  153. WHERE u_workprice_change.billid = :arg_billid;
  154. IF SQLCA.SQLCode <> 0 THEN
  155. rslt = 0
  156. arG_MSG = "因网络或其它原因导致添加备注操作失败"+"~n"+SQLCA.SQLErrText
  157. GOTO ext
  158. END IF
  159. ext:
  160. IF rslt = 0 THEN
  161. ROLLBACK;
  162. ELSEIF rslt = 1 AND arg_ifcommit THEN
  163. COMMIT;
  164. END IF
  165. Return (rslt)
  166. end function
  167. public function integer audit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  168. Int li_flag, li_priceflag
  169. Long ll_scid
  170. String ls_billcode
  171. Int li_rsltflag
  172. DateTime ldt_nulldt
  173. Int li_ifchangebill
  174. SetNull(ldt_nulldt)
  175. uo_workpricetable uo_workprice
  176. uo_workprice = Create uo_workpricetable
  177. If arg_billid <= 0 Then
  178. rslt = 0
  179. ARG_MSG = '错误单据唯一码'
  180. Goto ext
  181. End If
  182. If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
  183. rslt = 0
  184. Goto ext
  185. End If
  186. Select scid,billcode
  187. Into :ll_scid,:ls_billcode
  188. From u_workprice_change
  189. Where billid = :arg_billid;
  190. If sqlca.SQLCode <> 0 Then
  191. rslt = 0
  192. ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
  193. Goto ext
  194. End If
  195. If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
  196. If f_check_if_oaflow(ll_scid,arg_billid,1494,ARG_MSG ) = 0 Then
  197. rslt = 0
  198. Goto ext
  199. End If
  200. End If
  201. If li_flag <> 0 Then
  202. rslt = 0
  203. ARG_MSG = '单据不是在待审核状态,不可以审核'
  204. Goto ext
  205. End If
  206. If sys_option_workprice_change_secaudit = 1 Then
  207. If li_priceflag <> 1 Then
  208. rslt = 0
  209. ARG_MSG = '系统选项控制,单据使用二级审核,不是在已确认状态,不可以审核'
  210. Goto ext
  211. End If
  212. End If
  213. //更新工价表
  214. Long ll_sonmtrlid
  215. s_workprice_changemx s_workprice_mx[]
  216. Long ll_arr_cnt,ll_i
  217. Long cnt
  218. DateTime serdate
  219. Select Top 1 getdate() Into :serdate From u_user;
  220. If sqlca.SQLCode <> 0 Then
  221. ARG_MSG = '查询服务器时间失败'
  222. rslt = 0
  223. Goto ext
  224. End If
  225. If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
  226. rslt = 0
  227. Goto ext
  228. End If
  229. For ll_i = 1 To ll_arr_cnt
  230. If s_workprice_mx[ll_i].iffinishoa = 1 Then Continue //结束审批的明细不处理
  231. If (s_workprice_mx[ll_i].editflag = 1 And s_workprice_mx[ll_i].rsltflag <> 0) Then Continue //无效变更的,不处理; 如果是新增类且不是同意,不处理
  232. //如果是无效并且类型为变更,更新工价表开单标记 20140729
  233. If s_workprice_mx[ll_i].rsltflag = 2 Then
  234. If s_workprice_mx[ll_i].editflag = 0 Then
  235. Select count(*)
  236. Into :cnt
  237. From u_workprice_changemx Inner JOIN
  238. u_workprice_change ON u_workprice_changemx.billid = u_workprice_change.billid
  239. Where (u_workprice_changemx.editflag = 0)
  240. And (u_workprice_changemx.workqty > 0)
  241. And (u_workprice_changemx.rsltflag = 0)
  242. And (u_workprice_change.flag = 0)
  243. And (u_workprice_changemx.mtrlid = :s_workprice_mx[ll_i].mtrlid)
  244. And (u_workprice_changemx.procode = :s_workprice_mx[ll_i].procode)
  245. And (u_workprice_changemx.wpcode = :s_workprice_mx[ll_i].wpcode)
  246. And (u_workprice_changemx.billid <> :arg_billid) ;
  247. If sqlca.SQLCode <> 0 Then cnt = 0
  248. If cnt = 0 Then
  249. li_ifchangebill = 0
  250. Else
  251. li_ifchangebill = 1
  252. End If
  253. Update u_sc_workprice
  254. Set ifchangebill = :li_ifchangebill
  255. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  256. And procode = :s_workprice_mx[ll_i].procode
  257. And wpcode = :s_workprice_mx[ll_i].wpcode;
  258. If sqlca.SQLCode <> 0 Then
  259. rslt = 0
  260. ARG_MSG = '更新工价表开单标记失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  261. Goto ext
  262. End If
  263. End If
  264. Continue
  265. End If
  266. /////////
  267. If s_workprice_mx[ll_i].wrkid = 0 Then
  268. rslt = 0
  269. ARG_MSG = '第'+String(ll_i)+'行,请先选择车间'
  270. Goto ext
  271. End If
  272. li_rsltflag = s_workprice_mx[ll_i].rsltflag
  273. If IsNull(s_workprice_mx[ll_i].ifgroup) Then s_workprice_mx[ll_i].ifgroup = 0
  274. If s_workprice_mx[ll_i].editflag = 0 Then //变更
  275. Select count(*)
  276. Into :cnt
  277. From u_workprice_changemx Inner JOIN
  278. u_workprice_change ON u_workprice_changemx.billid = u_workprice_change.billid
  279. Where (u_workprice_changemx.editflag = 0)
  280. And (u_workprice_changemx.workqty > 0)
  281. And (u_workprice_changemx.rsltflag = 0)
  282. And (u_workprice_change.flag = 0)
  283. And (u_workprice_changemx.mtrlid = :s_workprice_mx[ll_i].mtrlid)
  284. And (u_workprice_changemx.procode = :s_workprice_mx[ll_i].procode)
  285. And (u_workprice_changemx.wpcode = :s_workprice_mx[ll_i].wpcode)
  286. And (u_workprice_changemx.billid <> :arg_billid) ;
  287. If sqlca.SQLCode <> 0 Then cnt = 0
  288. If cnt = 0 Then
  289. li_ifchangebill = 0
  290. Else
  291. li_ifchangebill = 1
  292. End If
  293. If li_rsltflag = 0 Then
  294. If s_workprice_mx[ll_i].workqty > 0 Then
  295. Update u_sc_workprice
  296. Set proname = :s_workprice_mx[ll_i].proname,
  297. workqty = :s_workprice_mx[ll_i].workqty,
  298. workprice = :s_workprice_mx[ll_i].workprice,
  299. wrkgrpid = :s_workprice_mx[ll_i].wrkgrpid,
  300. ifstandard = :s_workprice_mx[ll_i].ifstandard,
  301. lsxtype = :s_workprice_mx[ll_i].lsxtype,
  302. lastflag = :s_workprice_mx[ll_i].lastflag,
  303. workhour = :s_workprice_mx[ll_i].workhour_minute / 60,
  304. workhour_minute = :s_workprice_mx[ll_i].workhour_minute,
  305. beforehour_minute = :s_workprice_mx[ll_i].beforehour_minute,
  306. afterhour_minute = :s_workprice_mx[ll_i].afterhour_minute,
  307. eqworkhour_minute = :s_workprice_mx[ll_i].eqworkhour_minute,
  308. beforehour = :s_workprice_mx[ll_i].beforehour_minute / 60,
  309. afterhour = :s_workprice_mx[ll_i].afterhour_minute / 60,
  310. eqworkhour = :s_workprice_mx[ll_i].eqworkhour_minute / 60,
  311. dscrp = :s_workprice_mx[ll_i].dscrp,
  312. worklevel = :s_workprice_mx[ll_i].worklevel,
  313. techlevel = :s_workprice_mx[ll_i].techlevel,
  314. ifjd = :s_workprice_mx[ll_i].ifjd,
  315. status = :s_workprice_mx[ll_i].status,
  316. auditflag = 1,
  317. auditrep = :arg_opemp,
  318. auditdate = getdate(),
  319. pricestr = :s_workprice_mx[ll_i].pricestr,
  320. workqtystr = :s_workprice_mx[ll_i].workqtystr,
  321. wrkid = :s_workprice_mx[ll_i].wrkid,
  322. u_workqty = :s_workprice_mx[ll_i].u_workqty,
  323. u_workprice = :s_workprice_mx[ll_i].u_workprice,
  324. u_workqtystr = :s_workprice_mx[ll_i].u_workqtystr,
  325. u_pricestr = :s_workprice_mx[ll_i].u_pricestr,
  326. arg1 = :s_workprice_mx[ll_i].arg1,
  327. arg2 = :s_workprice_mx[ll_i].arg2,
  328. arg3 = :s_workprice_mx[ll_i].arg3,
  329. arg4 = :s_workprice_mx[ll_i].arg4,
  330. arg5 = :s_workprice_mx[ll_i].arg5,
  331. arg6 = :s_workprice_mx[ll_i].arg6,
  332. arg7 = :s_workprice_mx[ll_i].arg7,
  333. arg8 = :s_workprice_mx[ll_i].arg8,
  334. arg9 = :s_workprice_mx[ll_i].arg9,
  335. ifgroup = :s_workprice_mx[ll_i].ifgroup,
  336. auditflag_gj = 1 ,
  337. auditrep_gj = :arg_opemp ,
  338. auditdate_gj = getdate() ,
  339. oppflag = 0 ,
  340. opprep = '' ,
  341. oppdate = :ldt_nulldt,
  342. changeflag = 2,
  343. lastprice = :s_workprice_mx[ll_i].workprice,
  344. replacestr = :s_workprice_mx[ll_i].replacestr,
  345. relchangecode = :ls_billcode,
  346. worktype = :s_workprice_mx[ll_i].worktype,
  347. rpcode = :s_workprice_mx[ll_i].rpcode,
  348. ifdftpg = :s_workprice_mx[ll_i].ifdftpg,
  349. ifdftjj = :s_workprice_mx[ll_i].ifdftjj,
  350. ifchangebill = :li_ifchangebill
  351. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  352. And procode = :s_workprice_mx[ll_i].procode
  353. And wpcode = :s_workprice_mx[ll_i].wpcode;
  354. If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
  355. rslt = 0
  356. ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  357. Goto ext
  358. End If
  359. If uo_workprice.uof_update_workprice_zl(s_workprice_mx[ll_i].mtrlid,s_workprice_mx[ll_i].wpcode,s_workprice_mx[ll_i].procode,ARG_MSG,False) = 0 Then
  360. rslt = 0
  361. Goto ext
  362. End If
  363. ElseIf s_workprice_mx[ll_i].workqty = 0 Then //数量为0,删除
  364. Delete From u_sc_workprice
  365. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  366. And procode = :s_workprice_mx[ll_i].procode
  367. And wpcode = :s_workprice_mx[ll_i].wpcode;
  368. If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
  369. rslt = 0
  370. ARG_MSG = '删除工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  371. Goto ext
  372. End If
  373. End If
  374. Else
  375. //20141013修改:反对的明细不取消工价审,否则会导致原工价无效 YS
  376. // auditflag_gj = 0 ,
  377. // auditrep_gj = '' ,
  378. // auditdate_gj = :ldt_nulldt ,
  379. Update u_sc_workprice
  380. Set oppflag = 1 ,
  381. opprep = :arg_opemp ,
  382. oppdate = getdate(),
  383. oppreason = :s_workprice_mx[ll_i].reason,
  384. relchangecode = :ls_billcode,
  385. ifchangebill = :li_ifchangebill
  386. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  387. And procode = :s_workprice_mx[ll_i].procode
  388. And wpcode = :s_workprice_mx[ll_i].wpcode;
  389. If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
  390. rslt = 0
  391. ARG_MSG = '更新工价表反对标记失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  392. Goto ext
  393. End If
  394. End If
  395. ElseIf s_workprice_mx[ll_i].editflag = 2 Then //删除
  396. Delete From u_sc_workprice
  397. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  398. And procode = :s_workprice_mx[ll_i].procode
  399. And wpcode = :s_workprice_mx[ll_i].wpcode;
  400. If sqlca.SQLCode <> 0 Then //Or sqlca.SQLNRows = 0 THEN
  401. rslt = 0
  402. ARG_MSG = '删除工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  403. Goto ext
  404. End If
  405. Else // 新增
  406. cnt = 0
  407. Select count(*)
  408. Into :cnt
  409. From u_sc_workprice
  410. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  411. And procode = :s_workprice_mx[ll_i].procode
  412. And wpcode = :s_workprice_mx[ll_i].wpcode;
  413. If sqlca.SQLCode <> 0 Then
  414. rslt = 0
  415. ARG_MSG = '查询工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  416. Goto ext
  417. End If
  418. If cnt > 0 Then
  419. rslt = 0
  420. ARG_MSG = '工价表已存在相同信息,不能插入重复内容,第 '+String(ll_i)+' 行'
  421. Goto ext
  422. End If
  423. Select count(*)
  424. Into :cnt
  425. From u_mtrl_workprice
  426. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  427. And wpcode = :s_workprice_mx[ll_i].wpcode;
  428. If sqlca.SQLCode <> 0 Then
  429. rslt = 0
  430. ARG_MSG = '查询车间工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  431. Goto ext
  432. End If
  433. If cnt = 0 Then
  434. Insert Into u_mtrl_workprice
  435. (mtrlid,
  436. wrkid,
  437. flag,
  438. opemp,
  439. opdate,
  440. wpcode)
  441. Values
  442. (:s_workprice_mx[ll_i].mtrlid,
  443. :s_workprice_mx[ll_i].wrkid,
  444. 0,
  445. :arg_opemp,
  446. getdate(),
  447. :s_workprice_mx[ll_i].wpcode);
  448. If sqlca.SQLCode <> 0 Then
  449. rslt = 0
  450. ARG_MSG = '插入车间工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  451. Goto ext
  452. End If
  453. End If
  454. Insert Into u_sc_workprice
  455. (
  456. mtrlid,
  457. proorder,
  458. procode,
  459. proname,
  460. workqty,
  461. workprice,
  462. wrkgrpid,
  463. ifstandard ,
  464. lsxtype ,
  465. lastflag ,
  466. workhour,
  467. dscrp ,
  468. worklevel ,
  469. techlevel,
  470. proid,
  471. auditflag,
  472. auditrep,
  473. auditdate,
  474. status,
  475. ifjd,
  476. wrkid,
  477. workhour_minute,
  478. beforehour_minute,
  479. afterhour_minute,
  480. eqworkhour_minute,
  481. beforehour,
  482. afterhour,
  483. eqworkhour,
  484. pricestr,
  485. workqtystr,
  486. wpcode,
  487. u_workqty,
  488. u_workprice,
  489. u_workqtystr,
  490. u_pricestr,
  491. arg1,
  492. arg2,
  493. arg3,
  494. arg4,
  495. arg5,
  496. arg6,
  497. arg7,
  498. arg8,
  499. arg9,
  500. ifgroup,
  501. lastprice,
  502. replacestr,
  503. worktype,
  504. rpcode,
  505. ifdftpg,
  506. ifdftjj)
  507. Values
  508. (
  509. :s_workprice_mx[ll_i].mtrlid,
  510. :s_workprice_mx[ll_i].proorder,
  511. :s_workprice_mx[ll_i].procode,
  512. :s_workprice_mx[ll_i].proname,
  513. :s_workprice_mx[ll_i].workqty,
  514. :s_workprice_mx[ll_i].workprice,
  515. :s_workprice_mx[ll_i].wrkgrpid,
  516. :s_workprice_mx[ll_i].ifstandard,
  517. :s_workprice_mx[ll_i].lsxtype,
  518. :s_workprice_mx[ll_i].lastflag,
  519. :s_workprice_mx[ll_i].workhour_minute / 60 ,
  520. :s_workprice_mx[ll_i].dscrp,
  521. :s_workprice_mx[ll_i].worklevel,
  522. :s_workprice_mx[ll_i].techlevel,
  523. 0,
  524. 1,
  525. :arg_opemp,
  526. getdate(),
  527. :s_workprice_mx[ll_i].status,
  528. :s_workprice_mx[ll_i].ifjd,
  529. :s_workprice_mx[ll_i].wrkid,
  530. :s_workprice_mx[ll_i].workhour_minute,
  531. :s_workprice_mx[ll_i].beforehour_minute,
  532. :s_workprice_mx[ll_i].afterhour_minute,
  533. :s_workprice_mx[ll_i].eqworkhour_minute,
  534. :s_workprice_mx[ll_i].beforehour_minute / 60,
  535. :s_workprice_mx[ll_i].afterhour_minute / 60,
  536. :s_workprice_mx[ll_i].eqworkhour_minute / 60,
  537. :s_workprice_mx[ll_i].pricestr,
  538. :s_workprice_mx[ll_i].workqtystr,
  539. :s_workprice_mx[ll_i].wpcode,
  540. :s_workprice_mx[ll_i].u_workqty,
  541. :s_workprice_mx[ll_i].u_workprice,
  542. :s_workprice_mx[ll_i].u_workqtystr,
  543. :s_workprice_mx[ll_i].u_pricestr,
  544. :s_workprice_mx[ll_i].arg1,
  545. :s_workprice_mx[ll_i].arg2,
  546. :s_workprice_mx[ll_i].arg3,
  547. :s_workprice_mx[ll_i].arg4,
  548. :s_workprice_mx[ll_i].arg5,
  549. :s_workprice_mx[ll_i].arg6,
  550. :s_workprice_mx[ll_i].arg7,
  551. :s_workprice_mx[ll_i].arg8,
  552. :s_workprice_mx[ll_i].arg9,
  553. :s_workprice_mx[ll_i].ifgroup,
  554. :s_workprice_mx[ll_i].workprice,
  555. :s_workprice_mx[ll_i].replacestr,
  556. :s_workprice_mx[ll_i].worktype,
  557. :s_workprice_mx[ll_i].rpcode,
  558. :s_workprice_mx[ll_i].ifdftpg,
  559. :s_workprice_mx[ll_i].ifdftjj
  560. );
  561. If sqlca.SQLCode <> 0 Then
  562. rslt = 0
  563. ARG_MSG = '插入工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  564. Goto ext
  565. End If
  566. End If
  567. // IF uo_workprice.update_auditflag(s_workprice_mx[ll_i].mtrlid,serdate,arg_opemp,ARG_MSG,FALSE) = 0 THEN
  568. // rslt = 0
  569. // GOTO ext
  570. // END IF
  571. Next
  572. //更新审核标记
  573. Update u_workprice_change
  574. Set auditingrep = :arg_opemp,
  575. auditingdate = getdate(),
  576. flag = 1
  577. Where billid = :arg_billid
  578. And flag = 0;
  579. If sqlca.SQLCode <> 0 Then
  580. rslt = 0
  581. ARG_MSG = "因网络或其它原因导致单据审核操作失败"+"~n"+sqlca.SQLErrText
  582. Goto ext
  583. ElseIf sqlca.SQLNRows = 0 Then
  584. rslt = 0
  585. ARG_MSG = "单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText
  586. Goto ext
  587. End If
  588. ext:
  589. If rslt = 0 Then
  590. Rollback;
  591. ElseIf rslt = 1 And arg_ifcommit Then
  592. Commit;
  593. End If
  594. Destroy uo_workprice
  595. Return rslt
  596. end function
  597. public function integer getinfo (long arg_billid, ref s_workprice_changemx arg_ref_mx[], ref long arg_arr_cnt, ref string arg_msg);Int rslt = 1
  598. Long i = 1,no_mxcheck = 0
  599. IF arg_billid <= 0 THEN
  600. rslt = 0
  601. arg_msg = '错误单据唯一码'
  602. GOTO ext
  603. END IF
  604. //用游标读取明细
  605. DECLARE cur_mx CURSOR FOR
  606. SELECT billid,
  607. printid,
  608. editflag,
  609. mtrlid,
  610. proorder,
  611. procode,
  612. proname,
  613. workqty,
  614. workprice_ori,
  615. workprice,
  616. wrkgrpid,
  617. ifstandard,
  618. lsxtype,
  619. lastflag,
  620. workhour,
  621. dscrp,
  622. worklevel,
  623. techlevel,
  624. status,
  625. ifjd,
  626. wrkid,
  627. arg1,
  628. arg2,
  629. arg3,
  630. arg4,
  631. arg5,
  632. arg6,
  633. arg7,
  634. arg8,
  635. arg9,
  636. workhour_minute,
  637. beforehour_minute,
  638. afterhour_minute,
  639. eqworkhour_minute,
  640. pricestr,
  641. workqtystr,
  642. rsltflag,
  643. wpcode,
  644. u_workqty,
  645. u_workprice,
  646. u_workqtystr,
  647. u_pricestr,
  648. ifgroup,
  649. reason,
  650. replacestr,
  651. worktype,
  652. iffinishoa,
  653. rpcode,
  654. ifdftpg,
  655. ifdftjj
  656. FROM u_workprice_changemx
  657. WHERE u_workprice_changemx.billid = :arg_billid
  658. Order By u_workprice_changemx.printid;
  659. OPEN cur_mx;
  660. FETCH cur_mx INTO
  661. :arg_ref_mx[i].billid,
  662. :arg_ref_mx[i].printid,
  663. :arg_ref_mx[i].editflag,
  664. :arg_ref_mx[i].mtrlid,
  665. :arg_ref_mx[i].proorder,
  666. :arg_ref_mx[i].procode,
  667. :arg_ref_mx[i].proname,
  668. :arg_ref_mx[i].workqty,
  669. :arg_ref_mx[i].workprice_ori,
  670. :arg_ref_mx[i].workprice,
  671. :arg_ref_mx[i].wrkgrpid,
  672. :arg_ref_mx[i].ifstandard,
  673. :arg_ref_mx[i].lsxtype,
  674. :arg_ref_mx[i].lastflag,
  675. :arg_ref_mx[i].workhour,
  676. :arg_ref_mx[i].dscrp,
  677. :arg_ref_mx[i].worklevel,
  678. :arg_ref_mx[i].techlevel,
  679. :arg_ref_mx[i].status,
  680. :arg_ref_mx[i].ifjd,
  681. :arg_ref_mx[i].wrkid,
  682. :arg_ref_mx[i].arg1,
  683. :arg_ref_mx[i].arg2,
  684. :arg_ref_mx[i].arg3,
  685. :arg_ref_mx[i].arg4,
  686. :arg_ref_mx[i].arg5,
  687. :arg_ref_mx[i].arg6,
  688. :arg_ref_mx[i].arg7,
  689. :arg_ref_mx[i].arg8,
  690. :arg_ref_mx[i].arg9,
  691. :arg_ref_mx[i].workhour_minute,
  692. :arg_ref_mx[i].beforehour_minute,
  693. :arg_ref_mx[i].afterhour_minute,
  694. :arg_ref_mx[i].eqworkhour_minute,
  695. :arg_ref_mx[i].pricestr,
  696. :arg_ref_mx[i].workqtystr,
  697. :arg_ref_mx[i].rsltflag,
  698. :arg_ref_mx[i].wpcode,
  699. :arg_ref_mx[i].u_workqty,
  700. :arg_ref_mx[i].u_workprice,
  701. :arg_ref_mx[i].u_workqtystr,
  702. :arg_ref_mx[i].u_pricestr,
  703. :arg_ref_mx[i].ifgroup,
  704. :arg_ref_mx[i].reason,
  705. :arg_ref_mx[i].replacestr,
  706. :arg_ref_mx[i].worktype,
  707. :arg_ref_mx[i].iffinishoa,
  708. :arg_ref_mx[i].rpcode,
  709. :arg_ref_mx[i].ifdftpg,
  710. :arg_ref_mx[i].ifdftjj;
  711. DO WHILE sqlca.SQLCode = 0
  712. i++
  713. FETCH cur_mx INTO
  714. :arg_ref_mx[i].billid,
  715. :arg_ref_mx[i].printid,
  716. :arg_ref_mx[i].editflag,
  717. :arg_ref_mx[i].mtrlid,
  718. :arg_ref_mx[i].proorder,
  719. :arg_ref_mx[i].procode,
  720. :arg_ref_mx[i].proname,
  721. :arg_ref_mx[i].workqty,
  722. :arg_ref_mx[i].workprice_ori,
  723. :arg_ref_mx[i].workprice,
  724. :arg_ref_mx[i].wrkgrpid,
  725. :arg_ref_mx[i].ifstandard,
  726. :arg_ref_mx[i].lsxtype,
  727. :arg_ref_mx[i].lastflag,
  728. :arg_ref_mx[i].workhour,
  729. :arg_ref_mx[i].dscrp,
  730. :arg_ref_mx[i].worklevel,
  731. :arg_ref_mx[i].techlevel,
  732. :arg_ref_mx[i].status,
  733. :arg_ref_mx[i].ifjd,
  734. :arg_ref_mx[i].wrkid,
  735. :arg_ref_mx[i].arg1,
  736. :arg_ref_mx[i].arg2,
  737. :arg_ref_mx[i].arg3,
  738. :arg_ref_mx[i].arg4,
  739. :arg_ref_mx[i].arg5,
  740. :arg_ref_mx[i].arg6,
  741. :arg_ref_mx[i].arg7,
  742. :arg_ref_mx[i].arg8,
  743. :arg_ref_mx[i].arg9,
  744. :arg_ref_mx[i].workhour_minute,
  745. :arg_ref_mx[i].beforehour_minute,
  746. :arg_ref_mx[i].afterhour_minute,
  747. :arg_ref_mx[i].eqworkhour_minute,
  748. :arg_ref_mx[i].pricestr,
  749. :arg_ref_mx[i].workqtystr,
  750. :arg_ref_mx[i].rsltflag,
  751. :arg_ref_mx[i].wpcode,
  752. :arg_ref_mx[i].u_workqty,
  753. :arg_ref_mx[i].u_workprice,
  754. :arg_ref_mx[i].u_workqtystr,
  755. :arg_ref_mx[i].u_pricestr,
  756. :arg_ref_mx[i].ifgroup,
  757. :arg_ref_mx[i].reason,
  758. :arg_ref_mx[i].replacestr,
  759. :arg_ref_mx[i].worktype,
  760. :arg_ref_mx[i].iffinishoa,
  761. :arg_ref_mx[i].rpcode,
  762. :arg_ref_mx[i].ifdftpg,
  763. :arg_ref_mx[i].ifdftjj;
  764. LOOP
  765. CLOSE cur_mx;
  766. //检验明细是否读入完整
  767. SELECT count(*) INTO :no_mxcheck
  768. FROM u_workprice_changemx
  769. Where billid = :arg_billid;
  770. IF sqlca.SQLCode <> 0 THEN
  771. rslt = 0
  772. arg_msg = "查询操作失败,单据明细数量"
  773. GOTO ext
  774. END IF
  775. IF i <> (no_mxcheck + 1) THEN
  776. rslt = 0
  777. arg_msg = "查询操作失败,单据明细"
  778. GOTO ext
  779. END IF
  780. arg_arr_cnt = i - 1
  781. ext:
  782. RETURN rslt
  783. end function
  784. public function integer save (s_workprice_change arg_s_workprice, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Integer rslt = 1,cnt = 0
  785. DateTime server_dt
  786. Long ll_billid,it_mxbt,i,ll_i
  787. String ls_sccode,ls_billcode
  788. If IsNull(arg_s_workprice.scid) Then arg_s_workprice.scid = 0
  789. If IsNull(arg_s_workprice.billid) Then arg_s_workprice.billid = 0
  790. If IsNull(arg_s_workprice.wrkid) Then arg_s_workprice.wrkid = 0 //备注性质
  791. If IsNull(arg_s_workprice.procode) Then arg_s_workprice.procode = ''
  792. If IsNull(arg_s_workprice.proname) Then arg_s_workprice.proname = ''
  793. If IsNull(arg_s_workprice.rep) Then arg_s_workprice.rep = ''
  794. If IsNull(arg_s_workprice.dscrp) Then arg_s_workprice.dscrp = ''
  795. //IF arg_s_workprice.procode = '' THEN
  796. // arg_msg = '请选择工序'
  797. // rslt = 0
  798. // GOTO ext
  799. //END IF
  800. If arg_s_workprice.rep = '' Then
  801. arg_msg = '请输入经手人'
  802. rslt = 0
  803. Goto ext
  804. End If
  805. If arg_s_workprice.scid < 0 Then
  806. arg_msg = '请选择分部'
  807. rslt = 0
  808. Goto ext
  809. End If
  810. Select Top 1 getdate() Into :server_dt From u_user;
  811. If sqlca.SQLCode <> 0 Then
  812. rslt = 0
  813. arg_msg = "查询操作失败,日期 "
  814. Goto ext
  815. End If
  816. it_mxbt = UpperBound(arg_s_workprice.arg_s_mx)
  817. If it_mxbt <= 0 Then
  818. rslt = 0
  819. arg_msg = "没有正确明细内容"
  820. Goto ext
  821. End If
  822. //新增类型,检查 工组 对应 车间
  823. For i = 1 To it_mxbt
  824. If arg_s_workprice.arg_s_mx[i].wpcode = '' Then
  825. rslt = 0
  826. arg_msg = "行"+String(i)+ ",没有工价表号"
  827. Goto ext
  828. End If
  829. //新增类型,检查 工组 对应 车间
  830. //新增类型,检查 流水表打印类型 不能为 不参加打印[0]
  831. If arg_s_workprice.arg_s_mx[i].editflag = 1 Then
  832. If arg_s_workprice.arg_s_mx[i].lsxtype = 0 Then
  833. rslt = 0
  834. arg_msg = "行"+String(i)+ ",新增工序的流水表打印类型不能为[不参加打印]"
  835. Goto ext
  836. End If
  837. Select count(*)
  838. Into :cnt
  839. From u_sc_workgroup
  840. Where u_sc_workgroup.wrkGrpid = :arg_s_workprice.arg_s_mx[i].wrkgrpid
  841. And u_sc_workgroup.storageid = :arg_s_workprice.arg_s_mx[i].wrkid;
  842. If sqlca.SQLCode <> 0 Then
  843. rslt = 0
  844. arg_msg = "行"+String(i)+ ",查询工组对应车间失败,"+sqlca.SQLErrText
  845. Goto ext
  846. End If
  847. If cnt = 0 Then
  848. rslt = 0
  849. arg_msg = "行"+String(i)+ ",当前工组、车间与资料设置不一致"
  850. Goto ext
  851. End If
  852. End If
  853. //检查是否有未审核的相同物料,工序的单据
  854. Select count(*)
  855. Into :cnt
  856. From u_workprice_change Inner JOIN
  857. u_workprice_changemx ON
  858. u_workprice_change.billid = u_workprice_changemx.billid
  859. Where (u_workprice_change.flag = 0)
  860. And (u_workprice_changemx.mtrlid = :arg_s_workprice.arg_s_mx[i].mtrlid)
  861. And(u_workprice_changemx.procode = :arg_s_workprice.arg_s_mx[i].procode)
  862. And (u_workprice_change.billid <> :arg_s_workprice.billid)
  863. And (u_workprice_changemx.rsltflag = 0);
  864. If sqlca.SQLCode <> 0 Then
  865. rslt = 0
  866. arg_msg = "行"+String(i)+ ",查询是否有相关未审工价表变更单失败,"+sqlca.SQLErrText
  867. Goto ext
  868. End If
  869. If cnt > 0 Then
  870. rslt = 0
  871. arg_msg = "行"+String(i)+ ",存在相同物料相同工序的工价表变更单未审核["+String(cnt)+"]"
  872. Goto ext
  873. End If
  874. Next
  875. If arg_s_workprice.billid = 0 Then
  876. ll_billid = f_sys_scidentity(0,"u_workprice_change","billid",arg_msg,True,id_sqlca)
  877. If ll_billid <= 0 Then
  878. rslt = 0
  879. Goto ext
  880. End If
  881. If f_get_sccode(0,sqlca,ls_sccode,arg_msg) = 0 Then
  882. rslt = 0
  883. Goto ext
  884. End If
  885. ls_billcode = getid(0,ls_sccode + 'WC',Date(server_dt),False,sqlca)
  886. If ls_billcode = "err" Then
  887. rslt = 0
  888. arg_msg = "无法获取单据编号"+"~n"+sqlca.SQLErrText
  889. Goto ext
  890. End If
  891. Insert Into u_workprice_change
  892. (scid,
  893. billid,
  894. billcode,
  895. billdate,
  896. relcode,
  897. procode,
  898. proname,
  899. rep,
  900. dscrp,
  901. opdate,
  902. opemp,
  903. wrkid)
  904. Values
  905. (:arg_s_workprice.scid,
  906. :ll_billid,
  907. :ls_billcode,
  908. :arg_s_workprice.billdate,
  909. :arg_s_workprice.relcode,
  910. :arg_s_workprice.procode,
  911. :arg_s_workprice.proname,
  912. :arg_s_workprice.rep,
  913. :arg_s_workprice.dscrp,
  914. getdate(),
  915. :arg_opemp,
  916. :arg_s_workprice.wrkid);
  917. If sqlca.SQLCode <> 0 Then
  918. rslt = 0
  919. arg_msg = "因网络或其它原因导致建立单据操作失败"+"~n"+sqlca.SQLErrText
  920. Goto ext
  921. End If
  922. uo_billid = ll_billid
  923. uo_billcode = ls_billcode
  924. Else
  925. Update u_workprice_change
  926. Set billdate = :arg_s_workprice.billdate,
  927. procode = :arg_s_workprice.procode,
  928. proname = :arg_s_workprice.proname,
  929. rep = :arg_s_workprice.rep,
  930. dscrp = :arg_s_workprice.dscrp,
  931. relcode = :arg_s_workprice.relcode,
  932. moddate = getdate(),
  933. modemp = :arg_opemp,
  934. wrkid = :arg_s_workprice.wrkid
  935. Where billid = :arg_s_workprice.billid
  936. And flag = 0 ;
  937. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 Then
  938. rslt = 0
  939. arg_msg = "因网络或其它原因导致更新单据操作失败"+"~n"+sqlca.SQLErrText
  940. Goto ext
  941. End If
  942. Delete From u_workprice_changemx
  943. Where billid = :arg_s_workprice.billid;
  944. If sqlca.SQLCode <> 0 Then
  945. rslt = 0
  946. arg_msg = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
  947. Goto ext
  948. End If
  949. uo_billid = arg_s_workprice.billid
  950. End If
  951. For i = 1 To it_mxbt
  952. If IsNull(arg_s_workprice.arg_s_mx[i].ifgroup) Then arg_s_workprice.arg_s_mx[i].ifgroup = 0
  953. If arg_s_workprice.arg_s_mx[i].workqty = 0 then arg_s_workprice.arg_s_mx[i].editflag = 2
  954. Insert Into u_workprice_changemx
  955. (billid,
  956. printid,
  957. editflag,
  958. mtrlid,
  959. proorder,
  960. procode,
  961. proname,
  962. workqty_ori,
  963. workqty,
  964. workprice_ori,
  965. workprice,
  966. wrkgrpid,
  967. ifstandard,
  968. lsxtype,
  969. lastflag,
  970. dscrp,
  971. workhour,
  972. techlevel,
  973. status,
  974. ifjd,
  975. wrkid,
  976. arg1,
  977. arg2,
  978. arg3,
  979. arg4,
  980. arg5,
  981. arg6,
  982. arg7,
  983. arg8,
  984. arg9,
  985. workhour_minute,
  986. beforehour_minute,
  987. afterhour_minute,
  988. eqworkhour_minute,
  989. pricestr,
  990. workqtystr,
  991. wpcode,
  992. u_workqty,
  993. u_workprice,
  994. u_workqtystr,
  995. u_pricestr,
  996. proname_ori,
  997. ifgroup,
  998. replacestr,
  999. worktype,
  1000. rpcode,
  1001. ifdftpg,
  1002. ifdftjj)
  1003. Values
  1004. (:uo_billid,
  1005. :arg_s_workprice.arg_s_mx[i].printid,
  1006. :arg_s_workprice.arg_s_mx[i].editflag,
  1007. :arg_s_workprice.arg_s_mx[i].mtrlid,
  1008. :arg_s_workprice.arg_s_mx[i].proorder,
  1009. :arg_s_workprice.arg_s_mx[i].procode,
  1010. :arg_s_workprice.arg_s_mx[i].proname,
  1011. :arg_s_workprice.arg_s_mx[i].workqty_ori,
  1012. :arg_s_workprice.arg_s_mx[i].workqty,
  1013. :arg_s_workprice.arg_s_mx[i].workprice_ori,
  1014. :arg_s_workprice.arg_s_mx[i].workprice,
  1015. :arg_s_workprice.arg_s_mx[i].wrkgrpid,
  1016. :arg_s_workprice.arg_s_mx[i].ifstandard,
  1017. :arg_s_workprice.arg_s_mx[i].lsxtype,
  1018. :arg_s_workprice.arg_s_mx[i].lastflag,
  1019. :arg_s_workprice.arg_s_mx[i].dscrp,
  1020. :arg_s_workprice.arg_s_mx[i].workhour,
  1021. :arg_s_workprice.arg_s_mx[i].techlevel,
  1022. :arg_s_workprice.arg_s_mx[i].status,
  1023. :arg_s_workprice.arg_s_mx[i].ifjd,
  1024. :arg_s_workprice.arg_s_mx[i].wrkid,
  1025. :arg_s_workprice.arg_s_mx[i].arg1,
  1026. :arg_s_workprice.arg_s_mx[i].arg2,
  1027. :arg_s_workprice.arg_s_mx[i].arg3,
  1028. :arg_s_workprice.arg_s_mx[i].arg4,
  1029. :arg_s_workprice.arg_s_mx[i].arg5,
  1030. :arg_s_workprice.arg_s_mx[i].arg6,
  1031. :arg_s_workprice.arg_s_mx[i].arg7,
  1032. :arg_s_workprice.arg_s_mx[i].arg8,
  1033. :arg_s_workprice.arg_s_mx[i].arg9,
  1034. :arg_s_workprice.arg_s_mx[i].workhour_minute,
  1035. :arg_s_workprice.arg_s_mx[i].beforehour_minute,
  1036. :arg_s_workprice.arg_s_mx[i].afterhour_minute,
  1037. :arg_s_workprice.arg_s_mx[i].eqworkhour_minute,
  1038. :arg_s_workprice.arg_s_mx[i].pricestr,
  1039. :arg_s_workprice.arg_s_mx[i].workqtystr,
  1040. :arg_s_workprice.arg_s_mx[i].wpcode,
  1041. :arg_s_workprice.arg_s_mx[i].u_workqty,
  1042. :arg_s_workprice.arg_s_mx[i].u_workprice,
  1043. :arg_s_workprice.arg_s_mx[i].u_workqtystr,
  1044. :arg_s_workprice.arg_s_mx[i].u_pricestr,
  1045. :arg_s_workprice.arg_s_mx[i].proname_ori,
  1046. :arg_s_workprice.arg_s_mx[i].ifgroup,
  1047. :arg_s_workprice.arg_s_mx[i].replacestr,
  1048. :arg_s_workprice.arg_s_mx[i].worktype,
  1049. :arg_s_workprice.arg_s_mx[i].rpcode,
  1050. :arg_s_workprice.arg_s_mx[i].ifdftpg,
  1051. :arg_s_workprice.arg_s_mx[i].ifdftjj);
  1052. If sqlca.SQLCode <> 0 Then
  1053. uo_billid = arg_s_workprice.billid
  1054. rslt = 0
  1055. arg_msg = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  1056. Goto ext
  1057. End If
  1058. Next
  1059. For ll_i = 1 To it_mxbt
  1060. If arg_s_workprice.arg_s_mx[ll_i].editflag = 0 Then //变更
  1061. If arg_s_workprice.arg_s_mx[ll_i].workqty > 0 Then
  1062. Update u_sc_workprice
  1063. Set ifchangebill = 1
  1064. Where mtrlid = :arg_s_workprice.arg_s_mx[ll_i].mtrlid
  1065. And procode = :arg_s_workprice.arg_s_mx[ll_i].procode
  1066. And wpcode = :arg_s_workprice.arg_s_mx[ll_i].wpcode;
  1067. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
  1068. rslt = 0
  1069. ARG_MSG = '更新工价表是否有相关变更单字段失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  1070. Goto ext
  1071. End If
  1072. End If
  1073. End If
  1074. Next
  1075. ext:
  1076. If rslt = 0 Then
  1077. Rollback;
  1078. ElseIf arg_ifcommit And rslt = 1 Then
  1079. Commit;
  1080. End If
  1081. Return rslt
  1082. end function
  1083. public function integer uof_mod_rsltflag (long arg_billid, long arg_printid, integer arg_rsltflag, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  1084. Int li_flag,li_priceflag
  1085. IF arg_billid <= 0 THEN
  1086. rslt = 0
  1087. ARG_MSG = '错误单据唯一码'
  1088. GOTO ext
  1089. END IF
  1090. IF p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 THEN
  1091. rslt = 0
  1092. GOTO ext
  1093. END IF
  1094. IF li_flag <> 0 THEN
  1095. rslt = 0
  1096. ARG_MSG = '单据不是在待审核状态,不可以修改结果'
  1097. GOTO ext
  1098. END IF
  1099. UPDATE u_workprice_changemx
  1100. SET rsltflag = :arg_rsltflag
  1101. WHERE billid = :arg_billid
  1102. and printid = :arg_printid ;
  1103. IF sqlca.SQLCode <> 0 Or sqlca.SQLNRows <= 0 THEN
  1104. rslt = 0
  1105. arg_msg = "更新工价表变更单明细结果操作失败"+"~n"+sqlca.SQLErrText
  1106. GOTO ext
  1107. END IF
  1108. ext:
  1109. IF rslt = 0 THEN
  1110. ROLLBACK;
  1111. ELSEIF arg_ifcommit THEN
  1112. COMMIT;
  1113. END IF
  1114. RETURN rslt
  1115. end function
  1116. public function integer priceaudit (long arg_billid, string arg_opemp, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  1117. Int li_flag, li_priceflag
  1118. Long ll_scid
  1119. String ls_billcode, ls_relcode, ls_dscrp
  1120. DateTime null_dt
  1121. SetNull(null_dt)
  1122. If arg_billid <= 0 Then
  1123. rslt = 0
  1124. ARG_MSG = '错误单据唯一码'
  1125. Goto ext
  1126. End If
  1127. If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
  1128. rslt = 0
  1129. Goto ext
  1130. End If
  1131. If li_priceflag <> 0 Then
  1132. rslt = 0
  1133. ARG_MSG = '单据不是在待确认状态,不可以确认'
  1134. Goto ext
  1135. End If
  1136. Select scid, billcode, relcode, dscrp
  1137. Into :ll_scid, :ls_billcode, :ls_relcode, :ls_dscrp
  1138. From u_workprice_change
  1139. Where billid = :arg_billid;
  1140. If sqlca.SQLCode <> 0 Then
  1141. rslt = 0
  1142. ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
  1143. Goto ext
  1144. End If
  1145. //更新确认标记
  1146. Update u_workprice_change
  1147. Set priceemp = :arg_opemp,
  1148. pricedate = getdate(),
  1149. priceflag = 1
  1150. Where billid = :arg_billid
  1151. And priceflag = 0;
  1152. If sqlca.SQLCode <> 0 Then
  1153. rslt = 0
  1154. ARG_MSG = "单据确认操作失败"+"~n"+sqlca.SQLErrText
  1155. Goto ext
  1156. ElseIf sqlca.SQLNRows = 0 Then
  1157. rslt = 0
  1158. ARG_MSG = "单据正在确认,请稍后查询。"+"~n"+sqlca.SQLErrText
  1159. Goto ext
  1160. End If
  1161. If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
  1162. If f_oa(sqlca,False,ARG_MSG,1494,ll_scid,arg_billid,ls_billcode,ls_relcode,ls_dscrp) = 0 Then
  1163. rslt = 0
  1164. Goto ext
  1165. End If
  1166. End If
  1167. s_workprice_changemx s_workprice_mx[]
  1168. Long ll_arr_cnt,ll_i
  1169. If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
  1170. rslt = 0
  1171. Goto ext
  1172. End If
  1173. For ll_i = 1 To ll_arr_cnt
  1174. If s_workprice_mx[ll_i].editflag = 0 Then //变更
  1175. If s_workprice_mx[ll_i].workqty > 0 Then
  1176. Update u_sc_workprice
  1177. Set changeflag_ori = changeflag,
  1178. changeflag = 1,
  1179. oppflag = 0
  1180. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  1181. And procode = :s_workprice_mx[ll_i].procode
  1182. And wpcode = :s_workprice_mx[ll_i].wpcode;
  1183. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
  1184. rslt = 0
  1185. ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  1186. Goto ext
  1187. End If
  1188. End If
  1189. End If
  1190. Next
  1191. ext:
  1192. If rslt = 0 Then
  1193. Rollback;
  1194. ElseIf rslt = 1 And arg_ifcommit Then
  1195. Commit;
  1196. End If
  1197. Return rslt
  1198. end function
  1199. public function integer c_priceaudit (long arg_billid, ref string arg_msg, boolean arg_ifcommit);Int rslt = 1
  1200. Int li_flag, li_priceflag
  1201. Long ll_scid
  1202. If arg_billid <= 0 Then
  1203. rslt = 0
  1204. ARG_MSG = '错误单据唯一码'
  1205. Goto ext
  1206. End If
  1207. If p_getflag(arg_billid,li_flag,li_priceflag,ARG_MSG) = 0 Then
  1208. rslt = 0
  1209. Goto ext
  1210. End If
  1211. If li_priceflag <> 1 Then
  1212. rslt = 0
  1213. ARG_MSG = '单据不是在已确认状态,不可以反确认'
  1214. Goto ext
  1215. End If
  1216. If li_flag <> 0 Then
  1217. rslt = 0
  1218. ARG_MSG = '单据不是在待审核状态,不可以反确认'
  1219. Goto ext
  1220. End If
  1221. Select scid
  1222. Into :ll_scid
  1223. From u_workprice_change
  1224. Where billid = :arg_billid;
  1225. If sqlca.SQLCode <> 0 Then
  1226. rslt = 0
  1227. ARG_MSG = '查询单据信息失败,'+sqlca.SQLErrText
  1228. Goto ext
  1229. End If
  1230. If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
  1231. If f_check_if_oaflow_caudit(ll_scid,arg_billid,1494,ARG_MSG ) = 0 Then
  1232. rslt = 0
  1233. Goto ext
  1234. End If
  1235. End If
  1236. s_workprice_changemx s_workprice_mx[]
  1237. Long ll_arr_cnt,ll_i
  1238. If getinfo(arg_billid,s_workprice_mx,ll_arr_cnt,ARG_MSG) = 0 Then
  1239. rslt = 0
  1240. Goto ext
  1241. End If
  1242. For ll_i = 1 To ll_arr_cnt
  1243. If s_workprice_mx[ll_i].editflag = 0 Then //变更
  1244. If audit_buildtype = 0 Then
  1245. If s_workprice_mx[ll_i].workqty > 0 Then
  1246. Update u_sc_workprice
  1247. Set changeflag = changeflag_ori
  1248. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  1249. And procode = :s_workprice_mx[ll_i].procode
  1250. And wpcode = :s_workprice_mx[ll_i].wpcode;
  1251. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
  1252. rslt = 0
  1253. ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  1254. Goto ext
  1255. End If
  1256. End If
  1257. Else
  1258. Update u_sc_workprice
  1259. Set changeflag = changeflag_ori,
  1260. oppflag = 1,
  1261. opprep = :publ_operator,
  1262. oppdate = getdate(),
  1263. oppreason = :oppreason
  1264. Where mtrlid = :s_workprice_mx[ll_i].mtrlid
  1265. And procode = :s_workprice_mx[ll_i].procode
  1266. And wpcode = :s_workprice_mx[ll_i].wpcode;
  1267. If sqlca.SQLCode <> 0 Or sqlca.SQLNRows = 0 Then
  1268. rslt = 0
  1269. ARG_MSG = '更新工价表失败,第 '+String(ll_i)+' 行'+'~n'+sqlca.SQLErrText
  1270. Goto ext
  1271. End If
  1272. End If
  1273. End If
  1274. Next
  1275. //更新确认标记
  1276. Update u_workprice_change
  1277. Set priceemp = '',
  1278. pricedate = Null,
  1279. priceflag = 0
  1280. Where billid = :arg_billid
  1281. And priceflag = 1
  1282. And flag = 0;
  1283. If sqlca.SQLCode <> 0 Then
  1284. rslt = 0
  1285. ARG_MSG = "单据反确认操作失败"+"~n"+sqlca.SQLErrText
  1286. Goto ext
  1287. ElseIf sqlca.SQLNRows = 0 Then
  1288. rslt = 0
  1289. ARG_MSG = "单据正在审核,请稍后查询。"+"~n"+sqlca.SQLErrText
  1290. Goto ext
  1291. End If
  1292. If sys_option_if_oa_workprice_change = 1 And sys_option_workprice_change_secaudit = 1 And audit_buildtype = 0 Then
  1293. Update oa_doc
  1294. Set docflag = 12
  1295. Where powerid = 1494
  1296. And scid = :ll_scid
  1297. And billid = :arg_billid;
  1298. If sqlca.SQLCode <> 0 Then
  1299. rslt = 0
  1300. ARG_MSG = '更新相关公文状态失败'+sqlca.SQLErrText
  1301. Goto ext
  1302. End If
  1303. End If
  1304. ext:
  1305. If rslt = 0 Then
  1306. Rollback;
  1307. ElseIf rslt = 1 And arg_ifcommit Then
  1308. Commit;
  1309. End If
  1310. Return rslt
  1311. end function
  1312. public function integer p_getflag (long arg_billid, ref integer arg_flag, ref integer arg_priceflag, ref string arg_msg);Int rslt = 1
  1313. SELECT flag,priceflag
  1314. INTO :arg_flag,:arg_priceflag
  1315. FROM u_workprice_change
  1316. WHERE billid = :arg_billid;
  1317. IF sqlca.SQLCode <> 0 THEN
  1318. ARG_MSG = '查询单据审核标记失败,'+sqlca.SQLErrText
  1319. rslt = 0
  1320. GOTO ext
  1321. END IF
  1322. ext:
  1323. RETURN rslt
  1324. end function
  1325. on uo_workprice_change.create
  1326. call super::create
  1327. TriggerEvent( this, "constructor" )
  1328. end on
  1329. on uo_workprice_change.destroy
  1330. TriggerEvent( this, "destructor" )
  1331. call super::destroy
  1332. end on