w_outwaremx_p_new_scanqty.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. $PBExportHeader$w_outwaremx_p_new_scanqty.srw
  2. forward
  3. global type w_outwaremx_p_new_scanqty from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_outwaremx_p_new_scanqty
  6. end type
  7. type st_1 from statictext within w_outwaremx_p_new_scanqty
  8. end type
  9. type st_msg from statictext within w_outwaremx_p_new_scanqty
  10. end type
  11. type sle_1 from u_sleedit within w_outwaremx_p_new_scanqty
  12. end type
  13. type cb_1 from uo_imflatbutton within w_outwaremx_p_new_scanqty
  14. end type
  15. type cb_err from uo_imflatbutton within w_outwaremx_p_new_scanqty
  16. end type
  17. type dw_1 from u_dw_rbtnfilter within w_outwaremx_p_new_scanqty
  18. end type
  19. type dw_2 from u_dw_rbtnfilter within w_outwaremx_p_new_scanqty
  20. end type
  21. type cbx_1 from checkbox within w_outwaremx_p_new_scanqty
  22. end type
  23. end forward
  24. global type w_outwaremx_p_new_scanqty from w_publ_base
  25. integer width = 3922
  26. integer height = 2064
  27. string title = "扫描开单"
  28. boolean minbox = false
  29. windowtype windowtype = response!
  30. windowstate windowstate = maximized!
  31. cb_ok cb_ok
  32. st_1 st_1
  33. st_msg st_msg
  34. sle_1 sle_1
  35. cb_1 cb_1
  36. cb_err cb_err
  37. dw_1 dw_1
  38. dw_2 dw_2
  39. cbx_1 cbx_1
  40. end type
  41. global w_outwaremx_p_new_scanqty w_outwaremx_p_new_scanqty
  42. type variables
  43. s_edit_index_tran s_tran
  44. long ins_scid,ins_inwareid
  45. string ins_inwarecode
  46. long cur_thflag
  47. long err_num=0
  48. w_outware_sale parent_win
  49. long cur_storageid
  50. end variables
  51. on w_outwaremx_p_new_scanqty.create
  52. int iCurrent
  53. call super::create
  54. this.cb_ok=create cb_ok
  55. this.st_1=create st_1
  56. this.st_msg=create st_msg
  57. this.sle_1=create sle_1
  58. this.cb_1=create cb_1
  59. this.cb_err=create cb_err
  60. this.dw_1=create dw_1
  61. this.dw_2=create dw_2
  62. this.cbx_1=create cbx_1
  63. iCurrent=UpperBound(this.Control)
  64. this.Control[iCurrent+1]=this.cb_ok
  65. this.Control[iCurrent+2]=this.st_1
  66. this.Control[iCurrent+3]=this.st_msg
  67. this.Control[iCurrent+4]=this.sle_1
  68. this.Control[iCurrent+5]=this.cb_1
  69. this.Control[iCurrent+6]=this.cb_err
  70. this.Control[iCurrent+7]=this.dw_1
  71. this.Control[iCurrent+8]=this.dw_2
  72. this.Control[iCurrent+9]=this.cbx_1
  73. end on
  74. on w_outwaremx_p_new_scanqty.destroy
  75. call super::destroy
  76. destroy(this.cb_ok)
  77. destroy(this.st_1)
  78. destroy(this.st_msg)
  79. destroy(this.sle_1)
  80. destroy(this.cb_1)
  81. destroy(this.cb_err)
  82. destroy(this.dw_1)
  83. destroy(this.dw_2)
  84. destroy(this.cbx_1)
  85. end on
  86. event open;call super::open;dw_1.settransobject(sqlca)
  87. dw_2.settransobject(sqlca)
  88. dw_2.visible=false
  89. s_tran=Message.PowerObjectParm
  90. cur_storageid=s_tran.c_long
  91. parent_win=ParentWindow()
  92. ins_scid = s_tran.b_long
  93. ins_inwareid = s_tran.c_long
  94. ins_inwarecode = s_tran.c_string
  95. cur_thflag=s_tran.d_long
  96. //dw_1.retrieve( ins_scid,ins_inwareid)
  97. dw_1.SetTabOrder('u_outwaremx_scanqty',10)
  98. sle_1.setfocus()
  99. long i
  100. for i=1 to dw_1.rowcount()
  101. dw_1.object.u_outwaremx_scanqty[i]=0
  102. next
  103. end event
  104. event resize;call super::resize;dw_1.height=this.height - dw_1.y - 500
  105. dw_1.width=this.width - 150
  106. cb_1.y= dw_1.y + dw_1.height + 50
  107. cb_ok.y= cb_1.y
  108. cb_exit.y= cb_1.y
  109. cb_err.y= cb_1.y
  110. cbx_1.y=cb_1.y
  111. end event
  112. type cb_func from w_publ_base`cb_func within w_outwaremx_p_new_scanqty
  113. boolean visible = false
  114. end type
  115. type cb_exit from w_publ_base`cb_exit within w_outwaremx_p_new_scanqty
  116. integer x = 2025
  117. integer y = 1860
  118. integer picsize = 16
  119. end type
  120. type cb_ok from uo_imflatbutton within w_outwaremx_p_new_scanqty
  121. integer x = 1371
  122. integer y = 1864
  123. integer width = 311
  124. integer height = 96
  125. integer taborder = 20
  126. boolean bringtotop = true
  127. string normalpicname = "ok.bmp"
  128. integer picsize = 16
  129. end type
  130. event clicked;call super::clicked;dw_1.accepttext()
  131. //parent_win.dw_child.Reset()
  132. //dw_1.ShareData(parent_win.dw_child)
  133. dw_1.AcceptText()
  134. Long i,j
  135. parent_win.dw_child.reset()
  136. FOR i = 1 To dw_1.RowCount()
  137. IF dw_1.Object.u_outwaremx_mtrlid[i] <> 0 THEN
  138. j++
  139. parent_win.dw_child.object.u_outwaremx_mtrlwareid[j]=dw_1.Object.u_outwaremx_mtrlwareid[i]
  140. parent_win.dw_child.object.u_outwaremx_mtrlid[j]=dw_1.Object.u_outwaremx_mtrlid[i]
  141. parent_win.dw_child.object.u_mtrldef_mtrlcode[j]=dw_1.Object.u_mtrldef_mtrlcode[i]
  142. parent_win.dw_child.object.u_mtrldef_mtrlname[j]=dw_1.Object.u_mtrldef_mtrlname[i]
  143. parent_win.dw_child.object.u_mtrldef_mtrlmode[j]=dw_1.Object.u_mtrldef_mtrlmode[i]
  144. parent_win.dw_child.object.u_outwaremx_uqty[j]=dw_1.Object.u_outwaremx_scanqty[i]
  145. parent_win.dw_child.object.u_outwaremx_unit[j]=dw_1.Object.u_outwaremx_unit[i]
  146. END IF
  147. NEXT
  148. close(parent)
  149. end event
  150. type st_1 from statictext within w_outwaremx_p_new_scanqty
  151. integer x = 64
  152. integer y = 28
  153. integer width = 402
  154. integer height = 184
  155. boolean bringtotop = true
  156. integer textsize = -20
  157. integer weight = 400
  158. fontcharset fontcharset = gb2312charset!
  159. fontpitch fontpitch = variable!
  160. string facename = "宋体"
  161. long textcolor = 255
  162. long backcolor = 67108864
  163. string text = "扫描框"
  164. long bordercolor = 255
  165. boolean focusrectangle = false
  166. end type
  167. type st_msg from statictext within w_outwaremx_p_new_scanqty
  168. integer x = 2382
  169. integer y = 12
  170. integer width = 1193
  171. integer height = 184
  172. boolean bringtotop = true
  173. integer textsize = -25
  174. integer weight = 400
  175. fontcharset fontcharset = gb2312charset!
  176. fontpitch fontpitch = variable!
  177. string facename = "宋体"
  178. long textcolor = 255
  179. long backcolor = 67108864
  180. long bordercolor = 255
  181. boolean focusrectangle = false
  182. end type
  183. type sle_1 from u_sleedit within w_outwaremx_p_new_scanqty
  184. integer x = 489
  185. integer y = 12
  186. integer width = 1870
  187. integer height = 196
  188. integer taborder = 20
  189. boolean bringtotop = true
  190. integer textsize = -15
  191. end type
  192. event modified;call super::modified;//IF retrieve_all or retrmode=0 THEN
  193. //// PARENT.TRIGGEREVENT("ue_usual_query_filt")
  194. //ELSE
  195. // PARENT.TRIGGEREVENT("ue_usual_query_RETR")
  196. //END IF
  197. end event
  198. event keyup;call super::keyup;Long j
  199. String ls_Billcode
  200. Boolean lb_oo
  201. IF Key = KeyEnter! THEN //
  202. lb_oo = False
  203. sle_1.SetFocus()
  204. IF Trim(sle_1.Text) = '' THEN RETURN 1
  205. ls_Billcode = Trim(sle_1.Text)
  206. ls_Billcode=f_pb_of_globalreplace(ls_Billcode,'~r','')
  207. ls_Billcode=f_pb_of_globalreplace(ls_Billcode,'~n','')
  208. //首先查询这个是否是条形码 如果是 找出物料编码
  209. String ls_temp_code
  210. SELECT mtrlcode Into :ls_temp_code From u_mtrldef Where barcode = :ls_Billcode;
  211. IF Len(ls_temp_code) > 0 THEN
  212. ls_Billcode = ls_temp_code
  213. END IF
  214. //首先查询这个是否是条形码 如果是 找出物料编码
  215. dw_1.AcceptText()
  216. FOR j = 1 To dw_1.RowCount()
  217. // IF Pos(ls_Billcode, Trim(dw_1.Object.u_mtrldef_mtrlcode[j]) ) > 0 THEN
  218. String lkks_temp_str
  219. lkks_temp_str = ''
  220. lkks_temp_str = '0' + String(dw_1.Object.u_mtrldef_mtrlcode[j])
  221. IF ls_Billcode = dw_1.Object.u_mtrldef_mtrlcode[j] Or (ls_Billcode = lkks_temp_str ) THEN
  222. lb_oo = True
  223. // messagebox('',string(dw_child.object.u_scanbillmx_scanqty[j]))
  224. IF cur_thflag = 0 THEN
  225. dw_1.Object.u_outwaremx_scanqty[j] = Long(dw_1.Object.u_outwaremx_scanqty[j]) + 1
  226. ELSE
  227. dw_1.Object.u_outwaremx_scanqty[j] = Long(dw_1.Object.u_outwaremx_scanqty[j]) - 1
  228. END IF
  229. EXIT
  230. END IF
  231. NEXT
  232. //目前列表没有 新增一行
  233. Long ll_row,ll_mtrlid,ll_mtrlwareid
  234. String ls_mtrlmode,ls_mtrlname,ls_mtrlcode,ls_unit
  235. Decimal dec_noqty
  236. IF lb_oo = False THEN
  237. ll_mtrlid = 0
  238. ls_mtrlmode = ''
  239. ls_mtrlname = ''
  240. ls_unit=''
  241. SELECT top 1 mtrlid,mtrlmode,mtrlname,mtrlcode,unit INTO :ll_mtrlid,:ls_mtrlmode,:ls_mtrlname,:ls_mtrlcode,:ls_unit
  242. From u_mtrldef Where :ls_Billcode = '0' + rtrim(ltrim(mtrlcode)) or
  243. :ls_Billcode = rtrim(ltrim(mtrlcode));
  244. // Where :ls_Billcode Like '%' + rtrim(ltrim(mtrlcode)) ;
  245. IF IsNull(ll_mtrlid) THEN ll_mtrlid = 0
  246. IF ll_mtrlid > 0 THEN
  247. ll_row = dw_1.InsertRow(0)
  248. dec_noqty = 0
  249. SELECT top 1 mtrlwareid,sum(noallocqty) INTO :ll_mtrlwareid,:dec_noqty FROM u_mtrlware WHERE mtrlid = :ll_mtrlid AND storageid = :cur_storageid
  250. Group By mtrlwareid Order By sum(noallocqty) Desc;
  251. IF IsNull(dec_noqty) THEN dec_noqty = 0
  252. dw_1.Object.u_outwaremx_mtrlwareid[ll_row] = ll_mtrlwareid
  253. dw_1.Object.u_outwaremx_mtrlid[ll_row] = ll_mtrlid
  254. dw_1.Object.u_mtrldef_mtrlcode[ll_row] = ls_mtrlcode
  255. dw_1.Object.u_mtrldef_mtrlname[ll_row] = ls_mtrlname
  256. dw_1.Object.u_mtrldef_mtrlmode[ll_row] = ls_mtrlmode
  257. dw_1.Object.u_outwaremx_unit[ll_row] = ls_unit
  258. IF cur_thflag = 0 THEN
  259. dw_1.Object.u_outwaremx_scanqty[j] = 1
  260. ELSE
  261. dw_1.Object.u_outwaremx_scanqty[j] = -1
  262. END IF
  263. // dw_1.Object.u_warepdb_billmx_factqty[j] = dec_qty
  264. // dw_1.Object.u_warepdb_billmx_printid[j]=j
  265. // ELSE
  266. // dw_1.Object.u_warepdb_billmx_printid[ll_row]=ll_row
  267. // dw_1.Object.u_warepdb_billmx_factqty[ll_row] = dw_1.Object.u_warepdb_billmx_factqty[ll_row] + dec_qty
  268. //// END IF
  269. lb_oo = True
  270. END IF
  271. END IF
  272. // 找不到
  273. sle_1.Text = ''
  274. IF lb_oo = False THEN
  275. err_num = err_num + 1
  276. st_msg.Text = '出错' + String(err_num)
  277. String lss_mtrlname,lss_mtrlmode,lss_unit,lss_mtrlsectype,lss_zxmtrlmode,lss_mtrlengname
  278. Long lkk_row
  279. Boolean lb_kk
  280. SELECT Top 1 mtrlname,mtrlmode,unit,mtrlsectype,zxmtrlmode,mtrlengname Into : lss_mtrlname,:lss_mtrlmode,:lss_unit,:lss_mtrlsectype,:lss_zxmtrlmode,:lss_mtrlengname From u_mtrldef Where mtrlcode Like '%' + :ls_Billcode ;
  281. dw_2.AcceptText()
  282. lb_kk = False
  283. FOR j = 1 To dw_2.RowCount()
  284. IF Pos(ls_Billcode, dw_2.Object.u_mtrldef_mtrlcode[j] ) > 0 THEN
  285. lb_kk = True
  286. IF cur_thflag = 0 THEN
  287. dw_2.Object.u_outwaremx_scanqty[j] = Long(dw_2.Object.u_outwaremx_scanqty[j]) + 1
  288. ELSE
  289. dw_2.Object.u_outwaremx_scanqty[j] = Long(dw_2.Object.u_outwaremx_scanqty[j]) - 1
  290. END IF
  291. EXIT
  292. END IF
  293. NEXT
  294. IF lb_kk = False THEN
  295. lkk_row = dw_2.InsertRow(0)
  296. dw_2.Object.u_mtrldef_mtrlcode[lkk_row] = ls_Billcode
  297. dw_2.Object.u_mtrldef_mtrlname[lkk_row] = lss_mtrlname
  298. dw_2.Object.u_mtrldef_mtrlmode[lkk_row] = lss_mtrlmode
  299. dw_2.Object.u_outwaremx_unit[lkk_row] = lss_unit
  300. dw_2.Object.u_mtrldef_mtrlsectype[lkk_row] = lss_mtrlsectype
  301. dw_2.Object.u_mtrldef_zxmtrlmode[lkk_row] = lss_zxmtrlmode
  302. dw_2.Object.u_mtrldef_mtrlengname[lkk_row] = lss_mtrlengname
  303. IF cur_thflag = 0 THEN
  304. dw_2.Object.u_outwaremx_scanqty[lkk_row] = 1
  305. ELSE
  306. dw_2.Object.u_outwaremx_scanqty[lkk_row] = - 1
  307. END IF
  308. END IF
  309. END IF
  310. RETURN 1
  311. END IF
  312. end event
  313. type cb_1 from uo_imflatbutton within w_outwaremx_p_new_scanqty
  314. integer x = 283
  315. integer y = 1872
  316. integer width = 411
  317. integer height = 96
  318. integer taborder = 30
  319. boolean bringtotop = true
  320. string text = "勾选删行"
  321. integer picsize = 16
  322. end type
  323. event clicked;call super::clicked;
  324. long i
  325. next1:
  326. FOR i = 1 TO dw_1.RowCount()
  327. IF dw_1.Object.ch[i] = 1 THEN
  328. dw_1.DeleteRow(i)
  329. GOTO next1
  330. END IF
  331. NEXT
  332. end event
  333. type cb_err from uo_imflatbutton within w_outwaremx_p_new_scanqty
  334. integer x = 782
  335. integer y = 1872
  336. integer width = 411
  337. integer height = 96
  338. integer taborder = 40
  339. boolean bringtotop = true
  340. string text = "错误列表"
  341. integer picsize = 16
  342. end type
  343. event clicked;call super::clicked;dw_2.visible=true
  344. dw_2.x=10
  345. dw_2.width=dw_1.width - 500
  346. end event
  347. type dw_1 from u_dw_rbtnfilter within w_outwaremx_p_new_scanqty
  348. integer x = 18
  349. integer y = 244
  350. integer width = 3584
  351. integer height = 1608
  352. integer taborder = 30
  353. boolean bringtotop = true
  354. string dataobject = "dw_outwaremx_p_scanqty"
  355. boolean rbutton_filter_use = true
  356. boolean rbutton_setposition_use = true
  357. boolean titleclick_sort_use = true
  358. end type
  359. type dw_2 from u_dw_rbtnfilter within w_outwaremx_p_new_scanqty
  360. integer x = 2235
  361. integer y = 284
  362. integer width = 3584
  363. integer height = 1312
  364. integer taborder = 40
  365. boolean bringtotop = true
  366. boolean titlebar = true
  367. string title = "错误列表"
  368. string dataobject = "dw_outwaremx_p_scanqty"
  369. boolean controlmenu = true
  370. boolean minbox = true
  371. boolean maxbox = true
  372. boolean rbutton_filter_use = true
  373. boolean rbutton_setposition_use = true
  374. boolean titleclick_sort_use = true
  375. end type
  376. type cbx_1 from checkbox within w_outwaremx_p_new_scanqty
  377. integer x = 32
  378. integer y = 1880
  379. integer width = 206
  380. integer height = 76
  381. boolean bringtotop = true
  382. integer textsize = -9
  383. integer weight = 400
  384. fontcharset fontcharset = gb2312charset!
  385. fontpitch fontpitch = variable!
  386. string facename = "宋体"
  387. long textcolor = 33554432
  388. long backcolor = 67108864
  389. string text = "全选"
  390. end type
  391. event clicked;Long i
  392. IF this.Checked = TRUE THEN
  393. FOR i = 1 TO dw_1.RowCount()
  394. dw_1.Object.ch[i] = 1
  395. NEXT
  396. ELSE
  397. FOR i = 1 TO dw_1.RowCount()
  398. dw_1.Object.ch[i] = 0
  399. NEXT
  400. END IF
  401. end event