w_warepdb_bill_p_scanqty.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. $PBExportHeader$w_warepdb_bill_p_scanqty.srw
  2. forward
  3. global type w_warepdb_bill_p_scanqty from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_warepdb_bill_p_scanqty
  6. end type
  7. type st_1 from statictext within w_warepdb_bill_p_scanqty
  8. end type
  9. type cb_1 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  10. end type
  11. type cb_2 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  12. end type
  13. type cb_3 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  14. end type
  15. type sle_1 from multilineedit within w_warepdb_bill_p_scanqty
  16. end type
  17. type dw_1 from u_dw_rbtnfilter within w_warepdb_bill_p_scanqty
  18. end type
  19. type cb_4 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  20. end type
  21. type dw_2 from u_dw_rbtnfilter within w_warepdb_bill_p_scanqty
  22. end type
  23. type cb_5 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  24. end type
  25. type cb_6 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  26. end type
  27. end forward
  28. global type w_warepdb_bill_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_warepdb_bill_p_scanqty w_warepdb_bill_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_warepdb_bill 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_warepdb_bill_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_warepdb_bill_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_warepdb_bill_p_scanqty
  125. boolean visible = false
  126. end type
  127. type cb_exit from w_publ_base`cb_exit within w_warepdb_bill_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_warepdb_bill_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. FOR i = 1 To dw_1.RowCount()
  148. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] <> 0 THEN
  149. j++
  150. dw_1.RowsCopy(i, i, Primary!, parent_win.dw_child, j, Primary!)
  151. END IF
  152. NEXT
  153. close(parent)
  154. end event
  155. type st_1 from statictext within w_warepdb_bill_p_scanqty
  156. integer x = 64
  157. integer y = 28
  158. integer width = 402
  159. integer height = 184
  160. boolean bringtotop = true
  161. integer textsize = -20
  162. integer weight = 400
  163. fontcharset fontcharset = gb2312charset!
  164. fontpitch fontpitch = variable!
  165. string facename = "宋体"
  166. long textcolor = 255
  167. long backcolor = 67108864
  168. string text = "扫描框"
  169. long bordercolor = 255
  170. boolean focusrectangle = false
  171. end type
  172. type cb_1 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  173. integer x = 4151
  174. integer y = 136
  175. integer width = 411
  176. integer height = 96
  177. integer taborder = 40
  178. boolean bringtotop = true
  179. string text = "清空盘点数"
  180. integer picsize = 16
  181. end type
  182. event clicked;call super::clicked;long i
  183. for i=1 to dw_1.rowcount()
  184. dw_1.Object.u_warepdb_billmx_factqty[i]=0
  185. next
  186. end event
  187. type cb_2 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  188. integer x = 4151
  189. integer y = 16
  190. integer width = 411
  191. integer height = 96
  192. integer taborder = 50
  193. boolean bringtotop = true
  194. string text = "清空扫描框"
  195. integer picsize = 16
  196. end type
  197. event clicked;call super::clicked;long i
  198. sle_1.text=''
  199. end event
  200. type cb_3 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  201. integer x = 3611
  202. integer y = 20
  203. integer width = 416
  204. integer height = 200
  205. integer taborder = 60
  206. boolean bringtotop = true
  207. string text = "生成盘点数据"
  208. integer picsize = 16
  209. end type
  210. event clicked;call super::clicked;Long i,j,li_argcnt = 1
  211. String ls_cmd,ls_arg[]
  212. ls_cmd = Trim(sle_1.Text)
  213. dw_1.AcceptText()
  214. ls_cmd = of_globalreplace(ls_cmd,';',';')
  215. DO WHILE Len(ls_cmd) > 0
  216. i = Pos( ls_cmd, ";")
  217. IF i = 0 THEN i = Len(ls_cmd) + 1
  218. ls_arg[li_argcnt] = Left(ls_cmd, i - 1)
  219. li_argcnt = li_argcnt + 1
  220. ls_cmd = Replace(ls_cmd, 1, i, "")
  221. LOOP
  222. Long ll_mtrlid,ll_row,ll_mtrlwareid
  223. String ls_mtrlcode,ls_mtrlmode,ls_mtrlname,ls_handtype,ls_barcode,ls_mtrlengname,ls_mtrlsectype
  224. Decimal dec_qty,dec_noqty
  225. dw_1.SetRedraw (False)
  226. FOR i = 1 To UpperBound(ls_arg) Step 2
  227. dw_1.AcceptText()
  228. ls_mtrlcode = ls_arg[i]
  229. ls_mtrlcode = f_pb_of_globalreplace(ls_mtrlcode,'~r','')
  230. ls_mtrlcode = f_pb_of_globalreplace(ls_mtrlcode,'~n','')
  231. //首先查询这个是否是条形码 如果是 找出物料编码
  232. String ls_temp_code
  233. SELECT mtrlcode Into :ls_temp_code From u_mtrldef Where barcode = :ls_mtrlcode;
  234. IF Len(ls_temp_code) > 0 THEN
  235. ls_mtrlcode = ls_temp_code
  236. END IF
  237. //首先查询这个是否是条形码 如果是 找出物料编码
  238. IF UpperBound(ls_arg) >= i+1 THEN
  239. dec_qty = Dec(ls_arg[i + 1])
  240. ELSE
  241. dec_qty = 0
  242. END IF
  243. ll_row = 0
  244. FOR j = 1 To dw_1.RowCount()
  245. String lkks_temp_str
  246. lkks_temp_str = ''
  247. lkks_temp_str = '0' + String(dw_1.Object.u_mtrldef_mtrlcode[j])
  248. // IF Pos(ls_mtrlcode, dw_1.Object.u_mtrldef_mtrlcode[j] ) > 0 THEN
  249. IF ls_mtrlcode = dw_1.Object.u_mtrldef_mtrlcode[j] Or (ls_mtrlcode = lkks_temp_str ) THEN
  250. ll_row = j
  251. END IF
  252. NEXT
  253. IF ll_row = 0 THEN
  254. ll_row = dw_1.InsertRow(0)
  255. ll_mtrlid = 0
  256. ls_mtrlmode = ''
  257. ls_mtrlname = ''
  258. ls_handtype=''
  259. ls_barcode=''
  260. ls_mtrlengname=''
  261. ls_mtrlsectype=''
  262. // SELECT top 1 mtrlid,mtrlmode,mtrlname INTO :ll_mtrlid,:ls_mtrlmode,:ls_mtrlname
  263. // From u_mtrldef Where :ls_mtrlcode Like '%' + rtrim(ltrim(mtrlcode)) ;
  264. SELECT top 1 mtrlid,mtrlmode,mtrlname,handtype,barcode,mtrlengname,mtrlsectype INTO :ll_mtrlid,:ls_mtrlmode,:ls_mtrlname,:ls_handtype,:ls_barcode,:ls_mtrlengname,:ls_mtrlsectype
  265. FROM u_mtrldef WHERE :ls_mtrlcode = '0' + rtrim(ltrim(mtrlcode)) OR
  266. :ls_mtrlcode = rtrim(ltrim(mtrlcode))
  267. ;
  268. IF IsNull(ll_mtrlid) THEN ll_mtrlid = 0
  269. // IF ll_mtrlid = 0 THEN CONTINUE
  270. dec_noqty = 0
  271. SELECT top 1 mtrlwareid,sum(noallocqty) INTO :ll_mtrlwareid,:dec_noqty FROM u_mtrlware WHERE mtrlid = :ll_mtrlid AND storageid = :cur_storageid
  272. Group By mtrlwareid Order By sum(noallocqty) Desc;
  273. IF IsNull(dec_noqty) THEN dec_noqty = 0
  274. dw_1.Object.u_warepdb_billmx_mtrlwareid[j] = ll_mtrlwareid
  275. dw_1.Object.u_warepdb_billmx_mtrlid[j] = ll_mtrlid
  276. dw_1.Object.u_mtrldef_mtrlcode[j] = ls_mtrlcode
  277. dw_1.Object.u_mtrldef_mtrlname[j] = ls_mtrlname
  278. dw_1.Object.u_mtrldef_mtrlmode[j] = ls_mtrlmode
  279. dw_1.Object.u_mtrldef_handtype[j] = ls_handtype
  280. dw_1.Object.u_mtrldef_barcode[j] =ls_barcode
  281. dw_1.Object.u_mtrldef_mtrlengname[j] =ls_mtrlengname
  282. dw_1.Object.u_mtrldef_mtrlsectype[j] =ls_mtrlsectype
  283. dw_1.Object.u_warepdb_billmx_qty[j] = dec_noqty
  284. dw_1.Object.u_warepdb_billmx_factqty[j] = dec_qty
  285. dw_1.Object.u_warepdb_billmx_printid[j] = j
  286. dw_1.Object.u_warepdb_billmx_waredscrp[j] = ''
  287. ELSE
  288. dw_1.Object.u_warepdb_billmx_printid[ll_row] = ll_row
  289. dw_1.Object.u_warepdb_billmx_factqty[ll_row] = dw_1.Object.u_warepdb_billmx_factqty[ll_row] + dec_qty
  290. END IF
  291. NEXT
  292. dw_1.SetRedraw (True)
  293. dw_1.AcceptText()
  294. IF dw_1.RowCount() > 0 THEN
  295. IF dw_1.Object.u_mtrldef_mtrlcode[1] = '' THEN dw_1.DeleteRow(1)
  296. END IF
  297. end event
  298. type sle_1 from multilineedit within w_warepdb_bill_p_scanqty
  299. integer x = 480
  300. integer width = 3118
  301. integer height = 236
  302. integer taborder = 70
  303. boolean bringtotop = true
  304. integer textsize = -12
  305. integer weight = 400
  306. fontcharset fontcharset = ansi!
  307. fontpitch fontpitch = variable!
  308. fontfamily fontfamily = swiss!
  309. string facename = "Arial"
  310. long textcolor = 33554432
  311. boolean hscrollbar = true
  312. boolean vscrollbar = true
  313. boolean autohscroll = true
  314. boolean autovscroll = true
  315. borderstyle borderstyle = stylelowered!
  316. end type
  317. type dw_1 from u_dw_rbtnfilter within w_warepdb_bill_p_scanqty
  318. integer x = 23
  319. integer y = 240
  320. integer width = 3570
  321. integer height = 1608
  322. integer taborder = 20
  323. boolean bringtotop = true
  324. string dataobject = "dw_u_warepdb_p_scanqty"
  325. boolean hscrollbar = true
  326. boolean vscrollbar = true
  327. boolean rbutton_filter_use = true
  328. boolean rbutton_setposition_use = true
  329. boolean titleclick_sort_use = true
  330. end type
  331. type cb_4 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  332. integer x = 4631
  333. integer y = 68
  334. integer width = 411
  335. integer height = 96
  336. integer taborder = 60
  337. boolean bringtotop = true
  338. string text = "显示错误列表"
  339. integer picsize = 16
  340. end type
  341. event clicked;call super::clicked;dw_2.visible=true
  342. dw_2.x=10
  343. dw_2.width=dw_1.width - 500
  344. dw_2.Reset()
  345. dw_1.AcceptText()
  346. Long i,j
  347. FOR i = 1 To dw_1.RowCount()
  348. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN
  349. j++
  350. dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!)
  351. END IF
  352. NEXT
  353. end event
  354. type dw_2 from u_dw_rbtnfilter within w_warepdb_bill_p_scanqty
  355. integer x = 3621
  356. integer y = 252
  357. integer width = 3584
  358. integer height = 1312
  359. integer taborder = 50
  360. boolean bringtotop = true
  361. boolean titlebar = true
  362. string title = "错误列表"
  363. string dataobject = "dw_u_warepdb_p_scanqty"
  364. boolean controlmenu = true
  365. boolean minbox = true
  366. boolean maxbox = true
  367. boolean hscrollbar = true
  368. boolean vscrollbar = true
  369. boolean rbutton_filter_use = true
  370. boolean rbutton_setposition_use = true
  371. boolean titleclick_sort_use = true
  372. end type
  373. type cb_5 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  374. integer x = 5079
  375. integer y = 16
  376. integer width = 411
  377. integer height = 96
  378. integer taborder = 60
  379. boolean bringtotop = true
  380. string text = "导出盘点表"
  381. integer picsize = 16
  382. end type
  383. event clicked;call super::clicked;
  384. OpenWithParm(w_sentdataout,DW_1)
  385. end event
  386. type cb_6 from uo_imflatbutton within w_warepdb_bill_p_scanqty
  387. integer x = 5079
  388. integer y = 136
  389. integer width = 411
  390. integer height = 96
  391. integer taborder = 50
  392. boolean bringtotop = true
  393. string text = "导出错误列表"
  394. integer picsize = 16
  395. end type
  396. event clicked;call super::clicked;dw_2.Reset()
  397. dw_1.AcceptText()
  398. Long i,j
  399. FOR i = 1 To dw_1.RowCount()
  400. IF dw_1.Object.u_warepdb_billmx_mtrlid[i] = 0 THEN
  401. j++
  402. dw_1.RowsCopy(i, i, Primary!, dw_2, j, Primary!)
  403. END IF
  404. NEXT
  405. OpenWithParm(w_sentdataout,DW_2)
  406. end event