w_saletask_edit.srw 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. $PBExportHeader$w_saletask_edit.srw
  2. forward
  3. global type w_saletask_edit from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_saletask_edit
  6. end type
  7. type cb_1 from uo_imflatbutton within w_saletask_edit
  8. end type
  9. type dw_2 from datawindow within w_saletask_edit
  10. end type
  11. type cb_5 from uo_imflatbutton within w_saletask_edit
  12. end type
  13. end forward
  14. global type w_saletask_edit from w_publ_base
  15. boolean visible = false
  16. integer width = 2793
  17. integer height = 1800
  18. boolean titlebar = false
  19. string title = ""
  20. boolean controlmenu = false
  21. boolean minbox = false
  22. windowtype windowtype = child!
  23. long backcolor = 16777215
  24. event ue_addmx ( )
  25. event ue_delmx ( )
  26. dw_1 dw_1
  27. cb_1 cb_1
  28. dw_2 dw_2
  29. cb_5 cb_5
  30. end type
  31. global w_saletask_edit w_saletask_edit
  32. type variables
  33. string ins_tid
  34. long ins_column = 9
  35. long ins_confirm = 0
  36. end variables
  37. forward prototypes
  38. public subroutine wf_face ()
  39. public subroutine wf_save ()
  40. end prototypes
  41. event ue_addmx();Long row
  42. row = dw_2.GetRow()
  43. IF row <= 0 THEN
  44. FOR row = 1 To dw_2.RowCount()
  45. IF dw_2.Object.path[row] = '' THEN EXIT
  46. NEXT
  47. ELSEIF dw_2.Object.path[row] <> '' THEN
  48. FOR row = 1 To dw_2.RowCount()
  49. IF dw_2.Object.path[row] = '' THEN EXIT
  50. NEXT
  51. END IF
  52. IF row > dw_2.RowCount() THEN
  53. row = dw_2.InsertRow(0)
  54. END IF
  55. String ls_max = ''
  56. long j, newid
  57. IF dw_2.Object.mxcode[row] = '' THEN
  58. FOR j = 1 To dw_2.RowCount()
  59. IF dw_2.Object.mxcode[j] > ls_max THEN
  60. ls_max = dw_2.Object.mxcode[j]
  61. END IF
  62. NEXT
  63. IF ls_max = '' THEN
  64. dw_2.Object.mxcode[row] = dw_1.Object.tid[dw_1.GetRow()] + '_01'
  65. ELSE
  66. newid = long(right(ls_max,2)) + 1
  67. if newid > 99 then
  68. MessageBox('ERROR', '当前明细编号过大')
  69. return
  70. end if
  71. dw_2.Object.mxcode[row] = dw_1.Object.tid[dw_1.GetRow()] + '_' + string(newid, '00')
  72. END IF
  73. END IF
  74. String Pathname,Filename,FileType
  75. Integer i
  76. FileType = '所有文件,*.*'
  77. i = GetFileOpenName("请选择文件", Pathname,Filename, "All", FileType)
  78. IF i = 1 And Trim(Pathname) <> '' And Trim(Filename) <> "" THEN
  79. IF Pathname = '' Or Not FileExists(Pathname) THEN
  80. MessageBox('系统提示','请选择文件!')
  81. RETURN
  82. END IF
  83. dw_2.Object.path[row] = Pathname
  84. dw_2.Object.fjname[row] = Filename
  85. END IF
  86. end event
  87. event ue_delmx();long row
  88. row = dw_2.GetRow()
  89. if row <= 0 then return
  90. dw_2.Deleterow(row)
  91. if dw_2.rowcount() = 0 then
  92. triggerevent('ue_addmx')
  93. end if
  94. end event
  95. public subroutine wf_face ();long i
  96. if dw_edit_mode then
  97. for i = 1 to ins_column
  98. dw_1.SetTabOrder(i, i * 10)
  99. next
  100. else
  101. for i = 1 to ins_column
  102. dw_1.SetTabOrder(i, 0)
  103. next
  104. end if
  105. end subroutine
  106. public subroutine wf_save ();Long row
  107. String arg_msg = ''
  108. dw_1.AcceptText()
  109. dw_2.AcceptText()
  110. row = dw_1.GetRow()
  111. IF row <= 0 THEN RETURN
  112. long dw2Count, i
  113. dw2Count = dw_2.RowCount()
  114. IF dw2Count <= 0 THEN
  115. MessageBox('提示', '请选择明细')
  116. RETURN
  117. END IF
  118. for i = 1 to dw2Count
  119. if dw_2.Object.mtrltype[ i ] = "" then
  120. MessageBox('提示', '请在附件明细内选择产品类型')
  121. RETURN
  122. END IF
  123. next
  124. oleobject task, fjs, fj
  125. task = AppCom.CreatePbDictionary()
  126. fjs = AppCom.CreArrOfPbDictionary()
  127. task.SetString("token", app_token)
  128. task.SetString("tid", dw_1.Object.tid[row])
  129. task.SetString("cus_rep", dw_1.Object.cus_rep[row])
  130. task.SetString("cus_tele", dw_1.Object.cus_tele[row])
  131. task.SetString("cus_address", dw_1.Object.cus_address[row])
  132. task.SetString("freight", dw_1.Object.freight[row])
  133. task.SetString("freight_tele", dw_1.Object.freight_tele[row])
  134. task.SetString("buyer_name", dw_1.Object.buyer_name[row])
  135. task.SetString("buyer_tele", dw_1.Object.buyer_tele[row])
  136. task.SetDateTime("requiredate", dw_1.Object.requiredate[row])
  137. task.SetString("temp1", dw_1.Object.temp1[row])
  138. task.SetString("temp2", dw_1.Object.temp2[row])
  139. task.SetString("temp3", dw_1.Object.temp3[row])
  140. task.SetString("temp4", dw_1.Object.temp4[row])
  141. task.SetString("temp5", dw_1.Object.temp5[row])
  142. task.SetString("temp6", dw_1.Object.temp6[row])
  143. task.SetInt('confirm', ins_confirm)
  144. FOR i = 1 To dw_2.RowCount()
  145. fj = AppCom.CreatePbDictionary()
  146. fj.SetInt("printid", i)
  147. fj.SetString("mxcode", dw_2.Object.mxcode[i])
  148. fj.SetDouble("price_ls", dw_2.Object.price_ls[i])
  149. fj.SetString("mtrltype", dw_2.Object.mtrltype[i])
  150. fj.SetString("fjdscrp", dw_2.Object.fjdscrp[i])
  151. fj.SetString("path", dw_2.Object.path[i])
  152. fjs.Add(fj)
  153. NEXT
  154. AppCom.AddTaskAsync(task, fjs, Ref arg_msg)
  155. IF arg_msg <> '' THEN
  156. MessageBox('ERROR', arg_msg)
  157. RETURN
  158. END IF
  159. Close(this)
  160. end subroutine
  161. on w_saletask_edit.create
  162. int iCurrent
  163. call super::create
  164. this.dw_1=create dw_1
  165. this.cb_1=create cb_1
  166. this.dw_2=create dw_2
  167. this.cb_5=create cb_5
  168. iCurrent=UpperBound(this.Control)
  169. this.Control[iCurrent+1]=this.dw_1
  170. this.Control[iCurrent+2]=this.cb_1
  171. this.Control[iCurrent+3]=this.dw_2
  172. this.Control[iCurrent+4]=this.cb_5
  173. end on
  174. on w_saletask_edit.destroy
  175. call super::destroy
  176. destroy(this.dw_1)
  177. destroy(this.cb_1)
  178. destroy(this.dw_2)
  179. destroy(this.cb_5)
  180. end on
  181. event open;call super::open;Long row
  182. row = dw_1.InsertRow(0)
  183. dw_1.SetItem(row, 'cuscode', app_cuscode)
  184. dw_1.SetItem(row, 'cusname', app_cusname)
  185. dw_1.SetItem(row, 'cus_rep', app_custype)
  186. dw_1.SetItem(row, 'cus_tele', app_tele)
  187. dw_1.SetItem(row, 'cus_address', app_address)
  188. dw_1.SetItem(row, 'freight', app_freight)
  189. dw_1.SetItem(row, 'freight_tele', app_freight_tele)
  190. String arg_msg = ''
  191. ins_tid = AppCom.GetNewTid(app_token, Ref arg_msg)
  192. IF ins_tid = '' THEN
  193. MessageBox('ERROR', arg_msg)
  194. RETURN
  195. END IF
  196. dw_edit_mode = True
  197. wf_face()
  198. dw_1.SetItem(row, 'tid', ins_tid)
  199. dw_2.InsertRow(0)
  200. datawindowchild dw_child
  201. oleobject mtrltypes
  202. oleobject mtrltype
  203. Long cnt, i
  204. IF dw_2.GetChild('mtrltype', Ref dw_child) = 1 THEN
  205. mtrltypes = AppCom.GetMtrltypes(app_token, Ref arg_msg)
  206. IF arg_msg = '' THEN
  207. cnt = mtrltypes.Count
  208. FOR i = 1 To cnt
  209. mtrltype = mtrltypes.GetItem(i - 1)
  210. row = dw_child.InsertRow(0)
  211. dw_child.SetItem(row, 'typename', mtrltype.GetString('typename'))
  212. NEXT
  213. END IF
  214. END IF
  215. end event
  216. event close;call super::close;ParentWindow().TriggerEvent('ue_childclose')
  217. end event
  218. type cb_func from w_publ_base`cb_func within w_saletask_edit
  219. boolean visible = false
  220. integer x = 23
  221. integer y = 892
  222. end type
  223. type cb_exit from w_publ_base`cb_exit within w_saletask_edit
  224. integer x = 2437
  225. integer y = 1660
  226. end type
  227. type dw_1 from datawindow within w_saletask_edit
  228. integer width = 2770
  229. integer height = 1640
  230. integer taborder = 10
  231. boolean bringtotop = true
  232. string title = "none"
  233. string dataobject = "dw_saletask_edit"
  234. boolean livescroll = true
  235. borderstyle borderstyle = stylelowered!
  236. end type
  237. type cb_1 from uo_imflatbutton within w_saletask_edit
  238. boolean visible = false
  239. integer x = 2048
  240. integer y = 1660
  241. integer width = 370
  242. integer taborder = 20
  243. boolean bringtotop = true
  244. string text = "保存询价"
  245. string normalpicname = "save.bmp"
  246. end type
  247. event clicked;call super::clicked;ins_confirm = 0
  248. wf_save()
  249. end event
  250. type dw_2 from datawindow within w_saletask_edit
  251. integer x = 23
  252. integer y = 672
  253. integer width = 2670
  254. integer height = 308
  255. integer taborder = 20
  256. boolean bringtotop = true
  257. string title = "none"
  258. string dataobject = "dw_saletask_edit_fj"
  259. boolean hscrollbar = true
  260. boolean vscrollbar = true
  261. boolean livescroll = true
  262. borderstyle borderstyle = stylelowered!
  263. end type
  264. event clicked;string ls_name
  265. ls_name = dwo.name
  266. if row > 0 then dw_2.SetRow(row)
  267. if ls_name = 'addbtn' then
  268. parent.triggerevent('ue_addmx')
  269. elseif ls_name = 'delbtn' then
  270. parent.triggerevent('ue_delmx')
  271. end if
  272. end event
  273. type cb_5 from uo_imflatbutton within w_saletask_edit
  274. integer x = 151
  275. integer y = 1660
  276. integer width = 370
  277. integer taborder = 40
  278. boolean bringtotop = true
  279. string text = "询价确认"
  280. string normalpicname = "ok.bmp"
  281. end type
  282. event clicked;call super::clicked;ins_confirm = 1
  283. wf_save()
  284. end event