123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451 |
- $PBExportHeader$w_cusarea_add.srw
- forward
- global type w_cusarea_add from w_publ_base
- end type
- type dw_1 from datawindow within w_cusarea_add
- end type
- type cb_1 from uo_imflatbutton within w_cusarea_add
- end type
- type cbx_auto_code from checkbox within w_cusarea_add
- end type
- end forward
- global type w_cusarea_add from w_publ_base
- integer width = 1513
- integer height = 1036
- string title = "区域建立"
- boolean minbox = false
- windowtype windowtype = response!
- dw_1 dw_1
- cb_1 cb_1
- cbx_auto_code cbx_auto_code
- end type
- global w_cusarea_add w_cusarea_add
- type variables
- s_cusarea s_area
- long i_parentid
- string i_parent_handtype
- end variables
- forward prototypes
- public function integer wf_checkrand (long arg_cusareaid)
- public function integer wf_save ()
- public subroutine wf_set_typecode (integer arg_row, long arg_parentid)
- end prototypes
- public function integer wf_checkrand (long arg_cusareaid);Long ll_parentid
- Long ll_cusareaid_arr[],ll_cusareaid
- Long rt_b,rt_s,count,ls_i
- dw_1.accepttext()
- ll_parentid = dw_1.object.parentid[dw_1.getrow()]
- IF ll_parentid = arg_cusareaid THEN RETURN 1
- DECLARE area_cur CURSOR FOR
- SELECT u_cusarea.cusareaid
- FROM u_cusarea
- Where ( u_cusarea.parentid = :arg_cusareaid );
- OPEN area_cur;
- FETCH area_cur INTO :ll_cusareaid;
- DO WHILE sqlca.SQLCode = 0
- count++
- ll_cusareaid_arr[count] = ll_cusareaid
- FETCH area_cur INTO :ll_cusareaid;
- LOOP
- CLOSE area_cur;
- FOR ls_i = 1 TO count
- rt_b = wf_checkrand(ll_cusareaid_arr[ls_i])
- IF rt_b <> 0 THEN RETURN rt_b
- NEXT
- RETURN 0
- end function
- public function integer wf_save ();//Long ll_row
- //Long ll_cusareaid,ll_parentid
- //Int ls_cr_rsl
- //String ls_parent_handtype
- //
- //dw_1.AcceptText()
- //ll_row = dw_1.GetRow()
- //IF ll_row <= 0 THEN
- // MessageBox('提示','请选择资料', Information!, OK! )
- // RETURN
- //END IF
- //
- //dw_1.Object.cusareaname[ll_row] = Trim(dw_1.Object.cusareaname[ll_row])
- //
- //IF dw_1.Object.typecode[ll_row] = '' THEN
- // MessageBox('提示','请输入区域编号!', Information!, OK! )
- // dw_1.SetColumn('typecode')
- // dw_1.SetFocus()
- // RETURN
- //END IF
- //
- //IF dw_1.Object.cusareaname[ll_row] = '' THEN
- // MessageBox('提示','请输入区域名称!', Information!, OK! )
- // dw_1.SetColumn('cusareaname')
- // dw_1.SetFocus()
- // RETURN
- //END IF
- //
- //IF pos(dw_1.Object.cusareaname[ll_row],'>') > 0 THEN
- // MessageBox('提示','区域名称不能包含符号 > !', Information!, OK! )
- // dw_1.SetColumn('cusareaname')
- // dw_1.SetFocus()
- // RETURN
- //END IF
- //
- ////检查闭环
- //ll_cusareaid = dw_1.Object.cusareaid[dw_1.GetRow()]
- //ll_parentid = dw_1.Object.parentid[dw_1.GetRow()]
- //
- //IF ll_cusareaid > 0 THEN
- // IF ll_parentid <> i_parentid THEN
- // ls_cr_rsl = wf_checkrand(ll_cusareaid)
- // IF ls_cr_rsl = 1 THEN
- // MessageBox('提示',String(dw_1.Object.cusareaname[dw_1.GetRow()])+' 发现环,请核对!', Information!, OK! )
- // RETURN
- // ELSEIF ls_cr_rsl < 0 THEN
- // MessageBox('提示','因为网络或其他原因导致查环操作失败!['+String(dw_1.Object.cusareaname[dw_1.GetRow()])+']', Information!, OK! )
- // RETURN
- // END IF
- // END IF
- //END IF
- ////
- //
- //s_area.cusareaid = dw_1.Object.cusareaid[ll_row]
- //s_area.cusareaname = dw_1.Object.cusareaname[ll_row]
- //s_area.sonflag = dw_1.Object.sonflag[ll_row]
- //s_area.parentid = dw_1.Object.parentid[ll_row]
- //
- //IF ll_parentid <> i_parentid THEN
- // IF ll_parentid = 0 THEN
- // ls_parent_handtype = ''
- // ELSE
- // SELECT areaname INTO :ls_parent_handtype
- // FROM u_cusarea
- // Where cusareaid = :ll_parentid;
- // IF sqlca.SQLCode <> 0 THEN
- // MessageBox('提示','查询上级区域资料失败', Information!, OK! )
- // RETURN
- // END IF
- // END IF
- //ELSE
- // if ll_parentid = 0 then
- // ls_parent_handtype = ''
- // else
- // ls_parent_handtype = i_parent_handtype
- // end if
- //END IF
- //
- //
- //s_area.areaname = ls_parent_handtype + dw_1.Object.cusareaname[ll_row] + '>>'
- //
- //Close(PARENT)
- return 1
- end function
- public subroutine wf_set_typecode (integer arg_row, long arg_parentid);String ls_typecode, ls_typecodestr
- Int li_maxnum
- IF arg_row <= 0 THEN
- RETURN
- END IF
- SELECT count(*)
- INTO :li_maxnum
- FROM u_cusarea
- Where parentid = :arg_parentid;
- IF sqlca.SQLCode <> 0 THEN
- li_maxnum = 0
- END IF
- ls_typecode = String(li_maxnum + 1, "00")
- dw_1.Object.typecode[arg_row] = ls_typecode
- SELECT typecodestr
- INTO :ls_typecodestr
- FROM u_cusarea
- Where cusareaid = :arg_parentid;
- IF sqlca.SQLCode <> 0 THEN
- ls_typecodestr = ''
- END IF
- dw_1.Object.typecodestr[arg_row] = ls_typecodestr + ls_typecode
- end subroutine
- on w_cusarea_add.create
- int iCurrent
- call super::create
- this.dw_1=create dw_1
- this.cb_1=create cb_1
- this.cbx_auto_code=create cbx_auto_code
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.dw_1
- this.Control[iCurrent+2]=this.cb_1
- this.Control[iCurrent+3]=this.cbx_auto_code
- end on
- on w_cusarea_add.destroy
- call super::destroy
- destroy(this.dw_1)
- destroy(this.cb_1)
- destroy(this.cbx_auto_code)
- end on
- event close;call super::close;closewithreturn(this,s_area)
- end event
- event open;call super::open;dw_1.SetTransObject(sqlca)
- Long ll_row
- s_area = Message.PowerObjectParm
- IF s_area.cusareaid = 0 THEN
- ll_row = dw_1.InsertRow(0)
- dw_1.Object.cusareaid[ll_row] = s_area.cusareaid
- dw_1.Object.sonflag[ll_row] = s_area.sonflag
- dw_1.Object.parentid[ll_row] = s_area.parentid
- if cbx_auto_code.checked then
- wf_set_typecode(ll_row, s_area.parentid)
- end if
- ELSE
- dw_1.Retrieve(s_area.cusareaid)
- END IF
- ////
- //datawindowchild childdw
- //dw_1.GetChild("parentid",childdw)
- //childdw.SetTransObject (sqlca)
- //long li_row
- //li_row = childdw.insertrow(0)
-
- //
- dw_1.SetFocus()
- dw_1.SetColumn('cusareaname')
- i_parent_handtype = s_area.parenthandtype
- s_area.cusareaid = -1
- end event
- type cb_func from w_publ_base`cb_func within w_cusarea_add
- integer x = 617
- integer y = 736
- integer width = 311
- integer height = 96
- string text = "保存"
- boolean default = true
- string normalpicname = "ok.bmp"
- integer picsize = 0
- toolbaralignment pic_align = alignatleft!
- boolean border = true
- end type
- event cb_func::clicked;call super::clicked;Long ll_row
- Long ll_cusareaid,ll_parentid
- Int ls_cr_rsl
- String ls_parent_handtype
- dw_1.AcceptText()
- ll_row = dw_1.GetRow()
- IF ll_row <= 0 THEN
- MessageBox('提示','请选择资料', Information!, OK! )
- RETURN
- END IF
- dw_1.Object.cusareaname[ll_row] = Trim(dw_1.Object.cusareaname[ll_row])
- IF dw_1.Object.typecode[ll_row] = '' THEN
- MessageBox('提示','请输入区域编号!', Information!, OK! )
- dw_1.SetColumn('typecode')
- dw_1.SetFocus()
- RETURN
- END IF
- IF dw_1.Object.cusareaname[ll_row] = '' THEN
- MessageBox('提示','请输入区域名称!', Information!, OK! )
- dw_1.SetColumn('cusareaname')
- dw_1.SetFocus()
- RETURN
- END IF
- IF Pos(dw_1.Object.cusareaname[ll_row],'>') > 0 THEN
- MessageBox('提示','区域名称不能包含符号 > !', Information!, OK! )
- dw_1.SetColumn('cusareaname')
- dw_1.SetFocus()
- RETURN
- END IF
- //检查闭环
- ll_cusareaid = dw_1.Object.cusareaid[dw_1.GetRow()]
- ll_parentid = dw_1.Object.parentid[dw_1.GetRow()]
- IF ll_cusareaid > 0 THEN
- IF ll_parentid <> i_parentid THEN
- ls_cr_rsl = wf_checkrand(ll_cusareaid)
- IF ls_cr_rsl = 1 THEN
- MessageBox('提示',String(dw_1.Object.cusareaname[dw_1.GetRow()])+' 发现环,请核对!', Information!, OK! )
- RETURN
- ELSEIF ls_cr_rsl < 0 THEN
- MessageBox('提示','因为网络或其他原因导致查环操作失败!['+String(dw_1.Object.cusareaname[dw_1.GetRow()])+']', Information!, OK! )
- RETURN
- END IF
- END IF
- END IF
- //
- s_area.cusareaid = dw_1.Object.cusareaid[ll_row]
- s_area.cusareaname = dw_1.Object.cusareaname[ll_row]
- s_area.sonflag = dw_1.Object.sonflag[ll_row]
- s_area.parentid = dw_1.Object.parentid[ll_row]
- IF ll_parentid = 0 THEN
- ls_parent_handtype = ''
- ELSE
- IF ll_parentid <> i_parentid THEN
- SELECT areaname INTO :ls_parent_handtype
- FROM u_cusarea
- Where cusareaid = :ll_parentid;
- IF sqlca.SQLCode <> 0 THEN
- MessageBox('提示','查询上级区域资料失败', Information!, OK! )
- RETURN
- END IF
- ELSE
- ls_parent_handtype = i_parent_handtype
- END IF
- END IF
- s_area.areaname = ls_parent_handtype + dw_1.Object.cusareaname[ll_row] + '>>'
- string ls_typecode, ls_typecodestr
- ls_typecode = dw_1.Object.typecode[ll_row]
- //ls_typecodestr = dw_1.Object.typecodestr[ll_row]
- SELECT typecodestr
- INTO :ls_typecodestr
- FROM u_cusarea
- Where cusareaid = :s_area.parentid;
- IF sqlca.SQLCode <> 0 THEN
- ls_typecodestr = ''
- END IF
- s_area.typecode = ls_typecode
- //s_area.typecodestr = left(ls_typecodestr, len(ls_typecodestr) - len(ls_typecode))+ ls_typecode
- s_area.typecodestr = ls_typecodestr + ls_typecode
- Close(PARENT)
- end event
- type cb_exit from w_publ_base`cb_exit within w_cusarea_add
- integer x = 1120
- integer y = 736
- end type
- event cb_exit::clicked;s_area.cusareaid = -1
- close(parent)
- end event
- type dw_1 from datawindow within w_cusarea_add
- integer x = 133
- integer y = 108
- integer width = 1211
- integer height = 476
- integer taborder = 10
- boolean bringtotop = true
- string title = "none"
- string dataobject = "dw_cusarea_edit"
- boolean border = false
- boolean livescroll = true
- end type
- type cb_1 from uo_imflatbutton within w_cusarea_add
- integer x = 114
- integer y = 736
- integer width = 311
- integer height = 96
- integer taborder = 30
- boolean bringtotop = true
- string text = "查闭环"
- end type
- event clicked;call super::clicked;//检查有否环//
- Long ll_cusareaid,ll_parentid
- Int ls_cr_rsl
- dw_1.accepttext()
- IF dw_1.GetRow() <= 0 THEN RETURN
- ll_cusareaid = dw_1.Object.cusareaid[dw_1.GetRow()]
- ll_parentid = dw_1.Object.parentid[dw_1.GetRow()]
- IF ll_cusareaid <= 0 THEN RETURN
- IF ll_parentid = i_parentid THEN RETURN
- ls_cr_rsl = wf_checkrand(ll_cusareaid)
- IF ls_cr_rsl = 1 THEN
- MessageBox('提示',string(dw_1.Object.cusareaname[dw_1.GetRow()])+' 发现环,请核对!', Information!, OK! )
- RETURN
- ELSEIF ls_cr_rsl < 0 THEN
- MessageBox('提示','因为网络或其他原因导致查环操作失败!['+string(dw_1.Object.cusareaname[dw_1.GetRow()])+']', Information!, OK! )
- RETURN
- END IF
- MessageBox('提示','没有发现闭环!', Information!, OK! )
- end event
- type cbx_auto_code from checkbox within w_cusarea_add
- integer x = 133
- integer y = 624
- integer width = 457
- integer height = 72
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "自动编号"
- end type
- event constructor;Int li_flag
- li_flag = Integer(f_ProfileString (sys_empid,this.classname(), "if_auto_code", '0'))
- IF li_flag = 0 THEN
- THIS.Checked = FALSE
- ELSE
- THIS.Checked = TRUE
- END IF
- end event
- event clicked;Int li_flag
- IF THIS.Checked THEN
- li_flag = 1
- wf_set_typecode(dw_1.GetRow(), s_area.parentid)
-
- ELSE
- li_flag = 0
- END IF
- f_SetProfileString (sys_empid,THIS.ClassName(), "if_auto_code", String(li_flag))
- end event
|