123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- $PBExportHeader$w_add_cusmtrlname.srw
- forward
- global type w_add_cusmtrlname from w_publ_choice
- end type
- type cb_1 from uo_imflatbutton within w_add_cusmtrlname
- end type
- type st_2 from statictext within w_add_cusmtrlname
- end type
- end forward
- global type w_add_cusmtrlname from w_publ_choice
- integer width = 3867
- integer height = 1408
- string title = "客户物料别名"
- boolean controlmenu = true
- event ue_f7 ( )
- cb_1 cb_1
- st_2 st_2
- end type
- global w_add_cusmtrlname w_add_cusmtrlname
- type variables
- Long cur_mtrlid = 0
- end variables
- forward prototypes
- public function integer wf_add_cusmtrlname (long arg_mtrlid, long arg_cusid, string arg_cusmtrlname, string arg_cusmtrlcode, string arg_cusmtrlmode, 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_cust_ch) 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_cust_cuscode[dw_ch.GetRow()]))
-
- OpenWithParm(w_cust_ch,s_ch_tran) //调用
-
- s_custom S_INSCUST
- S_INSCUST = Message.PowerObjectParm //接受返回结构
-
- IF S_INSCUST.cusid > 0 THEN //正常返回值则可以取以下值
- dw_ch.SetRedraw(FALSE)
- dw_ch.Object.u_cusmtrlname_cusid[uc_row] = S_INSCUST.cusid
- dw_ch.Object.u_cust_name[uc_row] = S_INSCUST.Name
- dw_ch.Object.u_cust_cuscode[uc_row] = S_INSCUST.cuscode
-
- dw_ch.SetRedraw(TRUE)
- dw_ch.SetColumn("u_cusmtrlname_cusmtrlname")
-
- END IF
- END IF
- end event
- public function integer wf_add_cusmtrlname (long arg_mtrlid, long arg_cusid, string arg_cusmtrlname, string arg_cusmtrlcode, string arg_cusmtrlmode, ref string arg_msg, boolean arg_ifcommit);Long rslt = 1
- Long cnt = 0
- IF IsNull(arg_cusmtrlname) THEN arg_cusmtrlname = ''
- IF IsNull(arg_cusmtrlcode) THEN arg_cusmtrlcode = ''
- IF IsNull(arg_cusmtrlmode) THEN arg_cusmtrlmode = ''
- SELECT count(*) INTO :cnt
- FROM u_cust
- Where u_cust.cusid = :arg_cusid;
- 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_cusmtrlname
- WHERE u_cusmtrlname.cusid = :arg_cusid
- AND u_cusmtrlname.mtrlid = :arg_mtrlid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '因网络或其他原因查询客户物料别名失败'+sqlca.SQLErrText
- GOTO ext
- END IF
- IF cnt > 0 THEN
- UPDATE u_cusmtrlname
- SET cusmtrlname = :arg_cusmtrlname,cusmtrlcode = :arg_cusmtrlcode,cusmtrlmode = :arg_cusmtrlmode
- WHERE u_cusmtrlname.cusid = :arg_cusid
- AND u_cusmtrlname.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_cusmtrlname
- (cusid,
- mtrlid,
- cusmtrlname,
- cusmtrlcode,
- cusmtrlmode)
- VALUES
- (:arg_cusid,
- :arg_mtrlid,
- :arg_cusmtrlname,
- :arg_cusmtrlcode,
- :arg_cusmtrlmode);
- 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_cusmtrlname.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_cusmtrlname.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_cusmtrlname
- boolean visible = false
- integer x = 1513
- integer y = 1644
- end type
- type cb_exit from w_publ_choice`cb_exit within w_add_cusmtrlname
- integer x = 3534
- integer y = 1212
- 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_cusmtrlname
- boolean visible = false
- integer x = 754
- integer y = 1668
- end type
- type dw_ch from w_publ_choice`dw_ch within w_add_cusmtrlname
- integer y = 0
- integer width = 3854
- integer height = 1196
- string dataobject = "dw_add_cusmtrlname"
- end type
- event dw_ch::dwnkey;IF dw_edit_mode THEN
-
- String ls_cuscode,ls_cusname
- Long li_row,ll_cusid
- dw_ch.AcceptText()
- li_row = dw_ch.GetRow()
-
- IF dw_ch.GetColumnName ( ) = 'u_cust_cuscode' AND Key = keyenter! THEN
- ls_cuscode = Trim(dw_ch.Object.u_cust_cuscode[li_row])
- SELECT cusid,Name INTO :ll_cusid,:ls_cusname FROM u_cust Where cuscode = :ls_cuscode;
- dw_ch.SetRedraw(FALSE)
- IF sqlca.SQLCode <> 0 THEN
- PARENT.TriggerEvent('ue_f7')
- RETURN 1
- ELSE
- dw_ch.Object.u_cusmtrlname_cusid[li_row] = ll_cusid
- dw_ch.Object.u_cus_name[li_row] = ls_cusname
- END IF
- dw_ch.SetRedraw(TRUE)
- dw_ch.SetColumn("u_cusmtrlname_cusmtrlname")
- RETURN 1
- ElseIf (dw_ch.GetColumnName ( ) = 'u_cusmtrlname_cusmtrlname' 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_cust_cuscode' THEN
-
- PARENT.TriggerEvent('ue_f7')
-
- END IF
- end event
- type st_1 from w_publ_choice`st_1 within w_add_cusmtrlname
- boolean visible = false
- integer x = 1294
- integer y = 1676
- end type
- type cb_retrieve from w_publ_choice`cb_retrieve within w_add_cusmtrlname
- boolean visible = false
- integer x = 549
- integer y = 1660
- end type
- type cb_choice from w_publ_choice`cb_choice within w_add_cusmtrlname
- integer x = 3136
- integer y = 1212
- 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_cusid
- DateTime d_indate
- SetNull(d_indate)
- dw_ch.AcceptText()
- Long ll_rowcount
- Long ls_i
- String ls_cusmtrlname,ls_unit,ls_cusmtrlcode,ls_cusmtrlmode
- ll_rowcount = dw_ch.RowCount()
- FOR ls_i = 1 TO ll_rowcount
-
- ls_cusmtrlname = dw_ch.Object.u_cusmtrlname_cusmtrlname[ls_i]
- ls_cusmtrlcode = dw_ch.Object.u_cusmtrlname_cusmtrlcode[ls_i]
- ls_cusmtrlmode = dw_ch.Object.u_cusmtrlname_cusmtrlmode[ls_i]
- l_cusid = dw_ch.Object.u_cusmtrlname_cusid[ls_i]
-
- IF l_cusid <= 0 OR IsNull(l_cusid) THEN CONTINUE
-
- Boolean ifcommit = FALSE
- IF ls_i = ll_rowcount THEN ifcommit = TRUE
- IF wf_add_cusmtrlname(cur_mtrlid,l_cusid,ls_cusmtrlname,ls_cusmtrlcode,ls_cusmtrlmode,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_cusmtrlname
- end type
- type ln_bar2 from w_publ_choice`ln_bar2 within w_add_cusmtrlname
- end type
- type r_bar from w_publ_choice`r_bar within w_add_cusmtrlname
- end type
- type ln_1 from w_publ_choice`ln_1 within w_add_cusmtrlname
- end type
- type ln_2 from w_publ_choice`ln_2 within w_add_cusmtrlname
- end type
- type cb_1 from uo_imflatbutton within w_add_cusmtrlname
- 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_cusmtrlname
- 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
|