w_aifmb_addproductcode.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. $PBExportHeader$w_aifmb_addproductcode.srw
  2. forward
  3. global type w_aifmb_addproductcode from window
  4. end type
  5. type cb_addfj from commandbutton within w_aifmb_addproductcode
  6. end type
  7. type cb_picdel from commandbutton within w_aifmb_addproductcode
  8. end type
  9. type cb_picaddfile from commandbutton within w_aifmb_addproductcode
  10. end type
  11. type lv_1 from uo_piclistview within w_aifmb_addproductcode
  12. end type
  13. type cb_exit from commandbutton within w_aifmb_addproductcode
  14. end type
  15. type cb_save from commandbutton within w_aifmb_addproductcode
  16. end type
  17. type dw_1 from datawindow within w_aifmb_addproductcode
  18. end type
  19. end forward
  20. global type w_aifmb_addproductcode from window
  21. integer width = 3232
  22. integer height = 1648
  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. cb_addfj cb_addfj
  34. cb_picdel cb_picdel
  35. cb_picaddfile cb_picaddfile
  36. lv_1 lv_1
  37. cb_exit cb_exit
  38. cb_save cb_save
  39. dw_1 dw_1
  40. end type
  41. global w_aifmb_addproductcode w_aifmb_addproductcode
  42. type variables
  43. s_aifmb_addmodproductentrelation 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.mtrlcode[1] = ls_mtrlcode
  114. dw_1.Object.mtrlname[1] = ls_mtrlname
  115. dw_1.Object.productname[1] = ls_mtrlname
  116. dw_1.Object.mtrlmode[1] = ls_mtrlmode
  117. dw_1.Object.unit[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.mtrlcode[1] = S_INSCUST.mtrlcode[1]
  146. dw_1.Object.mtrlname[1] = S_INSCUST.mtrlname[1]
  147. dw_1.Object.mtrlmode[1] = S_INSCUST.mtrlmode[1]
  148. dw_1.Object.productname[1] = S_INSCUST.mtrlname[1]
  149. dw_1.Object.unit[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_addproductcode.create
  157. this.cb_addfj=create cb_addfj
  158. this.cb_picdel=create cb_picdel
  159. this.cb_picaddfile=create cb_picaddfile
  160. this.lv_1=create lv_1
  161. this.cb_exit=create cb_exit
  162. this.cb_save=create cb_save
  163. this.dw_1=create dw_1
  164. this.Control[]={this.cb_addfj,&
  165. this.cb_picdel,&
  166. this.cb_picaddfile,&
  167. this.lv_1,&
  168. this.cb_exit,&
  169. this.cb_save,&
  170. this.dw_1}
  171. end on
  172. on w_aifmb_addproductcode.destroy
  173. destroy(this.cb_addfj)
  174. destroy(this.cb_picdel)
  175. destroy(this.cb_picaddfile)
  176. destroy(this.lv_1)
  177. destroy(this.cb_exit)
  178. destroy(this.cb_save)
  179. destroy(this.dw_1)
  180. end on
  181. event open;s_aifmb_addmodproductentrelation s_input
  182. s_input = Message.PowerObjectParm
  183. dw_1.InsertRow(0)
  184. lv_1.uf_setsize(100, 100)
  185. IF IsNull(s_input) Or Not IsValid(s_input) THEN
  186. s_tran.relationid = 0
  187. ELSE
  188. s_tran = s_input
  189. dw_1.Object.relationid[1] = s_tran.relationid
  190. dw_1.Object.nodeid[1] = s_tran.nodeid
  191. dw_1.Object.mtrlid[1] = s_tran.mtrlid
  192. dw_1.Object.mtrlcode[1] = s_tran.mtrlcode
  193. dw_1.Object.mtrlname[1] = s_tran.mtrlname
  194. dw_1.Object.mtrlmode[1] = s_tran.mtrlmode
  195. dw_1.Object.unit[1] = s_tran.unit
  196. dw_1.Object.net_weight[1] = s_tran.net_weight
  197. dw_1.Object.gross_weight[1] = s_tran.gross_weight
  198. dw_1.Object.cubage[1] = s_tran.cubage
  199. dw_1.Object.mtrlengname[1] = s_tran.mtrlengname
  200. dw_1.Object.dscrp[1] = s_tran.dscrp
  201. dw_1.Object.QualityDscrp[1] = s_tran.QualityDscrp
  202. dw_1.Object.CustomCode[1] = s_tran.CustomCode
  203. dw_1.Object.MPrice[1] = s_tran.MPrice
  204. dw_1.Object.NPrice[1] = s_tran.NPrice
  205. IF s_tran.isPublic THEN
  206. dw_1.Object.isPublic[1] = 1
  207. ELSE
  208. dw_1.Object.isPublic[1] = 0
  209. END IF
  210. dw_1.Object.ProductID[1] = s_tran.ProductID
  211. String ls_nodename, ls_productname
  212. SELECT NodeName
  213. INTO :ls_nodename
  214. FROM aifmb_ClassNode
  215. Where nodeid = :s_tran.nodeid;
  216. IF sqlca.SQLCode = 0 THEN
  217. dw_1.Object.NodeName[1] = ls_nodename
  218. END IF
  219. SELECT mtrlname
  220. INTO :ls_productname
  221. FROM aifmb_ProductCode
  222. Where ProductID = :s_tran.ProductID;
  223. IF sqlca.SQLCode = 0 THEN
  224. dw_1.Object.productname[1] = ls_productname
  225. END IF
  226. END IF
  227. end event
  228. event close;closewithreturn(this, s_tran)
  229. end event
  230. type cb_addfj from commandbutton within w_aifmb_addproductcode
  231. integer x = 2930
  232. integer y = 116
  233. integer width = 274
  234. integer height = 104
  235. integer taborder = 40
  236. integer textsize = -9
  237. integer weight = 400
  238. fontcharset fontcharset = gb2312charset!
  239. fontpitch fontpitch = variable!
  240. string facename = "宋体"
  241. string text = "添加附件"
  242. end type
  243. event clicked;Open(w_aifmb_erpfj_ch)
  244. s_aifmb_erpfj_ch s_tran
  245. s_tran = Message.PowerObjectParm
  246. String arg_msg
  247. Long i
  248. FOR i = 1 To UpperBound(s_tran.pics)
  249. IF lv_1.uf_additem(s_tran.pics[i], arg_msg) <> 1 THEN
  250. END IF
  251. NEXT
  252. end event
  253. type cb_picdel from commandbutton within w_aifmb_addproductcode
  254. integer x = 2930
  255. integer y = 232
  256. integer width = 274
  257. integer height = 104
  258. integer taborder = 40
  259. integer textsize = -9
  260. integer weight = 400
  261. fontcharset fontcharset = gb2312charset!
  262. fontpitch fontpitch = variable!
  263. string facename = "宋体"
  264. string text = "删除"
  265. end type
  266. event clicked;Long ll_selectedindex
  267. ll_selectedindex = lv_1.SelectedIndex()
  268. DO WHILE ll_selectedindex > 0
  269. lv_1.DeleteItem(ll_selectedindex)
  270. ll_selectedindex = lv_1.SelectedIndex()
  271. LOOP
  272. end event
  273. type cb_picaddfile from commandbutton within w_aifmb_addproductcode
  274. integer x = 2930
  275. integer width = 274
  276. integer height = 104
  277. integer taborder = 30
  278. integer textsize = -9
  279. integer weight = 400
  280. fontcharset fontcharset = gb2312charset!
  281. fontpitch fontpitch = variable!
  282. string facename = "宋体"
  283. string text = "添加文件"
  284. end type
  285. event clicked;String ls_path
  286. String arr_files[]
  287. IF GetFileOpenName('上传图片', ls_path, arr_files, 'bmp', '图片 (*.bmp;*.gif;*.jpg;*.jpeg;*.png),*.bmp;*.gif;*.jpg;*.jpeg;*.png') <> 1 THEN
  288. RETURN
  289. END IF
  290. IF UpperBound(arr_files) <= 0 THEN
  291. RETURN
  292. END IF
  293. IF UpperBound(arr_files) = 1 THEN
  294. ls_path = Mid(ls_path, 1, Len(ls_path) - Len(arr_files[1]))
  295. END IF
  296. IF Right(ls_path, 1) <> '\' THEN
  297. ls_path += '\'
  298. END IF
  299. Int rslt = 1
  300. String arg_msg
  301. Long i
  302. s_piclistview_parm s_parm, s_empty
  303. FOR i = 1 To UpperBound(arr_files)
  304. s_parm = s_empty
  305. s_parm.Label = arr_files[i]
  306. s_parm.tmppath = ls_path + arr_files[i]
  307. IF lv_1.uf_additem(s_parm, arg_msg) <> 1 THEN
  308. rslt = 0
  309. GOTO ext
  310. END IF
  311. NEXT
  312. ext:
  313. IF rslt = 0 THEN
  314. MessageBox('ERROR', arg_msg)
  315. END IF
  316. end event
  317. type lv_1 from uo_piclistview within w_aifmb_addproductcode
  318. integer x = 1518
  319. integer width = 1399
  320. integer height = 1372
  321. integer taborder = 20
  322. end type
  323. type cb_exit from commandbutton within w_aifmb_addproductcode
  324. integer x = 2747
  325. integer y = 1408
  326. integer width = 256
  327. integer height = 116
  328. integer taborder = 30
  329. integer textsize = -9
  330. integer weight = 400
  331. fontcharset fontcharset = gb2312charset!
  332. fontpitch fontpitch = variable!
  333. string facename = "宋体"
  334. string text = "退出"
  335. boolean cancel = true
  336. end type
  337. event clicked;s_tran.relationid = 0
  338. close(parent)
  339. end event
  340. type cb_save from commandbutton within w_aifmb_addproductcode
  341. integer x = 2469
  342. integer y = 1408
  343. integer width = 256
  344. integer height = 116
  345. integer taborder = 20
  346. integer textsize = -9
  347. integer weight = 400
  348. fontcharset fontcharset = gb2312charset!
  349. fontpitch fontpitch = variable!
  350. string facename = "宋体"
  351. string text = "保存"
  352. end type
  353. event clicked;Int rslt = 1
  354. String arg_msg
  355. dw_1.AcceptText()
  356. IF dw_1.Object.nodeid[1] <= 0 THEN
  357. MessageBox('提示', '请选择基类')
  358. RETURN
  359. END IF
  360. IF dw_1.Object.mtrlname[1] = '' THEN
  361. MessageBox('提示', '请输入产品名称')
  362. RETURN
  363. END IF
  364. s_piclistview_parm s_parm[]
  365. IF lv_1.uf_getitems(s_parm, arg_msg) <> 1 THEN
  366. MessageBox('ERROR', arg_msg)
  367. RETURN
  368. END IF
  369. uo_aifmb = Create uo_aifmb
  370. //s_aifmb_addmodproductentrelation s_tran
  371. s_tran.RelationID = dw_1.Object.RelationID[1]
  372. s_tran.nodeid = dw_1.Object.nodeid[1]
  373. s_tran.mtrlid = dw_1.Object.mtrlid[1]
  374. s_tran.mtrlcode = dw_1.Object.mtrlcode[1]
  375. s_tran.mtrlname = dw_1.Object.mtrlname[1]
  376. s_tran.mtrlmode = dw_1.Object.mtrlmode[1]
  377. s_tran.unit = dw_1.Object.unit[1]
  378. s_tran.net_weight = dw_1.Object.net_weight[1]
  379. s_tran.gross_weight = dw_1.Object.gross_weight[1]
  380. s_tran.cubage = dw_1.Object.cubage[1]
  381. s_tran.mtrlengname = dw_1.Object.mtrlengname[1]
  382. s_tran.dscrp = dw_1.Object.dscrp[1]
  383. s_tran.QualityDscrp = dw_1.Object.QualityDscrp[1]
  384. s_tran.CustomCode = dw_1.Object.CustomCode[1]
  385. s_tran.MPrice = dw_1.Object.MPrice[1]
  386. s_tran.NPrice = dw_1.Object.NPrice[1]
  387. s_tran.isPublic = (dw_1.Object.isPublic[1] = 1)
  388. s_tran.productid = dw_1.Object.productid[1]
  389. s_tran.pics = s_parm
  390. IF uo_aifmb.uf_addmodproductentrelation(s_tran, arg_msg) <> 1 THEN
  391. rslt = 0
  392. GOTO ext
  393. END IF
  394. ext:
  395. Destroy uo_aifmb
  396. IF rslt = 0 THEN
  397. MessageBox('ERROR', arg_msg)
  398. ELSE
  399. Close(Parent)
  400. END IF
  401. end event
  402. type dw_1 from datawindow within w_aifmb_addproductcode
  403. integer width = 1509
  404. integer height = 1380
  405. integer taborder = 10
  406. string title = "none"
  407. string dataobject = "dw_aifmb_addproductcode"
  408. boolean livescroll = true
  409. borderstyle borderstyle = stylelowered!
  410. end type
  411. event buttonclicked;string ls_colname
  412. ls_colname = dwo.Name
  413. ls_colname = lower(ls_colname)
  414. IF ls_colname = 'b_1' THEN
  415. parent.triggerevent('ue_node_ch')
  416. ELSEIF ls_colname = 'b_2' THEN
  417. parent.triggerevent('ue_product_ch')
  418. ELSEIF ls_colname = 'b_3' THEN
  419. parent.triggerevent('ue_mtrl_ch')
  420. END IF
  421. end event