uo_fx_pz.sru 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. $PBExportHeader$uo_fx_pz.sru
  2. $PBExportComments$协同系统 物料配置 UO (用于选择物料配置)
  3. forward
  4. global type uo_fx_pz from nonvisualobject
  5. end type
  6. end forward
  7. global type uo_fx_pz from nonvisualobject
  8. end type
  9. global uo_fx_pz uo_fx_pz
  10. type variables
  11. long ins_comid // 协同企业ID(供应商 物料所在的企业)
  12. boolean ins_isReady = false // 当全部获取了10个(7个)配置表的时候,ins_isReady = true
  13. datastore ins_ds_color, ins_ds_color_w, ins_ds_color_p
  14. datastore ins_ds_pztype_def, ins_ds_pztype_mx
  15. datastore ins_ds_configure_type, ins_ds_configure_code, ins_ds_configure_codemx
  16. datastore ins_ds_configure, ins_ds_configure2
  17. end variables
  18. forward prototypes
  19. public function integer init ()
  20. public function integer uof_before_ready (ref string arg_msg)
  21. public function integer uof_get_ready (ref string arg_msg)
  22. public function string uof_open_pzwin (s_fx_pzwin_open arg_s, ref string arg_msg)
  23. end prototypes
  24. public function integer init ();// 初始化
  25. int rslt = 1
  26. ins_comid = 0
  27. ins_isReady = false
  28. ins_ds_color = create datastore
  29. ins_ds_color.DataObject = 'ds_fx_color'
  30. ins_ds_color.Reset()
  31. ins_ds_color_w = create datastore
  32. ins_ds_color_w.DataObject = 'ds_fx_color_wood'
  33. ins_ds_color_w.Reset()
  34. ins_ds_color_p = create datastore
  35. ins_ds_color_p.DataObject = 'ds_fx_color_pcode'
  36. ins_ds_color_p.Reset()
  37. //ins_ds_pztype_def = create datastore
  38. //ins_ds_pztype_def.DataObject = 'ds_fx_pztype_def'
  39. //ins_ds_pztype_def.Reset()
  40. ins_ds_pztype_mx = create datastore
  41. ins_ds_pztype_mx.DataObject = 'ds_fx_pztype_mx'
  42. ins_ds_pztype_mx.Reset()
  43. //ins_ds_configure_type = create datastore
  44. //ins_ds_configure_type.DataObject = 'ds_fx_configure_type'
  45. //ins_ds_configure_type.Reset()
  46. ins_ds_configure_code = create datastore
  47. ins_ds_configure_code.DataObject = 'ds_fx_configure_code'
  48. ins_ds_configure_code.Reset()
  49. ins_ds_configure_codemx = create datastore
  50. ins_ds_configure_codemx.DataObject = 'ds_fx_configure_codemx'
  51. ins_ds_configure_codemx.Reset()
  52. ins_ds_configure = create datastore
  53. ins_ds_configure.DataObject = 'ds_fx_mtrl_configure'
  54. ins_ds_configure.Reset()
  55. //ins_ds_configure2 = create datastore
  56. //ins_ds_configure2.DataObject = 'ds_fx_mtrl_configure2'
  57. //ins_ds_configure2.Reset()
  58. return rslt
  59. end function
  60. public function integer uof_before_ready (ref string arg_msg);// 异步获取供应商全部配置
  61. int rslt = 1
  62. if (ins_comid <= 0) then
  63. rslt = 0
  64. arg_msg = 'uo_fx_pz供应商参数有误,请联系开发人员'
  65. goto ext
  66. end if
  67. // 异步
  68. FXAppCom.GetpzByComidAsync(app_token_fx, ins_comid, -1, ref arg_msg) // [-1]获取10个表(7个表)
  69. if (arg_msg <> '') then
  70. rslt = 0
  71. goto ext
  72. end if
  73. ext:
  74. return rslt
  75. end function
  76. public function integer uof_get_ready (ref string arg_msg);// 下载配置
  77. int rslt = 1
  78. // 若提示找不到GetpzByComid
  79. // 请注意是否按照uo_pz.init()、uo_pz.ins_comid、uo_pz.uof_before_ready的顺序来调用
  80. // 对应的DW应该要有statusflag、statustype等共6个配置变量
  81. oleobject obj
  82. obj = FXAppCom.GetpzByComid(ref arg_msg)
  83. if (arg_msg <> '') then
  84. rslt = 0
  85. goto ext
  86. end if
  87. //arg_msg = obj.GetString('argmsg')
  88. //if not IsNull(arg_msg) then
  89. // if (arg_msg <> '') then
  90. // rslt = 0
  91. // goto ext
  92. // end if
  93. //end if
  94. oleobject colors, colorWoods, colorPcodes
  95. oleobject pztypeMxs
  96. oleobject mtrlConfigs
  97. oleobject configCodes, configCodeMxs
  98. colors = obj.GetArrOfPBDictionary('colors')
  99. colorWoods = obj.GetArrOfPBDictionary('colorWoods')
  100. colorPcodes = obj.GetArrOfPBDictionary('colorPcodes')
  101. pztypeMxs = obj.GetArrOfPBDictionary('pztypeMxs')
  102. mtrlConfigs = obj.GetArrOfPBDictionary('mtrlConfigs')
  103. configCodes = obj.GetArrOfPBDictionary('configCodes')
  104. configCodeMxs = obj.GetArrOfPBDictionary('configCodeMxs')
  105. long i
  106. oleobject item
  107. ins_ds_color.Reset()
  108. if not IsNull(colors) then
  109. for i = 1 to colors.Count
  110. item = colors.GetItem(i - 1)
  111. ins_ds_color.Object.comid[i] = item.GetInt('comid')
  112. ins_ds_color.Object.colorid_erp[i] = item.GetInt('colorid_erp')
  113. ins_ds_color.Object.colorname[i] = item.GetString('colorname')
  114. ins_ds_color.Object.printid[i] = item.GetString('printid')
  115. next
  116. end if
  117. ins_ds_color_w.Reset()
  118. if not IsNull(colorWoods) then
  119. for i = 1 to colorWoods.Count
  120. item = colorWoods.GetItem(i - 1)
  121. ins_ds_color_w.Object.comid[i] = item.GetInt('comid')
  122. ins_ds_color_w.Object.woodcodeid_erp[i] = item.GetInt('woodcodeid_erp')
  123. ins_ds_color_w.Object.woodcode[i] = item.GetString('woodcode')
  124. ins_ds_color_w.Object.printid[i] = item.GetString('printid')
  125. next
  126. end if
  127. ins_ds_color_p.Reset()
  128. if not IsNull(colorPcodes) then
  129. for i = 1 to colorPcodes.Count
  130. item = colorPcodes.GetItem(i - 1)
  131. ins_ds_color_p.Object.comid[i] = item.GetInt('comid')
  132. ins_ds_color_p.Object.pcodeid_erp[i] = item.GetInt('pcodeid_erp')
  133. ins_ds_color_p.Object.pcode[i] = item.GetString('pcode')
  134. ins_ds_color_p.Object.printid[i] = item.GetString('printid')
  135. next
  136. end if
  137. ins_ds_pztype_mx.Reset()
  138. if not IsNull(pztypeMxs) then
  139. for i = 1 to pztypeMxs.Count
  140. item = pztypeMxs.GetItem(i - 1)
  141. ins_ds_pztype_mx.Object.comid[i] = item.GetInt('comid')
  142. ins_ds_pztype_mx.Object.typeid_erp[i] = item.GetInt('typeid_erp')
  143. ins_ds_pztype_mx.Object.pztype[i] = item.GetInt('pztype')
  144. ins_ds_pztype_mx.Object.dscrp[i] = item.GetString('dscrp')
  145. ins_ds_pztype_mx.Object.tdscrp[i] = item.GetString('tdscrp')
  146. next
  147. end if
  148. ins_ds_configure.Reset()
  149. if not IsNull(mtrlConfigs) then
  150. for i = 1 to mtrlConfigs.Count
  151. item = mtrlConfigs.GetItem(i - 1)
  152. ins_ds_configure.Object.comid[i] = item.GetInt('comid')
  153. ins_ds_configure.Object.cid_erp[i] = item.GetInt('cid_erp')
  154. ins_ds_configure.Object.Mtrlid_erp[i] = item.GetInt('Mtrlid_erp')
  155. ins_ds_configure.Object.code[i] = item.GetString('code')
  156. ins_ds_configure.Object.name[i] = item.GetString('name')
  157. ins_ds_configure.Object.ename[i] = item.GetString('ename')
  158. ins_ds_configure.Object.type[i] = item.GetInt('type')
  159. ins_ds_configure.Object.dscrp[i] = item.GetString('dscrp')
  160. ins_ds_configure.Object.Planprice[i] = item.GetDouble('Planprice')
  161. ins_ds_configure.Object.price[i] = item.GetDouble('price')
  162. ins_ds_configure.Object.DefaultPZ[i] = item.GetInt('DefaultPZ')
  163. ins_ds_configure.Object.ifzj[i] = item.GetInt('ifzj')
  164. ins_ds_configure.Object.capacity[i] = item.GetDouble('capacity')
  165. ins_ds_configure.Object.capaparm[i] = item.GetDouble('capaparm')
  166. ins_ds_configure.Object.net_weight[i] = item.GetDouble('net_weight')
  167. ins_ds_configure.Object.gross_weight[i] = item.GetDouble('gross_weight')
  168. ins_ds_configure.Object.cubage[i] = item.GetDouble('cubage')
  169. next
  170. end if
  171. ins_ds_configure_code.Reset()
  172. if not IsNull(configCodes) then
  173. for i = 1 to configCodes.Count
  174. item = configCodes.GetItem(i - 1)
  175. ins_ds_configure_code.Object.comid[i] = item.GetInt('comid')
  176. ins_ds_configure_code.Object.typeid_erp[i] = item.GetInt('typeid_erp')
  177. ins_ds_configure_code.Object.pzid_erp[i] = item.GetInt('pzid_erp')
  178. ins_ds_configure_code.Object.pzcode[i] = item.GetString('pzcode')
  179. ins_ds_configure_code.Object.name[i] = item.GetString('name')
  180. ins_ds_configure_code.Object.inputtype[i] = item.GetInt('inputtype')
  181. ins_ds_configure_code.Object.configtype[i] = item.GetInt('configtype')
  182. next
  183. end if
  184. ins_ds_configure_codemx.Reset()
  185. if not IsNull(configCodeMxs) then
  186. for i = 1 to configCodeMxs.Count
  187. item = configCodeMxs.GetItem(i - 1)
  188. ins_ds_configure_codemx.Object.comid[i] = item.GetInt('comid')
  189. ins_ds_configure_codemx.Object.pzid_erp[i] = item.GetInt('pzid_erp')
  190. ins_ds_configure_codemx.Object.printid[i] = item.GetInt('printid')
  191. ins_ds_configure_codemx.Object.pzcodemx[i] = item.GetString('pzcodemx')
  192. ins_ds_configure_codemx.Object.namemx[i] = item.GetString('namemx')
  193. next
  194. end if
  195. ins_isReady = true
  196. ext:
  197. return rslt
  198. end function
  199. public function string uof_open_pzwin (s_fx_pzwin_open arg_s, ref string arg_msg);
  200. arg_msg = ''
  201. string ret = ''
  202. if (not ins_isReady) then
  203. arg_msg = '未获取供应商物料配置,请联系开发人员'
  204. goto ext
  205. end if
  206. if IsNull(arg_s.arg_mtrlid) then arg_s.arg_mtrlid = 0 // 协同物料ID
  207. if IsNull(arg_s.arg_mtrlid_erp) then arg_s.arg_mtrlid_erp = 0
  208. if IsNull(arg_s.arg_statusflag) then arg_s.arg_statusflag = 0
  209. if IsNull(arg_s.arg_statustype) then arg_s.arg_statustype = 0
  210. if IsNull(arg_s.arg_woodcodeflag) then arg_s.arg_woodcodeflag = 0
  211. if IsNull(arg_s.arg_woodcodetype) then arg_s.arg_woodcodetype = 0
  212. if IsNull(arg_s.arg_pcodeflag) then arg_s.arg_pcodeflag = 0
  213. if IsNull(arg_s.arg_pcodetype) then arg_s.arg_pcodetype = 0
  214. if IsNull(arg_s.arg_colname) then arg_s.arg_colname = ''
  215. if IsNull(arg_s.arg_x) then arg_s.arg_x = 0
  216. if IsNull(arg_s.arg_y) then arg_s.arg_y = 0
  217. if (arg_s.arg_mtrlid <= 0 or arg_s.arg_mtrlid_erp <= 0) then
  218. arg_msg = '物料ID参数有误,无法打开配置窗口,请联系开发人员'
  219. goto ext
  220. end if
  221. if (arg_s.arg_colname = '') then
  222. arg_msg = '配置列名参数有误,无法打开配置窗口,请联系开发人员'
  223. goto ext
  224. end if
  225. if (Pos(arg_s.arg_colname, 'status') > 0) then
  226. choose case arg_s.arg_statusflag
  227. case 0
  228. arg_s.arg_ds = ins_ds_color
  229. OpenWithParm(w_pz_ch_fx, arg_s)
  230. ret = Message.StringParm
  231. case 1
  232. arg_s.arg_ds = ins_ds_pztype_mx
  233. OpenWithParm(w_pz_ch_fx, arg_s)
  234. ret = Message.StringParm
  235. case 2
  236. arg_s.arg_ds = ins_ds_configure
  237. OpenWithParm(w_pz_ch_fx, arg_s)
  238. ret = Message.StringParm
  239. case 3
  240. ret = ''
  241. case 4
  242. arg_s.arg_ds = ins_ds_configure_code
  243. arg_s.arg_dsmx = ins_ds_configure_codemx
  244. OpenWithParm(w_pz_ch_configcode_fx, arg_s)
  245. ret = Message.StringParm
  246. case 5
  247. ret = ''
  248. case 6
  249. ret = ''
  250. case else
  251. ret = ''
  252. end choose
  253. elseif (Pos(arg_s.arg_colname, 'woodcode') > 0) then
  254. choose case arg_s.arg_woodcodeflag
  255. case 0
  256. arg_s.arg_ds = ins_ds_color_w
  257. OpenWithParm(w_pz_ch_fx, arg_s)
  258. ret = Message.StringParm
  259. case 1
  260. arg_s.arg_ds = ins_ds_pztype_mx
  261. OpenWithParm(w_pz_ch_fx, arg_s)
  262. ret = Message.StringParm
  263. case 4
  264. arg_s.arg_ds = ins_ds_configure_code
  265. arg_s.arg_dsmx = ins_ds_configure_codemx
  266. OpenWithParm(w_pz_ch_configcode_fx, arg_s)
  267. ret = Message.StringParm
  268. case 5
  269. ret = ''
  270. case else
  271. ret = ''
  272. end choose
  273. elseif (Pos(arg_s.arg_colname, 'pcode') > 0) then
  274. choose case arg_s.arg_pcodeflag
  275. case 0
  276. arg_s.arg_ds = ins_ds_color_p
  277. OpenWithParm(w_pz_ch_fx, arg_s)
  278. ret = Message.StringParm
  279. case 1
  280. arg_s.arg_ds = ins_ds_pztype_mx
  281. OpenWithParm(w_pz_ch_fx, arg_s)
  282. ret = Message.StringParm
  283. case 4
  284. arg_s.arg_ds = ins_ds_configure_code
  285. arg_s.arg_dsmx = ins_ds_configure_codemx
  286. OpenWithParm(w_pz_ch_configcode_fx, arg_s)
  287. ret = Message.StringParm
  288. case 5
  289. ret = ''
  290. case else
  291. ret = ''
  292. end choose
  293. else
  294. ret = ''
  295. end if
  296. ext:
  297. return ret
  298. end function
  299. on uo_fx_pz.create
  300. call super::create
  301. TriggerEvent( this, "constructor" )
  302. end on
  303. on uo_fx_pz.destroy
  304. TriggerEvent( this, "destructor" )
  305. call super::destroy
  306. end on
  307. event constructor;init()
  308. end event
  309. event destructor;destroy ins_ds_color
  310. destroy ins_ds_color_w
  311. destroy ins_ds_color_p
  312. destroy ins_ds_pztype_def
  313. destroy ins_ds_pztype_mx
  314. destroy ins_ds_configure_type
  315. destroy ins_ds_configure_code
  316. destroy ins_ds_configure_codemx
  317. destroy ins_ds_configure
  318. destroy ins_ds_configure2
  319. end event