w_quote_receive_ljfieb.srw 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  1. $PBExportHeader$w_quote_receive_ljfieb.srw
  2. forward
  3. global type w_quote_receive_ljfieb from w_publ_base
  4. end type
  5. type dw_uc from datawindow within w_quote_receive_ljfieb
  6. end type
  7. type dw_child from u_dw_rbtnfilter within w_quote_receive_ljfieb
  8. end type
  9. type mle_1 from multilineedit within w_quote_receive_ljfieb
  10. end type
  11. type st_1 from statictext within w_quote_receive_ljfieb
  12. end type
  13. type st_2 from statictext within w_quote_receive_ljfieb
  14. end type
  15. type sle_scname from singlelineedit within w_quote_receive_ljfieb
  16. end type
  17. type cb_accept from uo_imflatbutton within w_quote_receive_ljfieb
  18. end type
  19. type cb_feedback from uo_imflatbutton within w_quote_receive_ljfieb
  20. end type
  21. type cb_reject from uo_imflatbutton within w_quote_receive_ljfieb
  22. end type
  23. type mle_2 from multilineedit within w_quote_receive_ljfieb
  24. end type
  25. type st_3 from statictext within w_quote_receive_ljfieb
  26. end type
  27. type cbx_audit from checkbox within w_quote_receive_ljfieb
  28. end type
  29. type cb_1 from uo_imflatbutton within w_quote_receive_ljfieb
  30. end type
  31. type ln_bar from line within w_quote_receive_ljfieb
  32. end type
  33. type ln_bar2 from line within w_quote_receive_ljfieb
  34. end type
  35. type ln_1 from line within w_quote_receive_ljfieb
  36. end type
  37. type ln_2 from line within w_quote_receive_ljfieb
  38. end type
  39. type r_bar from rectangle within w_quote_receive_ljfieb
  40. end type
  41. end forward
  42. global type w_quote_receive_ljfieb from w_publ_base
  43. integer width = 3611
  44. integer height = 2380
  45. string title = "供应商报价单"
  46. boolean minbox = false
  47. windowtype windowtype = response!
  48. windowstate windowstate = maximized!
  49. event ue_quote ( )
  50. dw_uc dw_uc
  51. dw_child dw_child
  52. mle_1 mle_1
  53. st_1 st_1
  54. st_2 st_2
  55. sle_scname sle_scname
  56. cb_accept cb_accept
  57. cb_feedback cb_feedback
  58. cb_reject cb_reject
  59. mle_2 mle_2
  60. st_3 st_3
  61. cbx_audit cbx_audit
  62. cb_1 cb_1
  63. ln_bar ln_bar
  64. ln_bar2 ln_bar2
  65. ln_1 ln_1
  66. ln_2 ln_2
  67. r_bar r_bar
  68. end type
  69. global w_quote_receive_ljfieb w_quote_receive_ljfieb
  70. type variables
  71. Transaction tr_eb_sqlca
  72. s_packet_ljfieb s_inscust
  73. long ins_scid
  74. string ins_sn
  75. uo_spt_price_change uo_price
  76. uo_ljfieb uo_fieb
  77. long ins_sendid,ins_receid
  78. string ins_sendsccode,ins_reccesccode
  79. string ins_RelatedCode
  80. datetime ins_addtime
  81. string ins_adduser
  82. end variables
  83. forward prototypes
  84. public function integer wf_retrieve (string arg_sn, long arg_sendcuscommid, string arg_sendsccode, ref string arg_msg)
  85. public function integer wf_importnewbj (long arg_cusid, long arg_moneyid, long arg_mtrlid, string arg_status, string arg_woodcode, string arg_pcode, ref decimal arg_price, ref decimal arg_rebate, ref string arg_msg)
  86. public function integer wf_importnewprice (long arg_cusid, long arg_moneyid, long arg_mtrlid, string arg_status, string arg_woodcode, string arg_pcode, ref decimal arg_price, ref decimal arg_rebate, ref string arg_msg)
  87. public function integer wf_add_quote (integer arg_type, integer arg_ifaudit)
  88. end prototypes
  89. public function integer wf_retrieve (string arg_sn, long arg_sendcuscommid, string arg_sendsccode, ref string arg_msg);Int rslt = 1
  90. String ls_cuscode
  91. Long uc_row
  92. Long ll_i, ll_rowcnt,ll_row
  93. Long ll_moneyid,ll_banktypeid
  94. Decimal ls_1stnewprice,ls_1stzqrate
  95. dw_uc.Retrieve(arg_sn)
  96. dw_child.Retrieve(arg_sn)
  97. uc_row = dw_uc.GetRow()
  98. IF uc_row <= 0 THEN
  99. rslt = 0
  100. arg_msg = '没有对应的单据信息'
  101. GOTO ext
  102. END IF
  103. SELECT CusCode
  104. INTO :ls_cuscode
  105. FROM LJFIEB_CusComm
  106. Where CusCommID = :arg_sendcuscommid Using tr_eb_sqlca;
  107. IF tr_eb_sqlca.SQLCode <> 0 THEN
  108. ls_cuscode = ''
  109. END IF
  110. IF Trim(ls_cuscode) = '' THEN
  111. rslt = 0
  112. arg_msg = '供应商信息不明确,请检查'
  113. GOTO ext
  114. END IF
  115. Long ll_sptid
  116. String ls_sptcode, ls_sptname
  117. string ls_sptmtrlcode,ls_mtrlcode_my,ls_mtrlname_my,ls_mtrlmode_my
  118. long ll_mtrlid
  119. SELECT sptid, sptcode, name
  120. INTO :ll_sptid,:ls_sptcode,:ls_sptname
  121. FROM u_spt
  122. WHERE commcode = :ls_cuscode
  123. And commsccode = :arg_sendsccode Using sqlca;
  124. IF sqlca.SQLCode <> 0 THEN
  125. rslt = 0
  126. arg_msg = '查询供应商信息失败,请检查通信设置是否正确,'+sqlca.SQLErrText
  127. GOTO ext
  128. END IF
  129. dw_uc.Object.sptid[uc_row] = ll_sptid
  130. dw_uc.Object.sptCode[uc_row] = ls_sptcode
  131. dw_uc.Object.sptname[uc_row] = ls_sptname
  132. FOR ll_i = 1 To dw_child.RowCount()
  133. ls_sptmtrlcode = dw_child.Object.mtrlcode[ll_i]
  134. SELECT u_sptmtrlname.mtrlid,
  135. u_mtrldef.mtrlcode,
  136. u_mtrldef.mtrlname,
  137. u_mtrldef.mtrlmode
  138. INTO :ll_mtrlid,
  139. :ls_mtrlcode_my,
  140. :ls_mtrlname_my,
  141. :ls_mtrlmode_my
  142. FROM u_sptmtrlname INNER JOIN
  143. u_mtrldef ON u_sptmtrlname.mtrlid = u_mtrldef.mtrlid
  144. WHERE u_sptmtrlname.sptid = :ll_sptid
  145. And u_sptmtrlname.sptmtrlcode = :ls_sptmtrlcode using sqlca;
  146. IF sqlca.SQLCode <> 0 THEN
  147. rslt = 0
  148. arg_msg = '第'+string(ll_i)+'行,查询本地产品信息失败,'+sqlca.sqlerrtext
  149. GOTO ext
  150. END IF
  151. dw_child.Object.mtrlcode_my[ll_i] = ls_mtrlcode_my
  152. dw_child.Object.mtrlname_my[ll_i] = ls_mtrlname_my
  153. dw_child.Object.mtrlmode_my[ll_i] = ls_mtrlmode_my
  154. dw_child.Object.mtrlid_my[ll_i] = ll_mtrlid
  155. NEXT
  156. ext:
  157. RETURN rslt
  158. end function
  159. public function integer wf_importnewbj (long arg_cusid, long arg_moneyid, long arg_mtrlid, string arg_status, string arg_woodcode, string arg_pcode, ref decimal arg_price, ref decimal arg_rebate, ref string arg_msg);Int rslt = 1
  160. IF arg_moneyid = 0 THEN
  161. rslt = 0
  162. arg_msg = '请先选择币种'
  163. GOTO ext
  164. END IF
  165. IF IsNull(arg_cusid) THEN arg_cusid = 0
  166. IF arg_cusid = 0 THEN
  167. rslt = 0
  168. arg_msg = "请选择销售客户!"
  169. GOTO ext
  170. END IF
  171. SELECT u_cus_price.fprice_bj,u_cus_price.zqrate_bj
  172. INTO :arg_price,:arg_rebate
  173. FROM u_cus_price
  174. WHERE ( u_cus_price.cusid = :arg_cusid ) AND
  175. ( u_cus_price.mtrlid = :arg_mtrlid ) AND
  176. ( u_cus_price.status = :arg_status ) AND
  177. ( u_cus_price.pcode = :arg_pcode ) AND
  178. ( u_cus_price.woodcode = :arg_woodcode ) and
  179. ( u_cus_price.moneyid = :arg_moneyid);
  180. IF sqlca.SQLCode <> 0 THEN
  181. rslt = 0
  182. arg_msg = "没有最新销售价!"
  183. GOTO ext
  184. END IF
  185. ext:
  186. IF rslt = 0 THEN
  187. arg_price = 0
  188. arg_rebate = 0
  189. END IF
  190. RETURN rslt
  191. end function
  192. public function integer wf_importnewprice (long arg_cusid, long arg_moneyid, long arg_mtrlid, string arg_status, string arg_woodcode, string arg_pcode, ref decimal arg_price, ref decimal arg_rebate, ref string arg_msg);Int rslt = 1
  193. IF arg_moneyid = 0 THEN
  194. rslt = 0
  195. arg_msg = '请先选择币种'
  196. GOTO ext
  197. END IF
  198. IF IsNull(arg_cusid) THEN arg_cusid = 0
  199. IF arg_cusid = 0 THEN
  200. rslt = 0
  201. arg_msg = "请选择销售客户!"
  202. GOTO ext
  203. END IF
  204. SELECT u_cus_price.fprice,u_cus_price.zqrate
  205. INTO :arg_price,:arg_rebate
  206. FROM u_cus_price
  207. WHERE ( u_cus_price.cusid = :arg_cusid ) AND
  208. ( u_cus_price.mtrlid = :arg_mtrlid ) AND
  209. ( u_cus_price.status = :arg_status ) AND
  210. ( u_cus_price.pcode = :arg_pcode ) AND
  211. ( u_cus_price.woodcode = :arg_woodcode ) and
  212. ( u_cus_price.moneyid = :arg_moneyid);
  213. IF sqlca.SQLCode <> 0 THEN
  214. rslt = 0
  215. arg_msg = "没有最新销售价!"
  216. GOTO ext
  217. END IF
  218. ext:
  219. IF rslt = 0 THEN
  220. arg_price = 0
  221. arg_rebate = 0
  222. END IF
  223. RETURN rslt
  224. end function
  225. public function integer wf_add_quote (integer arg_type, integer arg_ifaudit);String arg_msg
  226. Long uc_row
  227. DateTime server_dt
  228. Long i
  229. Long ll_mtrlid
  230. String ls_mtrlcode
  231. Long ll_mess
  232. String ls_relquotecode
  233. Long ll_moneyid
  234. String ls_moneyname
  235. String ls_status,ls_code,ls_woodcode,ls_pcode
  236. Decimal ld_price
  237. Long ll_billid
  238. Boolean lb_ifcommit
  239. uc_row = dw_uc.GetRow()
  240. IF uc_row <= 0 THEN
  241. MessageBox('系统提示','没有可保存的内容')
  242. RETURN 0
  243. END IF
  244. dw_uc.AcceptText()
  245. dw_child.AcceptText()
  246. IF arg_type = 1 THEN
  247. SELECT Top 1 getdate() Into :server_dt From u_user Using sqlca;
  248. //取得系统时间,借用操作员表
  249. IF sqlca.SQLCode <> 0 THEN
  250. MessageBox('Error',"查询操作失败,日期 ")
  251. RETURN 0
  252. END IF
  253. ls_moneyname = dw_uc.Object.moneyname[uc_row]
  254. SELECT moneyid
  255. INTO :ll_moneyid
  256. FROM cw_currency
  257. Where Name = :ls_moneyname Using sqlca;
  258. IF sqlca.SQLCode <> 0 THEN
  259. MessageBox('Error','查询币种信息失败,'+sqlca.SQLErrText)
  260. RETURN 0
  261. END IF
  262. IF uo_price.newbegin() = 0 THEN
  263. MessageBox('Error!',arg_msg)
  264. RETURN 0
  265. END IF
  266. uo_price.billdate = server_dt // 发生时间
  267. uo_price.inrep = publ_operator
  268. uo_price.dscrp = dw_uc.Object.dscrp[uc_row] //备注
  269. uo_price.sptid = dw_uc.Object.sptid[uc_row] //
  270. uo_price.moneyid = ll_moneyid
  271. uo_price.billtype = 2
  272. FOR i = 1 To dw_child.RowCount()
  273. IF dw_child.Object.mtrlcode_my[i] <> '' THEN
  274. ls_mtrlcode = dw_child.Object.mtrlcode_my[i]
  275. SELECT mtrlid INTO :ll_mtrlid
  276. FROM u_mtrldef
  277. Where mtrlcode = :ls_mtrlcode Using sqlca;
  278. IF sqlca.SQLCode <> 0 THEN
  279. ll_mess = MessageBox('Error','第'+String(i)+'行,查询产品信息失败,是否忽略?',question!,yesno!)
  280. IF ll_mess = 1 THEN
  281. CONTINUE
  282. ELSEIF ll_mess = 2 THEN
  283. RETURN 0
  284. END IF
  285. END IF
  286. IF uo_price.acceptmx(i,&
  287. dw_child.Object.mtrlid_my[i],&
  288. dw_child.Object.mtrlcode_my[i],&
  289. dw_child.Object.unit[i],&
  290. 0,&
  291. dw_child.Object.price[i],&
  292. 1,&
  293. 1,&
  294. dw_child.Object.status[i],&
  295. dw_child.Object.woodcode[i],&
  296. dw_child.Object.pcode[i],&
  297. dw_child.Object.mtrlname[i],&
  298. dw_child.Object.mxdscrp[i],&
  299. arg_msg) = 0 THEN
  300. MessageBox('Error!',arg_msg)
  301. RETURN 0
  302. END IF
  303. END IF
  304. NEXT
  305. IF arg_ifaudit = 1 THEN
  306. lb_ifcommit = False
  307. ELSE
  308. lb_ifcommit = True
  309. END IF
  310. IF uo_price.Save(arg_msg,lb_ifcommit) = 0 THEN
  311. MessageBox('Error!',arg_msg)
  312. RETURN 0
  313. END IF
  314. IF arg_ifaudit = 1 THEN
  315. IF uo_price.getinfo(uo_price.billid,arg_msg) = 0 THEN
  316. MessageBox('error!',arg_msg)
  317. RETURN 0
  318. END IF
  319. IF uo_price.auditing(True,arg_msg) = 0 THEN
  320. MessageBox('error!',arg_msg)
  321. RETURN 0
  322. END IF
  323. END IF
  324. ls_relquotecode = uo_price.billcode
  325. ELSE
  326. ls_code = dw_uc.Object.fiebrelcode[uc_row]
  327. IF Trim(ls_code) = '' THEN
  328. MessageBox('系统提示','没有相关供应商询价单')
  329. RETURN 0
  330. END IF
  331. SELECT billid
  332. INTO :ll_billid
  333. FROM u_spt_price_change
  334. Where billcode = :ls_code Using sqlca;
  335. IF sqlca.SQLCode <> 0 THEN
  336. MessageBox('Error','查询供应商询价单状态失败,'+sqlca.SQLErrText)
  337. RETURN 0
  338. END IF
  339. FOR i = 1 To dw_child.RowCount()
  340. ll_mtrlid = dw_child.Object.mtrlid_my[i]
  341. ls_status = dw_child.Object.status[i]
  342. ls_woodcode = dw_child.object.woodcode[i]
  343. ls_pcode = dw_child.object.pcode[i]
  344. ld_price = dw_child.Object.price[i]
  345. UPDATE u_spt_price_changemx
  346. SET price = :ld_price
  347. WHERE mtrlid = :ll_mtrlid
  348. AND status = :ls_status
  349. and woodcode = :ls_woodcode
  350. and pcode = :ls_pcode
  351. And billid = :ll_billid Using sqlca;
  352. IF sqlca.SQLCode <> 0 THEN
  353. ROLLBACK Using sqlca;
  354. MessageBox('Error','第'+String(i)+'行,更新相关询价单明细失败,'+sqlca.SQLErrText)
  355. RETURN 0
  356. END IF
  357. NEXT
  358. IF uo_price.getinfo(ll_billid,arg_msg) = 0 THEN
  359. MessageBox('error!',arg_msg)
  360. RETURN 0
  361. END IF
  362. IF uo_price.auditing(false,arg_msg) = 0 THEN
  363. MessageBox('error!',arg_msg)
  364. RETURN 0
  365. END IF
  366. ls_relquotecode = ls_code
  367. COMMIT Using sqlca;
  368. END IF
  369. UPDATE LJFIEB_tempquote
  370. SET fiebrelcode = :ls_relquotecode,
  371. flag = 1,
  372. ConfirmTime = getdate(),
  373. ConfirmUser = :publ_operator
  374. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  375. IF tr_eb_sqlca.SQLCode <> 0 THEN
  376. ROLLBACK Using tr_eb_sqlca;
  377. MessageBox('Error','更新客户询价单相关报价单号失败,'+tr_eb_sqlca.SQLErrText)
  378. RETURN 0
  379. END IF
  380. dw_uc.Object.fiebrelcode[uc_row] = ls_relquotecode
  381. dw_uc.Object.flag[uc_row] = 1
  382. //更新本地通信记录
  383. UPDATE LJFIEB_packet
  384. SET status = 6,
  385. Complete = 1,
  386. ConfirmTime = getdate(),
  387. ConfirmUser = :publ_operator
  388. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  389. IF tr_eb_sqlca.SQLCode <> 0 THEN
  390. ROLLBACK Using tr_eb_sqlca;
  391. MessageBox('Error','更新本地通信记录失败,'+tr_eb_sqlca.SQLErrText)
  392. RETURN 0
  393. END IF
  394. RETURN 1
  395. end function
  396. on w_quote_receive_ljfieb.create
  397. int iCurrent
  398. call super::create
  399. this.dw_uc=create dw_uc
  400. this.dw_child=create dw_child
  401. this.mle_1=create mle_1
  402. this.st_1=create st_1
  403. this.st_2=create st_2
  404. this.sle_scname=create sle_scname
  405. this.cb_accept=create cb_accept
  406. this.cb_feedback=create cb_feedback
  407. this.cb_reject=create cb_reject
  408. this.mle_2=create mle_2
  409. this.st_3=create st_3
  410. this.cbx_audit=create cbx_audit
  411. this.cb_1=create cb_1
  412. this.ln_bar=create ln_bar
  413. this.ln_bar2=create ln_bar2
  414. this.ln_1=create ln_1
  415. this.ln_2=create ln_2
  416. this.r_bar=create r_bar
  417. iCurrent=UpperBound(this.Control)
  418. this.Control[iCurrent+1]=this.dw_uc
  419. this.Control[iCurrent+2]=this.dw_child
  420. this.Control[iCurrent+3]=this.mle_1
  421. this.Control[iCurrent+4]=this.st_1
  422. this.Control[iCurrent+5]=this.st_2
  423. this.Control[iCurrent+6]=this.sle_scname
  424. this.Control[iCurrent+7]=this.cb_accept
  425. this.Control[iCurrent+8]=this.cb_feedback
  426. this.Control[iCurrent+9]=this.cb_reject
  427. this.Control[iCurrent+10]=this.mle_2
  428. this.Control[iCurrent+11]=this.st_3
  429. this.Control[iCurrent+12]=this.cbx_audit
  430. this.Control[iCurrent+13]=this.cb_1
  431. this.Control[iCurrent+14]=this.ln_bar
  432. this.Control[iCurrent+15]=this.ln_bar2
  433. this.Control[iCurrent+16]=this.ln_1
  434. this.Control[iCurrent+17]=this.ln_2
  435. this.Control[iCurrent+18]=this.r_bar
  436. end on
  437. on w_quote_receive_ljfieb.destroy
  438. call super::destroy
  439. destroy(this.dw_uc)
  440. destroy(this.dw_child)
  441. destroy(this.mle_1)
  442. destroy(this.st_1)
  443. destroy(this.st_2)
  444. destroy(this.sle_scname)
  445. destroy(this.cb_accept)
  446. destroy(this.cb_feedback)
  447. destroy(this.cb_reject)
  448. destroy(this.mle_2)
  449. destroy(this.st_3)
  450. destroy(this.cbx_audit)
  451. destroy(this.cb_1)
  452. destroy(this.ln_bar)
  453. destroy(this.ln_bar2)
  454. destroy(this.ln_1)
  455. destroy(this.ln_2)
  456. destroy(this.r_bar)
  457. end on
  458. event open;call super::open;tr_eb_sqlca = sys_email_sqlca // 电子商务连接
  459. IF sys_email_sqlca.DBHandle() = 0 THEN
  460. MessageBox('Error','电子商务数据库连接失败,请检查')
  461. RETURN
  462. END IF
  463. dw_uc.settransobject(tr_eb_sqlca)
  464. dw_child.settransobject(tr_eb_sqlca)
  465. uo_price = CREATE uo_spt_price_change
  466. uo_price.commit_transaction = sqlca
  467. uo_fieb = Create uo_ljfieb
  468. uo_fieb.commit_transaction = tr_eb_sqlca
  469. s_inscust = Message.PowerObjectParm
  470. ins_sn = s_inscust.serialnum
  471. ins_sendid = s_inscust.sendcuscommid
  472. ins_receid = s_inscust.receivecuscommid
  473. ins_sendsccode = s_inscust.sendsccode
  474. ins_reccesccode = s_inscust.receivesccode
  475. ins_RelatedCode = s_inscust.RelatedCode
  476. ins_addtime = s_inscust.addtime
  477. ins_adduser = s_inscust.adduser
  478. String ls_sccode,ls_scname
  479. String arg_msg
  480. ls_sccode = s_inscust.receivesccode
  481. SELECT scid,scname
  482. INTO :ins_scid,:ls_scname
  483. FROM u_scdef
  484. Where sccode = :ls_sccode;
  485. IF sqlca.SQLCode <> 0 THEN
  486. MessageBox('Error','查询分部信息失败,'+sqlca.SQLErrText)
  487. RETURN
  488. END IF
  489. sle_scname.Text = ls_scname
  490. mle_1.Text = s_inscust.postscript
  491. mle_2.Text = s_inscust.remark
  492. long ll_status
  493. SELECT status INTO :ll_status
  494. FROM LJFIEB_packet
  495. Where serialnum = :ins_sn Using tr_eb_sqlca;
  496. IF tr_eb_sqlca.SQLCode <> 0 THEN
  497. MessageBox('Error','查询通信数据失败,'+sqlca.SQLErrText)
  498. RETURN
  499. END IF
  500. if ll_status <> 5 then
  501. cb_accept.enabled = false
  502. cb_reject.enabled = false
  503. end if
  504. IF wf_retrieve(ins_sn,ins_sendid,ins_sendsccode,arg_msg) = 0 THEN
  505. MessageBox('Error',arg_msg)
  506. RETURN
  507. END IF
  508. //更新对方状态-已打开
  509. string ls_SerialNum
  510. SELECT TOP 1 NEWID() INTO :ls_SerialNum
  511. From u_user Using sqlca;
  512. IF sqlca.SQLCode <> 0 THEN
  513. return
  514. END IF
  515. IF IsNull(ls_SerialNum) THEN ls_SerialNum = ''
  516. IF ls_SerialNum = '' THEN
  517. return
  518. END IF
  519. IF uo_fieb.add_packet(ls_SerialNum,'',ins_receid,ins_reccesccode,ins_sendid,ins_sendsccode,5,'打开消息','','',ins_sn,'',0,arg_msg,True) = 0 THEN
  520. return
  521. END IF
  522. end event
  523. event resize;call super::resize;ln_bar.endx = this.width
  524. ln_bar2.endx = this.width
  525. r_bar.width = this.width
  526. ln_1.endx = this.width
  527. ln_2.endx = this.width
  528. dw_child.width = this.WorkSpaceWidth() - 10
  529. mle_1.width = dw_child.width - dw_uc.width - 4
  530. mle_2.width = mle_1.width
  531. dw_child.height = this.workspaceheight() - dw_child.y - 30
  532. end event
  533. event close;call super::close;destroy uo_fieb
  534. destroy uo_price
  535. end event
  536. type cb_func from w_publ_base`cb_func within w_quote_receive_ljfieb
  537. boolean visible = false
  538. end type
  539. type cb_exit from w_publ_base`cb_exit within w_quote_receive_ljfieb
  540. integer x = 1426
  541. integer width = 183
  542. integer height = 164
  543. integer picsize = 16
  544. toolbaralignment pic_align = alignattop!
  545. boolean border = false
  546. end type
  547. type dw_uc from datawindow within w_quote_receive_ljfieb
  548. integer y = 296
  549. integer width = 1966
  550. integer height = 764
  551. integer taborder = 30
  552. boolean bringtotop = true
  553. string title = "none"
  554. string dataobject = "dw_quote_receive_ljfieb"
  555. boolean livescroll = true
  556. borderstyle borderstyle = stylelowered!
  557. end type
  558. type dw_child from u_dw_rbtnfilter within w_quote_receive_ljfieb
  559. integer y = 1060
  560. integer width = 3584
  561. integer height = 1196
  562. integer taborder = 20
  563. boolean bringtotop = true
  564. boolean titlebar = true
  565. string title = "单据明细内容"
  566. string dataobject = "dw_quotemx_receive_ljfieb"
  567. boolean maxbox = true
  568. boolean hscrollbar = true
  569. boolean vscrollbar = true
  570. boolean hsplitscroll = true
  571. end type
  572. event rowfocuschanged;call super::rowfocuschanged; IF currentrow <= 0 THEN RETURN
  573. THIS.SelectRow(0,FALSE)
  574. THIS.SelectRow(currentrow,TRUE)
  575. this.setrow(currentrow)
  576. end event
  577. event clicked;call super::clicked; IF row <= 0 THEN RETURN
  578. THIS.SelectRow(0,FALSE)
  579. THIS.SelectRow(row,TRUE)
  580. this.setrow(row)
  581. end event
  582. event rbuttondown;call super::rbuttondown;Long ll_row,ll_column
  583. ll_row = This.GetRow()
  584. ll_column = This.GetColumn()
  585. IF ll_row <= 0 THEN RETURN
  586. IF ll_column <= 0 THEN RETURN
  587. IF Left( This.Describe( dwo.Name+ ".coltype"),4) = 'date' THEN
  588. s_calender_arg s_calender
  589. s_calender.PointerX = This.PointerX()
  590. s_calender.PointerY = This.PointerY()
  591. s_calender.X = This.X + Parent.X
  592. s_calender.Y = This.Y + Parent.Y
  593. OpenWithParm(w_calendar,s_calender)
  594. This.SetItem(ll_row,ll_column,id_date_selected)
  595. END IF
  596. end event
  597. type mle_1 from multilineedit within w_quote_receive_ljfieb
  598. integer x = 1975
  599. integer y = 364
  600. integer width = 1595
  601. integer height = 344
  602. integer taborder = 40
  603. boolean bringtotop = true
  604. integer textsize = -9
  605. integer weight = 400
  606. fontcharset fontcharset = gb2312charset!
  607. fontpitch fontpitch = variable!
  608. string facename = "宋体"
  609. long textcolor = 33554432
  610. boolean vscrollbar = true
  611. boolean autovscroll = true
  612. boolean displayonly = true
  613. borderstyle borderstyle = stylelowered!
  614. end type
  615. type st_1 from statictext within w_quote_receive_ljfieb
  616. integer x = 1979
  617. integer y = 300
  618. integer width = 142
  619. integer height = 56
  620. boolean bringtotop = true
  621. integer textsize = -9
  622. integer weight = 400
  623. fontcharset fontcharset = gb2312charset!
  624. fontpitch fontpitch = variable!
  625. string facename = "宋体"
  626. long textcolor = 33554432
  627. long backcolor = 134217739
  628. string text = "附言"
  629. boolean focusrectangle = false
  630. end type
  631. type st_2 from statictext within w_quote_receive_ljfieb
  632. integer x = 23
  633. integer y = 204
  634. integer width = 155
  635. integer height = 48
  636. boolean bringtotop = true
  637. integer textsize = -9
  638. integer weight = 400
  639. fontcharset fontcharset = gb2312charset!
  640. fontpitch fontpitch = variable!
  641. string facename = "宋体"
  642. long textcolor = 33554432
  643. long backcolor = 134217739
  644. string text = "分部"
  645. alignment alignment = right!
  646. boolean focusrectangle = false
  647. end type
  648. type sle_scname from singlelineedit within w_quote_receive_ljfieb
  649. integer x = 210
  650. integer y = 188
  651. integer width = 443
  652. integer height = 84
  653. integer taborder = 30
  654. boolean bringtotop = true
  655. integer textsize = -9
  656. integer weight = 400
  657. fontcharset fontcharset = gb2312charset!
  658. fontpitch fontpitch = variable!
  659. string facename = "宋体"
  660. long textcolor = 33554432
  661. boolean displayonly = true
  662. borderstyle borderstyle = stylelowered!
  663. end type
  664. type cb_accept from uo_imflatbutton within w_quote_receive_ljfieb
  665. integer width = 494
  666. integer height = 164
  667. integer taborder = 30
  668. boolean bringtotop = true
  669. string text = "更新供应商询价单"
  670. string normalpicname = "ok.bmp"
  671. integer picsize = 16
  672. toolbaralignment pic_align = alignattop!
  673. boolean border = false
  674. end type
  675. event clicked;call super::clicked;IF Not f_power_ind(3168) THEN
  676. MessageBox(publ_operator,sys_msg_pow)
  677. RETURN
  678. END IF
  679. String ls_code
  680. Long ll_row,cnt,ll_i,ll_cntmx
  681. String ls_msg
  682. Int li_flag,li_iffail = 0,li_returnflag
  683. Long ll_mtrlid,ll_billid
  684. String ls_status,ls_woodcode,ls_pcode
  685. Decimal ld_price
  686. ll_row = dw_uc.GetRow()
  687. IF ll_row <= 0 THEN RETURN
  688. IF dw_child.RowCount() <= 0 THEN
  689. MessageBox('系统提示','没有明细内容,无法更新')
  690. RETURN
  691. END IF
  692. IF MessageBox('询问','确定更新相关供应商询价单吗?',question!,yesno!) = 2 THEN RETURN
  693. ls_code = dw_uc.Object.fiebrelcode[ll_row]
  694. IF Trim(ls_code) = '' THEN
  695. // MessageBox('系统提示','没有相关供应商询价单')
  696. // RETURN
  697. li_iffail = 2
  698. GOTO deal
  699. END IF
  700. SELECT count(*)
  701. INTO :cnt
  702. FROM u_spt_price_change
  703. Where Billcode = :ls_code Using sqlca;
  704. IF sqlca.SQLCode <> 0 THEN
  705. MessageBox('Error','查询供应商询价单信息失败,'+sqlca.SQLErrText)
  706. RETURN
  707. END IF
  708. IF cnt <> 1 THEN
  709. ls_msg = '无法查询相关供应商询价单,可能已被删除'
  710. li_iffail = 1
  711. ELSE
  712. SELECT billid,flag
  713. INTO :ll_billid,:li_flag
  714. FROM u_spt_price_change
  715. Where Billcode = :ls_code Using sqlca;
  716. IF sqlca.SQLCode <> 0 THEN
  717. MessageBox('Error','查询供应商询价单状态失败,'+sqlca.SQLErrText)
  718. RETURN
  719. END IF
  720. IF li_flag = 1 THEN
  721. ls_msg = '相关供应商询价单已审核'
  722. li_iffail = 1
  723. GOTO deal
  724. END IF
  725. //检查明细是否匹配
  726. FOR ll_i = 1 To dw_child.RowCount()
  727. ll_mtrlid = dw_child.Object.mtrlid_my[ll_i]
  728. ls_status = dw_child.Object.status[ll_i]
  729. ls_woodcode = dw_child.object.woodcode[ll_i]
  730. ls_pcode = dw_child.object.pcode[ll_i]
  731. ld_price = dw_child.Object.price[ll_i]
  732. ll_cntmx = 0
  733. SELECT count(*) INTO :ll_cntmx
  734. FROM u_spt_price_changemx
  735. WHERE billid = :ll_billid
  736. AND mtrlid = :ll_mtrlid
  737. And status = :ls_status
  738. and woodcode = :ls_woodcode
  739. and pcode = :ls_pcode Using sqlca;
  740. IF sqlca.SQLCode <> 0 THEN ll_cntmx = 0
  741. IF ll_cntmx = 0 THEN
  742. ls_msg = '相关供应商询价单与供应商报价单明细出现不匹配现象'
  743. li_iffail = 1
  744. END IF
  745. NEXT
  746. END IF
  747. //出现异常,让用户选择处理方式
  748. deal:
  749. Int li_ifaudit
  750. IF cbx_audit.Checked THEN
  751. li_ifaudit = 1
  752. ELSE
  753. li_ifaudit = 0
  754. END IF
  755. IF li_iffail = 1 THEN
  756. OpenWithParm(w_sptprice_deal_ljfieb,ls_msg)
  757. li_returnflag = Message.DoubleParm
  758. IF li_returnflag = 0 THEN
  759. RETURN
  760. ELSEIF li_returnflag = 1 THEN
  761. //重新建立新的单据
  762. IF wf_add_quote(1,li_ifaudit) = 0 THEN RETURN
  763. END IF
  764. ELSEIF li_iffail = 2 THEN
  765. //没有询价,供应商直接报价,不询问直接新建询价单
  766. IF wf_add_quote(1,li_ifaudit) = 0 THEN RETURN
  767. ELSE
  768. //直接更新
  769. IF wf_add_quote(0,li_ifaudit) = 0 THEN RETURN
  770. END IF
  771. String arg_msg
  772. String ls_SerialNum
  773. SELECT TOP 1 NEWID() INTO :ls_SerialNum
  774. From u_user Using sqlca;
  775. IF sqlca.SQLCode <> 0 THEN
  776. ROLLBACK Using sqlca;
  777. MessageBox('Error','生成序列号失败,'+sqlca.SQLErrText)
  778. RETURN
  779. END IF
  780. IF IsNull(ls_SerialNum) THEN ls_SerialNum = ''
  781. IF ls_SerialNum = '' THEN
  782. MessageBox('Error','错误的发送序列号')
  783. RETURN
  784. END IF
  785. IF uo_fieb.add_packet(ls_SerialNum,'',ins_receid,ins_reccesccode,ins_sendid,ins_sendsccode,6,'安排报价','','',ins_sn,ins_RelatedCode,0,arg_msg,True) = 0 THEN
  786. MessageBox('系统提示','发送确认指令失败 '+arg_msg)
  787. RETURN
  788. END IF
  789. MessageBox('系统提示','操作成功!')
  790. Close(Parent)
  791. end event
  792. type cb_feedback from uo_imflatbutton within w_quote_receive_ljfieb
  793. integer x = 494
  794. integer width = 494
  795. integer height = 164
  796. integer taborder = 10
  797. boolean bringtotop = true
  798. string text = "相关供应商询价单"
  799. string normalpicname = "open.BMP"
  800. integer picsize = 16
  801. toolbaralignment pic_align = alignattop!
  802. boolean border = false
  803. end type
  804. event clicked;call super::clicked;Long ll_row
  805. String ls_code
  806. Long cnt
  807. ll_row = dw_uc.GetRow()
  808. IF ll_row <= 0 THEN RETURN
  809. ls_code = dw_uc.Object.fiebrelcode[ll_row]
  810. IF Trim(ls_code) = '' THEN
  811. MessageBox('系统提示','没有相关供应商询价单')
  812. RETURN
  813. END IF
  814. SELECT count(*)
  815. INTO :cnt
  816. FROM u_spt_price_change
  817. Where Billcode = :ls_code Using sqlca;
  818. IF sqlca.SQLCode <> 0 THEN
  819. MessageBox('Error','查询销售报价单信息失败,'+sqlca.SQLErrText)
  820. RETURN
  821. END IF
  822. IF cnt = 0 THEN
  823. MessageBox('询问','无法查询相关销售报价单,可能已被删除')
  824. RETURN
  825. ELSE
  826. f_open_win(ins_scid,ls_code)
  827. END IF
  828. end event
  829. type cb_reject from uo_imflatbutton within w_quote_receive_ljfieb
  830. integer x = 987
  831. integer width = 219
  832. integer height = 164
  833. integer taborder = 30
  834. boolean bringtotop = true
  835. string text = "拒绝"
  836. string normalpicname = "DELETE.BMP"
  837. integer picsize = 16
  838. toolbaralignment pic_align = alignattop!
  839. boolean border = false
  840. end type
  841. event clicked;call super::clicked;IF Not f_power_ind(3169) THEN
  842. MessageBox(publ_operator,sys_msg_pow)
  843. RETURN
  844. END IF
  845. String arg_summary,arg_postscript,arg_remark
  846. String arg_msg
  847. String ls_SerialNum
  848. SELECT TOP 1 NEWID() INTO :ls_SerialNum
  849. From u_user Using sqlca;
  850. IF sqlca.SQLCode <> 0 THEN
  851. ROLLBACK Using sqlca;
  852. MessageBox('Error','生成序列号失败,'+sqlca.SQLErrText)
  853. RETURN
  854. END IF
  855. IF IsNull(ls_SerialNum) THEN ls_SerialNum = ''
  856. IF ls_SerialNum = '' THEN
  857. MessageBox('Error','错误的发送序列号')
  858. RETURN
  859. END IF
  860. s_packet_ljfieb s_pack,s_return
  861. //s_pack.summary = '拒绝订单:'+ins_RelatedCode
  862. OpenWithParm(w_dscrp_edit_ljfieb,s_pack)
  863. s_return = Message.PowerObjectParm
  864. IF s_return.returnflag <> 1 THEN RETURN
  865. //arg_summary = s_return.summary
  866. arg_postscript = s_return.postscript
  867. arg_remark = s_return.remark
  868. UPDATE LJFIEB_tempquote
  869. SET flag = 2
  870. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  871. IF tr_eb_sqlca.SQLCode <> 0 THEN
  872. ROLLBACK Using tr_eb_sqlca;
  873. MessageBox('Error','更新供应商报价单状态失败,'+tr_eb_sqlca.SQLErrText)
  874. RETURN 0
  875. END IF
  876. //更新本地通信记录
  877. UPDATE LJFIEB_packet
  878. SET status = 10,
  879. Complete = 1
  880. Where SerialNum = :ins_sn Using tr_eb_sqlca;
  881. IF tr_eb_sqlca.SQLCode <> 0 THEN
  882. ROLLBACK Using tr_eb_sqlca;
  883. MessageBox('Error', '更新本地通信记录失败,'+tr_eb_sqlca.SQLErrText)
  884. RETURN
  885. END IF
  886. IF uo_fieb.add_packet(ls_SerialNum,'',ins_receid,ins_reccesccode,ins_sendid,ins_sendsccode,11,arg_summary,arg_postscript,arg_remark,ins_sn,ins_RelatedCode,0,arg_msg,True) = 0 THEN
  887. MessageBox('系统提示','发送确认指令失败 '+arg_msg)
  888. RETURN
  889. END IF
  890. MessageBox('系统提示','操作成功')
  891. Close(Parent)
  892. end event
  893. type mle_2 from multilineedit within w_quote_receive_ljfieb
  894. integer x = 1975
  895. integer y = 788
  896. integer width = 1595
  897. integer height = 264
  898. integer taborder = 50
  899. boolean bringtotop = true
  900. integer textsize = -9
  901. integer weight = 400
  902. fontcharset fontcharset = gb2312charset!
  903. fontpitch fontpitch = variable!
  904. string facename = "宋体"
  905. long textcolor = 33554432
  906. boolean vscrollbar = true
  907. boolean autovscroll = true
  908. boolean displayonly = true
  909. borderstyle borderstyle = stylelowered!
  910. end type
  911. type st_3 from statictext within w_quote_receive_ljfieb
  912. integer x = 1984
  913. integer y = 728
  914. integer width = 178
  915. integer height = 48
  916. boolean bringtotop = true
  917. integer textsize = -9
  918. integer weight = 400
  919. fontcharset fontcharset = gb2312charset!
  920. fontpitch fontpitch = variable!
  921. string facename = "宋体"
  922. long textcolor = 33554432
  923. long backcolor = 134217739
  924. string text = "留言"
  925. boolean focusrectangle = false
  926. end type
  927. type cbx_audit from checkbox within w_quote_receive_ljfieb
  928. integer x = 722
  929. integer y = 196
  930. integer width = 795
  931. integer height = 60
  932. boolean bringtotop = true
  933. integer textsize = -9
  934. integer weight = 400
  935. fontcharset fontcharset = gb2312charset!
  936. fontpitch fontpitch = variable!
  937. string facename = "宋体"
  938. long textcolor = 33554432
  939. long backcolor = 134217739
  940. string text = "更新供应商询价单后审核单据"
  941. end type
  942. event constructor;IF Not (f_power_ind(115) Or f_power_ind(426)) THEN
  943. This.Visible = False
  944. This.Checked = False
  945. ELSE
  946. This.Visible = True
  947. Int if_audit
  948. if_audit = Integer(f_ProfileString (sys_empid,'w_quote_receive_ljfieb', "if_audit", '0'))
  949. IF if_audit = 0 THEN
  950. This.Checked = False
  951. ELSE
  952. This.Checked = True
  953. END IF
  954. END IF
  955. end event
  956. event clicked;Int if_audit
  957. IF This.Checked THEN
  958. if_audit = 1
  959. ELSE
  960. if_audit = 0
  961. END IF
  962. f_SetProfileString (sys_empid,'w_quote_receive_ljfieb', "if_audit", String(if_audit))
  963. end event
  964. type cb_1 from uo_imflatbutton within w_quote_receive_ljfieb
  965. integer x = 1207
  966. integer width = 219
  967. integer height = 164
  968. integer taborder = 40
  969. boolean bringtotop = true
  970. string text = "匹配"
  971. string normalpicname = "update2.BMP"
  972. integer picsize = 16
  973. toolbaralignment pic_align = alignattop!
  974. boolean border = false
  975. end type
  976. event clicked;call super::clicked;openwithparm(w_mtrl_receive_ljfieb, '')
  977. string arg_msg
  978. IF wf_retrieve(ins_sn,ins_sendid,ins_sendsccode,arg_msg) = 0 THEN
  979. MessageBox('Error',arg_msg)
  980. RETURN
  981. END IF
  982. end event
  983. type ln_bar from line within w_quote_receive_ljfieb
  984. long linecolor = 268435456
  985. integer linethickness = 4
  986. integer beginy = 172
  987. integer endx = 3200
  988. integer endy = 172
  989. end type
  990. type ln_bar2 from line within w_quote_receive_ljfieb
  991. long linecolor = 16777215
  992. integer linethickness = 4
  993. integer beginx = 9
  994. integer beginy = 176
  995. integer endx = 3273
  996. integer endy = 176
  997. end type
  998. type ln_1 from line within w_quote_receive_ljfieb
  999. long linecolor = 268435456
  1000. integer linethickness = 4
  1001. integer beginy = 284
  1002. integer endx = 3250
  1003. integer endy = 284
  1004. end type
  1005. type ln_2 from line within w_quote_receive_ljfieb
  1006. long linecolor = 16777215
  1007. integer linethickness = 4
  1008. integer beginy = 288
  1009. integer endx = 3282
  1010. integer endy = 288
  1011. end type
  1012. type r_bar from rectangle within w_quote_receive_ljfieb
  1013. long linecolor = 16777215
  1014. integer linethickness = 4
  1015. long fillcolor = 1073741824
  1016. integer x = 3351
  1017. integer width = 87
  1018. integer height = 68
  1019. end type
  1020. event constructor;this.fillcolor = 14215660
  1021. this.linecolor = 14215660
  1022. this.x = -1
  1023. this.y = -1
  1024. this.height = ln_bar.beginy - 5
  1025. end event