w_warebalc_view_new_bk.srw 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180
  1. $PBExportHeader$w_warebalc_view_new_bk.srw
  2. forward
  3. global type w_warebalc_view_new_bk from w_publ_easyq
  4. end type
  5. type tv_1 from uo_tv_mtrltype within w_warebalc_view_new_bk
  6. end type
  7. type st_2 from statictext within w_warebalc_view_new_bk
  8. end type
  9. type ddlb_storageid from uo_ddlb_storageid within w_warebalc_view_new_bk
  10. end type
  11. type cbx_1 from checkbox within w_warebalc_view_new_bk
  12. end type
  13. type cbx_inout from checkbox within w_warebalc_view_new_bk
  14. end type
  15. type tab_1 from tab within w_warebalc_view_new_bk
  16. end type
  17. type tabpage_1 from userobject within tab_1
  18. end type
  19. type dw_inout from u_dw_rbtnfilter within tabpage_1
  20. end type
  21. type em_3 from editmask within tabpage_1
  22. end type
  23. type em_4 from editmask within tabpage_1
  24. end type
  25. type cb_iomx_retrieve from uo_imflatbutton within tabpage_1
  26. end type
  27. type ddlb_billtype from dropdownlistbox within tabpage_1
  28. end type
  29. type st_7 from statictext within tabpage_1
  30. end type
  31. type st_6 from statictext within tabpage_1
  32. end type
  33. type tabpage_1 from userobject within tab_1
  34. dw_inout dw_inout
  35. em_3 em_3
  36. em_4 em_4
  37. cb_iomx_retrieve cb_iomx_retrieve
  38. ddlb_billtype ddlb_billtype
  39. st_7 st_7
  40. st_6 st_6
  41. end type
  42. type tabpage_2 from userobject within tab_1
  43. end type
  44. type dw_out_noaudit from u_dw_rbtnfilter within tabpage_2
  45. end type
  46. type tabpage_2 from userobject within tab_1
  47. dw_out_noaudit dw_out_noaudit
  48. end type
  49. type tab_1 from tab within w_warebalc_view_new_bk
  50. tabpage_1 tabpage_1
  51. tabpage_2 tabpage_2
  52. end type
  53. type cb_other from uo_imflatbutton within w_warebalc_view_new_bk
  54. end type
  55. type sle_usual_query from u_sleedit within w_warebalc_view_new_bk
  56. end type
  57. type st_8 from statictext within w_warebalc_view_new_bk
  58. end type
  59. type st_1 from statictext within w_warebalc_view_new_bk
  60. end type
  61. type em_month from editmask within w_warebalc_view_new_bk
  62. end type
  63. type st_lastbalcdate from statictext within w_warebalc_view_new_bk
  64. end type
  65. type ddlb_1 from dropdownlistbox within w_warebalc_view_new_bk
  66. end type
  67. type cb_balc from uo_imflatbutton within w_warebalc_view_new_bk
  68. end type
  69. end forward
  70. global type w_warebalc_view_new_bk from w_publ_easyq
  71. string title = "仓库结存表"
  72. event ue_retrieve_info ( )
  73. event retrieve_pageretr ( )
  74. event ue_mtrl_info ( )
  75. event ue_retrieve_inoutmx ( )
  76. event ue_usual_query_filt ( )
  77. event ue_usual_query_retr ( )
  78. event ue_cmp_mtrlware ( )
  79. event ue_cmp_amt2 ( )
  80. event ue_cmp ( )
  81. event ue_update_inware_mtrlwareid ( )
  82. tv_1 tv_1
  83. st_2 st_2
  84. ddlb_storageid ddlb_storageid
  85. cbx_1 cbx_1
  86. cbx_inout cbx_inout
  87. tab_1 tab_1
  88. cb_other cb_other
  89. sle_usual_query sle_usual_query
  90. st_8 st_8
  91. st_1 st_1
  92. em_month em_month
  93. st_lastbalcdate st_lastbalcdate
  94. ddlb_1 ddlb_1
  95. cb_balc cb_balc
  96. end type
  97. global w_warebalc_view_new_bk w_warebalc_view_new_bk
  98. type variables
  99. Long cur_storageid = -1
  100. Long cur_storageid_arr[]
  101. DateTime balcdate //结存日期
  102. Int cur_mtrlorigin = -1 //当前显示物料来源
  103. String ls_handtype = ''
  104. string ls_mtrltype = ''
  105. long ins_if_info = 0
  106. integer cur_billtype_in = -1
  107. integer cur_billtype_out = -1
  108. end variables
  109. forward prototypes
  110. public subroutine wf_hidecol ()
  111. public function window getparentwindow ()
  112. end prototypes
  113. event ue_retrieve_info();if ddlb_1.text = '分类统计表' then return
  114. Long ll_row
  115. Long ll_mtrlid
  116. ll_row = dw_1.GetRow()
  117. IF ll_row <= 0 THEN
  118. ll_mtrlid = 0
  119. ELSE
  120. ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  121. END IF
  122. IF IsValid(w_mtrl_info) THEN
  123. w_mtrl_info.WindowState = Normal!
  124. w_mtrl_info.ins_mtrlid = ll_mtrlid
  125. w_mtrl_info.wf_retrieve(ll_mtrlid)
  126. END IF
  127. end event
  128. event retrieve_pageretr();
  129. Int rtr_zeronoallocqty
  130. IF cbx_1.Checked THEN
  131. rtr_zeronoallocqty = -1
  132. ELSE
  133. rtr_zeronoallocqty = 0
  134. END IF
  135. dw_1.Retrieve(cur_storageid_arr,ls_handtype,ls_mtrltype,cur_mtrlorigin,publ_operator)
  136. IF dw_1.RowCount() > 0 AND dw_1.GetRow() = 0 THEN dw_1.SetRow(1)
  137. //查询最后结存日期
  138. DateTime ldt_lastbalcdate
  139. SELECT max( balcdate)
  140. INTO :ldt_lastbalcdate
  141. FROM u_warebalc
  142. WHERE (storageid = :cur_storageid OR :cur_storageid = -1)
  143. And balcdateint <> 0;
  144. IF sqlca.SQLCode <> 0 THEN
  145. SetNull(ldt_lastbalcdate)
  146. END IF
  147. IF IsNull(ldt_lastbalcdate) THEN
  148. st_lastbalcdate.Text = '没有结存记录'
  149. ELSE
  150. st_lastbalcdate.Text = '最后结存日期:'+String(ldt_lastbalcdate, 'yyyy-mm-dd')
  151. END IF
  152. SetPointer(Arrow!)
  153. end event
  154. event ue_mtrl_info();if ddlb_1.text = '分类统计表' then return
  155. Long ll_row
  156. ll_row = dw_1.GetRow()
  157. IF ll_row <= 0 THEN
  158. MessageBox('提示','请选择物料',information!,OK!)
  159. RETURN
  160. END IF
  161. Long ll_mtrlid
  162. ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  163. IF IsValid(w_mtrl_info) THEN
  164. w_mtrl_info.WindowState = Normal!
  165. w_mtrl_info.ins_mtrlid = ll_mtrlid
  166. w_mtrl_info.wf_retrieve(ll_mtrlid)
  167. ELSE
  168. OpenWithParm(w_mtrl_info,ll_mtrlid)
  169. END IF
  170. end event
  171. event ue_retrieve_inoutmx();//Long ll_row
  172. //Long ll_storageid,ll_mtrlid, ll_mtrlwareid
  173. //String ls_status,ls_woodcode,ls_pcode
  174. //String ls_plancode,ls_mtrlcuscode,ls_location
  175. //Long ll_sptid
  176. //DateTime ld_fdate,ld_edate,ld_showsale_data
  177. //Int li_storagetype
  178. //
  179. //ll_row = dw_1.GetRow()
  180. //
  181. //
  182. //tab_1.tabpage_1.dw_inout.setredraw(false)
  183. //tab_1.tabpage_1.dw_inout.setfilter('')
  184. //tab_1.tabpage_1.dw_inout.filter()
  185. //
  186. //tab_1.tabpage_2.dw_out_noaudit.setredraw(false)
  187. //tab_1.tabpage_2.dw_out_noaudit.setfilter('')
  188. //tab_1.tabpage_2.dw_out_noaudit.filter()
  189. //
  190. //IF ll_row <= 0 THEN
  191. // tab_1.tabpage_1.dw_inout.Reset()
  192. // tab_1.tabpage_2.dw_out_noaudit.Reset()
  193. //ELSE
  194. // ld_fdate = DateTime(Date(tab_1.tabpage_1.em_3.Text),Time(0))
  195. // ld_edate = DateTime(Date(tab_1.tabpage_1.em_4.Text),Time('23:59:59'))
  196. //
  197. // IF ld_fdate < sys_showsaledata_mindt THEN
  198. // ld_showsale_data = sys_showsaledata_mindt
  199. // ELSE
  200. // ld_showsale_data = ld_fdate
  201. // END IF
  202. //
  203. // ll_mtrlwareid = dw_1.Object.u_mtrlware_mtrlwareid[ll_row]
  204. // ll_storageid = dw_1.Object.u_mtrlware_storageid[ll_row]
  205. // ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  206. // ls_status = dw_1.Object.u_mtrlware_status[ll_row]
  207. // ls_woodcode = dw_1.Object.u_mtrlware_woodcode[ll_row]
  208. // ls_pcode = dw_1.Object.u_mtrlware_pcode[ll_row]
  209. // ls_plancode = dw_1.Object.u_mtrlware_plancode[ll_row]
  210. // ll_sptid = dw_1.Object.u_mtrlware_sptid[ll_row]
  211. //
  212. // tab_1.tabpage_1.dw_inout.Retrieve(ll_storageid,ll_mtrlid,ld_fdate,ld_edate,ls_status,ls_woodcode,ls_pcode,ld_showsale_data,ls_plancode,ll_sptid, cur_billtype_in, cur_billtype_out)
  213. // tab_1.tabpage_2.dw_out_noaudit.Retrieve(ll_mtrlwareid)
  214. //END IF
  215. tab_1.tabpage_1.dw_inout.setredraw(true)
  216. tab_1.tabpage_2.dw_out_noaudit.setredraw(true)
  217. end event
  218. event ue_usual_query_filt();String obj_expr = ''
  219. IF ddlb_1.Text = '明细统计表' or ddlb_1.text='汇总统计表' THEN
  220. IF Trim(sle_usual_query.Text) <> '' THEN
  221. IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  222. obj_expr = obj_expr+' ( u_mtrldef_mtrlcode LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  223. obj_expr = obj_expr+' or ( u_mtrldef_mtrlname LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  224. ELSE
  225. obj_expr = obj_expr+' ( u_mtrldef_mtrlcode LIKE "'+Trim(sle_usual_query.Text)+'") '
  226. obj_expr = obj_expr+' or ( u_mtrldef_mtrlname LIKE "'+Trim(sle_usual_query.Text)+'") '
  227. END IF
  228. END IF
  229. ELSE
  230. IF Trim(sle_usual_query.Text) <> '' THEN
  231. IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  232. obj_expr = obj_expr+' ( u_mtrltype_mtrltype LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  233. ELSE
  234. obj_expr = obj_expr+' ( u_mtrltype_mtrltype LIKE "'+Trim(sle_usual_query.Text)+'") '
  235. END IF
  236. END IF
  237. END IF
  238. dw_1.SetFilter(obj_expr)
  239. dw_1.SetRedraw(FALSE)
  240. dw_1.Filter()
  241. IF dw_1.RowCount() >= 1 THEN
  242. dw_1.SelectRow(0,FALSE)
  243. dw_1.SelectRow(1,TRUE)
  244. END IF
  245. dw_1.SetRedraw(TRUE)
  246. end event
  247. event ue_usual_query_retr();//String ls_querystrpart = ''
  248. //ls_newselect = Lower(ori_oldselect)
  249. //IF Trim(sle_usual_query.Text) <> '' THEN
  250. // IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  251. // ls_querystrpart = ls_querystrpart + "u_mtrldef.mtrlcode like '%"+Trim(sle_usual_query.Text)+"%'"
  252. // ls_querystrpart = ls_querystrpart + " or u_mtrldef.mtrlname like '%"+Trim(sle_usual_query.Text)+"%')"
  253. // ELSE
  254. // ls_querystrpart = ls_querystrpart + " (u_mtrldef.mtrlcode like '"+Trim(sle_usual_query.Text)+"'"
  255. // ls_querystrpart = ls_querystrpart + " or u_mtrldef.mtrlname like '"+Trim(sle_usual_query.Text)+"')"
  256. // END IF
  257. //
  258. // IF Pos(ls_newselect," where ") <> 0 THEN
  259. // ls_newselect = ls_newselect+" AND ("+ls_querystrpart+')'
  260. // ELSE
  261. // ls_newselect = ls_newselect+" where ("+ls_querystrpart+')'
  262. // END IF
  263. //END IF
  264. //wf_retrieveuc(dw_pageretr,ls_newselect,1)
  265. //THIS.TriggerEvent('retrieve_pageretr')
  266. //
  267. end event
  268. event ue_cmp_mtrlware();//按库存数重算本期期初
  269. IF Not f_power_ind(1507) THEN
  270. MessageBox(publ_operator,'你没有使用权限!')
  271. RETURN
  272. END IF
  273. //IF Not dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  274. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  275. // RETURN
  276. //END IF
  277. IF MessageBox (publ_operator,"是否确定要执行按库存数重算结存功能?",Question!,YesNo! ) = 2 THEN RETURN
  278. IF cur_storageid = -1 THEN
  279. MessageBox('系统提示','请先选择仓库')
  280. RETURN
  281. END IF
  282. Long rslt = 1
  283. String arg_msg
  284. datastore ds_warebalc
  285. ds_warebalc = Create datastore
  286. ds_warebalc.DataObject = 'dw_warebalc_view'
  287. ds_warebalc.SetTransObject(sqlca)
  288. ds_warebalc.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  289. // //清空筛选内容
  290. //ds_warebalc.SetFilter('')
  291. //ds_warebalc.Filter()
  292. //ds_warebalc.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  293. Long ll_i
  294. Decimal ld_newcost // 最新成本价
  295. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  296. Decimal ld_balcqty,ld_balcamt
  297. Long ll_mtrlid
  298. String ls_status,ls_pcode,ls_woodcode
  299. String ls_mtrlcode
  300. Decimal ld_noallocqty,ld_wareamt,ld_noallocaddqty
  301. Decimal ld_noallocqty_sum,ld_wareamt_sum,ld_noallocaddqty_sum,ld_incaddqty,ld_desaddqty
  302. Long ll_sptid_cusid,ll_sptid
  303. Open(w_sys_wait_jdt) //初始化进度条
  304. w_sys_wait_jdt.Show()
  305. //结存查库存
  306. w_sys_wait_jdt.wf_accepttol(ds_warebalc.RowCount())
  307. FOR ll_i = 1 To ds_warebalc.RowCount()
  308. ll_mtrlid = ds_warebalc.Object.u_mtrldef_mtrlid[ll_i]
  309. ls_mtrlcode = ds_warebalc.Object.u_mtrldef_mtrlcode[ll_i]
  310. ls_status = ds_warebalc.Object.u_warebalc_status[ll_i]
  311. ls_woodcode = ds_warebalc.Object.u_warebalc_woodcode[ll_i]
  312. ls_pcode = ds_warebalc.Object.u_warebalc_pcode[ll_i]
  313. ll_sptid_cusid = ds_warebalc.Object.u_warebalc_sptid_cusid[ll_i]
  314. w_sys_wait_jdt.st_msg.Text = " 正在结存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  315. w_sys_wait_jdt.wf_inc(ll_i)
  316. SELECT isnull(sum(noallocqty),0),
  317. isnull(sum(wareamt),0),
  318. isnull(sum(noallocaddqty),0)
  319. INTO :ld_noallocqty,
  320. :ld_wareamt,
  321. :ld_noallocaddqty
  322. FROM u_mtrlware
  323. WHERE mtrlid = :ll_mtrlid
  324. AND storageid = :cur_storageid
  325. AND status = :ls_status
  326. AND woodcode = :ls_woodcode
  327. AND pcode = :ls_pcode
  328. And sptid = :ll_sptid_cusid;
  329. IF sqlca.SQLCode <> 0 THEN
  330. IF sqlca.SQLCode = 100 THEN
  331. ld_noallocqty = 0
  332. ld_wareamt = 0
  333. ELSE
  334. rslt = 0
  335. arg_msg = '查询库存资料失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  336. GOTO ext
  337. END IF
  338. END IF
  339. UPDATE u_warebalc
  340. SET balcqty = :ld_noallocqty,
  341. balcaddqty = :ld_noallocaddqty,
  342. balcamt = :ld_wareamt,
  343. bgqty = :ld_noallocqty + desqty - incqty,
  344. bgamt = :ld_wareamt + desamt - incamt,
  345. bgaddqty = :ld_noallocaddqty + desaddqty - incaddqty
  346. WHERE mtrlid = :ll_mtrlid
  347. AND balcdateint = 0
  348. AND Storageid = :cur_storageid
  349. AND status = :ls_status
  350. AND woodcode = :ls_woodcode
  351. AND pcode = :ls_pcode
  352. And sptid_cusid = :ll_sptid_cusid;
  353. IF sqlca.SQLCode <> 0 THEN
  354. rslt = 0
  355. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  356. GOTO ext
  357. END IF
  358. ld_noallocqty_sum += ld_noallocqty
  359. ld_wareamt_sum += ld_wareamt
  360. ld_noallocaddqty_sum += ld_noallocaddqty
  361. NEXT
  362. //库存计结存
  363. Long cnt,ll_scid
  364. datastore ds_mtrlware
  365. ds_mtrlware = Create datastore
  366. ds_mtrlware.DataObject = 'ds_warebalc_view_cmpl_mtrlware_to_balc'
  367. ds_mtrlware.SetTransObject(sqlca)
  368. ds_mtrlware.Retrieve(cur_storageid)
  369. ds_mtrlware.AcceptText()
  370. IF ld_noallocqty_sum <> ds_mtrlware.Object.sumqty[1] Or &
  371. ld_wareamt_sum <> ds_mtrlware.Object.sumamt[1] Or &
  372. ld_noallocaddqty_sum <> ds_mtrlware.Object.sumaddqty[1] THEN
  373. SELECT scid INTO :ll_scid
  374. FROM u_storage
  375. Where storageid = :cur_storageid;
  376. IF sqlca.SQLCode <> 0 THEN
  377. rslt = 0
  378. arg_msg = '查询仓库所属分部失败,操作取消'
  379. GOTO ext
  380. END IF
  381. w_sys_wait_jdt.wf_accepttol(ds_mtrlware.RowCount())
  382. FOR ll_i = 1 To ds_mtrlware.RowCount()
  383. ll_mtrlid = 0
  384. ls_mtrlcode = ''
  385. ls_status = ''
  386. ls_woodcode = ''
  387. ls_pcode = ''
  388. ld_noallocqty = 0
  389. ld_wareamt = 0
  390. ll_sptid = 0
  391. cnt = 0
  392. ls_mtrlcode = ds_mtrlware.Object.u_mtrldef_mtrlcode[ll_i]
  393. ll_mtrlid = ds_mtrlware.Object.mtrlid[ll_i]
  394. ls_status = ds_mtrlware.Object.status[ll_i]
  395. ls_woodcode = ds_mtrlware.Object.woodcode[ll_i]
  396. ls_pcode = ds_mtrlware.Object.pcode[ll_i]
  397. ld_noallocqty = ds_mtrlware.Object.qty[ll_i]
  398. ld_noallocaddqty = ds_mtrlware.Object.addqty[ll_i]
  399. ld_wareamt = ds_mtrlware.Object.amt[ll_i]
  400. ll_sptid = ds_mtrlware.Object.u_mtrlware_sptid[ll_i]
  401. w_sys_wait_jdt.st_msg.Text = " 正在库存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  402. w_sys_wait_jdt.wf_inc(ll_i)
  403. SELECT count(*) INTO :cnt
  404. FROM u_warebalc
  405. WHERE mtrlid = :ll_mtrlid
  406. AND balcdateint = 0
  407. AND Storageid = :cur_storageid
  408. AND status = :ls_status
  409. AND woodcode = :ls_woodcode
  410. AND pcode = :ls_pcode
  411. And sptid_cusid = :ll_sptid;
  412. IF sqlca.SQLCode <> 0 THEN
  413. rslt = 0
  414. arg_msg = '查询结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  415. GOTO ext
  416. END IF
  417. IF cnt > 0 THEN CONTINUE
  418. SELECT CASE when sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) Is Null THEN 0 ELSE sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) END ,
  419. CASE when sum(u_inwaremx.qty) Is Null THEN 0 ELSE sum(u_inwaremx.qty) END,
  420. CASE when sum(u_inwaremx.addqty) Is Null THEN 0 ELSE sum(u_inwaremx.addqty) END
  421. Into :ld_incamt,:ld_incqty,:ld_incaddqty
  422. From u_inwaremx,u_inware
  423. Where u_inwaremx.scid = u_inware.scid
  424. And u_inwaremx.inwareid = u_inware.inwareid
  425. And u_inware.storageid = :cur_storageid
  426. And u_inware.balcdateint = 0
  427. And u_inwaremx.mtrlid = :ll_mtrlid
  428. And u_inwaremx.status = :ls_status
  429. And u_inwaremx.woodcode = :ls_woodcode
  430. And u_inwaremx.pcode = :ls_pcode
  431. And u_inwaremx.sptid_cusid = :ll_sptid;
  432. IF sqlca.SQLCode <> 0 THEN
  433. rslt = 0
  434. arg_msg = '查询进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  435. GOTO ext
  436. END IF
  437. SELECT CASE when sum(u_outwaremx.costamt) Is Null THEN 0 ELSE sum(u_outwaremx.costamt) END ,
  438. CASE when sum(u_outwaremx.qty) Is Null THEN 0 ELSE sum(u_outwaremx.qty) END ,
  439. CASE when sum(u_outwaremx.addqty) Is Null THEN 0 ELSE sum(u_outwaremx.addqty) END
  440. Into :ld_desamt,:ld_desqty,:ld_desaddqty
  441. From u_outwaremx,u_outware
  442. Where u_outwaremx.scid = u_outware.scid
  443. And u_outwaremx.outwareid = u_outware.outwareid
  444. And u_outware.storageid = :cur_storageid
  445. And u_outware.balcdateint = 0
  446. And u_outwaremx.mtrlid = :ll_mtrlid
  447. And u_outwaremx.status = :ls_status
  448. And u_outwaremx.woodcode = :ls_woodcode
  449. And u_outwaremx.pcode = :ls_pcode
  450. And u_outwaremx.sptid = :ll_sptid;
  451. IF sqlca.SQLCode <> 0 THEN
  452. rslt = 0
  453. arg_msg = '查询出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  454. GOTO ext
  455. END IF
  456. INSERT INTO u_warebalc
  457. (scid,
  458. balcdateint,
  459. storageid,
  460. mtrlid,
  461. status,
  462. woodcode,
  463. pcode,
  464. bgqty,
  465. bgamt,
  466. incqty,
  467. incamt,
  468. desqty,
  469. desamt,
  470. balcqty,
  471. balcamt,
  472. sptid_cusid,
  473. bgaddqty,
  474. balcaddqty,
  475. incaddqty,
  476. desaddqty
  477. )
  478. VALUES
  479. (:ll_scid,0,
  480. :cur_storageid,
  481. :ll_mtrlid,
  482. :ls_status,
  483. :ls_woodcode,
  484. :ls_pcode,
  485. :ld_noallocqty + :ld_desqty - :ld_incqty,
  486. :ld_wareamt + :ld_desamt - :ld_incamt,
  487. :ld_incqty,
  488. :ld_incamt,
  489. :ld_desqty,
  490. :ld_desamt,
  491. :ld_noallocqty,
  492. :ld_wareamt,
  493. :ll_sptid,
  494. :ld_noallocaddqty + :ld_desaddqty - :ld_incaddqty,
  495. :ld_noallocaddqty,
  496. :ld_incqty,
  497. :ld_desaddqty);
  498. IF sqlca.SQLCode <> 0 THEN
  499. rslt = 0
  500. arg_msg = '新加结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  501. GOTO ext
  502. END IF
  503. NEXT
  504. END IF
  505. //CLOSE(w_sys_wait_jdt)
  506. //COMMIT;
  507. //MessageBox('系统提示','重算成功!')
  508. //THIS.TriggerEvent('retrieve_pageretr')
  509. ext:
  510. Destroy ds_warebalc
  511. Destroy ds_mtrlware
  512. Close(w_sys_wait_jdt)
  513. IF rslt = 0 THEN
  514. ROLLBACK;
  515. MessageBox('Error',arg_msg)
  516. RETURN
  517. ELSE
  518. COMMIT;
  519. MessageBox('系统提示','重算成功!')
  520. This.TriggerEvent('retrieve_pageretr')
  521. END IF
  522. end event
  523. event ue_cmp_amt2();//按上期结存重算本期结余
  524. IF Not f_power_ind(1507) THEN
  525. MessageBox(publ_operator,'你没有使用权限!')
  526. RETURN
  527. END IF
  528. //IF Not dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  529. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  530. // RETURN
  531. //END IF
  532. IF cur_storageid = -1 THEN
  533. MessageBox('系统提示','请先选择仓库')
  534. RETURN
  535. END IF
  536. Long rslt = 1
  537. String arg_msg
  538. Long cnt
  539. cnt = 0
  540. SELECT count(*) INTO :cnt
  541. FROM u_mtrlware
  542. WHERE u_mtrlware.storageid = :cur_storageid
  543. AND ( u_mtrlware.plancode <> '' OR sptid <> 0 )
  544. AND u_mtrlware.noallocqty <> 0
  545. And u_mtrlware.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  546. IF sqlca.SQLCode <> 0 THEN
  547. MessageBox('系统提示','查询仓库物料使用了批号库存失败,'+sqlca.SQLErrText)
  548. RETURN
  549. END IF
  550. IF cnt > 0 THEN
  551. MessageBox('系统提示','仓库物料使用了批号库存,不能重算')
  552. RETURN
  553. END IF
  554. cnt = 0
  555. SELECT count(*) INTO :cnt
  556. FROM u_outware,u_outwaremx
  557. WHERE u_outware.storageid = :cur_storageid
  558. AND u_outware.scid = u_outwaremx.scid
  559. AND u_outware.outwareid = u_outwaremx.outwareid
  560. AND u_outware.flag = 1
  561. AND u_outware.balcdateint = 0
  562. AND u_outwaremx.plancode <> ''
  563. And u_outwaremx.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  564. IF sqlca.SQLCode <> 0 THEN
  565. MessageBox('系统提示','查询仓库物料出仓使用了批号库存失败,'+sqlca.SQLErrText)
  566. RETURN
  567. END IF
  568. IF cnt > 0 THEN
  569. MessageBox('系统提示','仓库物料出仓使用了批号库存,不能重算')
  570. RETURN
  571. END IF
  572. cnt = 0
  573. SELECT count(*) INTO :cnt
  574. FROM u_inware,u_inwaremx
  575. WHERE u_inware.storageid = :cur_storageid
  576. AND u_inware.scid = u_inwaremx.scid
  577. AND u_inware.inwareid = u_inwaremx.inwareid
  578. AND u_inware.flag = 1
  579. AND u_inware.balcdateint = 0
  580. AND u_inwaremx.plancode <> ''
  581. And u_inwaremx.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  582. IF sqlca.SQLCode <> 0 THEN
  583. MessageBox('系统提示','查询仓库物料进仓使用了批号库存失败,'+sqlca.SQLErrText)
  584. RETURN
  585. END IF
  586. IF cnt > 0 THEN
  587. MessageBox('系统提示','仓库物料进仓使用了批号库存,不能重算')
  588. RETURN
  589. END IF
  590. IF MessageBox (publ_operator,"是否确定要执行按上期结存重算本期结余功能?",Question!,YesNo! ) = 2 THEN RETURN
  591. //IF cur_storageid = -1 THEN
  592. // MessageBox('系统提示','请先选择仓库')
  593. // RETURN
  594. //END IF
  595. datastore ds_warebalc
  596. ds_warebalc = Create datastore
  597. ds_warebalc.DataObject = 'dw_warebalc_view'
  598. ds_warebalc.SetTransObject(sqlca)
  599. ds_warebalc.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  600. // //清空筛选内容
  601. //ds_warebalc.SetFilter('')
  602. //ds_warebalc.Filter()
  603. //ds_warebalc.Retrieve(cur_storageid_arr,'','',cur_mtrlorigin,publ_operator)
  604. Long ll_lastbalcdateint
  605. Long ll_i
  606. Decimal ld_newcost // 最新成本价
  607. Decimal ld_balcqty_last,ld_balcamt_last,ld_inamt,ld_inqty,ld_outamt,ld_outqty
  608. Decimal ld_ubalcqty_last,ld_uinqty,ld_uoutqty
  609. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  610. Decimal ld_balcqty,ld_balcamt
  611. Long ll_mtrlid
  612. String ls_status,ls_pcode,ls_woodcode
  613. String ls_mtrlcode,ls_msg
  614. Long ll_sptid_cusid
  615. cnt = 0
  616. SELECT count(*) INTO :cnt
  617. FROM u_warebalc
  618. Where storageid = :cur_storageid;
  619. IF sqlca.SQLCode <> 0 THEN
  620. rslt = 0
  621. arg_msg = '查询历史结存失败,操作取消'
  622. GOTO ext
  623. END IF
  624. IF cnt > 0 THEN
  625. SELECT max(balcdateint) INTO :ll_lastbalcdateint
  626. FROM u_warebalc
  627. Where storageid = :cur_storageid;
  628. IF sqlca.SQLCode <> 0 THEN
  629. rslt = 0
  630. arg_msg = '查询上次结存失败,操作取消'
  631. GOTO ext
  632. END IF
  633. ELSE
  634. ll_lastbalcdateint = -1
  635. END IF
  636. UPDATE u_mtrlware
  637. SET noallocqty = 0,wareamt = 0
  638. Where storageid = : cur_storageid;
  639. IF sqlca.SQLCode <> 0 THEN
  640. rslt = 0
  641. arg_msg = '清除库存数量,金额失败,操作取消'
  642. GOTO ext
  643. END IF
  644. Open(w_sys_wait_jdt) //初始化进度条
  645. w_sys_wait_jdt.Show()
  646. w_sys_wait_jdt.wf_accepttol(ds_warebalc.RowCount())
  647. FOR ll_i = 1 To ds_warebalc.RowCount()
  648. ld_bgqty = ds_warebalc.Object.u_mtrldef_bgqty[ll_i]
  649. ld_bgamt = ds_warebalc.Object.u_mtrldef_bgamt[ll_i]
  650. ld_incqty = ds_warebalc.Object.u_mtrldef_incqty[ll_i]
  651. ld_incamt = ds_warebalc.Object.u_mtrldef_incamt[ll_i]
  652. ld_desqty = ds_warebalc.Object.u_mtrldef_desqty[ll_i]
  653. ld_desamt = ds_warebalc.Object.u_mtrldef_desamt[ll_i]
  654. ls_status = ds_warebalc.Object.u_warebalc_status[ll_i]
  655. ls_woodcode = ds_warebalc.Object.u_warebalc_woodcode[ll_i]
  656. ls_pcode = ds_warebalc.Object.u_warebalc_pcode[ll_i]
  657. ls_mtrlcode = ds_warebalc.Object.u_mtrldef_mtrlcode[ll_i]
  658. ll_mtrlid = ds_warebalc.Object.u_mtrldef_mtrlid[ll_i]
  659. ll_sptid_cusid = ds_warebalc.Object.u_warebalc_sptid_cusid[ll_i]
  660. // if ll_mtrlid = 9159 then
  661. // ll_mtrlid = 9159
  662. // end if
  663. w_sys_wait_jdt.st_msg.Text = " 正在重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  664. w_sys_wait_jdt.wf_inc(ll_i)
  665. IF IsNull(ld_bgqty) THEN ld_bgqty = 0
  666. IF IsNull(ld_incqty) THEN ld_incqty = 0
  667. IF IsNull(ld_bgamt) THEN ld_bgamt = 0
  668. IF IsNull(ld_incamt) THEN ld_incamt = 0
  669. IF IsNull(ld_desqty) THEN ld_desqty = 0
  670. IF IsNull(ld_desamt) THEN ld_desamt = 0
  671. //查期初
  672. IF ld_bgqty > 0 And ll_lastbalcdateint > 0 THEN
  673. SELECT balcqty,balcamt
  674. INTO :ld_balcqty_last,:ld_balcamt_last
  675. FROM u_warebalc
  676. WHERE storageid = :cur_storageid
  677. AND mtrlid = :ll_mtrlid
  678. AND status = :ls_status
  679. AND woodcode = :ls_woodcode
  680. AND pcode = :ls_pcode
  681. AND balcdateint = :ll_lastbalcdateint
  682. And sptid_cusid = :ll_sptid_cusid;
  683. IF sqlca.SQLCode <> 0 THEN
  684. rslt = 0
  685. arg_msg = '查询上月结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  686. GOTO ext
  687. END IF
  688. IF ld_balcqty_last <> ld_bgqty THEN ld_bgqty = ld_balcqty_last
  689. IF ld_balcamt_last <> ld_bgamt THEN ld_bgamt = ld_balcamt_last
  690. ELSE
  691. ld_bgqty = 0
  692. ld_bgamt = 0
  693. END IF
  694. //查进仓
  695. SELECT isnull(sum(u_inwaremx.qty),0),isnull(sum(u_inwaremx.uqty),0),isnull(sum(round(u_inwaremx.cost * u_inwaremx.qty,2)),0)
  696. INTO :ld_inqty,:ld_uinqty,:ld_inamt
  697. FROM u_inware,u_inwaremx
  698. WHERE u_inware.scid = u_inwaremx.scid
  699. AND u_inware.inwareid = u_inwaremx.inwareid
  700. AND u_inwaremx.mtrlid = :ll_mtrlid
  701. AND u_inwaremx.status = :ls_status
  702. AND u_inwaremx.woodcode = :ls_woodcode
  703. AND u_inwaremx.pcode = :ls_pcode
  704. AND u_inware.storageid = :cur_storageid
  705. AND u_inware.balcdateint = 0
  706. AND u_inware.flag = 1
  707. And u_inwaremx.sptid_cusid = :ll_sptid_cusid;
  708. IF sqlca.SQLCode <> 0 THEN
  709. rslt = 0
  710. arg_msg = '查询本月进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  711. GOTO ext
  712. END IF
  713. IF ld_incqty <> ld_inqty THEN ld_incqty = ld_inqty
  714. IF ld_incamt <> ld_inamt THEN ld_incamt = ld_inamt
  715. //查出仓
  716. SELECT isnull(sum(u_outwaremx.qty),0),isnull(sum(u_outwaremx.uqty),0),isnull(sum(round(u_outwaremx.costamt,2)),0)
  717. INTO :ld_outqty,:ld_uoutqty,:ld_outamt
  718. FROM u_outware,u_outwaremx
  719. WHERE u_outware.scid = u_outwaremx.scid
  720. AND u_outware.outwareid = u_outwaremx.outwareid
  721. AND u_outwaremx.mtrlid = :ll_mtrlid
  722. AND u_outwaremx.status = :ls_status
  723. AND u_outwaremx.woodcode = :ls_woodcode
  724. AND u_outwaremx.pcode = :ls_pcode
  725. AND u_outware.storageid = :cur_storageid
  726. AND u_outware.balcdateint = 0
  727. AND u_outware.flag = 1
  728. And u_outwaremx.sptid = :ll_sptid_cusid;
  729. IF sqlca.SQLCode <> 0 THEN
  730. rslt = 0
  731. arg_msg = '查询本月出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  732. GOTO ext
  733. END IF
  734. IF ld_desqty <> ld_outqty THEN ld_desqty = ld_outqty
  735. IF ld_desamt <> ld_outamt THEN ld_desamt = ld_outamt
  736. IF IsNull(ld_bgqty) THEN ld_bgqty = 0
  737. IF IsNull(ld_bgamt) THEN ld_bgamt = 0
  738. IF IsNull(ld_incqty) THEN ld_incqty = 0
  739. IF IsNull(ld_incamt) THEN ld_incamt = 0
  740. IF IsNull(ld_desqty) THEN ld_desqty = 0
  741. IF IsNull(ld_desamt) THEN ld_desamt = 0
  742. IF ld_bgqty + ld_incqty <> 0 THEN
  743. ld_newcost = Round((ld_bgamt + ld_incamt) / (ld_bgqty + ld_incqty),10)
  744. ELSE
  745. IF ld_desqty <> 0 THEN
  746. ld_newcost = Round(ld_desamt / ld_desqty, 10)
  747. ELSE
  748. ld_newcost = 0
  749. END IF
  750. END IF
  751. IF ld_newcost < 0 THEN ld_newcost = 0
  752. //更新期间出金额,结存金额
  753. UPDATE u_warebalc
  754. SET bgqty = :ld_bgqty,
  755. bgamt = :ld_bgamt,
  756. incqty = :ld_incqty,
  757. incamt = :ld_incamt,
  758. desqty = :ld_desqty,
  759. desamt = round(:ld_desqty * :ld_newcost,2),
  760. balcqty = :ld_bgqty + :ld_incqty - :ld_desqty,
  761. balcamt = round((:ld_bgqty + :ld_incqty - :ld_desqty) * :ld_newcost,2)
  762. WHERE mtrlid = :ll_mtrlid
  763. AND balcdateint = 0
  764. AND Storageid = :cur_storageid
  765. AND status = :ls_status
  766. AND woodcode = :ls_woodcode
  767. AND pcode = :ls_pcode
  768. And sptid_cusid = :ll_sptid_cusid;
  769. IF sqlca.SQLCode <> 0 THEN
  770. rslt = 0
  771. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  772. GOTO ext
  773. END IF
  774. UPDATE u_mtrlware
  775. SET cost = :ld_newcost,
  776. noallocqty = :ld_bgqty + :ld_incqty - :ld_desqty ,
  777. wareamt = round((:ld_bgqty + :ld_incqty - :ld_desqty) * :ld_newcost,2)
  778. WHERE mtrlid = :ll_mtrlid
  779. AND Storageid = :cur_storageid
  780. AND status = :ls_status
  781. AND woodcode = :ls_woodcode
  782. AND pcode = :ls_pcode
  783. AND plancode = ''
  784. And sptid = :ll_sptid_cusid;
  785. IF sqlca.SQLCode <> 0 THEN
  786. rslt = 0
  787. arg_msg = '更新库存金额失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  788. GOTO ext
  789. END IF
  790. UPDATE u_outwaremx
  791. SET u_outwaremx.cost = :ld_newcost,
  792. u_outwaremx.costamt = round(u_outwaremx.qty * :ld_newcost,2)
  793. FROM u_outwaremx INNER JOIN
  794. u_outware ON u_outwaremx.scid = u_outware.scid AND
  795. u_outwaremx.outwareid = u_outware.outwareid
  796. WHERE u_outwaremx.mtrlid = :ll_mtrlid
  797. AND u_outware.storageid = :cur_storageid
  798. AND u_outwaremx.status = :ls_status
  799. AND u_outwaremx.woodcode = :ls_woodcode
  800. AND u_outwaremx.pcode = :ls_pcode
  801. AND u_outware.balcflag = 0
  802. And u_outwaremx.sptid = :ll_sptid_cusid;
  803. IF sqlca.SQLCode <> 0 THEN
  804. rslt = 0
  805. arg_msg = '更新未结存的出仓单金额失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  806. GOTO ext
  807. END IF
  808. NEXT
  809. ext:
  810. Destroy ds_warebalc
  811. Close(w_sys_wait_jdt)
  812. IF rslt = 0 THEN
  813. ROLLBACK;
  814. MessageBox('Error',arg_msg)
  815. RETURN
  816. ELSE
  817. COMMIT;
  818. MessageBox('系统提示','重算成功!')
  819. This.TriggerEvent('retrieve_pageretr')
  820. END IF
  821. end event
  822. event ue_cmp();//超级重算
  823. IF Not f_power_ind(1507) THEN
  824. MessageBox(publ_operator,'你没有使用权限!')
  825. RETURN
  826. END IF
  827. //IF NOT dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  828. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  829. // RETURN
  830. //END IF
  831. IF MessageBox (publ_operator,"是否确定要执行超级重算结存功能?",Question!,YesNo! ) = 2 THEN RETURN
  832. IF cur_storageid = -1 THEN
  833. MessageBox('系统提示','请先选择仓库')
  834. RETURN
  835. END IF
  836. //// //清空筛选内容
  837. //dw_pageretr.SetFilter('')
  838. //dw_pageretr.Filter()
  839. //dw_pageretr.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  840. Long rslt = 1
  841. String arg_msg
  842. Long ll_i
  843. Decimal ld_newcost // 最新成本价
  844. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  845. Decimal ld_balcqty,ld_balcamt
  846. Long ll_mtrlid
  847. String ls_status,ls_pcode,ls_woodcode
  848. String ls_mtrlcode
  849. Decimal ld_noallocqty,ld_wareamt
  850. Decimal ld_noallocqty_sum,ld_wareamt_sum
  851. Long ll_sptid
  852. Open(w_sys_wait_jdt) //初始化进度条
  853. w_sys_wait_jdt.Show()
  854. //
  855. ////结存查库存
  856. //库存计结存
  857. Long cnt,ll_scid
  858. datastore ds_mtrlware
  859. ds_mtrlware = Create datastore
  860. ds_mtrlware.DataObject = 'ds_warebalc_view_cmpl_mtrlware_to_balc2'
  861. ds_mtrlware.SetTransObject(sqlca)
  862. ds_mtrlware.Retrieve(cur_storageid)
  863. ds_mtrlware.AcceptText()
  864. //IF ld_noallocqty_sum <> ds_mtrlware.Object.sumqty[1] OR &
  865. // ld_wareamt_sum <> ds_mtrlware.Object.sumamt[1] THEN
  866. SELECT scid INTO :ll_scid
  867. FROM u_storage
  868. Where storageid = :cur_storageid;
  869. IF sqlca.SQLCode <> 0 THEN
  870. rslt = 0
  871. arg_msg = '查询仓库所属分部失败'
  872. GOTO ext
  873. END IF
  874. w_sys_wait_jdt.wf_accepttol(ds_mtrlware.RowCount())
  875. FOR ll_i = 1 To ds_mtrlware.RowCount()
  876. ll_mtrlid = 0
  877. ls_mtrlcode = ''
  878. ls_status = ''
  879. ls_woodcode = ''
  880. ls_pcode = ''
  881. ld_noallocqty = 0
  882. ld_wareamt = 0
  883. ll_sptid = 0
  884. cnt = 0
  885. ls_mtrlcode = ds_mtrlware.Object.u_mtrldef_mtrlcode[ll_i]
  886. ll_mtrlid = ds_mtrlware.Object.mtrlid[ll_i]
  887. ls_status = ds_mtrlware.Object.status[ll_i]
  888. ls_woodcode = ds_mtrlware.Object.woodcode[ll_i]
  889. ls_pcode = ds_mtrlware.Object.pcode[ll_i]
  890. ld_noallocqty = ds_mtrlware.Object.qty[ll_i]
  891. ld_wareamt = ds_mtrlware.Object.amt[ll_i]
  892. ll_sptid = ds_mtrlware.Object.u_mtrlware_sptid[ll_i]
  893. w_sys_wait_jdt.st_msg.Text = " 正在库存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  894. w_sys_wait_jdt.wf_inc(ll_i)
  895. SELECT sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) ,
  896. sum(u_inwaremx.qty)
  897. INTO :ld_incamt,:ld_incqty
  898. FROM u_inwaremx,u_inware
  899. WHERE u_inwaremx.scid = u_inware.scid
  900. AND u_inwaremx.inwareid = u_inware.inwareid
  901. AND u_inware.storageid = :cur_storageid
  902. AND u_inware.balcdateint = 0
  903. AND u_inwaremx.mtrlid = :ll_mtrlid
  904. AND u_inwaremx.status = :ls_status
  905. AND u_inwaremx.woodcode = :ls_woodcode
  906. AND u_inwaremx.pcode = :ls_pcode
  907. AND u_inwaremx.sptid_cusid = :ll_sptid
  908. And u_inware.flag = 1;
  909. IF sqlca.SQLCode <> 0 THEN
  910. rslt = 0
  911. arg_msg = '查询进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  912. GOTO ext
  913. END IF
  914. SELECT sum(u_outwaremx.costamt) ,
  915. sum(u_outwaremx.qty)
  916. INTO :ld_desamt,:ld_desqty
  917. FROM u_outwaremx,u_outware
  918. WHERE u_outwaremx.scid = u_outware.scid
  919. AND u_outwaremx.outwareid = u_outware.outwareid
  920. AND u_outware.storageid = :cur_storageid
  921. AND u_outware.balcdateint = 0
  922. AND u_outwaremx.mtrlid = :ll_mtrlid
  923. AND u_outwaremx.status = :ls_status
  924. AND u_outwaremx.woodcode = :ls_woodcode
  925. AND u_outwaremx.pcode = :ls_pcode
  926. AND u_outwaremx.sptid = :ll_sptid
  927. And u_outware.flag = 1;
  928. IF sqlca.SQLCode <> 0 THEN
  929. rslt = 0
  930. arg_msg = '查询出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  931. GOTO ext
  932. END IF
  933. IF IsNull(ld_desqty) THEN ld_desqty = 0
  934. IF IsNull(ld_incqty) THEN ld_incqty = 0
  935. IF IsNull(ld_desamt) THEN ld_desamt = 0
  936. IF IsNull(ld_incamt) THEN ld_incamt = 0
  937. UPDATE u_warebalc
  938. SET balcqty = :ld_noallocqty,
  939. balcamt = :ld_wareamt,
  940. bgqty = :ld_noallocqty + :ld_desqty - :ld_incqty,
  941. bgamt = :ld_wareamt + :ld_desamt - :ld_incamt,
  942. incqty = :ld_incqty,
  943. incamt = :ld_incamt,
  944. desqty = :ld_desqty,
  945. desamt = :ld_desamt
  946. WHERE mtrlid = :ll_mtrlid
  947. AND balcdateint = 0
  948. AND Storageid = :cur_storageid
  949. AND status = :ls_status
  950. AND woodcode = :ls_woodcode
  951. AND pcode = :ls_pcode
  952. And sptid_cusid = :ll_sptid;
  953. IF sqlca.SQLCode <> 0 THEN
  954. rslt = 0
  955. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  956. GOTO ext
  957. ELSEIF sqlca.SQLNRows = 0 THEN
  958. INSERT INTO u_warebalc
  959. (scid,
  960. balcdateint,
  961. storageid,
  962. mtrlid,
  963. status,
  964. woodcode,
  965. pcode,
  966. bgqty,
  967. bgamt,
  968. incqty,
  969. incamt,
  970. desqty,
  971. desamt,
  972. balcqty,
  973. balcamt,
  974. sptid_cusid)
  975. VALUES
  976. (:sys_scid,0,
  977. :cur_storageid,
  978. :ll_mtrlid,
  979. :ls_status,
  980. :ls_woodcode,
  981. :ls_pcode,
  982. :ld_noallocqty + :ld_desqty - :ld_incqty,
  983. :ld_wareamt + :ld_desamt - :ld_incamt,
  984. :ld_incqty,
  985. :ld_incamt,
  986. :ld_desqty,
  987. :ld_desamt,
  988. :ld_noallocqty,
  989. :ld_wareamt,
  990. :ll_sptid);
  991. IF sqlca.SQLCode <> 0 THEN
  992. rslt = 0
  993. arg_msg = '新加结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  994. GOTO ext
  995. END IF
  996. END IF
  997. NEXT
  998. //END IF
  999. ext:
  1000. Destroy ds_mtrlware
  1001. Close(w_sys_wait_jdt)
  1002. IF rslt = 0 THEN
  1003. ROLLBACK;
  1004. MessageBox('Error',arg_msg)
  1005. RETURN
  1006. ELSE
  1007. COMMIT;
  1008. MessageBox('系统提示','重算成功!')
  1009. This.TriggerEvent('retrieve_pageretr')
  1010. END IF
  1011. end event
  1012. event ue_update_inware_mtrlwareid();UPDATE u_inwaremx
  1013. SET mtrlwareid = u_mtrlware.mtrlwareid
  1014. FROM u_inware INNER JOIN
  1015. u_inwaremx ON u_inware.scid = u_inwaremx.scid AND
  1016. u_inware.inwareid = u_inwaremx.inwareid INNER JOIN
  1017. u_mtrlware ON u_inwaremx.scid = u_mtrlware.scid AND
  1018. u_inwaremx.mtrlid = u_mtrlware.mtrlid AND
  1019. u_inwaremx.plancode = u_mtrlware.plancode AND
  1020. u_inwaremx.status = u_mtrlware.Status AND
  1021. u_inwaremx.woodcode = u_mtrlware.woodcode AND
  1022. u_inwaremx.pcode = u_mtrlware.pcode AND
  1023. u_inwaremx.sptid_cusid = u_mtrlware.Sptid AND
  1024. u_inware.storageid = u_mtrlware.storageid AND
  1025. u_inware.Dxflag = u_mtrlware.Dxflag
  1026. Where (u_inware.flag = 1) And (u_inwaremx.mtrlwareid = 0);
  1027. IF sqlca.SQLCode <> 0 THEN
  1028. ROLLBACK;
  1029. MessageBox('','失败')
  1030. ELSE
  1031. COMMIT;
  1032. MessageBox('','成功')
  1033. END IF
  1034. end event
  1035. public subroutine wf_hidecol ();s_hide_col s_col
  1036. s_col.col_1 = 'u_mtrldef_bgamt'
  1037. s_col.col_2 = 'u_mtrldef_incamt'
  1038. s_col.col_3 = 'u_mtrldef_desamt'
  1039. s_col.col_4 = 'u_mtrldef_balcamt'
  1040. f_hide_col(123,dw_1,s_col)
  1041. end subroutine
  1042. public function window getparentwindow ();return this
  1043. end function
  1044. on w_warebalc_view_new_bk.create
  1045. int iCurrent
  1046. call super::create
  1047. this.tv_1=create tv_1
  1048. this.st_2=create st_2
  1049. this.ddlb_storageid=create ddlb_storageid
  1050. this.cbx_1=create cbx_1
  1051. this.cbx_inout=create cbx_inout
  1052. this.tab_1=create tab_1
  1053. this.cb_other=create cb_other
  1054. this.sle_usual_query=create sle_usual_query
  1055. this.st_8=create st_8
  1056. this.st_1=create st_1
  1057. this.em_month=create em_month
  1058. this.st_lastbalcdate=create st_lastbalcdate
  1059. this.ddlb_1=create ddlb_1
  1060. this.cb_balc=create cb_balc
  1061. iCurrent=UpperBound(this.Control)
  1062. this.Control[iCurrent+1]=this.tv_1
  1063. this.Control[iCurrent+2]=this.st_2
  1064. this.Control[iCurrent+3]=this.ddlb_storageid
  1065. this.Control[iCurrent+4]=this.cbx_1
  1066. this.Control[iCurrent+5]=this.cbx_inout
  1067. this.Control[iCurrent+6]=this.tab_1
  1068. this.Control[iCurrent+7]=this.cb_other
  1069. this.Control[iCurrent+8]=this.sle_usual_query
  1070. this.Control[iCurrent+9]=this.st_8
  1071. this.Control[iCurrent+10]=this.st_1
  1072. this.Control[iCurrent+11]=this.em_month
  1073. this.Control[iCurrent+12]=this.st_lastbalcdate
  1074. this.Control[iCurrent+13]=this.ddlb_1
  1075. this.Control[iCurrent+14]=this.cb_balc
  1076. end on
  1077. on w_warebalc_view_new_bk.destroy
  1078. call super::destroy
  1079. destroy(this.tv_1)
  1080. destroy(this.st_2)
  1081. destroy(this.ddlb_storageid)
  1082. destroy(this.cbx_1)
  1083. destroy(this.cbx_inout)
  1084. destroy(this.tab_1)
  1085. destroy(this.cb_other)
  1086. destroy(this.sle_usual_query)
  1087. destroy(this.st_8)
  1088. destroy(this.st_1)
  1089. destroy(this.em_month)
  1090. destroy(this.st_lastbalcdate)
  1091. destroy(this.ddlb_1)
  1092. destroy(this.cb_balc)
  1093. end on
  1094. event resize;call super::resize;IF cbx_inout.Checked THEN
  1095. tab_1.Visible = TRUE
  1096. dw_1.Width = THIS.Width - dw_1.X - 40
  1097. dw_1.Height = THIS.Height - dw_1.Y - tab_1.Height - 150
  1098. tv_1.Height = THIS.Height - tv_1.Y - 150
  1099. tab_1.Width = THIS.Width - tab_1.X - 40
  1100. tab_1.Y = dw_1.Y + dw_1.Height + 10
  1101. tab_1.X = dw_1.X
  1102. tab_1.tabpage_1.dw_inout.Height = tab_1.tabpage_1.Height - tab_1.tabpage_1.dw_inout.Y - 40
  1103. tab_1.tabpage_1.dw_inout.Width = tab_1.tabpage_1.Width - tab_1.tabpage_1.dw_inout.X - 40
  1104. tab_1.tabpage_2.dw_out_noaudit.Height = tab_1.tabpage_2.Height - tab_1.tabpage_2.dw_out_noaudit.Y - 40
  1105. tab_1.tabpage_2.dw_out_noaudit.Width = tab_1.tabpage_2.Width - tab_1.tabpage_2.dw_out_noaudit.X - 40
  1106. ELSE
  1107. dw_1.Width = THIS.Width - dw_1.X - 40
  1108. dw_1.Height = THIS.Height - dw_1.Y - 150
  1109. tv_1.Height = THIS.Height - tv_1.Y - 150
  1110. tab_1.Visible = FALSE
  1111. END IF
  1112. end event
  1113. event ue_before_open;call super::ue_before_open;cbx_1.visible = false
  1114. cbx_inout.visible = false
  1115. ins_if_info = Long(f_ProfileString (sys_empid,This.ClassName(), "ins_if_info",'0'))
  1116. IF ins_if_info = 1 THEN
  1117. This.PostEvent('ue_mtrl_info')
  1118. END IF
  1119. end event
  1120. event ue_before_openretrieve;call super::ue_before_openretrieve;tab_1.tabpage_1.dw_inout.settransobject(sqlca)
  1121. tab_1.tabpage_2.dw_out_noaudit.settransobject(sqlca)
  1122. end event
  1123. event close;call super::close;IF IsValid(w_mtrl_info) THEN
  1124. ins_if_info = 1
  1125. ELSE
  1126. ins_if_info = 0
  1127. END IF
  1128. f_SetProfileString (sys_empid,This.ClassName(),"ins_if_info",String(ins_if_info))
  1129. end event
  1130. type cb_func from w_publ_easyq`cb_func within w_warebalc_view_new_bk
  1131. end type
  1132. type cb_exit from w_publ_easyq`cb_exit within w_warebalc_view_new_bk
  1133. integer x = 1536
  1134. end type
  1135. type cb_2 from w_publ_easyq`cb_2 within w_warebalc_view_new_bk
  1136. integer x = 1234
  1137. boolean bringtotop = true
  1138. end type
  1139. type cb_psetup from w_publ_easyq`cb_psetup within w_warebalc_view_new_bk
  1140. integer x = 978
  1141. boolean bringtotop = true
  1142. end type
  1143. type cb_1 from w_publ_easyq`cb_1 within w_warebalc_view_new_bk
  1144. boolean bringtotop = true
  1145. end type
  1146. event cb_1::clicked;parent.triggerevent("retrieve_pageretr")
  1147. end event
  1148. type st_3 from w_publ_easyq`st_3 within w_warebalc_view_new_bk
  1149. boolean visible = false
  1150. integer x = 690
  1151. integer y = 204
  1152. end type
  1153. type st_4 from w_publ_easyq`st_4 within w_warebalc_view_new_bk
  1154. boolean visible = false
  1155. integer x = 1381
  1156. integer y = 204
  1157. end type
  1158. type em_1 from w_publ_easyq`em_1 within w_warebalc_view_new_bk
  1159. boolean visible = false
  1160. integer x = 882
  1161. integer y = 188
  1162. integer taborder = 120
  1163. end type
  1164. type em_2 from w_publ_easyq`em_2 within w_warebalc_view_new_bk
  1165. boolean visible = false
  1166. integer x = 1486
  1167. integer y = 188
  1168. integer taborder = 130
  1169. end type
  1170. type ddlb_yl from w_publ_easyq`ddlb_yl within w_warebalc_view_new_bk
  1171. integer x = 2071
  1172. integer y = 8
  1173. end type
  1174. type cbx_yl from w_publ_easyq`cbx_yl within w_warebalc_view_new_bk
  1175. integer x = 1861
  1176. integer y = 12
  1177. end type
  1178. type dw_1 from w_publ_easyq`dw_1 within w_warebalc_view_new_bk
  1179. integer x = 805
  1180. integer y = 392
  1181. integer width = 2400
  1182. integer height = 988
  1183. string dataobject = "dw_warebalc_view_sum"
  1184. end type
  1185. event dw_1::doubleclicked;call super::doubleclicked;IF dwo.Name = 'u_mtrlware_waredscrp' THEN
  1186. Parent.TriggerEvent('ue_waredscrp_view')
  1187. END IF
  1188. end event
  1189. event dw_1::rowfocuschanged;call super::rowfocuschanged;Parent.TriggerEvent('ue_retrieve_info')
  1190. IF cbx_inout.Checked THEN
  1191. Parent.TriggerEvent('ue_retrieve_inoutmx')
  1192. END IF
  1193. end event
  1194. type sle_mtrl from w_publ_easyq`sle_mtrl within w_warebalc_view_new_bk
  1195. end type
  1196. type sle_cust from w_publ_easyq`sle_cust within w_warebalc_view_new_bk
  1197. end type
  1198. type st_mtrl from w_publ_easyq`st_mtrl within w_warebalc_view_new_bk
  1199. end type
  1200. type st_cust from w_publ_easyq`st_cust within w_warebalc_view_new_bk
  1201. end type
  1202. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_warebalc_view_new_bk
  1203. boolean visible = true
  1204. integer x = 1861
  1205. integer y = 100
  1206. end type
  1207. type pb_em1 from w_publ_easyq`pb_em1 within w_warebalc_view_new_bk
  1208. boolean visible = false
  1209. integer x = 1298
  1210. integer y = 188
  1211. end type
  1212. type pb_em2 from w_publ_easyq`pb_em2 within w_warebalc_view_new_bk
  1213. boolean visible = false
  1214. integer x = 1897
  1215. integer y = 188
  1216. end type
  1217. type pb_2 from w_publ_easyq`pb_2 within w_warebalc_view_new_bk
  1218. boolean visible = false
  1219. integer x = 2007
  1220. integer y = 188
  1221. end type
  1222. type cb_help from w_publ_easyq`cb_help within w_warebalc_view_new_bk
  1223. integer x = 1385
  1224. end type
  1225. type cb_copyself from w_publ_easyq`cb_copyself within w_warebalc_view_new_bk
  1226. integer x = 722
  1227. end type
  1228. type gb_1 from w_publ_easyq`gb_1 within w_warebalc_view_new_bk
  1229. end type
  1230. type ln_bar from w_publ_easyq`ln_bar within w_warebalc_view_new_bk
  1231. end type
  1232. type ln_bar2 from w_publ_easyq`ln_bar2 within w_warebalc_view_new_bk
  1233. end type
  1234. type r_bar from w_publ_easyq`r_bar within w_warebalc_view_new_bk
  1235. integer x = 2272
  1236. end type
  1237. type ln_1 from w_publ_easyq`ln_1 within w_warebalc_view_new_bk
  1238. integer beginy = 384
  1239. integer endy = 384
  1240. end type
  1241. type ln_2 from w_publ_easyq`ln_2 within w_warebalc_view_new_bk
  1242. integer beginy = 388
  1243. integer endy = 388
  1244. end type
  1245. type ln_3 from w_publ_easyq`ln_3 within w_warebalc_view_new_bk
  1246. boolean visible = false
  1247. end type
  1248. type ln_4 from w_publ_easyq`ln_4 within w_warebalc_view_new_bk
  1249. boolean visible = false
  1250. end type
  1251. type tv_1 from uo_tv_mtrltype within w_warebalc_view_new_bk
  1252. integer y = 392
  1253. integer width = 800
  1254. integer height = 1808
  1255. integer taborder = 130
  1256. boolean bringtotop = true
  1257. integer textsize = -9
  1258. fontcharset fontcharset = gb2312charset!
  1259. fontfamily fontfamily = anyfont!
  1260. string facename = "宋体"
  1261. end type
  1262. event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype
  1263. ls_mtrltype = THIS.uo_cur_info.mtrltype
  1264. IF ls_handtype <> '' THEN
  1265. ls_mtrltype = '%'+ls_handtype+'%'
  1266. ls_handtype = ls_handtype+'%'
  1267. ELSE
  1268. ls_mtrltype = ""
  1269. END IF
  1270. PARENT.TriggerEvent('retrieve_pageretr')
  1271. end event
  1272. type st_2 from statictext within w_warebalc_view_new_bk
  1273. integer x = 5
  1274. integer y = 204
  1275. integer width = 343
  1276. integer height = 48
  1277. boolean bringtotop = true
  1278. integer textsize = -9
  1279. integer weight = 400
  1280. fontcharset fontcharset = gb2312charset!
  1281. fontpitch fontpitch = variable!
  1282. string facename = "宋体"
  1283. long textcolor = 33554432
  1284. long backcolor = 134217739
  1285. string text = "仓库:"
  1286. alignment alignment = right!
  1287. boolean focusrectangle = false
  1288. end type
  1289. type ddlb_storageid from uo_ddlb_storageid within w_warebalc_view_new_bk
  1290. integer x = 352
  1291. integer y = 188
  1292. integer width = 635
  1293. integer height = 1232
  1294. integer taborder = 130
  1295. boolean bringtotop = true
  1296. end type
  1297. event constructor;call super::constructor;cur_storageid = this.uo_storageid
  1298. cur_storageid_arr = this.uo_storageid_arr
  1299. end event
  1300. event selectionchanged;call super::selectionchanged;cur_storageid = this.uo_storageid
  1301. cur_storageid_arr = this.uo_storageid_arr
  1302. cb_1.triggerevent(clicked!)
  1303. end event
  1304. type cbx_1 from checkbox within w_warebalc_view_new_bk
  1305. integer x = 2080
  1306. integer y = 200
  1307. integer width = 439
  1308. integer height = 76
  1309. boolean bringtotop = true
  1310. integer textsize = -9
  1311. integer weight = 700
  1312. fontcharset fontcharset = gb2312charset!
  1313. fontpitch fontpitch = variable!
  1314. string facename = "宋体"
  1315. long backcolor = 134217739
  1316. string text = "显示 0 库存"
  1317. end type
  1318. event clicked;int if_zeromtrlware
  1319. if this.checked then
  1320. if_zeromtrlware=1
  1321. else
  1322. if_zeromtrlware=0
  1323. end if
  1324. f_SetProfileString (sys_empid,dw_1.DATAOBJECT, "if_zeromtrlware", string(if_zeromtrlware))
  1325. parent.triggerevent("retrieve_pageretr")
  1326. end event
  1327. event constructor;
  1328. int if_zeromtrlware
  1329. if_zeromtrlware=integer(f_ProfileString (sys_empid,dw_1.DATAOBJECT, "if_zeromtrlware", '0'))
  1330. if if_zeromtrlware =0 then
  1331. this.checked=false
  1332. else
  1333. this.checked=true
  1334. end if
  1335. end event
  1336. type cbx_inout from checkbox within w_warebalc_view_new_bk
  1337. integer x = 2080
  1338. integer y = 312
  1339. integer width = 402
  1340. integer height = 60
  1341. boolean bringtotop = true
  1342. integer textsize = -9
  1343. integer weight = 400
  1344. fontcharset fontcharset = gb2312charset!
  1345. fontpitch fontpitch = variable!
  1346. string facename = "宋体"
  1347. long textcolor = 33554432
  1348. long backcolor = 134217739
  1349. string text = "显示明细"
  1350. end type
  1351. event clicked;Int if_inout
  1352. IF This.Checked THEN
  1353. if_inout = 1
  1354. ELSE
  1355. if_inout = 0
  1356. END IF
  1357. f_SetProfileString (sys_empid,dw_1.DataObject, "if_inout", String(if_inout))
  1358. Parent.TriggerEvent(Resize!)
  1359. Parent.TriggerEvent("ue_retrieve_inoutmx")
  1360. end event
  1361. event constructor;Int if_inout
  1362. if_inout = Integer(f_ProfileString (sys_empid,dw_1.DataObject, "if_inout", '0'))
  1363. IF if_inout = 0 THEN
  1364. This.Checked = False
  1365. ELSE
  1366. This.Checked = True
  1367. END IF
  1368. end event
  1369. type tab_1 from tab within w_warebalc_view_new_bk
  1370. event create ( )
  1371. event destroy ( )
  1372. integer x = 786
  1373. integer y = 1228
  1374. integer width = 2286
  1375. integer height = 1056
  1376. integer taborder = 60
  1377. boolean bringtotop = true
  1378. integer textsize = -9
  1379. integer weight = 400
  1380. fontcharset fontcharset = gb2312charset!
  1381. fontpitch fontpitch = variable!
  1382. string facename = "宋体"
  1383. long backcolor = 134217739
  1384. boolean raggedright = true
  1385. boolean focusonbuttondown = true
  1386. integer selectedtab = 1
  1387. tabpage_1 tabpage_1
  1388. tabpage_2 tabpage_2
  1389. end type
  1390. on tab_1.create
  1391. this.tabpage_1=create tabpage_1
  1392. this.tabpage_2=create tabpage_2
  1393. this.Control[]={this.tabpage_1,&
  1394. this.tabpage_2}
  1395. end on
  1396. on tab_1.destroy
  1397. destroy(this.tabpage_1)
  1398. destroy(this.tabpage_2)
  1399. end on
  1400. type tabpage_1 from userobject within tab_1
  1401. event create ( )
  1402. event destroy ( )
  1403. integer x = 18
  1404. integer y = 96
  1405. integer width = 2249
  1406. integer height = 944
  1407. long backcolor = 134217739
  1408. string text = "进出明细"
  1409. long tabtextcolor = 33554432
  1410. long tabbackcolor = 134217739
  1411. long picturemaskcolor = 536870912
  1412. dw_inout dw_inout
  1413. em_3 em_3
  1414. em_4 em_4
  1415. cb_iomx_retrieve cb_iomx_retrieve
  1416. ddlb_billtype ddlb_billtype
  1417. st_7 st_7
  1418. st_6 st_6
  1419. end type
  1420. on tabpage_1.create
  1421. this.dw_inout=create dw_inout
  1422. this.em_3=create em_3
  1423. this.em_4=create em_4
  1424. this.cb_iomx_retrieve=create cb_iomx_retrieve
  1425. this.ddlb_billtype=create ddlb_billtype
  1426. this.st_7=create st_7
  1427. this.st_6=create st_6
  1428. this.Control[]={this.dw_inout,&
  1429. this.em_3,&
  1430. this.em_4,&
  1431. this.cb_iomx_retrieve,&
  1432. this.ddlb_billtype,&
  1433. this.st_7,&
  1434. this.st_6}
  1435. end on
  1436. on tabpage_1.destroy
  1437. destroy(this.dw_inout)
  1438. destroy(this.em_3)
  1439. destroy(this.em_4)
  1440. destroy(this.cb_iomx_retrieve)
  1441. destroy(this.ddlb_billtype)
  1442. destroy(this.st_7)
  1443. destroy(this.st_6)
  1444. end on
  1445. type dw_inout from u_dw_rbtnfilter within tabpage_1
  1446. integer y = 92
  1447. integer taborder = 30
  1448. string dataobject = "dw_rp_ware_mtrlware_inoutmx"
  1449. boolean hscrollbar = true
  1450. boolean vscrollbar = true
  1451. boolean hsplitscroll = true
  1452. boolean rbutton_filter_use = true
  1453. boolean rbutton_setposition_use = true
  1454. boolean titleclick_sort_use = true
  1455. end type
  1456. event clicked;call super::clicked;IF row > 0 THEN
  1457. This.SelectRow(0, False)
  1458. This.SetRow(row)
  1459. This.SelectRow(row,True)
  1460. END IF
  1461. end event
  1462. event doubleclicked;call super::doubleclicked;IF row > 0 THEN
  1463. String ls_code,ls_relcode
  1464. Long ll_scid
  1465. Int li_thflag,li_billtype
  1466. ll_scid = This.Object.u_outware_scid[row]
  1467. ls_code = This.Object.code[row]
  1468. f_open_win(ll_scid,ls_code)
  1469. END IF
  1470. end event
  1471. type em_3 from editmask within tabpage_1
  1472. integer x = 224
  1473. integer y = 4
  1474. integer width = 402
  1475. integer height = 84
  1476. integer taborder = 90
  1477. integer textsize = -9
  1478. integer weight = 400
  1479. fontcharset fontcharset = gb2312charset!
  1480. fontpitch fontpitch = variable!
  1481. string facename = "宋体"
  1482. long textcolor = 33554432
  1483. string text = "none"
  1484. borderstyle borderstyle = stylelowered!
  1485. maskdatatype maskdatatype = datemask!
  1486. string mask = "yyyy-mm-dd"
  1487. boolean spin = true
  1488. end type
  1489. event constructor;this.Text = String(Today(),'YYYY-MM')+'-01'
  1490. end event
  1491. type em_4 from editmask within tabpage_1
  1492. integer x = 704
  1493. integer y = 4
  1494. integer width = 402
  1495. integer height = 84
  1496. integer taborder = 90
  1497. integer textsize = -9
  1498. integer weight = 400
  1499. fontcharset fontcharset = gb2312charset!
  1500. fontpitch fontpitch = variable!
  1501. string facename = "宋体"
  1502. long textcolor = 33554432
  1503. string text = "none"
  1504. borderstyle borderstyle = stylelowered!
  1505. maskdatatype maskdatatype = datemask!
  1506. string mask = "yyyy-mm-dd"
  1507. boolean spin = true
  1508. end type
  1509. event constructor;this.Text = String(Today(),'YYYY-MM-DD')
  1510. end event
  1511. type cb_iomx_retrieve from uo_imflatbutton within tabpage_1
  1512. integer x = 1134
  1513. integer y = 4
  1514. integer width = 215
  1515. integer height = 84
  1516. integer taborder = 90
  1517. string text = "刷新"
  1518. integer picsize = 16
  1519. end type
  1520. event clicked;call super::clicked;getparentwindow().triggerevent("ue_retrieve_inoutmx")
  1521. end event
  1522. type ddlb_billtype from dropdownlistbox within tabpage_1
  1523. integer x = 1381
  1524. integer y = 4
  1525. integer width = 827
  1526. integer height = 976
  1527. integer taborder = 40
  1528. integer textsize = -9
  1529. integer weight = 400
  1530. fontcharset fontcharset = gb2312charset!
  1531. fontpitch fontpitch = variable!
  1532. string facename = "宋体"
  1533. long textcolor = 33554432
  1534. string text = "全 部[0]"
  1535. boolean sorted = false
  1536. boolean vscrollbar = true
  1537. string item[] = {"全 部[0]","全部进仓[0]","全部出仓{0}","采购进仓[1]","生产进仓[3]","外协进仓[4]","其它进仓[8]","盘盈进仓[9]","调拨进仓[12]","拆装进仓[15]","来料加工收料进仓[20]","库存配置调整单[22]","销售出仓{1}","领料出仓{3}","外协仓库出仓{4}","其它出仓{8}","盘亏出仓{9}","扣费品出仓{10}","调拨出仓{12}","拆装出仓{15}"}
  1538. borderstyle borderstyle = stylelowered!
  1539. end type
  1540. event selectionchanged;string ls_billtype
  1541. choose case index
  1542. case 1
  1543. cur_billtype_in = -1
  1544. cur_billtype_out = -1
  1545. case 2
  1546. cur_billtype_in = -1
  1547. cur_billtype_out = 0
  1548. case 3
  1549. cur_billtype_in = 0
  1550. cur_billtype_out = -1
  1551. case else
  1552. ls_billtype = Mid ( this.text,pos(this.text,'[') + 1,len(this.text) - pos(this.text,'[') - 1 )
  1553. if isnumber(ls_billtype) then
  1554. cur_billtype_in=long(ls_billtype)
  1555. else
  1556. cur_billtype_in = 0
  1557. end if
  1558. ls_billtype = Mid ( this.text,pos(this.text,'{') + 1,len(this.text) - pos(this.text,'{') - 1 )
  1559. if isnumber(ls_billtype) then
  1560. cur_billtype_out=long(ls_billtype)
  1561. else
  1562. cur_billtype_out = 0
  1563. end if
  1564. end choose
  1565. cb_iomx_retrieve.triggerevent(clicked!)
  1566. end event
  1567. type st_7 from statictext within tabpage_1
  1568. integer x = 9
  1569. integer y = 20
  1570. integer width = 219
  1571. integer height = 48
  1572. integer textsize = -9
  1573. integer weight = 400
  1574. fontcharset fontcharset = gb2312charset!
  1575. fontpitch fontpitch = variable!
  1576. string facename = "宋体"
  1577. long textcolor = 33554432
  1578. long backcolor = 134217739
  1579. string text = "日期从:"
  1580. boolean focusrectangle = false
  1581. end type
  1582. type st_6 from statictext within tabpage_1
  1583. integer x = 631
  1584. integer y = 20
  1585. integer width = 73
  1586. integer height = 48
  1587. integer textsize = -9
  1588. integer weight = 400
  1589. fontcharset fontcharset = gb2312charset!
  1590. fontpitch fontpitch = variable!
  1591. string facename = "宋体"
  1592. long textcolor = 33554432
  1593. long backcolor = 134217739
  1594. string text = "至"
  1595. boolean focusrectangle = false
  1596. end type
  1597. type tabpage_2 from userobject within tab_1
  1598. integer x = 18
  1599. integer y = 96
  1600. integer width = 2249
  1601. integer height = 944
  1602. long backcolor = 134217739
  1603. string text = "未审明细"
  1604. long tabtextcolor = 33554432
  1605. long tabbackcolor = 134217739
  1606. long picturemaskcolor = 536870912
  1607. dw_out_noaudit dw_out_noaudit
  1608. end type
  1609. on tabpage_2.create
  1610. this.dw_out_noaudit=create dw_out_noaudit
  1611. this.Control[]={this.dw_out_noaudit}
  1612. end on
  1613. on tabpage_2.destroy
  1614. destroy(this.dw_out_noaudit)
  1615. end on
  1616. type dw_out_noaudit from u_dw_rbtnfilter within tabpage_2
  1617. integer taborder = 40
  1618. string dataobject = "dw_rp_ware_mtrlware_out_noaudit"
  1619. boolean hscrollbar = true
  1620. boolean vscrollbar = true
  1621. boolean hsplitscroll = true
  1622. boolean rbutton_filter_use = true
  1623. boolean rbutton_setposition_use = true
  1624. boolean titleclick_sort_use = true
  1625. end type
  1626. event clicked;call super::clicked;IF row > 0 THEN
  1627. This.SelectRow(0, False)
  1628. This.SetRow(row)
  1629. This.SelectRow(row,True)
  1630. END IF
  1631. end event
  1632. event doubleclicked;call super::doubleclicked;IF row > 0 THEN
  1633. String ls_code,ls_relcode
  1634. Long ll_scid
  1635. Int li_thflag,li_billtype
  1636. ll_scid = This.Object.u_outware_scid[row]
  1637. ls_code = This.Object.u_outware_outwarecode[row]
  1638. f_open_win(ll_scid,ls_code)
  1639. END IF
  1640. end event
  1641. type cb_other from uo_imflatbutton within w_warebalc_view_new_bk
  1642. integer x = 466
  1643. integer width = 256
  1644. integer height = 164
  1645. integer taborder = 30
  1646. boolean bringtotop = true
  1647. string text = "辅助功能"
  1648. string normalpicname = "other.BMP"
  1649. integer picsize = 16
  1650. toolbaralignment pic_align = alignattop!
  1651. boolean border = false
  1652. end type
  1653. event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
  1654. String menustr
  1655. menustr = "Text=按上期结存重算本期结余~tEvent=ue_cmp_amt2"
  1656. menustr = menustr + "|" + "Text=按库存数重算本期期初~tEvent=ue_cmp_mtrlware"
  1657. menustr = menustr + "|" + "Text=超级重算~tEvent=ue_cmp"
  1658. menustr = menustr + "|" + "Text=-"
  1659. menustr = menustr + "|" + "Text=更新进仓单明细库存ID~tEvent=ue_update_inware_mtrlwareid"
  1660. menustr = menustr + "|" + "Text=物料相关查询~tEvent=ue_mtrl_info"
  1661. IF Len(Trim(menustr)) <> 0 THEN
  1662. dmPopupMenu = CREATE m_Dfc_Control_PopupMenu
  1663. dmPopupMenu.mf_BuildMenu(THIS, menustr)
  1664. dmPopupMenu.mf_PopMenu()
  1665. DESTROY dmPopupMenu
  1666. END IF
  1667. end event
  1668. type sle_usual_query from u_sleedit within w_warebalc_view_new_bk
  1669. integer x = 352
  1670. integer y = 272
  1671. integer width = 635
  1672. integer height = 92
  1673. integer taborder = 100
  1674. boolean bringtotop = true
  1675. end type
  1676. event modified;call super::modified;//IF retrieve_all or retrmode=0 THEN
  1677. //// PARENT.TRIGGEREVENT("ue_usual_query_filt")
  1678. //ELSE
  1679. // PARENT.TRIGGEREVENT("ue_usual_query_RETR")
  1680. //END IF
  1681. end event
  1682. event keyup;call super::keyup;IF NOT dw_edit_mode THEN
  1683. If Key = KeyDownArrow! Then //
  1684. dw_1.ScrollNextRow()
  1685. End If
  1686. If Key = KeyUPArrow! Then //
  1687. dw_1.ScrollPriorRow()
  1688. End If
  1689. END IF
  1690. end event
  1691. event inputchanged;call super::inputchanged;//IF retrieve_all THEN
  1692. PARENT.TRIGGEREVENT("ue_usual_query_filt")
  1693. //END IF
  1694. end event
  1695. type st_8 from statictext within w_warebalc_view_new_bk
  1696. integer y = 292
  1697. integer width = 343
  1698. integer height = 48
  1699. boolean bringtotop = true
  1700. integer textsize = -9
  1701. integer weight = 400
  1702. fontcharset fontcharset = gb2312charset!
  1703. fontpitch fontpitch = variable!
  1704. string facename = "宋体"
  1705. long textcolor = 33554432
  1706. long backcolor = 134217739
  1707. string text = "编码/名称含:"
  1708. boolean focusrectangle = false
  1709. end type
  1710. type st_1 from statictext within w_warebalc_view_new_bk
  1711. integer x = 1120
  1712. integer y = 212
  1713. integer width = 242
  1714. integer height = 48
  1715. boolean bringtotop = true
  1716. integer textsize = -9
  1717. integer weight = 400
  1718. fontcharset fontcharset = gb2312charset!
  1719. fontpitch fontpitch = variable!
  1720. string facename = "宋体"
  1721. long textcolor = 33554432
  1722. long backcolor = 134217739
  1723. string text = "结存日期"
  1724. alignment alignment = right!
  1725. boolean focusrectangle = false
  1726. end type
  1727. type em_month from editmask within w_warebalc_view_new_bk
  1728. integer x = 1371
  1729. integer y = 188
  1730. integer width = 434
  1731. integer height = 88
  1732. integer taborder = 130
  1733. boolean bringtotop = true
  1734. integer textsize = -9
  1735. integer weight = 400
  1736. fontcharset fontcharset = gb2312charset!
  1737. fontpitch fontpitch = variable!
  1738. string facename = "宋体"
  1739. long textcolor = 33554432
  1740. string text = "none"
  1741. alignment alignment = center!
  1742. borderstyle borderstyle = stylelowered!
  1743. maskdatatype maskdatatype = datemask!
  1744. string mask = "yyyy-mm-dd"
  1745. boolean spin = true
  1746. end type
  1747. event constructor;this.text = string(today(),'yyyy-mm-dd')
  1748. end event
  1749. event rbuttondown;s_calender_arg s_calender
  1750. s_calender.PointerX = THIS.PointerX()
  1751. s_calender.PointerY = THIS.PointerY()
  1752. s_calender.X = THIS.X
  1753. s_calender.Y = THIS.Y
  1754. OpenWithParm(w_calendar,s_calender)
  1755. THIS.Text = String(id_date_selected)
  1756. end event
  1757. type st_lastbalcdate from statictext within w_warebalc_view_new_bk
  1758. integer x = 1134
  1759. integer y = 300
  1760. integer width = 823
  1761. integer height = 48
  1762. boolean bringtotop = true
  1763. integer textsize = -9
  1764. integer weight = 400
  1765. fontcharset fontcharset = gb2312charset!
  1766. fontpitch fontpitch = variable!
  1767. string facename = "宋体"
  1768. long textcolor = 33554432
  1769. long backcolor = 134217739
  1770. string text = "最后结存日期"
  1771. boolean focusrectangle = false
  1772. end type
  1773. type ddlb_1 from dropdownlistbox within w_warebalc_view_new_bk
  1774. integer x = 2427
  1775. integer y = 32
  1776. integer width = 745
  1777. integer height = 1100
  1778. integer taborder = 100
  1779. boolean bringtotop = true
  1780. integer textsize = -9
  1781. integer weight = 400
  1782. fontcharset fontcharset = gb2312charset!
  1783. fontpitch fontpitch = variable!
  1784. string facename = "宋体"
  1785. long textcolor = 33554432
  1786. string text = "汇总统计表"
  1787. boolean sorted = false
  1788. boolean vscrollbar = true
  1789. string item[] = {"汇总统计表","产品明细统计表","客户产品统计表","分类统计表","汇总统计表(设定售价)"}
  1790. borderstyle borderstyle = stylelowered!
  1791. end type
  1792. event selectionchanged;dw_1.SetRedraw(False)
  1793. dw_1.uf_save_profile_layout()
  1794. IF this.Text = '客户产品统计表' THEN
  1795. dw_1.DataObject = 'dw_warebalc_view'
  1796. ELSEIF this.Text = '产品明细统计表' THEN
  1797. dw_1.DataObject = 'dw_warebalc_view_sum_1'
  1798. ELSEIF this.Text = '汇总统计表' THEN
  1799. dw_1.DataObject = 'dw_warebalc_view_sum'
  1800. ELSEIF this.Text = '分类统计表' THEN
  1801. dw_1.DataObject = 'dw_warebalc_view_2'
  1802. ELSEIF this.Text = '汇总统计表(设定售价)' THEN
  1803. dw_1.DataObject = 'dw_warebalc_view_sum_saleprice'
  1804. END IF
  1805. dw_1.SetTransObject(sqlca)
  1806. dw_1.ins_INIfile_name = sys_inifilename
  1807. dw_1.ins_opemp = publ_operator
  1808. dw_1.cardw_empid = sys_empid
  1809. dw_1.cur_DataObject = dw_1.DataObject
  1810. dw_1.uf_read_profile_layout()
  1811. wf_hidecol()
  1812. f_title_change(dw_1)
  1813. dw_1.SetRedraw(True)
  1814. cb_1.TriggerEvent(Clicked!)
  1815. end event
  1816. type cb_balc from uo_imflatbutton within w_warebalc_view_new_bk
  1817. integer x = 302
  1818. integer width = 165
  1819. integer height = 164
  1820. integer taborder = 30
  1821. boolean bringtotop = true
  1822. string text = "结存"
  1823. string normalpicname = "update2.BMP"
  1824. integer picsize = 16
  1825. toolbaralignment pic_align = alignattop!
  1826. boolean border = false
  1827. end type
  1828. event clicked;call super::clicked;IF NOT f_power_ind(75) THEN
  1829. MessageBox('提示','你没有使用权限!',information!,ok!)
  1830. RETURN
  1831. END IF
  1832. IF cur_storageid = -1 THEN
  1833. MessageBox("提示","请选择仓库结存",information!,ok!)
  1834. RETURN
  1835. END IF
  1836. balcdate = DateTime(Date(em_month.Text),Time('23:59:59'))
  1837. IF MessageBox ('询问',"是否确定要把当前日仓库进行结存操作吗?"+'~n'+&
  1838. '结存时间: '+String(balcdate,'YYYY-MM-DD HH:MM:SS')+',结存过程中不能进行其它操作!',Question!,YesNo! ) = 2 THEN RETURN
  1839. w_sys_wait.Show()
  1840. String arg_msg = '',err_msg = ''
  1841. uf_warebalc(1,0,cur_storageid,balcdate,arg_msg)
  1842. w_sys_wait.Hide()
  1843. MessageBox('提示',arg_msg,information!,ok!)
  1844. cb_1.TriggerEvent(Clicked!)
  1845. end event