w_outwaremx_p_scanqty.srw 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. $PBExportHeader$w_outwaremx_p_scanqty.srw
  2. forward
  3. global type w_outwaremx_p_scanqty from w_publ_base
  4. end type
  5. type cb_ok from uo_imflatbutton within w_outwaremx_p_scanqty
  6. end type
  7. type st_1 from statictext within w_outwaremx_p_scanqty
  8. end type
  9. type st_msg from statictext within w_outwaremx_p_scanqty
  10. end type
  11. type sle_1 from u_sleedit within w_outwaremx_p_scanqty
  12. end type
  13. type cb_1 from uo_imflatbutton within w_outwaremx_p_scanqty
  14. end type
  15. type cb_err from uo_imflatbutton within w_outwaremx_p_scanqty
  16. end type
  17. type dw_1 from u_dw_rbtnfilter within w_outwaremx_p_scanqty
  18. end type
  19. type dw_2 from u_dw_rbtnfilter within w_outwaremx_p_scanqty
  20. end type
  21. end forward
  22. global type w_outwaremx_p_scanqty from w_publ_base
  23. integer width = 3922
  24. integer height = 2064
  25. string title = "扫描窗口"
  26. boolean minbox = false
  27. windowtype windowtype = response!
  28. windowstate windowstate = maximized!
  29. cb_ok cb_ok
  30. st_1 st_1
  31. st_msg st_msg
  32. sle_1 sle_1
  33. cb_1 cb_1
  34. cb_err cb_err
  35. dw_1 dw_1
  36. dw_2 dw_2
  37. end type
  38. global w_outwaremx_p_scanqty w_outwaremx_p_scanqty
  39. type variables
  40. s_edit_index_tran s_tran
  41. long ins_scid,ins_inwareid
  42. string ins_inwarecode
  43. long cur_thflag
  44. long err_num=0
  45. w_outware_sale parent_win
  46. w_outware_sale_th parent_win_th
  47. long ll_VerticalScroll//垂直滚动条位置
  48. end variables
  49. on w_outwaremx_p_scanqty.create
  50. int iCurrent
  51. call super::create
  52. this.cb_ok=create cb_ok
  53. this.st_1=create st_1
  54. this.st_msg=create st_msg
  55. this.sle_1=create sle_1
  56. this.cb_1=create cb_1
  57. this.cb_err=create cb_err
  58. this.dw_1=create dw_1
  59. this.dw_2=create dw_2
  60. iCurrent=UpperBound(this.Control)
  61. this.Control[iCurrent+1]=this.cb_ok
  62. this.Control[iCurrent+2]=this.st_1
  63. this.Control[iCurrent+3]=this.st_msg
  64. this.Control[iCurrent+4]=this.sle_1
  65. this.Control[iCurrent+5]=this.cb_1
  66. this.Control[iCurrent+6]=this.cb_err
  67. this.Control[iCurrent+7]=this.dw_1
  68. this.Control[iCurrent+8]=this.dw_2
  69. end on
  70. on w_outwaremx_p_scanqty.destroy
  71. call super::destroy
  72. destroy(this.cb_ok)
  73. destroy(this.st_1)
  74. destroy(this.st_msg)
  75. destroy(this.sle_1)
  76. destroy(this.cb_1)
  77. destroy(this.cb_err)
  78. destroy(this.dw_1)
  79. destroy(this.dw_2)
  80. end on
  81. event open;call super::open;dw_1.SetTransObject(sqlca)
  82. dw_2.SetTransObject(sqlca)
  83. dw_2.Visible = False
  84. s_tran = Message.PowerObjectParm
  85. ins_scid = s_tran.b_long
  86. ins_inwareid = s_tran.c_long
  87. ins_inwarecode = s_tran.c_string
  88. cur_thflag = s_tran.d_long
  89. IF cur_thflag = 0 THEN
  90. parent_win = ParentWindow()
  91. ELSE
  92. parent_win_th = ParentWindow()
  93. END IF
  94. dw_1.Retrieve( ins_scid,ins_inwareid)
  95. dw_1.SetTabOrder('u_outwaremx_scanqty',10)
  96. sle_1.SetFocus()
  97. Long i
  98. FOR i = 1 To dw_1.RowCount()
  99. dw_1.Object.u_outwaremx_scanqty[i] = 0
  100. NEXT
  101. end event
  102. event resize;call super::resize;dw_1.height=this.height - dw_1.y - 500
  103. dw_1.width=this.width - 150
  104. cb_1.y= dw_1.y + dw_1.height + 50
  105. cb_ok.y= cb_1.y
  106. cb_exit.y= cb_1.y
  107. cb_err.y= cb_1.y
  108. end event
  109. type cb_func from w_publ_base`cb_func within w_outwaremx_p_scanqty
  110. boolean visible = false
  111. end type
  112. type cb_exit from w_publ_base`cb_exit within w_outwaremx_p_scanqty
  113. integer x = 2025
  114. integer y = 1860
  115. integer picsize = 16
  116. end type
  117. type cb_ok from uo_imflatbutton within w_outwaremx_p_scanqty
  118. integer x = 1371
  119. integer y = 1864
  120. integer width = 311
  121. integer height = 96
  122. integer taborder = 20
  123. boolean bringtotop = true
  124. string normalpicname = "ok.bmp"
  125. integer picsize = 16
  126. end type
  127. event clicked;call super::clicked;
  128. Long rslt = 1
  129. Long i
  130. Long ll_printid
  131. Decimal lde_buyqty,ld_jgprice, lde_rebate, lde_tax
  132. String arg_msg
  133. Decimal dec_scanqty
  134. dw_1.AcceptText()
  135. FOR i = 1 To dw_1.RowCount()
  136. IF dw_1.Object.u_outwaremx_scanqty[i] <> dw_1.Object.u_outwaremx_uqty[i] THEN
  137. MessageBox('','第' + String(i) + '行出仓数不等于扫描数!')
  138. RETURN
  139. END IF
  140. NEXT
  141. FOR i = 1 To dw_1.RowCount()
  142. ll_printid = dw_1.Object.u_outwaremx_printid[i]
  143. dec_scanqty = dw_1.Object.u_outwaremx_scanqty[i]
  144. IF IsNull(dec_scanqty) THEN dec_scanqty = 0
  145. IF cur_thflag = 1 THEN dec_scanqty = Abs(dec_scanqty) * (-1)
  146. UPDATE u_outwaremx Set scanqty = :dec_scanqty Where scid = :ins_scid And outwareid = :ins_inwareid And printid = :ll_printid;
  147. NEXT
  148. UPDATE u_outware Set scanflag = 1 Where scid = :ins_scid And outwareid = :ins_inwareid ;
  149. IF rslt = 0 THEN
  150. ROLLBACK;
  151. MessageBox('错误',arg_msg, StopSign!, OK! )
  152. RETURN
  153. ELSE
  154. COMMIT;
  155. MessageBox('提示','修改扫描数量成功!', Information!, OK! )
  156. IF cur_thflag = 0 THEN
  157. parent_win = ParentWindow()
  158. parent_win.dw_pageretr.Object.scanflag[parent_win.dw_pageretr.GetRow()] = 1
  159. ELSE
  160. parent_win_th = ParentWindow()
  161. parent_win_th.dw_pageretr.Object.u_outware_scanflag[parent_win_th.dw_pageretr.GetRow()] = 1
  162. END IF
  163. Close(Parent)
  164. END IF
  165. end event
  166. type st_1 from statictext within w_outwaremx_p_scanqty
  167. integer x = 64
  168. integer y = 28
  169. integer width = 402
  170. integer height = 184
  171. boolean bringtotop = true
  172. integer textsize = -20
  173. integer weight = 400
  174. fontcharset fontcharset = gb2312charset!
  175. fontpitch fontpitch = variable!
  176. string facename = "宋体"
  177. long textcolor = 255
  178. long backcolor = 67108864
  179. string text = "扫描框"
  180. long bordercolor = 255
  181. boolean focusrectangle = false
  182. end type
  183. type st_msg from statictext within w_outwaremx_p_scanqty
  184. integer x = 2382
  185. integer y = 12
  186. integer width = 1193
  187. integer height = 184
  188. boolean bringtotop = true
  189. integer textsize = -25
  190. integer weight = 400
  191. fontcharset fontcharset = gb2312charset!
  192. fontpitch fontpitch = variable!
  193. string facename = "宋体"
  194. long textcolor = 255
  195. long backcolor = 67108864
  196. long bordercolor = 255
  197. boolean focusrectangle = false
  198. end type
  199. type sle_1 from u_sleedit within w_outwaremx_p_scanqty
  200. integer x = 489
  201. integer y = 12
  202. integer width = 1870
  203. integer height = 196
  204. integer taborder = 20
  205. boolean bringtotop = true
  206. integer textsize = -15
  207. end type
  208. event modified;call super::modified;//IF retrieve_all or retrmode=0 THEN
  209. //// PARENT.TRIGGEREVENT("ue_usual_query_filt")
  210. //ELSE
  211. // PARENT.TRIGGEREVENT("ue_usual_query_RETR")
  212. //END IF
  213. end event
  214. event keyup;call super::keyup;Long j
  215. String ls_Billcode
  216. Boolean lb_oo
  217. IF Key = KeyEnter! THEN //
  218. lb_oo = False
  219. sle_1.SetFocus()
  220. IF Trim(sle_1.Text) = '' THEN RETURN 1
  221. ls_Billcode = Trim(sle_1.Text)
  222. ls_Billcode = f_pb_of_globalreplace(ls_Billcode,'~r','')
  223. ls_Billcode = f_pb_of_globalreplace(ls_Billcode,'~n','')
  224. //首先查询这个是否是条形码 如果是 找出物料编码
  225. String ls_temp_code
  226. SELECT mtrlcode Into :ls_temp_code From u_mtrldef Where barcode = :ls_Billcode;
  227. IF Len(ls_temp_code) > 0 THEN
  228. ls_Billcode = ls_temp_code
  229. END IF
  230. //首先查询这个是否是条形码 如果是 找出物料编码
  231. dw_1.AcceptText()
  232. FOR j = 1 To dw_1.RowCount()
  233. String lkks_temp_str
  234. lkks_temp_str = ''
  235. lkks_temp_str = '0' + String(dw_1.Object.u_mtrldef_mtrlcode[j])
  236. IF ls_Billcode = dw_1.Object.u_mtrldef_mtrlcode[j] Or (ls_Billcode = lkks_temp_str ) THEN
  237. // IF Pos(ls_Billcode, trim(dw_1.Object.u_mtrldef_mtrlcode[j]) ) > 0 THEN
  238. lb_oo = True
  239. // messagebox('',string(dw_child.object.u_scanbillmx_scanqty[j]))
  240. IF cur_thflag = 0 THEN
  241. dw_1.Object.u_outwaremx_scanqty[j] = Long(dw_1.Object.u_outwaremx_scanqty[j]) + 1
  242. ELSE
  243. dw_1.Object.u_outwaremx_scanqty[j] = Long(dw_1.Object.u_outwaremx_scanqty[j]) - 1
  244. END IF
  245. dw_1.SelectRow(0,False)
  246. dw_1.SelectRow(j,True)
  247. dw_1.Object.DataWindow.VerticalScrollPosition = Long( j / Dec(dw_1.RowCount()) * Dec(dw_1.Object.DataWindow.VerticalScrollMaximum))
  248. EXIT
  249. END IF
  250. NEXT
  251. //
  252. sle_1.Text = ''
  253. IF lb_oo = False THEN
  254. err_num = err_num + 1
  255. st_msg.Text = '出错' + String(err_num)
  256. String lss_mtrlname,lss_mtrlmode,lss_unit,lss_mtrlsectype,lss_zxmtrlmode,lss_mtrlengname
  257. Long lkk_row
  258. Boolean lb_kk
  259. 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
  260. WHERE :ls_Billcode = '0' + rtrim(ltrim(mtrlcode)) OR
  261. :ls_Billcode = rtrim(ltrim(mtrlcode));
  262. dw_2.AcceptText()
  263. lb_kk = False
  264. FOR j = 1 To dw_2.RowCount()
  265. IF Pos(ls_Billcode, dw_2.Object.u_mtrldef_mtrlcode[j] ) > 0 THEN
  266. lb_kk = True
  267. IF cur_thflag = 0 THEN
  268. dw_2.Object.u_outwaremx_scanqty[j] = Long(dw_2.Object.u_outwaremx_scanqty[j]) + 1
  269. ELSE
  270. dw_2.Object.u_outwaremx_scanqty[j] = Long(dw_2.Object.u_outwaremx_scanqty[j]) - 1
  271. END IF
  272. EXIT
  273. END IF
  274. NEXT
  275. IF lb_kk = False THEN
  276. lkk_row = dw_2.InsertRow(0)
  277. dw_2.Object.u_mtrldef_mtrlcode[lkk_row] = ls_Billcode
  278. dw_2.Object.u_mtrldef_mtrlname[lkk_row] = lss_mtrlname
  279. dw_2.Object.u_mtrldef_mtrlmode[lkk_row] = lss_mtrlmode
  280. dw_2.Object.u_outwaremx_unit[lkk_row] = lss_unit
  281. dw_2.Object.u_mtrldef_mtrlsectype[lkk_row] = lss_mtrlsectype
  282. dw_2.Object.u_mtrldef_zxmtrlmode[lkk_row] = lss_zxmtrlmode
  283. dw_2.Object.u_mtrldef_mtrlengname[lkk_row] = lss_mtrlengname
  284. dw_2.Object.u_outwaremx_scanqty[lkk_row] = 1
  285. END IF
  286. END IF
  287. RETURN 1
  288. END IF
  289. end event
  290. type cb_1 from uo_imflatbutton within w_outwaremx_p_scanqty
  291. integer x = 78
  292. integer y = 1872
  293. integer width = 411
  294. integer height = 96
  295. integer taborder = 30
  296. boolean bringtotop = true
  297. string text = "扫描数=出仓数"
  298. integer picsize = 16
  299. end type
  300. event clicked;call super::clicked;long i
  301. for i=1 to dw_1.rowcount()
  302. dw_1.object.u_outwaremx_scanqty[i]=dw_1.object.u_outwaremx_uqty[i]
  303. next
  304. end event
  305. type cb_err from uo_imflatbutton within w_outwaremx_p_scanqty
  306. integer x = 594
  307. integer y = 1872
  308. integer width = 411
  309. integer height = 96
  310. integer taborder = 40
  311. boolean bringtotop = true
  312. string text = "错误列表"
  313. integer picsize = 16
  314. end type
  315. event clicked;call super::clicked;dw_2.visible=true
  316. dw_2.x=10
  317. dw_2.width=dw_1.width - 500
  318. end event
  319. type dw_1 from u_dw_rbtnfilter within w_outwaremx_p_scanqty
  320. integer x = 18
  321. integer y = 244
  322. integer width = 3584
  323. integer height = 1608
  324. integer taborder = 30
  325. boolean bringtotop = true
  326. string dataobject = "dw_outwaremx_p_scanqty"
  327. boolean vscrollbar = true
  328. boolean livescroll = false
  329. boolean rbutton_filter_use = true
  330. boolean rbutton_setposition_use = true
  331. boolean titleclick_sort_use = true
  332. end type
  333. event clicked;call super::clicked;IF row > 0 THEN
  334. dw_1.SelectRow(0,False)
  335. dw_1.SelectRow(row,True)
  336. END IF
  337. end event
  338. type dw_2 from u_dw_rbtnfilter within w_outwaremx_p_scanqty
  339. integer x = 2235
  340. integer y = 284
  341. integer width = 3584
  342. integer height = 1312
  343. integer taborder = 40
  344. boolean bringtotop = true
  345. boolean titlebar = true
  346. string title = "错误列表"
  347. string dataobject = "dw_outwaremx_p_scanqty"
  348. boolean controlmenu = true
  349. boolean minbox = true
  350. boolean maxbox = true
  351. boolean rbutton_filter_use = true
  352. boolean rbutton_setposition_use = true
  353. boolean titleclick_sort_use = true
  354. end type