123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- $PBExportHeader$w_add_sptmtrlname.srw
- forward
- global type w_add_sptmtrlname from w_publ_choice
- end type
- type cb_1 from uo_imflatbutton within w_add_sptmtrlname
- end type
- type st_2 from statictext within w_add_sptmtrlname
- end type
- end forward
- global type w_add_sptmtrlname from w_publ_choice
- integer width = 2331
- integer height = 1408
- string title = "供应商物料别名"
- boolean controlmenu = true
- event ue_f7 ( )
- cb_1 cb_1
- st_2 st_2
- end type
- global w_add_sptmtrlname w_add_sptmtrlname
- type variables
- Long cur_mtrlid = 0
- end variables
- forward prototypes
- public function integer wf_add_sptmtrlname (long arg_mtrlid, long arg_sptid, string arg_sptmtrlname, string arg_sptmtrlcode, string arg_sptmtrlmode, ref string arg_msg, boolean arg_ifcommit)
- end prototypes
- event ue_f7();IF NOT dw_edit_mode THEN RETURN
- Long uc_row
- uc_row = dw_ch.GetRow()
- IF uc_row = 0 THEN
- MessageBox('提示','请选定单据!',information!,ok!)
- RETURN
- END IF
- dw_ch.AcceptText()
- IF NOT IsValid(W_spt_edit) THEN
- s_edit_index_tran s_ch_tran //传递参数使用
- s_ch_tran.if_retrieve_all = FALSE //是否一次RETRIEVE所有行
- s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
- s_ch_tran.arg_pkid = 0 //目标定位PKID (备用)
- //查询列(物料编码)部分内容,用于初步筛选
- s_ch_tran.arg_string_code = Upper(Trim(dw_ch.Object.u_spt_sptcode[dw_ch.GetRow()]))
-
- OpenWithParm(W_spt_edit,s_ch_tran) //调用
-
- S_spt S_INSCUST
- S_INSCUST = Message.PowerObjectParm //接受返回结构
-
- IF S_INSCUST.sptid > 0 THEN //正常返回值则可以取以下值
- dw_ch.SetRedraw(FALSE)
- dw_ch.Object.u_sptmtrlname_sptid[uc_row] = S_INSCUST.sptid
- dw_ch.Object.u_spt_name[uc_row] = S_INSCUST.Name
- dw_ch.Object.u_spt_sptcode[uc_row] = S_INSCUST.sptcode
-
- dw_ch.SetRedraw(TRUE)
- dw_ch.SetColumn("u_sptmtrlname_sptmtrlname")
-
- END IF
- END IF
- end event
- public function integer wf_add_sptmtrlname (long arg_mtrlid, long arg_sptid, string arg_sptmtrlname, string arg_sptmtrlcode, string arg_sptmtrlmode, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1
- Long cnt = 0
- IF IsNull(arg_sptmtrlname) THEN arg_sptmtrlname = ''
- SELECT count(*) INTO :cnt
- FROM u_spt
- Where u_spt.sptid = :arg_sptid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络或其它原因导致查询供应商资料失败'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = "供应商不存在"
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_mtrldef
- Where u_mtrldef.mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络和其他原因查询失败'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt = 0 THEN
- rslt = 0
- arg_msg = '物料资料不存在'
- GOTO ext
- END IF
- cnt = 0
- SELECT count(*) INTO :cnt
- FROM u_sptmtrlname
- WHERE u_sptmtrlname.sptid = :arg_sptid
- AND u_sptmtrlname.mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络或其他原因查询供应商物料别名失败'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt > 0 THEN
- UPDATE u_sptmtrlname
- SET sptmtrlname = :arg_sptmtrlname,
- sptmtrlcode = :arg_sptmtrlcode,
- sptmtrlmode = :arg_sptmtrlmode
- WHERE u_sptmtrlname.sptid = :arg_sptid
- AND u_sptmtrlname.mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络或其它原因,供应商物料别名更新失败'+sqlca.SQLErrText
- GOTO ext
- END IF
- ELSEIF cnt = 0 THEN
- INSERT INTO u_sptmtrlname
- (sptid,
- mtrlid,
- sptmtrlname,
- sptmtrlcode,
- sptmtrlmode)
- VALUES
- (:arg_sptid,
- :arg_mtrlid,
- :arg_sptmtrlname,
- :arg_sptmtrlcode,
- :arg_sptmtrlmode);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络或其他原因,新增供应商物料别名失败'
- GOTO ext
- END IF
- END IF
- ext:
- IF rslt = 0 THEN
- ROLLBACK;
- ELSEIF arg_ifcommit AND rslt = 1 THEN
- COMMIT;
- END IF
- RETURN rslt
- end function
- on w_add_sptmtrlname.create
- int iCurrent
- call super::create
- this.cb_1=create cb_1
- this.st_2=create st_2
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cb_1
- this.Control[iCurrent+2]=this.st_2
- end on
- on w_add_sptmtrlname.destroy
- call super::destroy
- destroy(this.cb_1)
- destroy(this.st_2)
- end on
- event open;this.triggerevent('ue_before_open')
- wf_movetocenter()
- dw_edit_mode=true
- dw_CH.SetTransObject (sqlca)
- cur_mtrlid=message.DoubleParm
- dw_CH.retrieve(cur_mtrlid)
- dw_ch.InsertRow (0)
- end event
- type cb_func from w_publ_choice`cb_func within w_add_sptmtrlname
- boolean visible = false
- integer x = 1513
- integer y = 1644
- end type
- type cb_exit from w_publ_choice`cb_exit within w_add_sptmtrlname
- integer x = 1975
- integer y = 1208
- integer width = 311
- integer height = 96
- integer picsize = 0
- toolbaralignment pic_align = alignatleft!
- boolean border = true
- end type
- type sle_ch from w_publ_choice`sle_ch within w_add_sptmtrlname
- boolean visible = false
- integer x = 754
- integer y = 1668
- end type
- type dw_ch from w_publ_choice`dw_ch within w_add_sptmtrlname
- integer y = 0
- integer width = 2290
- integer height = 1196
- string dataobject = "dw_add_sptmtrlname"
- end type
- event dw_ch::dwnkey;IF dw_edit_mode THEN
-
- String ls_sptcode,ls_sptname
- Long li_row,ll_sptid
- dw_ch.AcceptText()
- li_row = dw_ch.GetRow()
-
- IF dw_ch.GetColumnName ( ) = 'u_spt_sptcode' AND Key = keyenter! THEN
- ls_sptcode = Trim(dw_ch.Object.u_spt_sptcode[li_row])
- SELECT sptid,Name INTO :ll_sptid,:ls_sptname FROM u_spt Where sptcode = :ls_sptcode;
- dw_ch.SetRedraw(FALSE)
- IF sqlca.SQLCode <> 0 THEN
- PARENT.TriggerEvent('ue_f7')
- RETURN 1
- ELSE
- dw_ch.Object.u_sptmtrlname_sptid[li_row] = ll_sptid
- dw_ch.Object.u_spt_name[li_row] = ls_sptname
- END IF
- dw_ch.SetRedraw(TRUE)
- dw_ch.SetColumn("u_sptmtrlname_sptmtrlname")
- RETURN 1
- ElseIf (dw_ch.GetColumnName ( ) = 'u_sptmtrlname_sptmtrlname' AND Key = keyenter!) Or ( KeyDown(Keydownarrow!)) THEN
- dw_ch.InsertRow(0)
- END IF
- END IF
- end event
- event dw_ch::doubleclicked;IF dw_edit_mode AND dw_ch.GetColumnName() = 'u_spt_sptcode' THEN
-
- PARENT.TriggerEvent('ue_f7')
-
- END IF
- end event
- type st_1 from w_publ_choice`st_1 within w_add_sptmtrlname
- boolean visible = false
- integer x = 1294
- integer y = 1676
- end type
- type cb_retrieve from w_publ_choice`cb_retrieve within w_add_sptmtrlname
- boolean visible = false
- integer x = 549
- integer y = 1660
- end type
- type cb_choice from w_publ_choice`cb_choice within w_add_sptmtrlname
- integer x = 1527
- integer y = 1208
- integer width = 311
- integer height = 96
- string text = "确定"
- integer picsize = 0
- toolbaralignment pic_align = alignatleft!
- boolean border = true
- end type
- event cb_choice::clicked;call super::clicked;String err_msg = ''
- Long l_sptid
- DateTime d_indate
- SetNull(d_indate)
- dw_ch.AcceptText()
- Long ll_rowcount
- Long ls_i
- String ls_sptmtrlname,ls_unit,ls_sptmtrlcode,ls_sptmtrlmode
- ll_rowcount = dw_ch.RowCount()
- FOR ls_i = 1 TO ll_rowcount
-
- ls_sptmtrlname = dw_ch.Object.u_sptmtrlname_sptmtrlname[ls_i]
- ls_sptmtrlcode =dw_ch.Object.u_sptmtrlname_sptmtrlcode[ls_i]
- ls_sptmtrlmode =dw_ch.Object.u_sptmtrlname_sptmtrlmode[ls_i]
- l_sptid = dw_ch.Object.u_sptmtrlname_sptid[ls_i]
-
- IF l_sptid <= 0 OR IsNull(l_sptid) THEN CONTINUE
-
- Boolean ifcommit = FALSE
- IF ls_i = ll_rowcount THEN ifcommit = TRUE
- IF wf_add_sptmtrlname(cur_mtrlid,l_sptid,ls_sptmtrlname,ls_sptmtrlcode,ls_sptmtrlmode,err_msg,ifcommit) = 0 THEN
- MessageBox('错误',err_msg,stopsign!,ok!)
- RETURN
- END IF
-
- NEXT
- MessageBox('提示','添加成功',information!,ok!)
- dw_edit_mode = FALSE
- Close(PARENT)
- end event
- type ln_bar from w_publ_choice`ln_bar within w_add_sptmtrlname
- end type
- type ln_bar2 from w_publ_choice`ln_bar2 within w_add_sptmtrlname
- end type
- type r_bar from w_publ_choice`r_bar within w_add_sptmtrlname
- end type
- type ln_1 from w_publ_choice`ln_1 within w_add_sptmtrlname
- end type
- type ln_2 from w_publ_choice`ln_2 within w_add_sptmtrlname
- end type
- type cb_1 from uo_imflatbutton within w_add_sptmtrlname
- integer x = 23
- integer y = 1208
- integer height = 96
- integer taborder = 50
- boolean bringtotop = true
- string text = "选供应商"
- end type
- event clicked;call super::clicked;parent.triggerevent('ue_f7')
- end event
- type st_2 from statictext within w_add_sptmtrlname
- integer x = 375
- integer y = 1232
- integer width = 507
- integer height = 48
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 16711680
- long backcolor = 134217739
- string text = "也可双击选择供应商"
- boolean focusrectangle = false
- end type
|