w_aifmb_addpromotions.srw 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. $PBExportHeader$w_aifmb_addpromotions.srw
  2. forward
  3. global type w_aifmb_addpromotions from window
  4. end type
  5. type lv_1 from uo_piclistview within w_aifmb_addpromotions
  6. end type
  7. type cb_picaddfile from commandbutton within w_aifmb_addpromotions
  8. end type
  9. type cb_picdel from commandbutton within w_aifmb_addpromotions
  10. end type
  11. type cb_addfj from commandbutton within w_aifmb_addpromotions
  12. end type
  13. type cb_cancel from commandbutton within w_aifmb_addpromotions
  14. end type
  15. type cb_ok from commandbutton within w_aifmb_addpromotions
  16. end type
  17. type dw_1 from datawindow within w_aifmb_addpromotions
  18. end type
  19. end forward
  20. global type w_aifmb_addpromotions from window
  21. integer width = 3607
  22. integer height = 1500
  23. boolean titlebar = true
  24. string title = "添加促销"
  25. boolean controlmenu = true
  26. windowtype windowtype = response!
  27. long backcolor = 67108864
  28. string icon = "AppIcon!"
  29. boolean center = true
  30. event ue_node_ch ( )
  31. event ue_product_ch ( )
  32. event ue_mtrl_ch ( )
  33. lv_1 lv_1
  34. cb_picaddfile cb_picaddfile
  35. cb_picdel cb_picdel
  36. cb_addfj cb_addfj
  37. cb_cancel cb_cancel
  38. cb_ok cb_ok
  39. dw_1 dw_1
  40. end type
  41. global w_aifmb_addpromotions w_aifmb_addpromotions
  42. type variables
  43. s_aifmb_promotions s_tran
  44. end variables
  45. event ue_node_ch();Long ll_nodeid
  46. String ls_nodename
  47. Open(w_aifmb_class_map_ch)
  48. ll_nodeid = Message.DoubleParm
  49. IF ll_nodeid > 0 THEN
  50. SELECT NodeName
  51. INTO :ls_nodename
  52. FROM aifmb_ClassNode
  53. Where NodeID = :ll_nodeid;
  54. IF sqlca.SQLCode <> 0 THEN
  55. MessageBox('ERROR', '查询基类名称失败,' + sqlca.SQLErrText)
  56. RETURN
  57. END IF
  58. dw_1.Object.NodeID[1] = ll_nodeid
  59. dw_1.Object.NodeName[1] = ls_nodename
  60. END IF
  61. end event
  62. event ue_product_ch();Open(w_aifmb_product)
  63. long ll_productid
  64. ll_productid = Message.DoubleParm
  65. IF ll_productid <= 0 THEN RETURN
  66. String ls_nodename
  67. String ls_mtrlcode
  68. String ls_mtrlname
  69. String ls_mtrlmode
  70. long ll_nodeid
  71. string ls_unit
  72. decimal ld_net_weight
  73. decimal ld_gross_weight
  74. decimal ld_cubage
  75. string ls_mtrlengname
  76. string ls_dscrp
  77. string ls_qualitydscrp
  78. SELECT aifmb_ProductCode.mtrlcode,
  79. aifmb_ProductCode.mtrlname,
  80. aifmb_ProductCode.mtrlmode,
  81. aifmb_ProductCode.NodeID,
  82. aifmb_ClassNode.NodeName,
  83. aifmb_ProductCode.unit,
  84. aifmb_ProductCode.net_weight,
  85. aifmb_ProductCode.gross_weight,
  86. aifmb_ProductCode.cubage,
  87. aifmb_ProductCode.mtrlengname,
  88. aifmb_ProductCode.dscrp,
  89. aifmb_ProductCode.qualitydscrp
  90. INTO :ls_mtrlcode,
  91. :ls_mtrlname,
  92. :ls_mtrlmode,
  93. :ll_nodeid,
  94. :ls_nodename,
  95. :ls_unit,
  96. :ld_net_weight,
  97. :ld_gross_weight,
  98. :ld_cubage,
  99. :ls_mtrlengname,
  100. :ls_dscrp,
  101. :ls_qualitydscrp
  102. FROM aifmb_ProductCode LEFT OUTER JOIN
  103. aifmb_ClassNode ON aifmb_ProductCode.NodeID = aifmb_ClassNode.NodeID
  104. Where (aifmb_ProductCode.ProductID = :ll_productid);
  105. IF sqlca.SQLCode <> 0 THEN
  106. MessageBox('ERROR', '查询标准物料信息失败ID=' + String(ll_productid) + ',' + sqlca.SQLErrText)
  107. RETURN
  108. END IF
  109. //dw_1.Object.mtrlid[1] = 0
  110. dw_1.Object.nodeid[1] = ll_nodeid
  111. dw_1.Object.nodename[1] = ls_nodename
  112. dw_1.Object.ProductID[1] = ll_productid
  113. dw_1.Object.procode[1] = ls_mtrlcode
  114. dw_1.Object.proname[1] = ls_mtrlname
  115. dw_1.Object.productname[1] = ls_mtrlname
  116. dw_1.Object.promode[1] = ls_mtrlmode
  117. dw_1.Object.prounit[1] = ls_unit
  118. //dw_1.Object.net_weight[1] = ld_net_weight
  119. //dw_1.Object.gross_weight[1] = ld_gross_weight
  120. //dw_1.Object.cubage[1] = ld_cubage
  121. //dw_1.Object.mtrlengname[1] = ls_mtrlengname
  122. //dw_1.Object.dscrp[1] = ls_dscrp
  123. //dw_1.Object.qualitydscrp[1] = ls_qualitydscrp
  124. end event
  125. event ue_mtrl_ch();
  126. s_edit_index_tran s_tranf8 //传递参数使用
  127. s_tranf8.if_retrieve_all = False //是否一次RETRIEVE所有行
  128. s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  129. s_tranf8.arg_pkid = 0 //目标定位PKID (备用)
  130. s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选
  131. s_tranf8.if_select_all = False //多选
  132. s_tranf8.b_long = -1 //选采购
  133. s_tranf8.c_long = -1
  134. s_tranf8.f_long = -1
  135. s_tranf8.g_long = -1
  136. //s_tranf8.arg_string_code = dw_1.Object.realmtrlcode[ll_row]
  137. OpenWithParm(W_mtrldef_edit,s_tranf8) //调用
  138. s_mtrldef_array S_INSCUST
  139. IF ClassName(Message.PowerObjectParm) <> 's_mtrldef_array' THEN RETURN
  140. S_INSCUST = Message.PowerObjectParm //接受返回结构
  141. IF UpperBound(S_INSCUST.mtrlid) <= 0 THEN RETURN
  142. IF S_INSCUST.mtrlid[1] <= 0 THEN RETURN
  143. //dw_1.Object.mtrlid[1] = S_INSCUST.mtrlid[1]
  144. dw_1.Object.ProductID[1] = 0
  145. dw_1.Object.procode[1] = S_INSCUST.mtrlcode[1]
  146. dw_1.Object.proname[1] = S_INSCUST.mtrlname[1]
  147. dw_1.Object.promode[1] = S_INSCUST.mtrlmode[1]
  148. dw_1.Object.productname[1] = S_INSCUST.mtrlname[1]
  149. dw_1.Object.prounit[1] = S_INSCUST.unit[1]
  150. //dw_1.Object.net_weight[1] = S_INSCUST.net_weight[1]
  151. //dw_1.Object.gross_weight[1] = S_INSCUST.gross_weight[1]
  152. //dw_1.Object.cubage[1] = S_INSCUST.cubage[1]
  153. //dw_1.Object.mtrlengname[1] = S_INSCUST.mtrlengname[1]
  154. //dw_1.Object.dscrp[1] = S_INSCUST.dscrp[1]
  155. end event
  156. on w_aifmb_addpromotions.create
  157. this.lv_1=create lv_1
  158. this.cb_picaddfile=create cb_picaddfile
  159. this.cb_picdel=create cb_picdel
  160. this.cb_addfj=create cb_addfj
  161. this.cb_cancel=create cb_cancel
  162. this.cb_ok=create cb_ok
  163. this.dw_1=create dw_1
  164. this.Control[]={this.lv_1,&
  165. this.cb_picaddfile,&
  166. this.cb_picdel,&
  167. this.cb_addfj,&
  168. this.cb_cancel,&
  169. this.cb_ok,&
  170. this.dw_1}
  171. end on
  172. on w_aifmb_addpromotions.destroy
  173. destroy(this.lv_1)
  174. destroy(this.cb_picaddfile)
  175. destroy(this.cb_picdel)
  176. destroy(this.cb_addfj)
  177. destroy(this.cb_cancel)
  178. destroy(this.cb_ok)
  179. destroy(this.dw_1)
  180. end on
  181. event open;uo_aifmb = create uo_aifmb
  182. s_aifmb_promotions s_input
  183. s_input = Message.PowerObjectParm
  184. lv_1.uf_setsize(100, 100)
  185. dw_1.InsertRow(0)
  186. IF IsNull(s_input) Or Not IsValid(s_input) THEN
  187. s_tran.PromoID = 0
  188. dw_1.Object.StartTime[1] = DateTime(Today(), time(0))
  189. dw_1.Object.EndTime[1] = DateTime(RelativeDate(Today(),7), time(0))
  190. dw_1.Object.PromoCode[1] = uo_aifmb.pf_getpromocode()
  191. dw_1.Object.CreaterName[1] = uo_aifmb.sf_username()
  192. dw_1.Object.CreaterPhone[1] = uo_aifmb.sf_phone()
  193. dw_1.Object.CreaterEmail[1] = uo_aifmb.sf_email()
  194. dw_1.Object.CreaterQQ[1] = uo_aifmb.sf_QQ()
  195. ELSE
  196. s_tran = s_input
  197. dw_1.Object.PromoID[1] = s_tran.PromoID
  198. dw_1.Object.EntID[1] = s_tran.EntID
  199. dw_1.Object.CreaterID[1] = s_tran.CreaterID
  200. dw_1.Object.CreatTime[1] = s_tran.CreatTime
  201. dw_1.Object.IsAudit[1] = s_tran.IsAudit
  202. dw_1.Object.AuditerID[1] = s_tran.AuditerID
  203. dw_1.Object.AuditTime[1] = s_tran.AuditTime
  204. dw_1.Object.StartTime[1] = s_tran.StartTime
  205. dw_1.Object.EndTime[1] = s_tran.EndTime
  206. dw_1.Object.PromoName[1] = s_tran.PromoName
  207. dw_1.Object.PromoTitle[1] = s_tran.PromoTitle
  208. dw_1.Object.PromoURL[1] = s_tran.PromoURL
  209. dw_1.Object.PromoRange[1] = s_tran.PromoRange
  210. dw_1.Object.PromoRemark[1] = s_tran.PromoRemark
  211. dw_1.Object.PromoCode[1] = s_tran.PromoCode
  212. dw_1.Object.NodeID[1] = s_tran.NodeID
  213. dw_1.Object.ProductID[1] = s_tran.ProductID
  214. dw_1.Object.ProCode[1] = s_tran.ProCode
  215. dw_1.Object.ProName[1] = s_tran.ProName
  216. dw_1.Object.ProMode[1] = s_tran.ProMode
  217. dw_1.Object.ProUnit[1] = s_tran.ProUnit
  218. IF s_tran.IsPublic THEN
  219. dw_1.Object.IsPublic[1] = 1
  220. ELSE
  221. dw_1.Object.IsPublic[1] = 0
  222. END IF
  223. dw_1.Object.PromoType[1] = s_tran.PromoType
  224. dw_1.Object.MPrice[1] = s_tran.MPrice
  225. dw_1.Object.NPrice[1] = s_tran.NPrice
  226. dw_1.Object.CreaterName[1] = s_tran.CreaterName
  227. dw_1.Object.CreaterPhone[1] = s_tran.CreaterPhone
  228. dw_1.Object.CreaterEmail[1] = s_tran.CreaterEmail
  229. dw_1.Object.CreaterQQ[1] = s_tran.CreaterQQ
  230. END IF
  231. destroy uo_aifmb
  232. end event
  233. event close;closewithreturn(this, s_tran)
  234. end event
  235. type lv_1 from uo_piclistview within w_aifmb_addpromotions
  236. integer x = 1893
  237. integer width = 1399
  238. integer height = 1284
  239. integer taborder = 20
  240. end type
  241. type cb_picaddfile from commandbutton within w_aifmb_addpromotions
  242. integer x = 3305
  243. integer width = 274
  244. integer height = 104
  245. integer taborder = 20
  246. integer textsize = -9
  247. integer weight = 400
  248. fontcharset fontcharset = gb2312charset!
  249. fontpitch fontpitch = variable!
  250. string facename = "宋体"
  251. string text = "添加文件"
  252. end type
  253. event clicked;String ls_path
  254. String arr_files[]
  255. IF GetFileOpenName('上传图片', ls_path, arr_files, 'bmp', '图片 (*.bmp;*.gif;*.jpg;*.jpeg;*.png),*.bmp;*.gif;*.jpg;*.jpeg;*.png') <> 1 THEN
  256. RETURN
  257. END IF
  258. IF UpperBound(arr_files) <= 0 THEN
  259. RETURN
  260. END IF
  261. IF UpperBound(arr_files) = 1 THEN
  262. ls_path = Mid(ls_path, 1, Len(ls_path) - Len(arr_files[1]))
  263. END IF
  264. IF Right(ls_path, 1) <> '\' THEN
  265. ls_path += '\'
  266. END IF
  267. Int rslt = 1
  268. String arg_msg
  269. Long i
  270. s_piclistview_parm s_parm, s_empty
  271. FOR i = 1 To UpperBound(arr_files)
  272. s_parm = s_empty
  273. s_parm.Label = arr_files[i]
  274. s_parm.tmppath = ls_path + arr_files[i]
  275. IF lv_1.uf_additem(s_parm, arg_msg) <> 1 THEN
  276. rslt = 0
  277. GOTO ext
  278. END IF
  279. NEXT
  280. ext:
  281. IF rslt = 0 THEN
  282. MessageBox('ERROR', arg_msg)
  283. END IF
  284. end event
  285. type cb_picdel from commandbutton within w_aifmb_addpromotions
  286. integer x = 3305
  287. integer y = 232
  288. integer width = 274
  289. integer height = 104
  290. integer taborder = 30
  291. integer textsize = -9
  292. integer weight = 400
  293. fontcharset fontcharset = gb2312charset!
  294. fontpitch fontpitch = variable!
  295. string facename = "宋体"
  296. string text = "删除"
  297. end type
  298. event clicked;Long ll_selectedindex
  299. ll_selectedindex = lv_1.SelectedIndex()
  300. DO WHILE ll_selectedindex > 0
  301. lv_1.DeleteItem(ll_selectedindex)
  302. ll_selectedindex = lv_1.SelectedIndex()
  303. LOOP
  304. end event
  305. type cb_addfj from commandbutton within w_aifmb_addpromotions
  306. integer x = 3305
  307. integer y = 116
  308. integer width = 274
  309. integer height = 104
  310. integer taborder = 20
  311. integer textsize = -9
  312. integer weight = 400
  313. fontcharset fontcharset = gb2312charset!
  314. fontpitch fontpitch = variable!
  315. string facename = "宋体"
  316. string text = "添加附件"
  317. end type
  318. event clicked;Open(w_aifmb_erpfj_ch)
  319. s_aifmb_erpfj_ch s_tran
  320. s_tran = Message.PowerObjectParm
  321. String arg_msg
  322. Long i
  323. FOR i = 1 To UpperBound(s_tran.pics)
  324. IF lv_1.uf_additem(s_tran.pics[i], arg_msg) <> 1 THEN
  325. END IF
  326. NEXT
  327. end event
  328. type cb_cancel from commandbutton within w_aifmb_addpromotions
  329. integer x = 3218
  330. integer y = 1296
  331. integer width = 210
  332. integer height = 104
  333. integer taborder = 30
  334. integer textsize = -9
  335. integer weight = 400
  336. fontcharset fontcharset = gb2312charset!
  337. fontpitch fontpitch = variable!
  338. string facename = "宋体"
  339. string text = "取消"
  340. end type
  341. event clicked;s_tran.PromoID = 0
  342. close(parent)
  343. end event
  344. type cb_ok from commandbutton within w_aifmb_addpromotions
  345. integer x = 2981
  346. integer y = 1296
  347. integer width = 210
  348. integer height = 104
  349. integer taborder = 20
  350. integer textsize = -9
  351. integer weight = 400
  352. fontcharset fontcharset = gb2312charset!
  353. fontpitch fontpitch = variable!
  354. string facename = "宋体"
  355. string text = " 确认"
  356. end type
  357. event clicked;Int rslt = 1
  358. String arg_msg
  359. dw_1.AcceptText()
  360. s_piclistview_parm s_parm[]
  361. IF lv_1.uf_getitems(s_parm, arg_msg) <> 1 THEN
  362. MessageBox('ERROR', arg_msg)
  363. RETURN
  364. END IF
  365. uo_aifmb = Create uo_aifmb
  366. s_aifmb_promotions s_modle[]
  367. s_modle[1].PromoID = dw_1.Object.PromoID[1]
  368. s_modle[1].EntID = dw_1.Object.EntID[1]
  369. s_modle[1].CreaterID = dw_1.Object.CreaterID[1]
  370. s_modle[1].CreatTime = dw_1.Object.CreatTime[1]
  371. s_modle[1].IsAudit = dw_1.Object.IsAudit[1]
  372. s_modle[1].AuditerID = dw_1.Object.AuditerID[1]
  373. s_modle[1].AuditTime = dw_1.Object.AuditTime[1]
  374. s_modle[1].StartTime = dw_1.Object.StartTime[1]
  375. s_modle[1].EndTime = dw_1.Object.EndTime[1]
  376. s_modle[1].PromoName = dw_1.Object.PromoName[1]
  377. s_modle[1].PromoTitle = dw_1.Object.PromoTitle[1]
  378. s_modle[1].PromoURL = dw_1.Object.PromoURL[1]
  379. s_modle[1].PromoRange = dw_1.Object.PromoRange[1]
  380. s_modle[1].PromoRemark = dw_1.Object.PromoRemark[1]
  381. s_modle[1].PromoCode = dw_1.Object.PromoCode[1]
  382. s_modle[1].NodeID = dw_1.Object.NodeID[1]
  383. s_modle[1].ProductID = dw_1.Object.ProductID[1]
  384. s_modle[1].ProCode = dw_1.Object.ProCode[1]
  385. s_modle[1].ProName = dw_1.Object.ProName[1]
  386. s_modle[1].ProMode = dw_1.Object.ProMode[1]
  387. s_modle[1].ProUnit = dw_1.Object.ProUnit[1]
  388. s_modle[1].IsPublic = (dw_1.Object.IsPublic[1] = 1)
  389. s_modle[1].PromoType = dw_1.Object.PromoType[1]
  390. s_modle[1].MPrice = dw_1.Object.MPrice[1]
  391. s_modle[1].NPrice = dw_1.Object.NPrice[1]
  392. s_modle[1].CreaterName = dw_1.Object.CreaterName[1]
  393. s_modle[1].CreaterPhone = dw_1.Object.CreaterPhone[1]
  394. s_modle[1].CreaterEmail = dw_1.Object.CreaterEmail[1]
  395. s_modle[1].CreaterQQ = dw_1.Object.CreaterQQ[1]
  396. s_modle[1].pics = s_parm
  397. IF uo_aifmb.uf_setPromotions(s_modle, arg_msg) <> 1 THEN
  398. rslt = 0
  399. GOTO ext
  400. END IF
  401. s_tran = s_modle[1]
  402. ext:
  403. Destroy uo_aifmb
  404. IF rslt = 0 THEN
  405. MessageBox('ERROR', arg_msg)
  406. ELSE
  407. Close(Parent)
  408. END IF
  409. end event
  410. type dw_1 from datawindow within w_aifmb_addpromotions
  411. integer width = 1883
  412. integer height = 1284
  413. integer taborder = 10
  414. string title = "none"
  415. string dataobject = "dw_aifmb_addpromotions"
  416. boolean livescroll = true
  417. borderstyle borderstyle = stylelowered!
  418. end type
  419. event buttonclicked;string ls_colname
  420. ls_colname = dwo.Name
  421. ls_colname = lower(ls_colname)
  422. IF ls_colname = 'b_1' THEN
  423. parent.triggerevent('ue_node_ch')
  424. ELSEIF ls_colname = 'b_2' THEN
  425. parent.triggerevent('ue_product_ch')
  426. ELSEIF ls_colname = 'b_3' THEN
  427. parent.triggerevent('ue_mtrl_ch')
  428. END IF
  429. end event