w_shopcart_fx.srw 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. $PBExportHeader$w_shopcart_fx.srw
  2. $PBExportComments$协同 购物车
  3. forward
  4. global type w_shopcart_fx from w_publ_base_style
  5. end type
  6. type dw_1 from datawindow within w_shopcart_fx
  7. end type
  8. type cb_retrieve from uo_imflatbutton within w_shopcart_fx
  9. end type
  10. type cb_to_spt_price from uo_imflatbutton within w_shopcart_fx
  11. end type
  12. type cb_to_buytask from uo_imflatbutton within w_shopcart_fx
  13. end type
  14. end forward
  15. global type w_shopcart_fx from w_publ_base_style
  16. integer width = 4887
  17. integer height = 2616
  18. string title = "我的购物车"
  19. boolean maxbox = true
  20. boolean resizable = true
  21. long backcolor = 16777215
  22. dw_1 dw_1
  23. cb_retrieve cb_retrieve
  24. cb_to_spt_price cb_to_spt_price
  25. cb_to_buytask cb_to_buytask
  26. end type
  27. global w_shopcart_fx w_shopcart_fx
  28. forward prototypes
  29. public subroutine wf_retrieve_shopcart ()
  30. public subroutine wf_select_group (readonly long a_sptcomid)
  31. end prototypes
  32. public subroutine wf_retrieve_shopcart ();dw_1.Reset()
  33. oleobject parm, ret
  34. parm = FXAppCom.CreatePbDictionary()
  35. parm.SetString('token', app_token_fx)
  36. string arg_msg
  37. ret = FXAppCom.GetShopcart(parm, ref arg_msg)
  38. if (arg_msg <> '') then
  39. MessageBox('提示', '获取购物车操作失败:' + arg_msg)
  40. return
  41. end if
  42. oleobject list, item
  43. list = ret.GetArrOfPBDictionary('list')
  44. long i, comid, mtrlid
  45. string temp_picPath, exePath, temp_filetype
  46. exePath = GetCurrentDirectory()
  47. dw_1.SetRedraw(false)
  48. for i = 1 to list.Count
  49. item = list.GetItem(i - 1)
  50. comid = item.GetInt('sptcomid')
  51. mtrlid = item.GetInt('mtrlid_erp')
  52. temp_filetype = item.GetString('filetype')
  53. dw_1.Object.userid[i] = item.GetInt('userid')
  54. dw_1.Object.sptcomid[i] = comid
  55. dw_1.Object.mtrlid_erp[i] = mtrlid
  56. dw_1.Object.fxmtrlid[i] = item.GetInt('fxmtrlid')
  57. dw_1.Object.price_ori[i] = item.GetDouble('price_ori')
  58. dw_1.Object.opdate[i] = item.GetDateTime('opdate')
  59. dw_1.Object.qty[i] = item.GetDouble('qty')
  60. dw_1.Object.mtrlcode[i] = item.GetString('mtrlcode')
  61. dw_1.Object.mtrlname[i] = item.GetString('mtrlname')
  62. dw_1.Object.mtrlmode[i] = item.GetString('mtrlmode')
  63. dw_1.Object.mtrlsectype[i] = item.GetString('mtrlsectype')
  64. dw_1.Object.zxmtrlmode[i] = item.GetString('zxmtrlmode')
  65. dw_1.Object.usermtrlmode[i] = item.GetString('usermtrlmode')
  66. dw_1.Object.unit[i] = item.GetString('unit')
  67. dw_1.Object.comname[i] = item.GetString('comname')
  68. dw_1.Object.simplename[i] = item.GetString('simplename')
  69. dw_1.Object.filetype[i] = temp_filetype
  70. dw_1.Object.now_price[i] = i //now_price
  71. temp_picPath = exePath + '\cache\mtrlpic\c_' + string(comid) + '_m_' + string(mtrlid) + '.' + temp_filetype
  72. if FileExists(temp_picPath) then
  73. dw_1.Object.filepath[i] = temp_picPath
  74. else
  75. dw_1.Object.filepath[i] = exePath + '\graphics\mtrl_view.png'
  76. end if
  77. next
  78. dw_1.AcceptText()
  79. dw_1.SetRedraw(true)
  80. end subroutine
  81. public subroutine wf_select_group (readonly long a_sptcomid);// 根据sptcomid全选/全反选产品
  82. long i
  83. long ch = 0
  84. for i = 1 to dw_1.RowCount()
  85. if (dw_1.Object.sptcomid[i] <> a_sptcomid) then continue
  86. if (dw_1.Object.ch[i] = 0) then
  87. ch = 1 // 存在未选择的情况,则全选,否则全反选
  88. exit
  89. end if
  90. next
  91. for i = 1 to dw_1.RowCount()
  92. if (dw_1.Object.sptcomid[i] <> a_sptcomid) then continue
  93. dw_1.Object.ch[i] = ch
  94. next
  95. end subroutine
  96. on w_shopcart_fx.create
  97. int iCurrent
  98. call super::create
  99. this.dw_1=create dw_1
  100. this.cb_retrieve=create cb_retrieve
  101. this.cb_to_spt_price=create cb_to_spt_price
  102. this.cb_to_buytask=create cb_to_buytask
  103. iCurrent=UpperBound(this.Control)
  104. this.Control[iCurrent+1]=this.dw_1
  105. this.Control[iCurrent+2]=this.cb_retrieve
  106. this.Control[iCurrent+3]=this.cb_to_spt_price
  107. this.Control[iCurrent+4]=this.cb_to_buytask
  108. end on
  109. on w_shopcart_fx.destroy
  110. call super::destroy
  111. destroy(this.dw_1)
  112. destroy(this.cb_retrieve)
  113. destroy(this.cb_to_spt_price)
  114. destroy(this.cb_to_buytask)
  115. end on
  116. event open;call super::open;string arg_msg
  117. if (f_find_fx_user_power(41, ref arg_msg) <> 1 &
  118. and f_find_fx_user_power(51, ref arg_msg) <> 1) then // 51-购物车转询价单(新建询价单) 41-供应商询价单新建
  119. cb_to_spt_price.Enabled = false
  120. end if
  121. if (f_find_fx_user_power(56, ref arg_msg) <> 1 &
  122. and f_find_fx_user_power(52, ref arg_msg) <> 1) then // 52-购物车转采购订单(新建采购订单) 56-采购订单新建
  123. cb_to_buytask.Enabled = false
  124. end if
  125. wf_retrieve_shopcart()
  126. end event
  127. event resize;call super::resize;if this.width < 4320 then this.Width = 4320
  128. if this.Height < 2680 then this.Height = 2680
  129. dw_1.Width = this.workspacewidth( )
  130. dw_1.Height = this.workspaceheight( ) - dw_1.Y
  131. dw_1.Modify('b_add.X = ' + string(this.workspacewidth( ) - (3662 - 3589) - 100))
  132. dw_1.Modify('qty.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100))
  133. dw_1.Modify('b_minus.X = ' + string(this.workspacewidth( ) - (3662 - 3214) - 100))
  134. dw_1.Modify('fx_shopcart_qty_t.X = ' + string(this.workspacewidth( ) - (3662 - 3355) - 100))
  135. dw_1.Modify('t_2.X = ' + string(this.workspacewidth( ) - (3662 - 3374) - 100))
  136. dw_1.Modify('compute_price.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100))
  137. dw_1.Modify('t_4.X = ' + string(this.workspacewidth( ) - (3662 - 3177) - 100))
  138. dw_1.Modify('compute_6.X = ' + string(this.workspacewidth( ) - (3662 - 3310) - 100))
  139. cb_exit.X = this.workspacewidth( ) - cb_exit.Width
  140. end event
  141. type cb_func from w_publ_base_style`cb_func within w_shopcart_fx
  142. boolean visible = false
  143. integer x = 110
  144. integer y = 2228
  145. boolean enabled = false
  146. end type
  147. type cb_exit from w_publ_base_style`cb_exit within w_shopcart_fx
  148. integer x = 2427
  149. end type
  150. type ln_bar from w_publ_base_style`ln_bar within w_shopcart_fx
  151. end type
  152. type ln_bar2 from w_publ_base_style`ln_bar2 within w_shopcart_fx
  153. end type
  154. type r_bar from w_publ_base_style`r_bar within w_shopcart_fx
  155. end type
  156. type dw_1 from datawindow within w_shopcart_fx
  157. integer y = 168
  158. integer width = 4553
  159. integer height = 1856
  160. integer taborder = 20
  161. boolean bringtotop = true
  162. string title = "none"
  163. string dataobject = "dw_fx_shopcart"
  164. boolean vscrollbar = true
  165. boolean livescroll = true
  166. borderstyle borderstyle = stylelowered!
  167. end type
  168. event scrollhorizontal;this.object.DataWindow.HorizontalScrollPosition = 0
  169. end event
  170. event clicked;long qty, comid
  171. if (row > 0) then
  172. this.SetRow(row)
  173. qty = this.Object.qty[row]
  174. comid = this.Object.sptcomid[row]
  175. if (dwo.Name = 'b_minus' and qty > 1) then
  176. this.Object.qty[row] = qty - 1
  177. elseif (dwo.Name = 'b_add') then
  178. this.Object.qty[row] = qty + 1
  179. elseif (dwo.Name = 'b_ch') then
  180. wf_select_group(comid)
  181. end if
  182. end if
  183. end event
  184. type cb_retrieve from uo_imflatbutton within w_shopcart_fx
  185. integer width = 151
  186. integer height = 164
  187. integer taborder = 30
  188. boolean bringtotop = true
  189. string text = "刷新"
  190. string normalpicname = "refresh.bmp"
  191. integer picsize = 16
  192. toolbaralignment pic_align = alignattop!
  193. boolean border = false
  194. end type
  195. event clicked;call super::clicked;wf_retrieve_shopcart()
  196. end event
  197. type cb_to_spt_price from uo_imflatbutton within w_shopcart_fx
  198. integer x = 151
  199. integer width = 279
  200. integer height = 164
  201. integer taborder = 20
  202. boolean bringtotop = true
  203. string text = "转询价单"
  204. boolean border = false
  205. end type
  206. event clicked;call super::clicked;if (dw_1.RowCount() <= 0) then return
  207. long i, sptcomid, row
  208. row = dw_1.Find('ch = 1', 1, dw_1.RowCount())
  209. if (row > 0) then
  210. sptcomid = dw_1.Object.sptcomid[row]
  211. else
  212. MessageBox('提示', '请勾选需要转为询价单的产品')
  213. return
  214. end if
  215. oleobject item, list
  216. list = FXAppCom.CreArrOfPbDictionary()
  217. for i = 1 to dw_1.RowCount()
  218. if (dw_1.Object.ch[i] = 0) then continue
  219. if (dw_1.Object.sptcomid[i] <> sptcomid) then
  220. MessageBox('提示', '请勾选同一个供应商的产品')
  221. return
  222. end if
  223. item = FXAppCom.CreatePbDictionary()
  224. item.SetInt('mtrlid_erp', dw_1.Object.mtrlid_erp[i])
  225. item.SetDouble('qty_min', dw_1.Object.qty[i])
  226. item.SetDouble('qty_max', dw_1.Object.qty[i])
  227. item.SetString('unit', dw_1.Object.unit[i])
  228. list.Add(item)
  229. next
  230. oleobject parm, retParm
  231. parm = FXAppCom.CreatePbDictionary()
  232. parm.SetString('token', app_token_fx)
  233. parm.SetObject('list', list)
  234. parm.SetInt('sptcomid', sptcomid)
  235. string arg_msg
  236. retParm = FxAppCom.ShopcartToSptPrice(parm, ref arg_msg)
  237. if (arg_msg <> '') then
  238. MessageBox('提示', '转询价单操作失败:' + arg_msg)
  239. return
  240. end if
  241. string billcode
  242. billcode = retParm.GetString('billcode')
  243. MessageBox('提示', '操作成功,新的询价单单号为:[' + billcode + ']')
  244. if (IsValid(s_win_open[4].win)) then // 4-供应商询价单
  245. Close(s_win_open[4].win)
  246. end if
  247. Open(w_spt_price_change_fx)
  248. end event
  249. type cb_to_buytask from uo_imflatbutton within w_shopcart_fx
  250. integer x = 430
  251. integer width = 320
  252. integer height = 164
  253. integer taborder = 30
  254. boolean bringtotop = true
  255. string text = "转采购订单"
  256. boolean border = false
  257. end type
  258. event clicked;call super::clicked;if (dw_1.RowCount() <= 0) then return
  259. long i, sptcomid, row
  260. row = dw_1.Find('ch = 1', 1, dw_1.RowCount())
  261. if (row > 0) then
  262. sptcomid = dw_1.Object.sptcomid[row]
  263. else
  264. MessageBox('提示', '请勾选需要转为询价单的产品')
  265. return
  266. end if
  267. oleobject item, list
  268. list = FXAppCom.CreArrOfPbDictionary()
  269. for i = 1 to dw_1.RowCount()
  270. if (dw_1.Object.ch[i] = 0) then continue
  271. if (dw_1.Object.sptcomid[i] <> sptcomid) then
  272. MessageBox('提示', '请勾选同一个供应商的产品')
  273. return
  274. end if
  275. item = FXAppCom.CreatePbDictionary()
  276. item.SetInt('fxmtrlid', dw_1.Object.fxmtrlid[i])
  277. item.SetDouble('qty', dw_1.Object.qty[i])
  278. list.Add(item)
  279. next
  280. oleobject parm, retParm
  281. parm = FXAppCom.CreatePbDictionary()
  282. parm.SetString('token', app_token_fx)
  283. parm.SetObject('list', list)
  284. parm.SetInt('sptcomid', sptcomid)
  285. string arg_msg
  286. retParm = FxAppCom.ShopcartToBuytask(parm, ref arg_msg)
  287. if (arg_msg <> '') then
  288. MessageBox('提示', '转采购订单操作失败:' + arg_msg)
  289. return
  290. end if
  291. string tid
  292. tid = retParm.GetString('tid')
  293. MessageBox('提示', '操作成功,新的采购订单单号为:[' + tid + ']')
  294. if (IsValid(s_win_open[53].win)) then // 53-采购订单
  295. Close(s_win_open[53].win)
  296. end if
  297. Open(w_buytask_fx)
  298. end event