$PBExportHeader$w_pz_code_add_edit.srw forward global type w_pz_code_add_edit from w_publ_base end type type dw_1 from datawindow within w_pz_code_add_edit end type type cb_savenew from uo_imflatbutton within w_pz_code_add_edit end type type cb_save from uo_imflatbutton within w_pz_code_add_edit end type end forward global type w_pz_code_add_edit from w_publ_base integer width = 1893 integer height = 568 string title = "配置增加" boolean minbox = false windowtype windowtype = response! dw_1 dw_1 cb_savenew cb_savenew cb_save cb_save end type global w_pz_code_add_edit w_pz_code_add_edit type variables long ins_type // 0 - status,1 -woodcode,2-pcode long ins_relid long ins_configtype = 0 end variables forward prototypes public function integer wf_save () public function integer wf_insertrow () end prototypes public function integer wf_save ();Int rslt = 1 Long ll_row,ll_newid, ll_relid String arg_msg dw_1.AcceptText() ll_row = dw_1.GetRow() IF ll_row <= 0 THEN MessageBox(publ_operator,'请选择资料') rslt = 0 GOTO ext END IF IF ins_type = 0 THEN dw_1.Object.status[ll_row] = Trim(dw_1.Object.status[ll_row]) IF dw_1.Object.status[ll_row] = '' THEN MessageBox(publ_operator,'请输入内容!') dw_1.SetColumn('status') dw_1.SetFocus() rslt = 0 GOTO ext END IF IF dw_1.Object.colorid[ll_row] = 0 THEN ll_newid = f_sys_scidentity(0,"u_color","colorid",arg_msg,TRUE,sqlca) IF ll_newid <= 0 THEN MessageBox('提示','取ID失败,'+arg_msg) rslt = 0 GOTO ext END IF dw_1.Object.colorid[ll_row] = ll_newid END IF ELSEIF ins_type = 1 THEN dw_1.Object.woodcode[ll_row] = Trim(dw_1.Object.woodcode[ll_row]) IF dw_1.Object.woodcode[ll_row] = '' THEN MessageBox(publ_operator,'请输入内容!') dw_1.SetColumn('woodcode') dw_1.SetFocus() rslt = 0 GOTO ext END IF IF dw_1.Object.woodcodeid[ll_row] = 0 THEN ll_newid = f_sys_scidentity(0,"u_color_wood","woodcodeid",arg_msg,TRUE,sqlca) IF ll_newid <= 0 THEN MessageBox('提示','取ID失败,'+arg_msg) rslt = 0 GOTO ext END IF dw_1.Object.woodcodeid[ll_row] = ll_newid END IF ELSEIF ins_type = 2 THEN dw_1.Object.pcode[ll_row] = Trim(dw_1.Object.pcode[ll_row]) IF dw_1.Object.pcode[ll_row] = '' THEN MessageBox(publ_operator,'请输入内容!') dw_1.SetColumn('pcode') dw_1.SetFocus() rslt = 0 GOTO ext END IF IF dw_1.Object.pcodeid[ll_row] = 0 THEN ll_newid = f_sys_scidentity(0,"u_color_pcode","pcodeid",arg_msg,TRUE,sqlca) IF ll_newid <= 0 THEN MessageBox('提示','取ID失败,'+arg_msg) rslt = 0 GOTO ext END IF dw_1.Object.pcodeid[ll_row] = ll_newid END IF ELSEIF ins_type = 3 THEN dw_1.Object.contfigtypename[ll_row] = Trim(dw_1.Object.contfigtypename[ll_row]) IF dw_1.Object.contfigtypename[ll_row] = '' THEN MessageBox(publ_operator,'请输入内容!') dw_1.SetColumn('contfigtypename') dw_1.SetFocus() rslt = 0 GOTO ext END IF IF dw_1.Object.contfigtypeid[ll_row] = 0 THEN ll_newid = f_sys_scidentity(0,"u_configure_type","contfigtypeid",arg_msg,FALSE,sqlca) IF ll_newid <= 0 THEN MessageBox('提示','取ID失败,'+arg_msg) rslt = 0 GOTO ext END IF dw_1.Object.contfigtypeid[ll_row] = ll_newid END IF ELSEIF ins_type = 4 THEN dw_1.Object.pzcode[ll_row] = Trim(dw_1.Object.pzcode[ll_row]) IF dw_1.Object.pzcode[ll_row] = '' THEN MessageBox(publ_operator,'请输入配置项编号!') rslt = 0 GOTO ext END IF dw_1.Object.Name[ll_row] = Trim(dw_1.Object.Name[ll_row]) IF dw_1.Object.Name[ll_row] = '' THEN MessageBox(publ_operator,'请输入配置项名称!') rslt = 0 GOTO ext END IF // IF dw_1.Object.typeid[ll_row] <= 0 THEN // MessageBox(publ_operator,'非法的配置类型id!') // rslt = 0 // GOTO ext // END IF IF dw_1.Object.pzid[ll_row] = 0 THEN ll_newid = f_sys_scidentity(0,"u_configure_code","pzid",arg_msg,FALSE,sqlca) IF ll_newid <= 0 THEN MessageBox('提示','取ID失败,'+arg_msg) rslt = 0 GOTO ext END IF dw_1.Object.pzid[ll_row] = ll_newid END IF ELSEIF ins_type = 5 THEN dw_1.Object.pzcodemx[ll_row] = Trim(dw_1.Object.pzcodemx[ll_row]) IF dw_1.Object.pzcodemx[ll_row] = '' THEN MessageBox(publ_operator,'请输入配置项明细编号!') rslt = 0 GOTO ext END IF dw_1.Object.namemx[ll_row] = Trim(dw_1.Object.namemx[ll_row]) IF dw_1.Object.namemx[ll_row] = '' THEN MessageBox(publ_operator,'请输入配置项明细名称!') rslt = 0 GOTO ext END IF ll_relid = dw_1.Object.pzid[ll_row] IF ll_relid <= 0 THEN MessageBox(publ_operator,'非法的配置项id!') rslt = 0 GOTO ext END IF ll_newid = dw_1.Object.printid[ll_row] IF ll_newid <= 0 or isnull(ll_newid) THEN SELECT isnull(max(printid),0) + 1 INTO :ll_newid FROM u_configure_codemx Where pzid = :ll_relid; IF sqlca.SQLCode = 100 THEN ll_newid = 1 ELSEIF sqlca.SQLCode <> 0 THEN MessageBox(publ_operator,'查询配置项明细id失败!') rslt = 0 GOTO ext END IF if ll_newid = 0 then ll_newid = 1 end if dw_1.Object.printid[ll_row] = ll_newid END IF END IF dw_1.AcceptText() IF dw_1.Update() = 1 THEN COMMIT; ELSE ROLLBACK; MessageBox('系统提示','保存操作失败!') rslt = 0 GOTO ext END IF ext: RETURN rslt end function public function integer wf_insertrow ();Long ll_row dw_1.SetRedraw(FALSE) dw_1.Reset() ll_row = dw_1.InsertRow(0) dw_1.SetRow(ll_row) dw_1.ScrollToRow(ll_row) dw_1.SetFocus() if ins_type = 4 then dw_1.Object.configtype[ll_row] = ins_configtype dw_1.Object.typeid[ll_row] = ins_relid elseif ins_type = 5 then dw_1.Object.pzid[ll_row] = ins_relid end if dw_1.SetRedraw(TRUE) RETURN 1 end function on w_pz_code_add_edit.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_savenew=create cb_savenew this.cb_save=create cb_save iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_savenew this.Control[iCurrent+3]=this.cb_save end on on w_pz_code_add_edit.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_savenew) destroy(this.cb_save) end on event open;call super::open;Long ll_id s_edit_index_tran s_inscust s_inscust = Message.PowerObjectParm ins_type = s_inscust.b_long ll_id = s_inscust.c_long IF NOT IsNull(s_inscust.d_long) THEN ins_relid = s_inscust.d_long END IF String ls_newmod IF ll_id = 0 THEN ls_newmod = '增加' ELSE ls_newmod = '修改' END IF String ls_pzname IF ins_type = 0 THEN dw_1.DataObject = 'dw_status_code_add' IF sys_option_change_status = '' THEN ls_pzname = '配置' ELSE ls_pzname = sys_option_change_status END IF ELSEIF ins_type = 1 THEN dw_1.DataObject = 'dw_woodcode_code_add' IF sys_option_change_woodcode = '' THEN ls_pzname = '配置1' ELSE ls_pzname = sys_option_change_woodcode END IF ELSEIF ins_type = 2 THEN dw_1.DataObject = 'dw_pcode_code_add' IF sys_option_change_pcode = '' THEN ls_pzname = '配置2' ELSE ls_pzname = sys_option_change_pcode END IF ELSEIF ins_type = 3 THEN dw_1.DataObject = 'dw_configure_type_add' ls_pzname = '部件选配类型' ELSEIF ins_type = 4 THEN ins_configtype = s_inscust.f_long dw_1.DataObject = 'dw_configure_code_add' ls_pzname = '部件选配项' ELSEIF ins_type = 5 THEN dw_1.DataObject = 'dw_configure_codemx_add' ls_pzname = '部件选配项明细' END IF THIS.Title = ls_pzname + ' ' + ls_newmod dw_1.SetTransObject(sqlca) f_title_change(dw_1) IF ll_id = 0 THEN wf_insertrow() ELSE dw_1.Retrieve(ll_id,ins_relid) dw_1.SetFocus() END IF end event type cb_func from w_publ_base`cb_func within w_pz_code_add_edit boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_pz_code_add_edit integer x = 1417 integer y = 352 integer width = 329 integer picsize = 16 end type type dw_1 from datawindow within w_pz_code_add_edit integer x = 59 integer y = 64 integer width = 1719 integer height = 264 integer taborder = 30 boolean bringtotop = true string title = "none" string dataobject = "dw_status_code_add" boolean border = false boolean livescroll = true end type type cb_savenew from uo_imflatbutton within w_pz_code_add_edit integer x = 178 integer y = 352 integer width = 407 integer taborder = 20 boolean bringtotop = true string text = "保存&增加" string normalpicname = "new.bmp" integer picsize = 16 end type event clicked;call super::clicked;IF wf_save() = 1 THEN wf_insertrow() END IF end event type cb_save from uo_imflatbutton within w_pz_code_add_edit integer x = 818 integer y = 352 integer width = 329 integer taborder = 20 boolean bringtotop = true string text = "保存" string normalpicname = "save.bmp" integer picsize = 16 end type event clicked;call super::clicked;IF wf_save() = 1 THEN Close(PARENT) END IF end event