$PBExportHeader$w_aifmb_addproductcode.srw forward global type w_aifmb_addproductcode from window end type type cb_addfj from commandbutton within w_aifmb_addproductcode end type type cb_picdel from commandbutton within w_aifmb_addproductcode end type type cb_picaddfile from commandbutton within w_aifmb_addproductcode end type type lv_1 from uo_piclistview within w_aifmb_addproductcode end type type cb_exit from commandbutton within w_aifmb_addproductcode end type type cb_save from commandbutton within w_aifmb_addproductcode end type type dw_1 from datawindow within w_aifmb_addproductcode end type end forward global type w_aifmb_addproductcode from window integer width = 3232 integer height = 1648 boolean titlebar = true string title = "亚洲-发布产品" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_node_ch ( ) event ue_product_ch ( ) event ue_mtrl_ch ( ) cb_addfj cb_addfj cb_picdel cb_picdel cb_picaddfile cb_picaddfile lv_1 lv_1 cb_exit cb_exit cb_save cb_save dw_1 dw_1 end type global w_aifmb_addproductcode w_aifmb_addproductcode type variables s_aifmb_addmodproductentrelation s_tran end variables event ue_node_ch();Long ll_nodeid String ls_nodename Open(w_aifmb_class_map_ch) ll_nodeid = Message.DoubleParm IF ll_nodeid > 0 THEN SELECT NodeName INTO :ls_nodename FROM aifmb_ClassNode Where NodeID = :ll_nodeid; IF sqlca.SQLCode <> 0 THEN MessageBox('ERROR', '查询基类名称失败,' + sqlca.SQLErrText) RETURN END IF dw_1.Object.NodeID[1] = ll_nodeid dw_1.Object.NodeName[1] = ls_nodename END IF end event event ue_product_ch();Open(w_aifmb_product) long ll_productid ll_productid = Message.DoubleParm IF ll_productid <= 0 THEN RETURN String ls_nodename String ls_mtrlcode String ls_mtrlname String ls_mtrlmode long ll_nodeid string ls_unit decimal ld_net_weight decimal ld_gross_weight decimal ld_cubage string ls_mtrlengname string ls_dscrp string ls_qualitydscrp SELECT aifmb_ProductCode.mtrlcode, aifmb_ProductCode.mtrlname, aifmb_ProductCode.mtrlmode, aifmb_ProductCode.NodeID, aifmb_ClassNode.NodeName, aifmb_ProductCode.unit, aifmb_ProductCode.net_weight, aifmb_ProductCode.gross_weight, aifmb_ProductCode.cubage, aifmb_ProductCode.mtrlengname, aifmb_ProductCode.dscrp, aifmb_ProductCode.qualitydscrp INTO :ls_mtrlcode, :ls_mtrlname, :ls_mtrlmode, :ll_nodeid, :ls_nodename, :ls_unit, :ld_net_weight, :ld_gross_weight, :ld_cubage, :ls_mtrlengname, :ls_dscrp, :ls_qualitydscrp FROM aifmb_ProductCode LEFT OUTER JOIN aifmb_ClassNode ON aifmb_ProductCode.NodeID = aifmb_ClassNode.NodeID Where (aifmb_ProductCode.ProductID = :ll_productid); IF sqlca.SQLCode <> 0 THEN MessageBox('ERROR', '查询标准物料信息失败ID=' + String(ll_productid) + ',' + sqlca.SQLErrText) RETURN END IF dw_1.Object.mtrlid[1] = 0 dw_1.Object.nodeid[1] = ll_nodeid dw_1.Object.nodename[1] = ls_nodename dw_1.Object.ProductID[1] = ll_productid dw_1.Object.mtrlcode[1] = ls_mtrlcode dw_1.Object.mtrlname[1] = ls_mtrlname dw_1.Object.productname[1] = ls_mtrlname dw_1.Object.mtrlmode[1] = ls_mtrlmode dw_1.Object.unit[1] = ls_unit dw_1.Object.net_weight[1] = ld_net_weight dw_1.Object.gross_weight[1] = ld_gross_weight dw_1.Object.cubage[1] = ld_cubage dw_1.Object.mtrlengname[1] = ls_mtrlengname dw_1.Object.dscrp[1] = ls_dscrp dw_1.Object.qualitydscrp[1] = ls_qualitydscrp end event event ue_mtrl_ch(); s_edit_index_tran s_tranf8 //传递参数使用 s_tranf8.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tranf8.arg_pkid = 0 //目标定位PKID (备用) s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选 s_tranf8.if_select_all = False //多选 s_tranf8.b_long = -1 //选采购 s_tranf8.c_long = -1 s_tranf8.f_long = -1 s_tranf8.g_long = -1 //s_tranf8.arg_string_code = dw_1.Object.realmtrlcode[ll_row] OpenWithParm(W_mtrldef_edit,s_tranf8) //调用 s_mtrldef_array S_INSCUST IF ClassName(Message.PowerObjectParm) <> 's_mtrldef_array' THEN RETURN S_INSCUST = Message.PowerObjectParm //接受返回结构 IF UpperBound(S_INSCUST.mtrlid) <= 0 THEN RETURN IF S_INSCUST.mtrlid[1] <= 0 THEN RETURN dw_1.Object.mtrlid[1] = S_INSCUST.mtrlid[1] dw_1.Object.ProductID[1] = 0 dw_1.Object.mtrlcode[1] = S_INSCUST.mtrlcode[1] dw_1.Object.mtrlname[1] = S_INSCUST.mtrlname[1] dw_1.Object.mtrlmode[1] = S_INSCUST.mtrlmode[1] dw_1.Object.productname[1] = S_INSCUST.mtrlname[1] dw_1.Object.unit[1] = S_INSCUST.unit[1] dw_1.Object.net_weight[1] = S_INSCUST.net_weight[1] dw_1.Object.gross_weight[1] = S_INSCUST.gross_weight[1] dw_1.Object.cubage[1] = S_INSCUST.cubage[1] dw_1.Object.mtrlengname[1] = S_INSCUST.mtrlengname[1] dw_1.Object.dscrp[1] = S_INSCUST.dscrp[1] end event on w_aifmb_addproductcode.create this.cb_addfj=create cb_addfj this.cb_picdel=create cb_picdel this.cb_picaddfile=create cb_picaddfile this.lv_1=create lv_1 this.cb_exit=create cb_exit this.cb_save=create cb_save this.dw_1=create dw_1 this.Control[]={this.cb_addfj,& this.cb_picdel,& this.cb_picaddfile,& this.lv_1,& this.cb_exit,& this.cb_save,& this.dw_1} end on on w_aifmb_addproductcode.destroy destroy(this.cb_addfj) destroy(this.cb_picdel) destroy(this.cb_picaddfile) destroy(this.lv_1) destroy(this.cb_exit) destroy(this.cb_save) destroy(this.dw_1) end on event open;s_aifmb_addmodproductentrelation s_input s_input = Message.PowerObjectParm dw_1.InsertRow(0) lv_1.uf_setsize(100, 100) IF IsNull(s_input) Or Not IsValid(s_input) THEN s_tran.relationid = 0 ELSE s_tran = s_input dw_1.Object.relationid[1] = s_tran.relationid dw_1.Object.nodeid[1] = s_tran.nodeid dw_1.Object.mtrlid[1] = s_tran.mtrlid dw_1.Object.mtrlcode[1] = s_tran.mtrlcode dw_1.Object.mtrlname[1] = s_tran.mtrlname dw_1.Object.mtrlmode[1] = s_tran.mtrlmode dw_1.Object.unit[1] = s_tran.unit dw_1.Object.net_weight[1] = s_tran.net_weight dw_1.Object.gross_weight[1] = s_tran.gross_weight dw_1.Object.cubage[1] = s_tran.cubage dw_1.Object.mtrlengname[1] = s_tran.mtrlengname dw_1.Object.dscrp[1] = s_tran.dscrp dw_1.Object.QualityDscrp[1] = s_tran.QualityDscrp dw_1.Object.CustomCode[1] = s_tran.CustomCode dw_1.Object.MPrice[1] = s_tran.MPrice dw_1.Object.NPrice[1] = s_tran.NPrice IF s_tran.isPublic THEN dw_1.Object.isPublic[1] = 1 ELSE dw_1.Object.isPublic[1] = 0 END IF dw_1.Object.ProductID[1] = s_tran.ProductID String ls_nodename, ls_productname SELECT NodeName INTO :ls_nodename FROM aifmb_ClassNode Where nodeid = :s_tran.nodeid; IF sqlca.SQLCode = 0 THEN dw_1.Object.NodeName[1] = ls_nodename END IF SELECT mtrlname INTO :ls_productname FROM aifmb_ProductCode Where ProductID = :s_tran.ProductID; IF sqlca.SQLCode = 0 THEN dw_1.Object.productname[1] = ls_productname END IF END IF end event event close;closewithreturn(this, s_tran) end event type cb_addfj from commandbutton within w_aifmb_addproductcode integer x = 2930 integer y = 116 integer width = 274 integer height = 104 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "添加附件" end type event clicked;Open(w_aifmb_erpfj_ch) s_aifmb_erpfj_ch s_tran s_tran = Message.PowerObjectParm String arg_msg Long i FOR i = 1 To UpperBound(s_tran.pics) IF lv_1.uf_additem(s_tran.pics[i], arg_msg) <> 1 THEN END IF NEXT end event type cb_picdel from commandbutton within w_aifmb_addproductcode integer x = 2930 integer y = 232 integer width = 274 integer height = 104 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "删除" end type event clicked;Long ll_selectedindex ll_selectedindex = lv_1.SelectedIndex() DO WHILE ll_selectedindex > 0 lv_1.DeleteItem(ll_selectedindex) ll_selectedindex = lv_1.SelectedIndex() LOOP end event type cb_picaddfile from commandbutton within w_aifmb_addproductcode integer x = 2930 integer width = 274 integer height = 104 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "添加文件" end type event clicked;String ls_path String arr_files[] IF GetFileOpenName('上传图片', ls_path, arr_files, 'bmp', '图片 (*.bmp;*.gif;*.jpg;*.jpeg;*.png),*.bmp;*.gif;*.jpg;*.jpeg;*.png') <> 1 THEN RETURN END IF IF UpperBound(arr_files) <= 0 THEN RETURN END IF IF UpperBound(arr_files) = 1 THEN ls_path = Mid(ls_path, 1, Len(ls_path) - Len(arr_files[1])) END IF IF Right(ls_path, 1) <> '\' THEN ls_path += '\' END IF Int rslt = 1 String arg_msg Long i s_piclistview_parm s_parm, s_empty FOR i = 1 To UpperBound(arr_files) s_parm = s_empty s_parm.Label = arr_files[i] s_parm.tmppath = ls_path + arr_files[i] IF lv_1.uf_additem(s_parm, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF NEXT ext: IF rslt = 0 THEN MessageBox('ERROR', arg_msg) END IF end event type lv_1 from uo_piclistview within w_aifmb_addproductcode integer x = 1518 integer width = 1399 integer height = 1372 integer taborder = 20 end type type cb_exit from commandbutton within w_aifmb_addproductcode integer x = 2747 integer y = 1408 integer width = 256 integer height = 116 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "退出" boolean cancel = true end type event clicked;s_tran.relationid = 0 close(parent) end event type cb_save from commandbutton within w_aifmb_addproductcode integer x = 2469 integer y = 1408 integer width = 256 integer height = 116 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "保存" end type event clicked;Int rslt = 1 String arg_msg dw_1.AcceptText() IF dw_1.Object.nodeid[1] <= 0 THEN MessageBox('提示', '请选择基类') RETURN END IF IF dw_1.Object.mtrlname[1] = '' THEN MessageBox('提示', '请输入产品名称') RETURN END IF s_piclistview_parm s_parm[] IF lv_1.uf_getitems(s_parm, arg_msg) <> 1 THEN MessageBox('ERROR', arg_msg) RETURN END IF uo_aifmb = Create uo_aifmb //s_aifmb_addmodproductentrelation s_tran s_tran.RelationID = dw_1.Object.RelationID[1] s_tran.nodeid = dw_1.Object.nodeid[1] s_tran.mtrlid = dw_1.Object.mtrlid[1] s_tran.mtrlcode = dw_1.Object.mtrlcode[1] s_tran.mtrlname = dw_1.Object.mtrlname[1] s_tran.mtrlmode = dw_1.Object.mtrlmode[1] s_tran.unit = dw_1.Object.unit[1] s_tran.net_weight = dw_1.Object.net_weight[1] s_tran.gross_weight = dw_1.Object.gross_weight[1] s_tran.cubage = dw_1.Object.cubage[1] s_tran.mtrlengname = dw_1.Object.mtrlengname[1] s_tran.dscrp = dw_1.Object.dscrp[1] s_tran.QualityDscrp = dw_1.Object.QualityDscrp[1] s_tran.CustomCode = dw_1.Object.CustomCode[1] s_tran.MPrice = dw_1.Object.MPrice[1] s_tran.NPrice = dw_1.Object.NPrice[1] s_tran.isPublic = (dw_1.Object.isPublic[1] = 1) s_tran.productid = dw_1.Object.productid[1] s_tran.pics = s_parm IF uo_aifmb.uf_addmodproductentrelation(s_tran, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF ext: Destroy uo_aifmb IF rslt = 0 THEN MessageBox('ERROR', arg_msg) ELSE Close(Parent) END IF end event type dw_1 from datawindow within w_aifmb_addproductcode integer width = 1509 integer height = 1380 integer taborder = 10 string title = "none" string dataobject = "dw_aifmb_addproductcode" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event buttonclicked;string ls_colname ls_colname = dwo.Name ls_colname = lower(ls_colname) IF ls_colname = 'b_1' THEN parent.triggerevent('ue_node_ch') ELSEIF ls_colname = 'b_2' THEN parent.triggerevent('ue_product_ch') ELSEIF ls_colname = 'b_3' THEN parent.triggerevent('ue_mtrl_ch') END IF end event