w_outware_fx.srw 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. $PBExportHeader$w_outware_fx.srw
  2. $PBExportComments$分销系统--销售订单发货
  3. forward
  4. global type w_outware_fx from w_publ_base_style
  5. end type
  6. type dw_1 from u_dw_rbtnfilter within w_outware_fx
  7. end type
  8. type st_1 from statictext within w_outware_fx
  9. end type
  10. type sle_1 from singlelineedit within w_outware_fx
  11. end type
  12. type st_2 from statictext within w_outware_fx
  13. end type
  14. type cb_1 from commandbutton within w_outware_fx
  15. end type
  16. end forward
  17. global type w_outware_fx from w_publ_base_style
  18. integer y = 388
  19. integer width = 3562
  20. integer height = 1677
  21. string title = "发货明细"
  22. boolean minbox = false
  23. windowtype windowtype = response!
  24. long backcolor = 16777215
  25. string icon = "graphics\chain_link_128px.ico"
  26. boolean center = true
  27. dw_1 dw_1
  28. st_1 st_1
  29. sle_1 sle_1
  30. st_2 st_2
  31. cb_1 cb_1
  32. end type
  33. global w_outware_fx w_outware_fx
  34. type variables
  35. int ins_rslt = 0 // 0 - 无操作返回 1 - 操作成功返回
  36. end variables
  37. forward prototypes
  38. public function integer wf_retrieve (readonly datastore arg_ds)
  39. public function integer wf_sendoutware (ref string arg_msg)
  40. end prototypes
  41. public function integer wf_retrieve (readonly datastore arg_ds);int rslt = 1
  42. dw_1.ReSet()
  43. dw_1.SetRedraw(false)
  44. long row, i
  45. Datetime ld_now
  46. ld_now = DateTime(Today(),Now())
  47. for i = 1 to arg_ds.RowCount()
  48. if (arg_ds.Object.qty[i] <= arg_ds.Object.cus_receiveqty[i] + arg_ds.Object.qty_wait[i]) then continue // '齐货' 跳过
  49. row = dw_1.InsertRow(0)
  50. dw_1.Object.taskid[row] = arg_ds.Object.taskid[i]
  51. dw_1.Object.printid[row] = arg_ds.Object.printid[i]
  52. dw_1.Object.mxcode[row] = arg_ds.Object.mxcode[i]
  53. dw_1.Object.fxmtrlid[row] = arg_ds.Object.fxmtrlid[i]
  54. dw_1.Object.mtrlid[row] = arg_ds.Object.mtrlid[i]
  55. dw_1.Object.mtrlcode[row] = arg_ds.Object.mtrlcode[i]
  56. dw_1.Object.mtrlname[row] = arg_ds.Object.mtrlname[i]
  57. dw_1.Object.mtrlmode[row] = arg_ds.Object.mtrlmode[i]
  58. dw_1.Object.status[row] = arg_ds.Object.status[i]
  59. dw_1.Object.woodcode[row] = arg_ds.Object.woodcode[i]
  60. dw_1.Object.pcode[row] = arg_ds.Object.pcode[i]
  61. dw_1.Object.qty[row] = arg_ds.Object.qty[i]
  62. dw_1.Object.qty_wait[row] = arg_ds.Object.qty_wait[i]
  63. dw_1.Object.cus_receiveqty[row] = arg_ds.Object.cus_receiveqty[i]
  64. IF arg_ds.Object.earliestsenddate[i] > ld_now THEN
  65. dw_1.Object.outqty[row] = 0
  66. ELSE
  67. dw_1.Object.outqty[row] = arg_ds.Object.qty[i] - arg_ds.Object.cus_receiveqty[i] - arg_ds.Object.qty_wait[i]
  68. END IF
  69. dw_1.Object.outwarecode[row] = ''
  70. dw_1.Object.requiredate[row] = arg_ds.Object.requiredate[i]
  71. // dw_1.Object.price[row] = arg_ds.Object.price[i]
  72. dw_1.Object.mxdscrp[row] = arg_ds.Object.mxdscrp[i]
  73. dw_1.Object.mxdscrp2[row] = arg_ds.Object.mxdscrp2[i]
  74. dw_1.Object.mtrlcuscode[row] = arg_ds.Object.mtrlcuscode[i]
  75. dw_1.Object.plancode[row] = arg_ds.Object.plancode[i]
  76. dw_1.Object.cus_mtrldef_senddays[row] = arg_ds.Object.cus_mtrldef_senddays[i]
  77. dw_1.Object.earliestsenddate[row] = arg_ds.Object.earliestsenddate[i]
  78. next
  79. dw_1.SetRedraw(true)
  80. return rslt
  81. end function
  82. public function integer wf_sendoutware (ref string arg_msg);int rslt = 1
  83. if (dw_1.RowCount() <= 0) then
  84. rslt = 0
  85. arg_msg = '没有发货明细'
  86. goto ext
  87. end if
  88. oleobject item, list
  89. list = FXAppCom.CreArrOfPbDictionary()
  90. long i, cnt = 0
  91. DateTime ld_now
  92. ld_now = DateTime(Today(),Now())
  93. for i = 1 to dw_1.RowCount()
  94. if (dw_1.Object.earliestsenddate[i] > ld_now) then dw_1.Object.outqty[i] = 0
  95. if (dw_1.Object.outqty[i] <= 0) then continue
  96. cnt ++
  97. item = FXAppCom.CreatePbDictionary()
  98. item.SetInt('taskid', dw_1.Object.taskid[i])
  99. item.SetInt('printid', dw_1.Object.printid[i])
  100. item.SetDouble('qty', dw_1.Object.outqty[i])
  101. item.SetString('mxcode', dw_1.Object.outwarecode[i]) // 暂时存放相关发货单号(非明细编号)
  102. item.SetInt('mtrlid', dw_1.Object.mtrlid[i])
  103. list.Add(item)
  104. next
  105. if (cnt <= 0) then
  106. rslt = 0
  107. arg_msg = '没有发货数大于0的明细'
  108. goto ext
  109. end if
  110. Open(w_packet_msg_edit_fx)
  111. s_open_packet s_tran
  112. s_tran = Message.PowerObjectParm
  113. if (s_tran.returnflag = 0) then
  114. rslt = 0
  115. arg_msg = '操作取消'
  116. goto ext
  117. end if
  118. string postscript
  119. postscript = s_tran.postscript
  120. FXAppCom.SendOutwareMx(app_token_fx, postscript, list, ref arg_msg)
  121. if (arg_msg <> '') then
  122. rslt = 0
  123. goto ext
  124. end if
  125. ext:
  126. return rslt
  127. end function
  128. on w_outware_fx.create
  129. int iCurrent
  130. call super::create
  131. this.dw_1=create dw_1
  132. this.st_1=create st_1
  133. this.sle_1=create sle_1
  134. this.st_2=create st_2
  135. this.cb_1=create cb_1
  136. iCurrent=UpperBound(this.Control)
  137. this.Control[iCurrent+1]=this.dw_1
  138. this.Control[iCurrent+2]=this.st_1
  139. this.Control[iCurrent+3]=this.sle_1
  140. this.Control[iCurrent+4]=this.st_2
  141. this.Control[iCurrent+5]=this.cb_1
  142. end on
  143. on w_outware_fx.destroy
  144. call super::destroy
  145. destroy(this.dw_1)
  146. destroy(this.st_1)
  147. destroy(this.sle_1)
  148. destroy(this.st_2)
  149. destroy(this.cb_1)
  150. end on
  151. event open;call super::open;datastore ds
  152. ds = Message.PowerObjectParm
  153. if (IsNull(ds)) then
  154. MessageBox('提示', '打开方式有误')
  155. Close(this)
  156. return
  157. elseif (ds.DataObject <> 'dw_fx_saletaskmx') then
  158. MessageBox('提示', '传递数据有误')
  159. Close(this)
  160. return
  161. end if
  162. string arg_msg
  163. if (f_find_fx_user_power(31, ref arg_msg) <> 1) then // 31-销售订单发货
  164. MessageBox('权限提示', arg_msg)
  165. Close(this)
  166. return
  167. end if
  168. wf_retrieve(ds)
  169. end event
  170. event close;call super::close;CloseWithReturn(this, ins_rslt)
  171. end event
  172. event resize;call super::resize;dw_1.Width = this.workspacewidth( )
  173. dw_1.Height = this.workspaceheight( ) - dw_1.Y
  174. cb_exit.X = this.workspacewidth( ) - cb_exit.Width
  175. end event
  176. type cb_func from w_publ_base_style`cb_func within w_outware_fx
  177. integer width = 274
  178. string text = "确认发货"
  179. string normalpicname = "ok.bmp"
  180. integer picsize = 16
  181. end type
  182. event cb_func::clicked;call super::clicked;if (dw_1.RowCount() <= 0) then
  183. MessageBox('提示', '没有发货明细')
  184. return
  185. end if
  186. dw_1.AcceptText()
  187. boolean pass = true
  188. string sum_msg
  189. long i
  190. DateTime ld_now
  191. ld_now = DateTime(Today(),Now())
  192. for i = 1 to dw_1.RowCount()
  193. if (Trim(dw_1.Object.outwarecode[i]) = '') then
  194. sum_msg += '第' + string(i) + '行,相关发货单号为空(可选填)~r~n'
  195. end if
  196. IF (dw_1.Object.outqty[i] = 0) THEN
  197. IF dw_1.Object.earliestsenddate[i] > ld_now THEN
  198. sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],当前时间未到最早发货时间,将跳过本次发货~r~n'
  199. END IF
  200. ELSEIF (dw_1.Object.outqty[i] = 0) then
  201. sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],本次发货数为0~r~n'
  202. elseif (dw_1.Object.outqty[i] < 0) then
  203. sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],发货数必须大于0~r~n'
  204. pass = false
  205. end if
  206. if (dw_1.Object.outqty[i] + dw_1.Object.cus_receiveqty[i] + dw_1.Object.qty_wait[i] > dw_1.Object.qty[i]) then
  207. sum_msg += '第' + string(i) + '行,物料名称[' + dw_1.OBject.mtrlname[i] + '],总发货数大于订单下单数~r~n'
  208. pass = false
  209. end if
  210. next
  211. if (not pass) then
  212. MessageBox('提示', sum_msg)
  213. return
  214. end if
  215. int ret = 1
  216. if (sum_msg <> '') then
  217. ret = MessageBox('提示', sum_msg + '确定继续?', Question!, YesNoCancel!)
  218. end if
  219. if (ret <> 1) then return
  220. string arg_msg
  221. ret = wf_sendoutware(ref arg_msg)
  222. if (ret = 0) then
  223. MessageBox('提示', '发货操作失败:' + arg_msg)
  224. else
  225. ins_rslt = 1
  226. MessageBox('提示', '操作成功!')
  227. Close(parent)
  228. end if
  229. end event
  230. type cb_exit from w_publ_base_style`cb_exit within w_outware_fx
  231. integer x = 2754
  232. end type
  233. type ln_bar from w_publ_base_style`ln_bar within w_outware_fx
  234. end type
  235. type ln_bar2 from w_publ_base_style`ln_bar2 within w_outware_fx
  236. end type
  237. type r_bar from w_publ_base_style`r_bar within w_outware_fx
  238. end type
  239. type dw_1 from u_dw_rbtnfilter within w_outware_fx
  240. integer y = 272
  241. integer width = 3350
  242. integer height = 1267
  243. integer taborder = 20
  244. boolean bringtotop = true
  245. string dataobject = "dw_fx_outware"
  246. boolean hscrollbar = true
  247. boolean vscrollbar = true
  248. boolean hsplitscroll = true
  249. boolean rbutton_setposition_use = true
  250. boolean titleclick_sort_use = true
  251. end type
  252. event clicked;call super::clicked;if (row <= 0) then return
  253. this.SelectRow(0, false)
  254. this.SelectRow(row, true)
  255. end event
  256. event itemfocuschanged;call super::itemfocuschanged;if (row > 0) then
  257. this.SelectRow(0, false)
  258. this.SelectRow(row, true)
  259. this.SetRow(row)
  260. string colName
  261. colName = this.GetColumnName()
  262. if (colName = 'outqty' or colName = 'outwarecode') then
  263. this.SelectText(1, Len(this.GetText()))
  264. end if
  265. end if
  266. end event
  267. type st_1 from statictext within w_outware_fx
  268. integer y = 195
  269. integer width = 508
  270. integer height = 48
  271. boolean bringtotop = true
  272. integer textsize = -9
  273. integer weight = 400
  274. fontcharset fontcharset = gb2312charset!
  275. fontpitch fontpitch = variable!
  276. string facename = "宋体"
  277. long textcolor = 33554432
  278. long backcolor = 16777215
  279. string text = "相关发货单号批设置"
  280. boolean focusrectangle = false
  281. end type
  282. type sle_1 from singlelineedit within w_outware_fx
  283. integer x = 512
  284. integer y = 179
  285. integer width = 614
  286. integer height = 83
  287. integer taborder = 20
  288. boolean bringtotop = true
  289. integer textsize = -9
  290. integer weight = 400
  291. fontcharset fontcharset = gb2312charset!
  292. fontpitch fontpitch = variable!
  293. string facename = "宋体"
  294. long textcolor = 33554432
  295. borderstyle borderstyle = stylelowered!
  296. end type
  297. event modified;if (dw_1.RowCount() <= 0) then return
  298. long i
  299. for i = 1 to dw_1.RowCount()
  300. dw_1.Object.outwarecode[i] = this.Text
  301. next
  302. this.Text = ''
  303. end event
  304. type st_2 from statictext within w_outware_fx
  305. integer x = 1148
  306. integer y = 195
  307. integer width = 315
  308. integer height = 48
  309. boolean bringtotop = true
  310. integer textsize = -9
  311. integer weight = 400
  312. fontcharset fontcharset = gb2312charset!
  313. fontpitch fontpitch = variable!
  314. string facename = "宋体"
  315. long textcolor = 33554432
  316. long backcolor = 16777215
  317. string text = "(回车执行)"
  318. boolean focusrectangle = false
  319. end type
  320. type cb_1 from commandbutton within w_outware_fx
  321. boolean visible = false
  322. integer x = 1434
  323. integer y = 179
  324. integer width = 439
  325. integer height = 83
  326. integer taborder = 30
  327. boolean bringtotop = true
  328. integer textsize = -9
  329. integer weight = 400
  330. fontcharset fontcharset = gb2312charset!
  331. fontpitch fontpitch = variable!
  332. string facename = "宋体"
  333. string text = "获取新发货单号"
  334. end type
  335. event clicked;oleobject request, response
  336. string arg_msg
  337. request = FXAppCom.CreatePbDictionary()
  338. request.SetString('token', app_token_fx)
  339. request.SetString('prefix', '#')
  340. request.SetString('suffix', 'FH')
  341. response = FXAppCom.DoExecute('GetBillCode', request)
  342. arg_msg = response.GetString('ErrMsg')
  343. if arg_msg <> '' then
  344. MessageBox('ERROR', arg_msg)
  345. return
  346. end if
  347. oleobject list
  348. list = response.GetPBArray('billcodeList')
  349. long cnt
  350. cnt = list.Count
  351. if cnt < 0 then
  352. MessageBox('ERROR', '单号列表为空')
  353. return
  354. end if
  355. sle_1.Text = list.GetString(0)
  356. end event