w_outware_sale_p_scanqty.srw 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. $PBExportHeader$w_outware_sale_p_scanqty.srw
  2. forward
  3. global type w_outware_sale_p_scanqty from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_outware_sale_p_scanqty
  6. end type
  7. type st_1 from statictext within w_outware_sale_p_scanqty
  8. end type
  9. type cb_1 from uo_imflatbutton within w_outware_sale_p_scanqty
  10. end type
  11. type cb_2 from uo_imflatbutton within w_outware_sale_p_scanqty
  12. end type
  13. type cb_3 from uo_imflatbutton within w_outware_sale_p_scanqty
  14. end type
  15. type sle_1 from multilineedit within w_outware_sale_p_scanqty
  16. end type
  17. type dw_1 from u_dw_rbtnfilter within w_outware_sale_p_scanqty
  18. end type
  19. type cb_4 from uo_imflatbutton within w_outware_sale_p_scanqty
  20. end type
  21. type dw_2 from u_dw_rbtnfilter within w_outware_sale_p_scanqty
  22. end type
  23. type cb_5 from uo_imflatbutton within w_outware_sale_p_scanqty
  24. end type
  25. type cb_6 from uo_imflatbutton within w_outware_sale_p_scanqty
  26. end type
  27. end forward
  28. global type w_outware_sale_p_scanqty from w_publ_base
  29. integer width = 5486
  30. integer height = 2064
  31. string title = "扫描窗口"
  32. windowstate windowstate = maximized!
  33. cb_ok cb_ok
  34. st_1 st_1
  35. cb_1 cb_1
  36. cb_2 cb_2
  37. cb_3 cb_3
  38. sle_1 sle_1
  39. dw_1 dw_1
  40. cb_4 cb_4
  41. dw_2 dw_2
  42. cb_5 cb_5
  43. cb_6 cb_6
  44. end type
  45. global w_outware_sale_p_scanqty w_outware_sale_p_scanqty
  46. type variables
  47. s_edit_index_tran s_tran
  48. long ins_scid,ins_inwareid
  49. string ins_inwarecode
  50. long cur_thflag
  51. long err_num=0
  52. w_outware_sale parent_win
  53. long cur_storageid
  54. end variables
  55. forward prototypes
  56. public function string of_globalreplace (string as_source, string as_old, string as_new)
  57. end prototypes
  58. public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos
  59. as_source=trim(as_source)
  60. as_old=trim(as_old)
  61. ll_pos = Pos(as_source,as_old)
  62. IF ll_pos > 0 Then
  63. ll_oldlen = Len(as_old)
  64. ll_newlen = Len(as_new)
  65. DO WHILE ll_pos > 0
  66. as_source = Replace(as_source,ll_pos,ll_oldlen,as_new)
  67. ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen)
  68. LOOP
  69. END IF
  70. RETURN as_source
  71. end function
  72. on w_outware_sale_p_scanqty.create
  73. int iCurrent
  74. call super::create
  75. this.cb_ok=create cb_ok
  76. this.st_1=create st_1
  77. this.cb_1=create cb_1
  78. this.cb_2=create cb_2
  79. this.cb_3=create cb_3
  80. this.sle_1=create sle_1
  81. this.dw_1=create dw_1
  82. this.cb_4=create cb_4
  83. this.dw_2=create dw_2
  84. this.cb_5=create cb_5
  85. this.cb_6=create cb_6
  86. iCurrent=UpperBound(this.Control)
  87. this.Control[iCurrent+1]=this.cb_ok
  88. this.Control[iCurrent+2]=this.st_1
  89. this.Control[iCurrent+3]=this.cb_1
  90. this.Control[iCurrent+4]=this.cb_2
  91. this.Control[iCurrent+5]=this.cb_3
  92. this.Control[iCurrent+6]=this.sle_1
  93. this.Control[iCurrent+7]=this.dw_1
  94. this.Control[iCurrent+8]=this.cb_4
  95. this.Control[iCurrent+9]=this.dw_2
  96. this.Control[iCurrent+10]=this.cb_5
  97. this.Control[iCurrent+11]=this.cb_6
  98. end on
  99. on w_outware_sale_p_scanqty.destroy
  100. call super::destroy
  101. destroy(this.cb_ok)
  102. destroy(this.st_1)
  103. destroy(this.cb_1)
  104. destroy(this.cb_2)
  105. destroy(this.cb_3)
  106. destroy(this.sle_1)
  107. destroy(this.dw_1)
  108. destroy(this.cb_4)
  109. destroy(this.dw_2)
  110. destroy(this.cb_5)
  111. destroy(this.cb_6)
  112. end on
  113. event open;call super::open;parent_win=ParentWindow()
  114. s_tran=Message.PowerObjectParm
  115. cur_storageid=s_tran.c_long
  116. dw_2.visible=false
  117. sle_1.setfocus()
  118. end event
  119. event resize;call super::resize;dw_1.height=this.height - dw_1.y - 500
  120. dw_1.width=this.width - 150
  121. cb_ok.y=dw_1.y + dw_1.height + 50
  122. cb_exit.y= dw_1.y + dw_1.height + 50
  123. end event
  124. type cb_func from w_publ_base`cb_func within w_outware_sale_p_scanqty
  125. boolean visible = false
  126. end type
  127. type cb_exit from w_publ_base`cb_exit within w_outware_sale_p_scanqty
  128. integer x = 2025
  129. integer y = 1860
  130. integer picsize = 16
  131. end type
  132. type cb_ok from uo_imflatbutton within w_outware_sale_p_scanqty
  133. integer x = 1371
  134. integer y = 1868
  135. integer width = 311
  136. integer height = 96
  137. integer taborder = 20
  138. boolean bringtotop = true
  139. string normalpicname = "ok.bmp"
  140. integer picsize = 16
  141. end type
  142. event clicked;call super::clicked;dw_1.accepttext()
  143. //parent_win.dw_child.Reset()
  144. //dw_1.ShareData(parent_win.dw_child)
  145. dw_1.AcceptText()
  146. Long i,j
  147. parent_win.dw_child.reset()
  148. FOR i = 1 To dw_1.RowCount()
  149. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] <> 0 THEN
  150. j++
  151. parent_win.dw_child.object.u_outwaremx_mtrlid[j]=dw_1.Object.u_warepdb_billmx_mtrlid[i]
  152. parent_win.dw_child.object.u_mtrldef_mtrlcode[j]=dw_1.Object.u_mtrldef_mtrlcode[i]
  153. parent_win.dw_child.object.u_mtrldef_mtrlname[j]=dw_1.Object.u_mtrldef_mtrlname[i]
  154. parent_win.dw_child.object.u_mtrldef_mtrlmode[j]=dw_1.Object.u_mtrldef_mtrlmode[i]
  155. parent_win.dw_child.object.u_outwaremx_uqty[j]=dw_1.Object.u_warepdb_billmx_factqty[i]
  156. END IF
  157. NEXT
  158. close(parent)
  159. end event
  160. type st_1 from statictext within w_outware_sale_p_scanqty
  161. integer x = 64
  162. integer y = 28
  163. integer width = 402
  164. integer height = 184
  165. boolean bringtotop = true
  166. integer textsize = -20
  167. integer weight = 400
  168. fontcharset fontcharset = gb2312charset!
  169. fontpitch fontpitch = variable!
  170. string facename = "宋体"
  171. long textcolor = 255
  172. long backcolor = 67108864
  173. string text = "扫描框"
  174. long bordercolor = 255
  175. boolean focusrectangle = false
  176. end type
  177. type cb_1 from uo_imflatbutton within w_outware_sale_p_scanqty
  178. integer x = 4151
  179. integer y = 136
  180. integer width = 411
  181. integer height = 96
  182. integer taborder = 40
  183. boolean bringtotop = true
  184. string text = "清空数量"
  185. integer picsize = 16
  186. end type
  187. event clicked;call super::clicked;long i
  188. for i=1 to dw_1.rowcount()
  189. dw_1.Object.u_warepdb_billmx_factqty[i]=0
  190. next
  191. end event
  192. type cb_2 from uo_imflatbutton within w_outware_sale_p_scanqty
  193. integer x = 4151
  194. integer y = 16
  195. integer width = 411
  196. integer height = 96
  197. integer taborder = 50
  198. boolean bringtotop = true
  199. string text = "清空扫描框"
  200. integer picsize = 16
  201. end type
  202. event clicked;call super::clicked;long i
  203. sle_1.text=''
  204. end event
  205. type cb_3 from uo_imflatbutton within w_outware_sale_p_scanqty
  206. integer x = 3611
  207. integer y = 20
  208. integer width = 416
  209. integer height = 200
  210. integer taborder = 60
  211. boolean bringtotop = true
  212. string text = "生成销售数据"
  213. integer picsize = 16
  214. end type
  215. event clicked;call super::clicked;Long i,j,li_argcnt = 1
  216. String ls_cmd,ls_arg[]
  217. ls_cmd = Trim(sle_1.Text)
  218. dw_1.AcceptText()
  219. ls_cmd = of_globalreplace(ls_cmd,';',';')
  220. DO WHILE Len(ls_cmd) > 0
  221. i = Pos( ls_cmd, ";")
  222. IF i = 0 THEN i = Len(ls_cmd) + 1
  223. ls_arg[li_argcnt] = Left(ls_cmd, i - 1)
  224. li_argcnt = li_argcnt + 1
  225. ls_cmd = Replace(ls_cmd, 1, i, "")
  226. LOOP
  227. Long ll_mtrlid,ll_row,ll_mtrlwareid
  228. String ls_mtrlcode,ls_mtrlmode,ls_mtrlname
  229. Decimal dec_qty,dec_noqty
  230. dw_1.SetRedraw (False)
  231. FOR i = 1 To UpperBound(ls_arg) Step 2
  232. dw_1.AcceptText()
  233. ls_mtrlcode = ls_arg[i]
  234. IF UpperBound(ls_arg) >= i+1 THEN
  235. dec_qty = Dec(ls_arg[i + 1])
  236. ELSE
  237. dec_qty = 0
  238. END IF
  239. ll_row = 0
  240. FOR j = 1 To dw_1.RowCount()
  241. IF Pos(ls_mtrlcode, dw_1.Object.u_mtrldef_mtrlcode[j] ) > 0 THEN
  242. ll_row = j
  243. END IF
  244. NEXT
  245. IF ll_row = 0 THEN
  246. ll_row = dw_1.InsertRow(0)
  247. ll_mtrlid = 0
  248. ls_mtrlmode = ''
  249. ls_mtrlname = ''
  250. SELECT top 1 mtrlid,mtrlmode,mtrlname INTO :ll_mtrlid,:ls_mtrlmode,:ls_mtrlname
  251. From u_mtrldef Where :ls_mtrlcode Like '%' + rtrim(ltrim(mtrlcode)) ;
  252. IF IsNull(ll_mtrlid) THEN ll_mtrlid = 0
  253. // IF ll_mtrlid = 0 THEN CONTINUE
  254. dec_noqty = 0
  255. SELECT top 1 mtrlwareid,sum(noallocqty) INTO :ll_mtrlwareid,:dec_noqty FROM u_mtrlware WHERE mtrlid = :ll_mtrlid AND storageid = :cur_storageid
  256. Group By mtrlwareid order by sum(noallocqty) desc;
  257. IF IsNull(dec_noqty) THEN dec_noqty = 0
  258. dw_1.Object.u_warepdb_billmx_mtrlwareid[j] = ll_mtrlwareid
  259. dw_1.Object.u_warepdb_billmx_mtrlid[j] = ll_mtrlid
  260. dw_1.Object.u_mtrldef_mtrlcode[j] = ls_mtrlcode
  261. dw_1.Object.u_mtrldef_mtrlname[j] = ls_mtrlname
  262. dw_1.Object.u_mtrldef_mtrlmode[j] = ls_mtrlmode
  263. dw_1.Object.u_warepdb_billmx_qty[j] = dec_noqty
  264. dw_1.Object.u_warepdb_billmx_factqty[j] = dec_qty
  265. dw_1.Object.u_warepdb_billmx_printid[j]=j
  266. ELSE
  267. dw_1.Object.u_warepdb_billmx_printid[ll_row]=ll_row
  268. dw_1.Object.u_warepdb_billmx_factqty[ll_row] = dw_1.Object.u_warepdb_billmx_factqty[ll_row] + dec_qty
  269. END IF
  270. NEXT
  271. dw_1.SetRedraw (true)
  272. dw_1.AcceptText()
  273. IF dw_1.RowCount() > 0 THEN
  274. IF dw_1.Object.u_mtrldef_mtrlcode[1] = '' THEN dw_1.DeleteRow(1)
  275. END IF
  276. end event
  277. type sle_1 from multilineedit within w_outware_sale_p_scanqty
  278. integer x = 480
  279. integer width = 3118
  280. integer height = 236
  281. integer taborder = 70
  282. boolean bringtotop = true
  283. integer textsize = -12
  284. integer weight = 400
  285. fontcharset fontcharset = ansi!
  286. fontpitch fontpitch = variable!
  287. fontfamily fontfamily = swiss!
  288. string facename = "Arial"
  289. long textcolor = 33554432
  290. boolean hscrollbar = true
  291. boolean vscrollbar = true
  292. boolean autohscroll = true
  293. boolean autovscroll = true
  294. borderstyle borderstyle = stylelowered!
  295. end type
  296. type dw_1 from u_dw_rbtnfilter within w_outware_sale_p_scanqty
  297. integer x = 23
  298. integer y = 240
  299. integer width = 3570
  300. integer height = 1608
  301. integer taborder = 20
  302. boolean bringtotop = true
  303. string dataobject = "dw_outware_sale_p_scanqty"
  304. boolean rbutton_filter_use = true
  305. boolean rbutton_setposition_use = true
  306. boolean titleclick_sort_use = true
  307. end type
  308. type cb_4 from uo_imflatbutton within w_outware_sale_p_scanqty
  309. integer x = 4631
  310. integer y = 68
  311. integer width = 411
  312. integer height = 96
  313. integer taborder = 60
  314. boolean bringtotop = true
  315. string text = "显示错误列表"
  316. integer picsize = 16
  317. end type
  318. event clicked;call super::clicked;dw_2.visible=true
  319. dw_2.x=10
  320. dw_2.width=dw_1.width - 500
  321. dw_2.Reset()
  322. dw_1.AcceptText()
  323. Long i,j
  324. FOR i = 1 To dw_1.RowCount()
  325. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN
  326. j++
  327. dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!)
  328. END IF
  329. NEXT
  330. end event
  331. type dw_2 from u_dw_rbtnfilter within w_outware_sale_p_scanqty
  332. integer x = 3621
  333. integer y = 252
  334. integer width = 3584
  335. integer height = 1312
  336. integer taborder = 50
  337. boolean bringtotop = true
  338. boolean titlebar = true
  339. string title = "错误列表"
  340. string dataobject = "dw_outware_sale_p_scanqty"
  341. boolean controlmenu = true
  342. boolean minbox = true
  343. boolean maxbox = true
  344. boolean rbutton_filter_use = true
  345. boolean rbutton_setposition_use = true
  346. boolean titleclick_sort_use = true
  347. end type
  348. type cb_5 from uo_imflatbutton within w_outware_sale_p_scanqty
  349. integer x = 5079
  350. integer y = 16
  351. integer width = 411
  352. integer height = 96
  353. integer taborder = 60
  354. boolean bringtotop = true
  355. string text = "导出当前表"
  356. integer picsize = 16
  357. end type
  358. event clicked;call super::clicked;
  359. OpenWithParm(w_sentdataout,DW_1)
  360. end event
  361. type cb_6 from uo_imflatbutton within w_outware_sale_p_scanqty
  362. integer x = 5079
  363. integer y = 136
  364. integer width = 411
  365. integer height = 96
  366. integer taborder = 50
  367. boolean bringtotop = true
  368. string text = "导出错误列表"
  369. integer picsize = 16
  370. end type
  371. event clicked;call super::clicked;dw_2.Reset()
  372. dw_1.AcceptText()
  373. Long i,j
  374. FOR i = 1 To dw_1.RowCount()
  375. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN
  376. j++
  377. dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!)
  378. END IF
  379. NEXT
  380. OpenWithParm(w_sentdataout,DW_2)
  381. end event