w_aifmb_querycom.srw 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. $PBExportHeader$w_aifmb_querycom.srw
  2. forward
  3. global type w_aifmb_querycom from window
  4. end type
  5. type cb_addcusspt from commandbutton within w_aifmb_querycom
  6. end type
  7. type cb_addspt from commandbutton within w_aifmb_querycom
  8. end type
  9. type cb_addcus from commandbutton within w_aifmb_querycom
  10. end type
  11. type cb_1 from commandbutton within w_aifmb_querycom
  12. end type
  13. type sle_1 from singlelineedit within w_aifmb_querycom
  14. end type
  15. type dw_1 from u_dw_rbtnfilter within w_aifmb_querycom
  16. end type
  17. end forward
  18. global type w_aifmb_querycom from window
  19. integer width = 3351
  20. integer height = 1968
  21. windowtype windowtype = child!
  22. long backcolor = 67108864
  23. string icon = "AppIcon!"
  24. boolean center = true
  25. cb_addcusspt cb_addcusspt
  26. cb_addspt cb_addspt
  27. cb_addcus cb_addcus
  28. cb_1 cb_1
  29. sle_1 sle_1
  30. dw_1 dw_1
  31. end type
  32. global w_aifmb_querycom w_aifmb_querycom
  33. forward prototypes
  34. public function integer wf_retrieve_type (ref string arg_msg)
  35. end prototypes
  36. public function integer wf_retrieve_type (ref string arg_msg);Int rslt = 1
  37. String ls_CusID
  38. Long ll_custype
  39. String ls_cuscode
  40. String ls_cusname
  41. Long i
  42. FOR i = 1 To dw_1.RowCount()
  43. ls_CusID = dw_1.Object.CusID[i]
  44. IF IsNull(ls_CusID) THEN CONTINUE
  45. IF ls_CusID = '' THEN CONTINUE
  46. SELECT top 1 custype, cuscode, cusname
  47. INTO :ll_custype, :ls_cuscode, :ls_cusname
  48. FROM LJFIEB_CusComm
  49. WHERE CusID = :ls_CusID
  50. Using sys_email_sqlca;
  51. IF sys_email_sqlca.SQLCode <> 0 THEN CONTINUE
  52. dw_1.Object.custype[i] = ll_custype
  53. dw_1.Object.cuscode[i] = ls_cuscode
  54. dw_1.Object.cusname[i] = ls_cusname
  55. NEXT
  56. RETURN rslt
  57. end function
  58. on w_aifmb_querycom.create
  59. this.cb_addcusspt=create cb_addcusspt
  60. this.cb_addspt=create cb_addspt
  61. this.cb_addcus=create cb_addcus
  62. this.cb_1=create cb_1
  63. this.sle_1=create sle_1
  64. this.dw_1=create dw_1
  65. this.Control[]={this.cb_addcusspt,&
  66. this.cb_addspt,&
  67. this.cb_addcus,&
  68. this.cb_1,&
  69. this.sle_1,&
  70. this.dw_1}
  71. end on
  72. on w_aifmb_querycom.destroy
  73. destroy(this.cb_addcusspt)
  74. destroy(this.cb_addspt)
  75. destroy(this.cb_addcus)
  76. destroy(this.cb_1)
  77. destroy(this.sle_1)
  78. destroy(this.dw_1)
  79. end on
  80. event resize;
  81. dw_1.Width = This.WorkSpaceWidth() - dw_1.X
  82. dw_1.Height = This.WorkSpaceHeight() - dw_1.Y
  83. end event
  84. type cb_addcusspt from commandbutton within w_aifmb_querycom
  85. integer x = 1641
  86. integer y = 40
  87. integer width = 439
  88. integer height = 84
  89. integer taborder = 50
  90. integer textsize = -9
  91. integer weight = 400
  92. fontcharset fontcharset = gb2312charset!
  93. fontpitch fontpitch = variable!
  94. string facename = "宋体"
  95. string text = "加为客户供应商"
  96. end type
  97. event clicked;Long ll_row
  98. ll_row = dw_1.GetRow()
  99. IF ll_row <= 0 THEN
  100. MessageBox('提示', '请选择添加对象')
  101. RETURN
  102. END IF
  103. s_aifmb_addcuscomm s_parm
  104. s_parm.cusid = dw_1.Object.cusid[ll_row]
  105. s_parm.cuscode = dw_1.Object.usercode[ll_row]
  106. s_parm.cusname = dw_1.Object.username[ll_row]
  107. s_parm.lb_readonly = False
  108. s_parm.custype = 3
  109. IF s_parm.cusid = '' THEN
  110. MessageBox('提示', '对方唯一码为空不能添加')
  111. RETURN
  112. END IF
  113. IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN
  114. MessageBox('提示', '对方唯一码为零不能添加')
  115. RETURN
  116. END IF
  117. //查询是否已经绑定客户
  118. Long ll_cnt
  119. SELECT COUNT(0)
  120. INTO :ll_cnt
  121. FROM LJFIEB_CusComm
  122. WHERE CusID = :s_parm.cusid
  123. Using sys_email_sqlca;
  124. IF sys_email_sqlca.SQLCode <> 0 THEN
  125. MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText)
  126. RETURN
  127. END IF
  128. String ls_cuscode
  129. String ls_cusname
  130. IF ll_cnt > 0 THEN
  131. SELECT top 1 cuscode, cusname
  132. INTO :ls_cuscode, :ls_cusname
  133. FROM LJFIEB_CusComm
  134. WHERE CusID = :s_parm.cusid
  135. Using sys_email_sqlca;
  136. IF sys_email_sqlca.SQLCode <> 0 THEN
  137. MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText)
  138. RETURN
  139. END IF
  140. s_parm.cuscode = ls_cuscode
  141. s_parm.cusname = ls_cusname
  142. s_parm.lb_readonly = True
  143. SELECT COUNT(0)
  144. INTO :ll_cnt
  145. FROM u_cust
  146. Where commcode = :ls_cuscode;
  147. IF sqlca.SQLCode <> 0 THEN
  148. MessageBox('提示', '查询已绑定客户个数失败,' + sys_email_sqlca.SQLErrText)
  149. RETURN
  150. END IF
  151. IF ll_cnt > 0 THEN
  152. IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个客户,是否继续?', Question!, YesNo!, 1) <> 1 THEN
  153. RETURN
  154. END IF
  155. END IF
  156. SELECT COUNT(0)
  157. INTO :ll_cnt
  158. FROM u_spt
  159. Where commcode = :ls_cuscode;
  160. IF sqlca.SQLCode <> 0 THEN
  161. MessageBox('提示', '查询已绑定供应商个数失败,' + sys_email_sqlca.SQLErrText)
  162. RETURN
  163. END IF
  164. IF ll_cnt > 0 THEN
  165. IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个供应商,是否继续?', Question!, YesNo!, 1) <> 1 THEN
  166. RETURN
  167. END IF
  168. END IF
  169. END IF
  170. s_custom s_cust
  171. s_cust.cuscode = dw_1.Object.usercode[ll_row]
  172. s_cust.Name = dw_1.Object.username[ll_row]
  173. s_cust.tele = dw_1.Object.tele[ll_row]
  174. s_cust.tele1 = dw_1.Object.phone[ll_row]
  175. s_cust.Address = dw_1.Object.Address[ll_row]
  176. s_cust.email = dw_1.Object.email[ll_row]
  177. s_cust.dscrp = dw_1.Object.dscrp[ll_row]
  178. s_edit_index_tran s_tran
  179. s_tran.if_retrieve_all = False //是否一次RETRIEVE所有行
  180. s_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  181. s_tran.arg_pkid = 0 //目标定位PKID (备用)
  182. s_tran.e_long = 1
  183. s_tran.a_any = s_cust
  184. OpenWithParm(w_cust_edit, s_tran)
  185. s_custom S_INSCUST
  186. S_INSCUST = Message.PowerObjectParm //接受返回结构
  187. IF S_INSCUST.cusid <= 0 THEN RETURN
  188. s_parm.ll_cusid = S_INSCUST.cusid
  189. s_parm.ls_cuscode = S_INSCUST.cuscode
  190. s_parm.ls_cusname = S_INSCUST.Name
  191. s_spt s_spt_tran
  192. s_spt_tran.sptcode = dw_1.Object.usercode[ll_row]
  193. s_spt_tran.Name = dw_1.Object.username[ll_row]
  194. s_spt_tran.tele = dw_1.Object.tele[ll_row]
  195. s_spt_tran.tele1 = dw_1.Object.phone[ll_row]
  196. s_spt_tran.Address = dw_1.Object.Address[ll_row]
  197. s_spt_tran.email = dw_1.Object.email[ll_row]
  198. s_spt_tran.dscrp = dw_1.Object.dscrp[ll_row]
  199. s_edit_index_tran s_tran_spt
  200. s_tran_spt.if_retrieve_all = False //是否一次RETRIEVE所有行
  201. s_tran_spt.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  202. s_tran_spt.arg_pkid = 0 //目标定位PKID (备用)
  203. s_tran_spt.e_long = 1
  204. s_tran_spt.a_any = s_spt_tran
  205. OpenWithParm(w_spt_edit, s_tran_spt)
  206. s_spt S_INSSPT
  207. S_INSSPT = Message.PowerObjectParm //接受返回结构
  208. IF S_INSSPT.sptid <= 0 THEN RETURN
  209. s_parm.ll_sptid = S_INSSPT.sptid
  210. s_parm.ls_sptcode = S_INSSPT.sptcode
  211. s_parm.ls_sptname = S_INSSPT.Name
  212. OpenWithParm(w_aifmb_addcuscomm,s_parm)
  213. end event
  214. type cb_addspt from commandbutton within w_aifmb_querycom
  215. integer x = 1298
  216. integer y = 40
  217. integer width = 329
  218. integer height = 84
  219. integer taborder = 50
  220. integer textsize = -9
  221. integer weight = 400
  222. fontcharset fontcharset = gb2312charset!
  223. fontpitch fontpitch = variable!
  224. string facename = "宋体"
  225. string text = "加为供应商"
  226. end type
  227. event clicked;Long ll_row
  228. ll_row = dw_1.GetRow()
  229. IF ll_row <= 0 THEN
  230. MessageBox('提示', '请选择添加对象')
  231. RETURN
  232. END IF
  233. s_aifmb_addcuscomm s_parm
  234. s_parm.cusid = dw_1.Object.cusid[ll_row]
  235. s_parm.cuscode = dw_1.Object.usercode[ll_row]
  236. s_parm.cusname = dw_1.Object.username[ll_row]
  237. s_parm.lb_readonly = False
  238. s_parm.custype = 1
  239. IF s_parm.cusid = '' THEN
  240. MessageBox('提示', '对方唯一码为空不能添加')
  241. RETURN
  242. END IF
  243. IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN
  244. MessageBox('提示', '对方唯一码为零不能添加')
  245. RETURN
  246. END IF
  247. //查询是否已经绑定客户
  248. Long ll_cnt
  249. SELECT COUNT(0)
  250. INTO :ll_cnt
  251. FROM LJFIEB_CusComm
  252. WHERE CusID = :s_parm.cusid
  253. Using sys_email_sqlca;
  254. IF sys_email_sqlca.SQLCode <> 0 THEN
  255. MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText)
  256. RETURN
  257. END IF
  258. String ls_cuscode
  259. String ls_cusname
  260. IF ll_cnt > 0 THEN
  261. SELECT top 1 cuscode, cusname
  262. INTO :ls_cuscode, :ls_cusname
  263. FROM LJFIEB_CusComm
  264. WHERE CusID = :s_parm.cusid
  265. Using sys_email_sqlca;
  266. IF sys_email_sqlca.SQLCode <> 0 THEN
  267. MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText)
  268. RETURN
  269. END IF
  270. s_parm.cuscode = ls_cuscode
  271. s_parm.cusname = ls_cusname
  272. s_parm.lb_readonly = True
  273. SELECT COUNT(0)
  274. INTO :ll_cnt
  275. FROM u_spt
  276. Where commcode = :ls_cuscode;
  277. IF sqlca.SQLCode <> 0 THEN
  278. MessageBox('提示', '查询已绑定供应商个数失败,' + sys_email_sqlca.SQLErrText)
  279. RETURN
  280. END IF
  281. IF ll_cnt > 0 THEN
  282. IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个供应商,是否继续?', Question!, YesNo!, 1) <> 1 THEN
  283. RETURN
  284. END IF
  285. END IF
  286. END IF
  287. s_spt s_spt_tran
  288. s_spt_tran.sptcode = dw_1.Object.usercode[ll_row]
  289. s_spt_tran.Name = dw_1.Object.username[ll_row]
  290. s_spt_tran.tele = dw_1.Object.tele[ll_row]
  291. s_spt_tran.tele1 = dw_1.Object.phone[ll_row]
  292. s_spt_tran.Address = dw_1.Object.Address[ll_row]
  293. s_spt_tran.email = dw_1.Object.email[ll_row]
  294. s_spt_tran.dscrp = dw_1.Object.dscrp[ll_row]
  295. s_edit_index_tran s_tran_spt
  296. s_tran_spt.if_retrieve_all = False //是否一次RETRIEVE所有行
  297. s_tran_spt.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  298. s_tran_spt.arg_pkid = 0 //目标定位PKID (备用)
  299. s_tran_spt.e_long = 1
  300. s_tran_spt.a_any = s_spt_tran
  301. OpenWithParm(w_spt_edit, s_tran_spt)
  302. s_spt S_INSSPT
  303. S_INSSPT = Message.PowerObjectParm //接受返回结构
  304. IF S_INSSPT.sptid <= 0 THEN RETURN
  305. s_parm.ll_sptid = S_INSSPT.sptid
  306. s_parm.ls_sptcode = S_INSSPT.sptcode
  307. s_parm.ls_sptname = S_INSSPT.Name
  308. OpenWithParm(w_aifmb_addcuscomm,s_parm)
  309. end event
  310. type cb_addcus from commandbutton within w_aifmb_querycom
  311. integer x = 1010
  312. integer y = 40
  313. integer width = 274
  314. integer height = 84
  315. integer taborder = 40
  316. integer textsize = -9
  317. integer weight = 400
  318. fontcharset fontcharset = gb2312charset!
  319. fontpitch fontpitch = variable!
  320. string facename = "宋体"
  321. string text = "加为客户"
  322. end type
  323. event clicked;Long ll_row
  324. ll_row = dw_1.GetRow()
  325. IF ll_row <= 0 THEN
  326. MessageBox('提示', '请选择添加对象')
  327. RETURN
  328. END IF
  329. s_aifmb_addcuscomm s_parm
  330. s_parm.cusid = dw_1.Object.cusid[ll_row]
  331. s_parm.cuscode = dw_1.Object.usercode[ll_row]
  332. s_parm.cusname = dw_1.Object.username[ll_row]
  333. s_parm.lb_readonly = False
  334. s_parm.custype = 2
  335. IF s_parm.cusid = '' THEN
  336. MessageBox('提示', '对方唯一码为空不能添加')
  337. RETURN
  338. END IF
  339. IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN
  340. MessageBox('提示', '对方唯一码为零不能添加')
  341. RETURN
  342. END IF
  343. //查询是否已经绑定客户
  344. Long ll_cnt
  345. SELECT COUNT(0)
  346. INTO :ll_cnt
  347. FROM LJFIEB_CusComm
  348. WHERE CusID = :s_parm.cusid
  349. Using sys_email_sqlca;
  350. IF sys_email_sqlca.SQLCode <> 0 THEN
  351. MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText)
  352. RETURN
  353. END IF
  354. String ls_cuscode
  355. String ls_cusname
  356. IF ll_cnt > 0 THEN
  357. SELECT top 1 cuscode, cusname
  358. INTO :ls_cuscode, :ls_cusname
  359. FROM LJFIEB_CusComm
  360. WHERE CusID = :s_parm.cusid
  361. Using sys_email_sqlca;
  362. IF sys_email_sqlca.SQLCode <> 0 THEN
  363. MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText)
  364. RETURN
  365. END IF
  366. s_parm.cuscode = ls_cuscode
  367. s_parm.cusname = ls_cusname
  368. s_parm.lb_readonly = True
  369. SELECT COUNT(0)
  370. INTO :ll_cnt
  371. FROM u_cust
  372. Where commcode = :ls_cuscode;
  373. IF sqlca.SQLCode <> 0 THEN
  374. MessageBox('提示', '查询已绑定客户个数失败,' + sys_email_sqlca.SQLErrText)
  375. RETURN
  376. END IF
  377. IF ll_cnt > 0 THEN
  378. IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个客户,是否继续?', Question!, YesNo!, 1) <> 1 THEN
  379. RETURN
  380. END IF
  381. END IF
  382. END IF
  383. s_custom s_cust
  384. s_cust.cuscode = dw_1.Object.usercode[ll_row]
  385. s_cust.Name = dw_1.Object.username[ll_row]
  386. s_cust.tele = dw_1.Object.tele[ll_row]
  387. s_cust.tele1 = dw_1.Object.phone[ll_row]
  388. s_cust.Address = dw_1.Object.Address[ll_row]
  389. s_cust.email = dw_1.Object.email[ll_row]
  390. s_cust.dscrp = dw_1.Object.dscrp[ll_row]
  391. s_edit_index_tran s_tran
  392. s_tran.if_retrieve_all = False //是否一次RETRIEVE所有行
  393. s_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  394. s_tran.arg_pkid = 0 //目标定位PKID (备用)
  395. s_tran.e_long = 1
  396. s_tran.a_any = s_cust
  397. OpenWithParm(w_cust_edit, s_tran)
  398. s_custom S_INSCUST
  399. S_INSCUST = Message.PowerObjectParm //接受返回结构
  400. IF S_INSCUST.cusid <= 0 THEN RETURN
  401. s_parm.ll_cusid = S_INSCUST.cusid
  402. s_parm.ls_cuscode = S_INSCUST.cuscode
  403. s_parm.ls_cusname = S_INSCUST.Name
  404. OpenWithParm(w_aifmb_addcuscomm,s_parm)
  405. end event
  406. type cb_1 from commandbutton within w_aifmb_querycom
  407. integer x = 654
  408. integer y = 40
  409. integer width = 206
  410. integer height = 84
  411. integer taborder = 20
  412. integer textsize = -9
  413. integer weight = 400
  414. fontcharset fontcharset = gb2312charset!
  415. fontpitch fontpitch = variable!
  416. string facename = "宋体"
  417. string text = "查找"
  418. end type
  419. event clicked;Int rslt = 1
  420. String arg_msg = ''
  421. uo_aifmbproxy ll_proxyfactory
  422. ll_proxyfactory = Create uo_aifmbproxy
  423. oleobject lo_proxy
  424. IF ll_proxyfactory.getproxy(lo_proxy, arg_msg) <> 1 THEN
  425. rslt = 0
  426. GOTO ext
  427. END IF
  428. oleobject request
  429. request = lo_proxy.NewQueryEntRequest()
  430. request.QueryStr = sle_1.Text
  431. oleobject response
  432. response = lo_proxy.QueryEnt(request)
  433. IF Not IsNull(response.ErrMsg) THEN
  434. rslt = 0
  435. arg_msg = response.ErrMsg
  436. GOTO ext
  437. END IF
  438. Long cnt
  439. cnt = response.Ents.Count
  440. dw_1.Reset()
  441. Long i, row
  442. oleobject lo_ent
  443. oleobject lo_status
  444. FOR i = 0 To cnt - 1
  445. lo_ent = response.Ents.GetItem(i)
  446. row = dw_1.InsertRow(0)
  447. dw_1.Object.UserID[row] = lo_ent.UserID
  448. dw_1.Object.CusID[row] = lo_ent.CusID
  449. dw_1.Object.usercode[row] = lo_ent.usercode
  450. dw_1.Object.username[row] = lo_ent.username
  451. dw_1.Object.tele[row] = lo_ent.tele
  452. dw_1.Object.phone[row] = lo_ent.phone
  453. dw_1.Object.Address[row] = lo_ent.Address
  454. dw_1.Object.email[row] = lo_ent.email
  455. dw_1.Object.dscrp[row] = lo_ent.dscrp
  456. dw_1.Object.comcode[row] = lo_ent.comcode
  457. IF Not IsNull(response.LinkStatus) THEN
  458. lo_status = response.LinkStatus.GetItem(i)
  459. dw_1.Object.SoftType[row] = lo_status.SoftType
  460. dw_1.Object.LinkType[row] = lo_status.LinkType
  461. END IF
  462. NEXT
  463. IF wf_retrieve_type(arg_msg) <> 1 THEN
  464. rslt = 0
  465. GOTO ext
  466. END IF
  467. ext:
  468. Destroy ll_proxyfactory
  469. IF rslt = 0 THEN
  470. MessageBox('ERROR', arg_msg)
  471. END IF
  472. end event
  473. type sle_1 from singlelineedit within w_aifmb_querycom
  474. integer x = 18
  475. integer y = 40
  476. integer width = 626
  477. integer height = 80
  478. integer taborder = 10
  479. integer textsize = -9
  480. integer weight = 400
  481. fontcharset fontcharset = gb2312charset!
  482. fontpitch fontpitch = variable!
  483. string facename = "宋体"
  484. long textcolor = 33554432
  485. borderstyle borderstyle = stylelowered!
  486. end type
  487. type dw_1 from u_dw_rbtnfilter within w_aifmb_querycom
  488. integer y = 152
  489. integer width = 2446
  490. integer height = 1212
  491. string dataobject = "dw_aifmb_querycom"
  492. boolean hscrollbar = true
  493. boolean vscrollbar = true
  494. boolean hsplitscroll = true
  495. boolean rbutton_filter_use = true
  496. boolean rbutton_setposition_use = true
  497. boolean titleclick_sort_use = true
  498. end type
  499. event rowfocuschanged;call super::rowfocuschanged;this.selectrow(0, false)
  500. if currentrow > 0 then
  501. this.selectrow(currentrow,true)
  502. end if
  503. end event
  504. event clicked;call super::clicked;if row > 0 then
  505. this.setrow(row)
  506. end if
  507. end event