| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;using Pur.Entity;
- using Core.Mes.Client.Comm.Control;
- using Pur.Entity.configureEntity;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Core.Mes.Client.Comm.Tool;
- using System.Data.OracleClient;
- using com.hnshituo.pur.vo;
- using System.Text.RegularExpressions;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using com.hnshituo.sel.vo;
- using Core.Mes.Client.Comm.Server;
- using Pur.Pop_upWindow;
- using CoreFS.SA06;
- using Pur.configure;
- using Pur.PublicTools;
- using Core.Mes.Client.Comm.Format;
- namespace Pur
- {
- public partial class SupplierManagement : FrmPmsBase
- {
- //地址(国家省份)信息
- DataTable regions;
- //附件上传
- String fileName = "";
- public SupplierManagement()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- private void SupplierManagement_Load(object sender, EventArgs e)
- {
- init();
- GetPUR_SUPP();
- ultraExpandableGroupBox1.Expanded = false;
- ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
- GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
- GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
- GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { "certPath" });
- GridHelper.SetExcludeColumnsActive(ultraGrid4.DisplayLayout.Bands[0], new string[] { });
- string basecode = "1217";
- DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
- dt = dt.AsEnumerable().Where(p => p["VALIDFLAG"].ToString().Equals("1")).CopyToDataTable();
- Combo_Rate.DataSource = dt;
- Combo_Rate.DisplayMember = "BASENAME";
- Combo_Rate.ValueMember = "BASECODE";
- //ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- //ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- //ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- }
- #region toolbar菜单
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- GetPUR_SUPP();
- break;
- case "Add":
- AddPUR_SUPP();
- break;
- case "Update":
- UpdPUR_SUPP();
- break;
- case "Delete":
- DelPUR_SUPP();
- break;
- case "close":
- CloPUR_SUPP();
- break;
- case "Enable":
- EnaPUR_SUPP();
- break;
- case "Pending":
- PenPUR_SUPP();
- break;
- case "ShenXIao":
- ShenPUR_SUPP();
- break;
- case "ChangePWD":
- ChangePWD();
- break;
- case "doExcel":
- doExcel();
- break;
- }
- }
- //导出Excel
- private void doExcel()
- {
- try
- {
- this.Cursor = Cursors.Default;
- ArrayList alUltraGrid = new ArrayList();
- alUltraGrid.Add(ultraGrid1);
- ArrayList alSheeft = new ArrayList();
- alSheeft.Add("供应商清单");
- if (ultraGrid1.Rows.Count > 0)
- {
- GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "供应商清单");//导出excel
- }
- else
- {
- MessageUtil.ShowTips("无可导出明细!");
- }
- }
- catch (Exception e)
- {
- MessageUtil.ShowTips("导出失败" + e.Message);
- }
- finally
- {
- this.Cursor = Cursors.Default;
- }
- }
- /// <summary>
- /// 修改供应商密码
- /// </summary>
- private void ChangePWD()
- {
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择供应商");
- return;
- }
- String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
- String strSuppName = uRow.Cells["suppName"].Value.ToString().Trim();
- if (String.IsNullOrEmpty(strSuppCode))
- {
- MessageUtil.ShowTips("选择供应商的编号为空!");
- return;
- }
- FrmSuppChangePassword frm = new FrmSuppChangePassword(strSuppName, strSuppCode,this.ob);
- frm.ShowDialog();
- }
- #endregion
- #region toolbar菜单事件
- /// <summary>
- /// 生效
- /// </summary>
- private void ShenPUR_SUPP()//生效
- {
- try
- {
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择供应商");
- return;
- }
- ArrayList list = new ArrayList();
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
- Supp_Entity.Status = "4";
- Supp_Entity.Validflag = "1";
- Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.UpdateTime = System.DateTime.Now;
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
- if (sc == null)
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
- return;
- }
- if (sc.SuspendStatus == "1")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】被暂挂,或请刷新页面再操作");
- return;
- }
- if (sc.Status == "4")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已生效,或请刷新页面再操作");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定生效供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
- {
- return;
- }
- CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
- if (re.Resultcode != 0)
- {
- MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
- return;
- }
- // 作废数据到计量系统
- string json = JSONFormat.Format(Supp_Entity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
- ccp.MethodName = "logicDelete";
- ccp.ServerParams = new object[] { json };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("生效信息成功!");
- GetPUR_SUPP();
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
- }
- catch (Exception e)
- {
- MessageUtil.ShowTips("操作失败:"+e);
- }
- }
- /// <summary>
- /// 暂挂
- /// </summary>
- private void PenPUR_SUPP()//暂挂
- {
- ultraGrid1.UpdateData();
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow.Cells["SuspendStatus"].Value.ToString() == "暂挂")
- {
- MessageUtil.ShowTips("信息已暂挂,无需再次操作!");
- return;
- }
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
- Supp_Entity.SuspendStatus = "1";
- Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.UpdateTime = System.DateTime.Now;
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
- if (sc == null)
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
- return;
- }
- if (sc.Validflag == "0")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
- return;
- }
- if (sc.SuspendStatus == "1")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已被被暂挂,无需重复操作,或请刷新页面再操作");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定暂挂供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
- {
- return;
- }
- CoreResult re= this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
- if (re.Resultcode != 0)
- {
- MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("暂挂信息成功!");
- GetPUR_SUPP();
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
- }
- /// <summary>
- /// 启用
- /// </summary>
- private void EnaPUR_SUPP()//启用
- {
- ultraGrid1.UpdateData();
-
- ArrayList list = new ArrayList();
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow.Cells["SuspendStatus"].Value.ToString() == "正常")
- {
- MessageUtil.ShowTips("该供应商已启用,无需再次操作!");
- return;
- }
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
- Supp_Entity.SuspendStatus = "0";
- Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.UpdateTime = System.DateTime.Now;
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
- if (sc == null)
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
- return;
- }
- if (sc.Validflag == "0")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
- return;
- }
- if (sc.SuspendStatus == "0")
- {
- MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已启用,无需重复操作,或请刷新页面再操作");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确定启用供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
- {
- return;
- }
- CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
- if (re.Resultcode != 0)
- {
- MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
- return;
- }
- MessageUtil.ShowTips("启用成功!");
- GetPUR_SUPP();
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
- }
- /// <summary>
- /// 关闭
- /// </summary>
- private void CloPUR_SUPP()//关闭
- {
- this.Close();
- }
- /// <summary>
- /// 删除
- /// </summary>
- private void DelPUR_SUPP()//删除
- {
- if (SQ == 1)
- {
-
- UltraGridRow uRow = ultraGrid1.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择供应商进行操作");
- return;
- }
- String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
- if (String.IsNullOrEmpty(strSuppCode))
- {
- MessageUtil.ShowTips("请选择供应商编码不能为空");
- return;
- }
- string resStr = "";
- resStr = this.execute<string>("com.hnshituo.pur.configure.service.SuppService", "SuppIsUsing", new object[] { uRow.Cells["suppCode"].Value.ToString() });//删除操作
- if (resStr != "")
- {
- MessageUtil.ShowTips("供应商在" + resStr + "中使用,若物料中使用,请先取消物料和供应商的关联,若已在任务单中使用,请先完成招标,否则将不予作废");
- return;
- }
- ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
-
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppCode = strSuppCode;
- Supp_Entity.Validflag = "0";
- Supp_Entity.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.DeleteTime = System.DateTime.Now;
- if (MessageUtil.ShowYesNoAndQuestion("确定要作废供应商【" + uRow.Cells["suppName"].Value.ToString() + "】?") == DialogResult.No)
- {
- return;
- }
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "delete_Supp", new object[] { Supp_Entity });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作失败!:" + rt.Resultmsg);
- }
- // 生效数据到计量系统
- string json = JSONFormat.Format(Supp_Entity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
- ccp.MethodName = "logicDelete";
- ccp.ServerParams = new object[] { json };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作成功!");
- GetPUR_SUPP();
- }
- else if (SQ == 2)
- {
- UltraGridRow uge = ultraGrid2.ActiveRow;
- SuppBank Banks = new SuppBank();
- Banks.Id = uge.Cells["id"].Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("确定要删除该司在【" + uge.Cells["bankName"].Value.ToString() + "】的账号信息?") == DialogResult.No)
- {
- return;
- }
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "delete_SuppBank", new object[] { Banks });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
- SuppBank YY = new SuppBank();
- YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
-
- }
- else if (SQ == 3)
- {
- UltraGridRow uge = ultraGrid3.ActiveRow;
- SuppAptitude Aptis = new SuppAptitude();
- Aptis.Id = uge.Cells["id"].Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("确定要删除供应商资质【" + uge.Cells["certNo"].Value.ToString() + "】信息?") == DialogResult.No)
- {
- return;
- }
- //CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete", new object[] { Aptis });
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete_SuppAptitude", new object[] { Aptis });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
- SuppAptitude YY = new SuppAptitude();
- YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
- GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
- }
- else if (SQ == 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("请点击你要删除的信息!");
- return;
- }
- else if(SQ == 5)
- {
- if (MessageUtil.ShowYesNoAndQuestion("确定要删除改供应商评级?") == DialogResult.No)
- {
- return;
- }
- UltraGridRow uge5 = ultraGrid5.ActiveRow;
- CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppRateService", "doDelete", new object[] { uge5.Cells["id"].Value.ToString().Trim() });
- if (cr.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + cr.Resultmsg);
- return;
- }
- MessageUtil.ShowWarning("删除成功!");
- GetPUR_SUPP();
- }
- }
- ///添加资质信息时修改
- private void UpdateSupp()
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- {
- MessageUtil.ShowTips("请选择供应商");
- return;
- }
- String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
- Supp Supp_Entity1 = new Supp();
- Supp_Entity1.SuppCode = StrnewsuppCode;
- Supp_Entity1.SuppLicNum = this.txt_SUPPLICNUM.Text;
- if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
- {
- txt_SUPPSTARTDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
- }
- if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text == null)
- {
- txt_SUPPENDDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
- }
- if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
- {
- txt_SUPPTAXSTARTDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
- }
- if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
- {
- txt_SUPPTAXENDDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
- }
- if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
- {
- txt_SUPPLICSTARTDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
- }
- if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text == null)
- {
- txt_SUPPLICENDDATE.Text = "";
- }
- else
- {
- Supp_Entity1.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
- }
- ////Supp_Entity1.OrgCode = txt_ORGCODE.Text;
- ////Supp_Entity1.SuppTaxId = txt_SUPPTAXID.Text;
- ////CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity1 });
- //GetPUR_SUPP();
- }
- /// <summary>
- /// 更新
- /// </summary>
- private void UpdPUR_SUPP()//更新
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- {
- MessageUtil.ShowTips("请选择供应商");
- return;
- }
- String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
- if (sc == null)
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
- return;
- }
- if (sc.Validflag == "0")
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
- return;
- }
- if (sc.SuspendStatus == "1")
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
- return;
- }
- try
- {
- if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
- {
- //校验名称重复
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
- Supp_Entity.Validflag = "1";
- string strsuppname = uge.Cells["SuppName"].Value.ToString().Trim();
- if (!Supp_Entity.SuppName.Equals(strsuppname))
- {
- if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity)>0)
- {
- MessageUtil.ShowTips("添加失败:数据库中已存在相同的供应商名称");
- return;
- }
- }
- //校验组织机构代码重复
- Supp Supp_Entity1 = new Supp();
- Supp_Entity.OrgCode = txt_ORGCODE.Text.ToString().Trim();
- Supp_Entity.Validflag = "1";
- string strorgCode = ultraGrid1.ActiveRow.Cells["orgCode"].Value.ToString().Trim();
- if (!Supp_Entity.OrgCode.Equals(strorgCode))
- {
- if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
- {
- MessageUtil.ShowTips("添加失败: 数据库中已存在相同的组织机构代码");
- return;
- }
- }
- if (testSupp() == false)
- {
- return;
- }
- if (!StrnewsuppCode.Equals(txt_SUPPCODE.Text.ToString().Trim()))
- {
- MessageBox.Show("供应商编号不允许修改", "提示");
- txt_SUPPCODE.Focus();
- return;
- }
- Supp_Entity.SuppCode = StrnewsuppCode;
- Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
- //Supp_Entity.OrgCode = txt_ORGCODE.Text;//组织结构代码
- Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;
- Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
- //Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;//税号
- Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;
- Supp_Entity.SuppCharacter = cop_suppType.Text;
- Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
- //Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
- Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value == null ? null : txt_SUPPNATIONALITY.Value.ToString().Trim();
- //Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
- Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
- Supp_Entity.SuppCity = txt_SUPPCITY.Text;
- //Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
- Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
- //if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
- //{
- // txt_SUPPSTARTDATE.Text = "";
- //}
- //else
- //{
- // Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
- //}
- //if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text==null)
- //{
- // txt_SUPPENDDATE.Text = "";
- //}
- //else
- //{
- // Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
- //}
- //if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
- //{
- // txt_SUPPTAXSTARTDATE.Text = "";
- //}
- //else
- //{
- // Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
- //}
- //if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
- //{
- // txt_SUPPTAXENDDATE.Text = "";
- //}
- //else
- //{
- // Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
- //}
- if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
- {
- txt_SUPPLICSTARTDATE.Text = "";
- }
- else
- {
- Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
- Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
- Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
- }
- if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text== null)
- {
- txt_SUPPLICENDDATE.Text = "";
- }
- else
- {
- Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
- Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
- Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
- }
- Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;//营业执照
- Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
- Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
- Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
- Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
- Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
- Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
- Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
- Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value==null?"0":txt_SUPPISINTERNAL.Value.ToString();
- Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? "0" : txt_SUPPISMANUFACTURER.Value.ToString();
- Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? "0" : txt_SUPPISSUBCOMPANY.Value.ToString();
- Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
- Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Text.ToString().Trim();
- Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
- double bSuppRegCapital = 0;
- double.TryParse(txt_SUPPREGCAPITAL.Text,out bSuppRegCapital);
- Supp_Entity.SuppRegCapital = bSuppRegCapital;
- Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
- Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
- Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
- Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.UpdateTime = System.DateTime.Now;
- Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
- Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
- Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
- if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
- {
- MessageUtil.ShowTips("请选择税率");
- txt_suppTaxRate.Focus();
- //return;
- }
- Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
- if (MessageBox.Show("是否需要修改供应商【" + strsuppname + "】的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- {
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改信息失败:" + rt.Resultmsg);
- return;
- }
- // 更新数据到计量系统
- string json = JSONFormat.Format(Supp_Entity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
- ccp.MethodName = "update";
- ccp.ServerParams = new object[] { json };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
- GetPUR_SUPP();
- ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SUPPNAME", strsuppname);
- }
- }
- else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
- {
- UltraGridRow ugc = ultraGrid2.ActiveRow;
- if (ugc == null)
- {
- MessageUtil.ShowTips("请选择供应商开户行");
- return;
- }
- SuppBank Banks = new SuppBank();
- Banks.Id = ugc.GetCellValue("id").ToString().Trim();
- if (String.IsNullOrEmpty(Banks.Id))
- {
- MessageUtil.ShowTips("请选择供应商开户行编码为空");
- return;
- }
- Banks.BankAccount = txt_BANKACCOUNT.Text.Trim();
- Banks.BankName = txt_BANKNAME.Text.Trim();
- Banks.PayTypeName = txtPayType.Text.Trim();
- if (String.IsNullOrEmpty(Banks.BankAccount))
- {
- MessageUtil.ShowTips("开户行账号不能为空");
- txt_BANKACCOUNT.Focus();
- return;
- }
- if (String.IsNullOrEmpty(Banks.BankName))
- {
- MessageUtil.ShowTips("开户行名称不能为空");
- txt_BANKNAME.Focus();
- return;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(Banks.BankAccount))
- {
- MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
- txt_BANKACCOUNT.Focus();
- return;
- }
- Banks.SuppCode = StrnewsuppCode;
- Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
- Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
- if (MessageBox.Show("确定修改供应商【" + Banks.SuppName + "】的该条开户行?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- {
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "doUpdate", new object[] { Banks });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改失败!" + rt.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
- SuppBank YY = new SuppBank();
- YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
- }
- }
- else if ((ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[2]))
- {
- SuppAptitude Aptis = new SuppAptitude();
- Aptis.CertDesc = txt_CERTDESC.Text;
- Aptis.CertiConstraint = txt_ap_constraint.Text;
- Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
- Aptis.CertNo = txt_CERTNO.Text;
- Aptis.CertType = txt_ap_type.Text;
- Aptis.CertValidStart =Convert.ToDateTime(txt_CERTVALID_start.Value);
- Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
- Aptis.SuppCode = StrnewsuppCode;
- Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
- Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
- Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
- Aptis.CertPath = txt_certPath.Text.ToString().Trim();
- Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
- Aptis.Id = ultraGrid3.ActiveRow.Cells["id"].Text.ToString().Trim();
- if (MessageBox.Show("是否需要修改供应商ID为[" + Aptis.SuppCode + "]的资质信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
- {
- CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { Aptis });
- if (rt1.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改失败!" + rt1.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
- SuppAptitude YY = new SuppAptitude();
- YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
- GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
- ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
- }
- }
- }
- catch (Exception e)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改信息失败!"+ e);
- return;
- }
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void AddPUR_SUPP()//新增
- {
- try
- {
- if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[0].Text )
- {
- if (txt_SUPPNAME.Value == null)
- {
- MessageUtil.ShowWarning("供应商名称不能为空");
- return;
- }
- Supp Supp_Entity = new Supp();
- Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
- //信息验证
- //if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
- //{
- // MessageUtil.ShowTips("添加失败 " + "数据库中已存在相同的供应商名称");
- // return;
- //}
- if (TestSupp() == false)
- {
- return;
- }
- Supp_Entity.SuppCode = txt_SUPPCODE.Text.ToString().Trim();
- Supp_Entity.Account = txt_SUPPCODE.Text.ToString().Trim().ToLower();
- //Supp_Entity.OrgCode = txt_ORGCODE.Text;
- Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;//组织机构代码
- Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
- //Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;
- Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;//税号
- Supp_Entity.SuppCharacter = cop_suppType.Text;
- Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
- //Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
- Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value==null?null:txt_SUPPNATIONALITY.Value.ToString().Trim();
- //Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
- Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
- Supp_Entity.SuppCity = txt_SUPPCITY.Text;
- //Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
- Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
- Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
- Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
- Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
- Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
- Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
- Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
- Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;
- Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
- Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
- Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
- Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
- Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
- Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
- Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
- Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value == null ? null : txt_SUPPISINTERNAL.Value.ToString();
- Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? null : txt_SUPPISMANUFACTURER.Value.ToString();
- Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? null : txt_SUPPISSUBCOMPANY.Value.ToString();
- Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
- Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Value.ToString();
- Supp_Entity.SuppRegCapital =txt_SUPPREGCAPITAL.Value==null?0:Convert.ToInt32(txt_SUPPREGCAPITAL.Text);
- Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
- Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
- Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
- Supp_Entity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- Supp_Entity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
- Supp_Entity.CreateTime = System.DateTime.Now;
- Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
- Supp_Entity.Status = "1";
- Supp_Entity.SuspendStatus = "0";
- Supp_Entity.Validflag = "1";
- Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
- Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
- if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
- {
- MessageUtil.ShowTips("请选择税率");
- txt_suppTaxRate.Focus();
- return;
- }
- Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
- Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
- CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "insert_Supp", new object[] { Supp_Entity });
- if (cr.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+cr.Resultmsg);
- return;
-
- }
- // 添加数据到计量系统
- string json = JSONFormat.Format(Supp_Entity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
- ccp.MethodName = "insert";
- ccp.ServerParams = new object[] { json };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- MessageUtil.ShowWarning("添加成功!");
- GetPUR_SUPP();
- Pur.configure.ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SuppName", Supp_Entity.SuppName);
- }
- else if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[3].Text)
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- SuppRate suppRate = new SuppRate();
- suppRate.Id = System.Guid.NewGuid().ToString("N");
- suppRate.SuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
- suppRate.Rate = Combo_Rate.Text;
- suppRate.RateYear = txt_Rate_Year.Text;
- suppRate.ValidFlag = "1";
- suppRate.CreateName = UserInfo.GetUserName();
- suppRate.CreateTime = System.DateTime.Now;
- CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppRateService", "doInsert", new object[] { suppRate });
- if (cr.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + cr.Resultmsg);
- return;
- }
- MessageUtil.ShowWarning("添加成功!");
- GetPUR_SUPP();
- } else
- {
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- {
- MessageUtil.ShowTips("请选择需要新增银行或者资质信息的供应商");
- return;
- }
- String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
- if (uge.Cells["SuspendStatus"].Value.ToString() == "暂挂")
- {
- MessageUtil.ShowTips("信息已暂挂,无权限进行增删!");
- return;
- }
- Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
- if (sc == null)
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
- return;
- }
- if (sc.Validflag == "0")
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
- return;
- }
- if (sc.SuspendStatus == "1")
- {
- MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
- return;
- }
- if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
- {
- String strAccount = txt_BANKACCOUNT.Text.Trim();
- String strAccountName = txt_BANKNAME.Text.Trim();
- String strPay = "";
- if(txtPayType.Text.Trim()!=""||txtPayType.Text.Trim()!=null)
- {
- strPay = txtPayType.Text.Trim();
- }
- if (String.IsNullOrEmpty(strAccount))
- {
- MessageUtil.ShowWarning("开户行账号不能为空");
- txt_BANKACCOUNT.Focus();
- return;
- }
- if (String.IsNullOrEmpty(strAccountName))
- {
- MessageUtil.ShowWarning("开户行名称不能为空");
- txt_BANKNAME.Focus();
- return;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(strAccount))
- {
- MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
- txt_BANKACCOUNT.Focus();
- return;
- }
- SuppBank Banks = new SuppBank();
- Banks.BankAccount = strAccount;
- Banks.BankName = strAccountName;
- Banks.PayTypeName = strPay;
- Banks.SuppCode = uge.Cells["suppCode"].Value.ToString().Trim();
- Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
- Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
- Banks.Id = uge.Cells["suppCode"].Value.ToString() + strAccount;
- Banks.Validflag = "1";
- SuppBank CC2= new SuppBank();
- CC2.SuppCode = StrnewsuppCode;
- CC2.PayTypeName = strPay;
- CC2.Validflag = "1";
- int count2 = this.execute<int>("com.hnshituo.pur.configure.service.SuppBankService", "count", new object[] { CC2 });
- if (count2 > 0)
- {
- MessageUtil.ShowTips("该供应商的有效开户行信息只能有一个,请先作废该供应商当前有效的开户行信息再添加");
- return;
- }
- CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "insert_SuppBank", new object[] { Banks });
- if (rt.Resultcode != 0)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt.Resultmsg);
- return;
- }
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
- SuppBank YY = new SuppBank();
- YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
- }
- else
- {
-
- //if (txt_CERTNO.Value == null)
- //{
- // MessageUtil.ShowWarning("证书编号不能为空");
- // return;
- //}
- //SuppAptitude CC = new SuppAptitude();
- //CC.SuppCode = uge.Cells["suppCode"].Value.ToString();
- //DataTable dtC1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { CC, 0, 0 });
- //for (int i = 0; i < dtC1.Rows.Count; i++)
- //{
- // if (dtC1.Rows[i]["CertNo"].Equals(txt_CERTNO.Text))
- // {
- // MessageUtil.ShowTips("证书编号不能重复,请核实后在操作!");
- // return;
- // }
- //}
- //SuppAptitude Aptis = new SuppAptitude();
- //Aptis.CertDesc = txt_CERTDESC.Text;
- //Aptis.CertiConstraint = txt_ap_constraint.Text;
- //Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
- //Aptis.CertNo = txt_CERTNO.Text;
- //Aptis.CertType = txt_ap_type.Text;
- //Aptis.CertValidStart = Convert.ToDateTime(txt_CERTVALID_start.Value);
- //Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
- //Aptis.SuppCode = uge.Cells["suppCode"].Value.ToString();
- //Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
- //Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
- //Aptis.ArchCode = txt_arch_code.Text;
- ////Aptis.Id = uge.Cells["suppCode"].Value.ToString() + txt_CERTNO.Text;//后台生成
- ////txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
- ////txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
- ////craftImg.Text = uge.Cells["CERTPATH"].Value.ToString();
- //Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
- //Aptis.CertPath = txt_certPath.Text.ToString().Trim();
- //Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
- //CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { Aptis });
- //if (rt1.Resultcode != 0)
- //{
- // Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt1.Resultmsg);
- // return;
- //}
- //Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
-
- //SuppAptitude YY = new SuppAptitude();
- //YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
- //DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
- //GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
- //ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
- //Info();
- //UpdateSupp();
- MessageUtil.ShowTips("请点击上传按钮!");
- return;
- }
- }
- }
- catch (Exception e)
- {
- Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+e);
- return;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void GetPUR_SUPP()//查询
- {
- try
- {
- dataTable1.Clear();
- dataTable2.Clear();
- dataTable3.Clear();
- dataTable4.Clear();
- Supp suppE = new Supp();
- suppE.SuppName = textBox1.Text.ToString().Trim();
- suppE.SupplierLinkMan = textBox2.Text.ToString().Trim();
- suppE.SuppCode = textBox3.Text.ToString().Trim();
- if (Qstatus.SelectedIndex != -1)
- {
- suppE.Status = Qstatus.Value.ToString().Trim();
- }
- if (QsuspendStatus.SelectedIndex != -1)
- {
- suppE.SuspendStatus = QsuspendStatus.Value.ToString().Trim();
- }
- if (cop_suppType.SelectedIndex != -1)
- {
- suppE.SuppType = cop_suppType.Value.ToString().Trim();
- }
- suppE.Validflag = "1";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppService", "get_Supp", new object[] { suppE, 0, 0 });
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);//绑定物料分类表
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (urg.Cells["end"].Value.Equals("1"))
- {
- urg.Appearance.BackColor = Color.Red;
- }
- if (urg.Cells["end"].Text.Equals("2"))
- {
- urg.Appearance.BackColor = Color.Yellow;
- }
- }
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("查询失败:"+ex);
- }
- }
- #endregion
- #region 控件事件
- /// <summary>
- /// 点击表格事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- int SQ = 0;//判断删除前点击那个界面
- private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
- {
- ClearTab();
- UltraGridRow uge = ultraGrid2.ActiveRow;
- if (uge == null)
- return;
- txt_BANKACCOUNT.Text = uge.Cells["BANKACCOUNT"].Value.ToString();
- txt_BANKNAME.Text = uge.Cells["BANKNAME"].Value.ToString();
- }
- private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
- {
- ClearTab();
- UltraGridRow uge = ultraGrid3.ActiveRow;
- if (uge == null)
- return;
- txt_CERTNO.Text = uge.Cells["CERTNO"].Value.ToString();
- txt_CERTDESC.Text = uge.Cells["CERTDESC"].Value.ToString();
- txt_CERTIOFFICER.Text = uge.Cells["CERTIOFFICER"].Value.ToString();
- txt_ap_constraint.Text = uge.Cells["CERTICONSTRAINT"].Value.ToString();
- txt_ap_type.Text = uge.Cells["CERTTYPE"].Value.ToString();
- txt_CERTVALID_start.Value = uge.Cells["CERTVALIDSTART"].Value.ToString();
- txt_CERTVALID_end.Value = uge.Cells["CERTVALIDEND"].Value.ToString();
- txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
- txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
- txt_certPath.Text = uge.Cells["CERTPATH"].Value.ToString();
- txt_arch_code.Text = uge.Cells["archCode"].Value.ToString();
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- dataTable2.Clear();
- dataTable3.Clear();
- dataTable4.Clear();
- ClearTab();
- ClearTabM();
- ClearTab5();
- UltraGridRow uge = ultraGrid1.ActiveRow;
- if (uge == null)
- return;
- Supp suppone = new Supp();
- suppone.SuppCode = uge.Cells["SUPPCODE"].Value.ToString();
- Supp suppone_entity = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { uge.Cells["SUPPCODE"].Value.ToString() });
- txt_SUPPISSUBCOMPANY.Value = suppone_entity.SuppIsSubCompany;//创建时间
- txt_SUPPISMANUFACTURER.Value = suppone_entity.SuppIsManufacturer;//创建人
- txt_SUPPISINTERNAL.Value = suppone_entity.SuppIsInternal;//采购管理科室描叙
- txt_SUPPADDRESS.Text = suppone_entity.SuppAddress;//供应商名称
- txt_SUPPRELATIONGRADE.Value = suppone_entity.SuppRelationGrade;//供应商代码
- txt_SUPPPERGRADE.Value = suppone_entity.SuppPerGrade;//是否暂挂1:暂挂 0:正常
- txt_SUPPREGCAPCURRENCY.Value = suppone_entity.SuppRegCapCurrency;//废除时间
- txt_SUPPREGCAPITAL.Value = suppone_entity.SuppRegCapital;//废除人
- txt_SUPPLICENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicEndDate);//采购管理部门描叙
- txt_SUPPTAXENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxEndDate);//管理科室代码
- txt_SUPPLICSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicStartDate);//采购管理部门代码
- txt_SUPPENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppEndDate);//管理部门代码
- txt_SUPPSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppStartDate);//供应商信用等级
- txt_SUPPTAXSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxStartDate);//管理部门描叙
- txt_SUPPOPERATESCOPE.Text = suppone_entity.SuppOperateScope;//采购管理科室代码
- txt_SUPPLICNUM.Text = suppone_entity.SuppLicNum;//管理科室描叙
- txt_SUPPCITY.Text = suppone_entity.SuppCity;//供应商联系人职务
- txt_SUPPREGISTRARNAME.Text = suppone_entity.SuppRegistrarName;//供应商联系人电话
- txt_SUPPSHORTNAME.Text = suppone_entity.SuppShortName;//供应商地址邮编
- txt_ORGCODE.Text = suppone_entity.OrgCode;//供应商地址
- txt_SUPPPROVINCE.Value = suppone_entity.SuppProvinceCode;//供应商省份
- cop_suppType.Text = suppone_entity.SuppCharacter;//供应商联系人传真
- txt_SUPPNAME.Text = suppone_entity.SuppName;//供应商合作关系等级
- txt_SUPPINDUSTRYTYPE.Text = suppone_entity.SuppIndustryType;//修改人
- txt_SUPPOFFICEPROVINCE.Value = suppone_entity.SuppOfficeProvinceCode;//供应商办公省份
- txt_SUPPNATIONALITY.Value = suppone_entity.SuppNationalityCode;//供应商国家
- txt_SUPPTAXID.Text = suppone_entity.SuppTaxId;//供应商联系人名称
- txt_SUPPCODE.Text = suppone_entity.SuppCode;//供应商评定等级
- txt_suppType.Value = suppone_entity.SuppType;
- txt_SUPPCONTACTTITLE.Text = suppone_entity.SuppContactTitle;//供应商联系人职务
- txt_SUPPCONTACTTEL.Text = suppone_entity.SuppContactTel;//供应商联系人电话
- txt_SUPPCONTACTFAX.Text = suppone_entity.SuppContactFax;//供应商联系人传真
- txt_SUPPCONTACTCELLPHONE.Text = suppone_entity.SuppContactCellPhone;//供应商联系人手机
- txt_SUPPCONTACTEMAIL.Text = suppone_entity.SuppContactEmail;//供应商联系人EMAIL
- txt_SUPPLIERLINKMAN.Text = suppone_entity.SupplierLinkMan;//供应商联系人名称
- txt_suppTaxRate.Value = suppone_entity.SuppTaxRate;//税率
- txt_postAdd.Text = suppone_entity.SuppAddPostal;
- txt_account_cw.Text = suppone_entity.AccountCw;
- txt_balanceCode.Text = suppone_entity.BalanceCode;//结算代码
- String strSuppCode=uge.Cells["suppCode"].Value.ToString();
- getSuppAptitude(strSuppCode,"");
- SuppBank YY1 = new SuppBank();
- YY1.SuppCode = strSuppCode;
- YY1.Validflag = "1";
- DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY1, 0, 0 });
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- GridHelper.RefreshAndAutoSize(ultraGrid2);
- MatEntity mat = new MatEntity();
- mat.Remark2 = strSuppCode;
- mat.Validflag = "1";
- DataTable dt_mat = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatService", "getMat", new object[] { mat});
- GridHelper.CopyDataToDatatable(dt_mat, dataTable4, true);
- GridHelper.RefreshAndAutoSize(ultraGrid4);
- SuppRate suppRate = new SuppRate();
- suppRate.SuppCode = strSuppCode;
- suppRate.ValidFlag = "1";
- DataTable dt_rate = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppRateService", "find", new object[] { suppRate, 0, 0 });
- GridHelper.CopyDataToDatatable(dt_rate, dataTable5, true);
- GridHelper.RefreshAndAutoSize(ultraGrid5);
- }
- private void ClearTabM()
- {
- publicPms.clearOldData(ultraTabPageControl1,new string[]{});
- //txt_SUPPISSUBCOMPANY.SelectedIndex = -1;//创建时间
- //txt_SUPPISMANUFACTURER.SelectedIndex = -1;//创建人
- //txt_SUPPISINTERNAL.SelectedIndex = -1;//采购管理科室描叙
- //txt_SUPPADDRESS.Clear();//供应商名称
- //txt_SUPPRELATIONGRADE.SelectedIndex = -1;//供应商代码
- //txt_SUPPPERGRADE.SelectedIndex = -1;
- //txt_SUPPREGCAPCURRENCY.SelectedIndex = -1;//废除时间
- //txt_SUPPREGCAPITAL.Clear();//废除人
- txt_SUPPLICENDDATE.Value = DateTime.Now.AddYears(2);//采购管理部门描叙
- txt_SUPPTAXENDDATE.Value = DateTime.Now.AddYears(2);//管理科室代码
- //txt_SUPPLICSTARTDATE.Value = DateTime.Now;//采购管理部门代码
- txt_SUPPENDDATE.Value = DateTime.Now.AddYears(2);//管理部门代码
- //txt_SUPPSTARTDATE.Value = DateTime.Now; ;//供应商信用等级
- //txt_SUPPTAXSTARTDATE.Value = DateTime.Now; ;//管理部门描叙
- //txt_SUPPOPERATESCOPE.Clear();//采购管理科室代码
- //txt_SUPPLICNUM.Clear();//管理科室描叙
- //txt_SUPPCITY.Clear();//供应商联系人职务
- //txt_SUPPREGISTRARNAME.Clear();//供应商联系人电话
- //txt_SUPPSHORTNAME.Clear();//供应商地址邮编
- //txt_ORGCODE.Clear();//供应商地址
- //txt_SUPPPROVINCE.SelectedIndex = -1;//供应商省份
- //cop_suppType.Clear();//供应商联系人传真
- //txt_SUPPNAME.Clear();//供应商合作关系等级
- //txt_SUPPINDUSTRYTYPE.Clear();//修改人
- //txt_SUPPOFFICEPROVINCE.SelectedIndex = -1;//供应商办公省份
- //txt_SUPPNATIONALITY.SelectedIndex = -1;//供应商国家
- //txt_SUPPTAXID.Clear();//供应商联系人名称
- //txt_SUPPCODE.Clear();//供应商评定等级
- //txt_suppType.SelectedIndex = -1;
- //txt_SUPPCONTACTTITLE.Clear();//供应商联系人职务
- //txt_SUPPCONTACTTEL.Clear();//供应商联系人电话
- //txt_SUPPCONTACTFAX.Clear();//供应商联系人传真
- //txt_SUPPCONTACTCELLPHONE.Clear();//供应商联系人手机
- //txt_SUPPCONTACTEMAIL.Clear();//供应商联系人EMAIL
- //txt_SUPPLIERLINKMAN.Clear();//供应商联系人名称
- //txt_suppTaxRate.SelectedIndex = -1;//税率
- //txt_postAdd.Clear();
- //txt_account_cw.Clear();
- }
- private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
- {
- this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
- SQ = 1;
- }
- private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
- {
- SQ = 2;
- this.ultraTabControl1.SelectedTab = ultraTabPageControl3.Tab;
- }
- private void ultraGrid3_ClickCell(object sender, ClickCellEventArgs e)
- {
- SQ = 3;
- this.ultraTabControl1.SelectedTab = ultraTabPageControl4.Tab;
- }
- private void ultraGrid5_ClickCell(object sender, ClickCellEventArgs e)
- {
- SQ = 5;
- this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[3];
- }
- private void txt_SUPPLICSTARTDATE_BeforeDropDown(object sender, CancelEventArgs e)
- {
-
- }
- ///// <summary>
- ///// 洲际筛选事件
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void txt_island_ValueChanged(object sender, EventArgs e)
- //{
- // try
- // {
- // String strisland = txt_island.Text.ToString().Trim();
-
- // //AdminRegion ar = new AdminRegion();
- // //ar.Validflag = "1";
- // //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.AdminRegionService", "find", new object[] { ar, 0, 0 });
- // //FillComboxItems(txt_island, dt, "regionNo", "regionNm", "regionType='A'");
- // FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A' AND regionNm like '%" + strisland + "%'");
- // }
- // catch(Exception ex)
- // {
- // //MessageUtil.ShowTips("地点数据加载失败");
- // }
- //}
- /// <summary>
- /// 根据洲际对省份和国家进行筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_island_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- String strisland = txt_island.Value.ToString().Trim();
- FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND pRegionNo like '" + strisland + "%'");
- FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '" + strisland + "%'");
- }
- catch (Exception ex)
- {
- //MessageUtil.ShowTips("地点数据加载失败");
- }
- }
- ///// <summary>
- ///// 国家选择事件
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void txt_SUPPNATIONALITY_ValueChanged(object sender, EventArgs e)
- //{
- // try
- // {
- // String strsuppNationName = txt_SUPPNATIONALITY.Text.ToString().Trim();
- // FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
- // }
- // catch (Exception ex)
- // {
-
- // }
- //}
- /// <summary>
- /// 国家选择事件对省份进行晒选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_SUPPNATIONALITY_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- String strsuppNationCode = txt_SUPPNATIONALITY.Value.ToString().Trim();
- //FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + strsuppNationCode.Substring(0,1) + "%'");
- FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
- }
- catch(Exception ex)
- {}
- //}
- ///// <summary>
- ///// 省份选择事件
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void txt_SUPPPROVINCE_ValueChanged(object sender, EventArgs e)
- //{
- // try
- // {
- // String strproName = txt_SUPPPROVINCE.Text.ToString().Trim();
- // FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND regionNm like '%" + strproName + "%'");
- // }
- // catch (Exception ex)
- // {
-
- // }
- }
- /// <summary>
- /// 省份选择对洲际和国家进行筛选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txt_SUPPPROVINCE_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- String txt_SUPPPROVINCECode = txt_SUPPPROVINCE.Value.ToString().Trim();
- String tr1 = txt_SUPPPROVINCECode.Substring(0,1);
- String tr2 = txt_SUPPPROVINCECode.Substring(0,3);
- //FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + tr1 + "%'");
- FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND regionNo like '" + tr2 + "%'");
- }
- catch (Exception ex)
- { }
- }
- ///// <summary>
- ///// 办公国家选择(对办公地点进行筛选)
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void txt_SUPPOFFICEPROVINCENATION_ValueChanged(object sender, EventArgs e)
- //{
- // try
- // {
- // String strsuppNationName = txt_SUPPOFFICEPROVINCENATION.Text.ToString().Trim();
- // FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
- // }
- // catch (Exception ex)
- // {
- // }
- //}
- private void txt_SUPPOFFICEPROVINCENATION_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- String strsuppNationCode = txt_SUPPOFFICEPROVINCENATION.Value.ToString().Trim();
- FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
- }
- catch (Exception ex)
- { }
- }
- #endregion
- #region 正则表达式
- /**
- * 是否为小数
- *
- * */
- public bool Isdecimal(string str)
- {
- decimal y;
- return decimal.TryParse(str, out y);
- }
- /// <summary>
- /// 是否为整数
- /// </summary>
- /// <param name="str"></param>
- /// <returns></returns>
- public bool IsInts(string str)
- {
- int y;
- return int.TryParse(str, out y);
- }
- /// <summary>
- /// 手机/电话号码的验证
- /// </summary>
- /// <param name="str"></param>
- /// <returns></returns>
- public bool isTelPhoneNum(String str)
- {
- //return Regex.IsMatch(str, @"^1[358][0-9]{9}$") || Regex.IsMatch(str, @"^(\d{3.4}-)\d{7,8}$|1[358][0-9]{9}$");
- return Regex.IsMatch(str, @"^(\d{3,4}-)\d{7,8}$|1[358][0-9]{9}$");
- //Regex rx = new Regex(@"((d{3,4})|d{3,4}-)?d{7,8}(-d{3})*");
- // return rx.IsMatch(str);
- }
- //身份证的验证
- public bool isId(String str)
- {
- return Regex.IsMatch(str, @"^\d{15}|\d{18}$");
- }
- //邮箱的验证
- public bool isEmail(String str)
- {
- return Regex.IsMatch(str, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
- }
- /// <summary>
- /// 判断数据库中是否存在相同的列
- /// </summary>
- /// <param name="strJavaPackName"></param>
- /// <param name="o"></param>
- /// <returns>true存在</returns>
- public int isExsitRow(string strJavaPackName, object o)
- {
- DataTable dt = this.execute<DataTable>(strJavaPackName, "find", new object[] { o, 0, 0 });
- if (dt != null && dt.Rows.Count > 0)//存在相同的行
- {
- return dt.Rows.Count;
- }
- return 0;
- }
- #endregion
- #region 初始化
- public void init()
- {
- try
- {
- txt_SUPPISSUBCOMPANY.Value = "0";
- txt_SUPPISMANUFACTURER.Value = "0";
- txt_SUPPISINTERNAL.Value = "0";
- Qstatus.SelectedIndex = 0;
- QsuspendStatus.SelectedIndex = 1;
- //加载下拉列表数据
- //加载国家身份下拉框
- AdminRegion ar = new AdminRegion();
- ar.Validflag = "1";
- regions = this.execute<DataTable>("com.hnshituo.pur.configure.service.AreaService", "find", new object[] { ar, 0, 0 });
- FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A'");
- FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC'");
- FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
- FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType='AC'");
- FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
- //加载税率下拉框
- DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1109" }, this.ob);
- ConfigureClassCommon.FilComboboxAdd(txt_suppTaxRate, dt1, "memo", "baseName", "validflag NOT in ('0')",true,"","");
- //加载供应商等级下拉框
- DataTable dt2 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1217" }, this.ob);
- ConfigureClassCommon.FilComboboxAdd(txt_SUPPPERGRADE, dt2, "baseCode", "baseName", "validflag NOT in ('0')",false,"","");
- //供应商货币类型
- DataTable dt3 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1001" }, this.ob);
- ConfigureClassCommon.FilComboboxAdd(txt_SUPPREGCAPCURRENCY, dt3, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
- //付款方式
- DataTable dt5 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME", new Object[] { }, this.ob);
- ConfigureClassCommon.FilComboboxAdd(txtPayType, dt5, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "", "");
- //供应商类别
- DataTable dt4 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1231" }, this.ob);
- ConfigureClassCommon.FilComboboxAdd(txt_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
- ConfigureClassCommon.FilComboboxAdd(cop_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", true, "全部", " ");
- cop_suppType.SelectedIndex = 0;
- //设定gd不可编辑
- ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
- ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
-
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("界面加载初始化数据失败");
- }
- }
- #endregion
- // private void QueryPayType()
- // {
- // try
- // {
- // txtPayType.Items.Clear();
- // DataTable dt = PublicServer.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME",
- //new Object[] { }, ob);
- // if (dt == null || dt.Rows.Count == 0)
- // {
- // return;
- // }
- // txtPayType.DataSource = dt;
- // txtPayType.DisplayMember = "BASENAME";
- // txtPayType.ValueMember = "BASECODE";
- // }
- // catch (Exception e)
- // {
- // MessageUtil.ShowWarning(e.Message);
- // return;
- // }
- // }
- #region 公共函数
- /// <summary>
- /// 清空tab页控件值
- /// </summary>
- private void ClearTab()
- {
- txt_BANKACCOUNT.Text = "";
- txt_BANKNAME.Text = "";
- txt_CERTNO.Text = "";
- txt_CERTDESC.Text = "";
- txt_CERTIOFFICER.Text = "";
- txt_ap_constraint.Text = "";
- txt_ap_type.Text = "";
- txt_CERTVALID_start.Text = "";
- txt_certPath.Text = "";
- txt_certpath_old.Text = "";
- txt_certNo_v.Text = "";
- txt_CERTVALID_start.Value = DateTime.Now.AddDays(1).ToString();
- txt_CERTVALID_end.Value = DateTime.Now.AddYears(1).ToString();
- }
- private void ClearTab5()
- {
- publicPms.clearOldData(ultraTabPageControl4);
- }
- /// <summary>
- /// 初始化Combox数据,加入数据筛选
- /// </summary>
- /// <param name="cmbx">ComboBox控件</param>
- /// <param name="dt">DataTable</param>
- /// <param name="filterCondition">RowFilter条件</param>
- public static void FillComboxItems(UltraComboEditor cmbx, DataTable dt, string valueCol, string textCol, string filterCondition)
- {
- if (dt != null && dt.Rows.Count > 0)
- {
- DataView dvw = dt.DefaultView;
- dvw.RowFilter = filterCondition;
- ArrayList aryTmp = new ArrayList();
- aryTmp.Add(new ValueListItem(" "," "));
- for (int i = 0; i < dvw.Count; i++)
- {
- aryTmp.Add(new ValueListItem( dvw[i][valueCol].ToString(),dvw[i][textCol].ToString()));
- }
- cmbx.DataSource = aryTmp;
- cmbx.DisplayMember = "DisplayText";
- cmbx.ValueMember = "DataValue";
- }
- }
- /// <summary>
- /// 校验供方数据
- /// </summary>
- /// <returns></returns>
- private bool testSupp()// 校验供方数据
- {
- if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
- {
- MessageBox.Show("请输入供应商编号", "提示");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (txt_SUPPCODE.Text.Trim().Length>11)
- {
- MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
- {
- MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
- txt_SUPPCODE.Focus();
- // return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
- {
- MessageBox.Show("请输入供应商名称", "提示");
- txt_SUPPNAME.Focus();
- //return false;
- }
- if (txt_SUPPNAME.Text.Trim().Length>120)
- {
- MessageBox.Show("请输入供应商名称最多120位", "提示");
- txt_SUPPNAME.Focus();
- //return false;
- }
- //if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
- //{
- // MessageBox.Show("请输入供应商法人", "提示");
- // txt_SUPPREGISTRARNAME.Focus();
- // return false;
- //}
- if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
- {
- MessageBox.Show("请输入组织机构代码", "提示");
- txt_ORGCODE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
- {
- MessageBox.Show("请输入供应商税号", "提示");
- txt_SUPPTAXID.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
- {
- MessageBox.Show("请输入供应商营业执照", "提示");
- txt_SUPPLICNUM.Focus();
- //return false;
- }
- //手机号码验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的手机号码", "提示");
- txt_SUPPCONTACTCELLPHONE.Focus();
- //return false;
- }
- //电话号码验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的电话号码", "提示");
- txt_SUPPCONTACTTEL.Focus();
- //return false;
- }
- //传真验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的传真号码", "提示");
- txt_SUPPCONTACTFAX.Focus();
- //return false;
- }
- //邮箱验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的邮箱", "提示");
- txt_SUPPCONTACTEMAIL.Focus();
- //return false;
- }
- if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
- {
- MessageUtil.ShowTips("供应商编号需大于6位");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (txt_SUPPCODE.Text.ToString().Trim().Length >10)
- {
- MessageUtil.ShowTips("供应商编号需小于等于10位");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (txt_SUPPREGCAPCURRENCY.Text == "")
- {
- MessageUtil.ShowTips("供应商货币类型不能为空");
- txt_SUPPREGCAPCURRENCY.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商生效开始时间不能为空");
- txt_SUPPSTARTDATE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商生效结束时间不能为空");
- txt_SUPPENDDATE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
- txt_SUPPTAXSTARTDATE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
- txt_SUPPTAXENDDATE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
- txt_SUPPLICSTARTDATE.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
- txt_SUPPLICENDDATE.Focus();
- //return false;
- }
- if (txt_suppTaxRate.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("供应商税率不能为空");
- txt_suppTaxRate.Focus();
- //return false;
- }
- if (txt_suppType.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("供应商类型不能为空");
- txt_suppType.Focus();
- //return false;
- }
- if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
- {
- MessageUtil.ShowTips("供应商邮编不能为空");
- txt_postAdd.Focus();
- //return false;
- }
- if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
- {
- if (txt_account_cw.Text.Trim().Length > 10)
- {
- MessageUtil.ShowTips("财务供应商编码最多10位");
- txt_account_cw.Focus();
- //return false;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
- {
- MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
- txt_account_cw.Focus();
- // return false;
- }
- }
- return true;
- }
- /// <summary>
- /// 校验供方数据
- /// </summary>
- /// <returns></returns>
- private bool TestSupp()// 校验供方数据
- {
- if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
- {
- MessageBox.Show("请输入供应商编号", "提示");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (txt_SUPPCODE.Text.Trim().Length > 11)
- {
- MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
- txt_SUPPCODE.Focus();
- //return false;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
- {
- MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
- txt_SUPPCODE.Focus();
- // return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
- {
- MessageBox.Show("请输入供应商名称", "提示");
- txt_SUPPNAME.Focus();
- return false;
- }
- if (txt_SUPPNAME.Text.Trim().Length > 120)
- {
- MessageBox.Show("请输入供应商名称最多120位", "提示");
- txt_SUPPNAME.Focus();
- return false;
- }
- //if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
- //{
- // MessageBox.Show("请输入供应商法人", "提示");
- // txt_SUPPREGISTRARNAME.Focus();
- // return false;
- //}
- if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
- {
- MessageBox.Show("请输入组织机构代码", "提示");
- txt_ORGCODE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
- {
- MessageBox.Show("请输入供应商税号", "提示");
- txt_SUPPTAXID.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
- {
- MessageBox.Show("请输入供应商营业执照", "提示");
- txt_SUPPLICNUM.Focus();
- return false;
- }
- //手机号码验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的手机号码", "提示");
- txt_SUPPCONTACTCELLPHONE.Focus();
- return false;
- }
- //电话号码验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的电话号码", "提示");
- txt_SUPPCONTACTTEL.Focus();
- return false;
- }
- //传真验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的传真号码", "提示");
- txt_SUPPCONTACTFAX.Focus();
- return false;
- }
- //邮箱验证
- if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
- {
- MessageBox.Show("请输入有效的邮箱", "提示");
- txt_SUPPCONTACTEMAIL.Focus();
- return false;
- }
- if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
- {
- MessageUtil.ShowTips("供应商编号需大于6位");
- txt_SUPPCODE.Focus();
- return false;
- }
- if (txt_SUPPCODE.Text.ToString().Trim().Length > 10)
- {
- MessageUtil.ShowTips("供应商编号需小于等于10位");
- txt_SUPPCODE.Focus();
- return false;
- }
- if (txt_SUPPREGCAPCURRENCY.Text == "")
- {
- MessageUtil.ShowTips("供应商货币类型不能为空");
- txt_SUPPREGCAPCURRENCY.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商生效开始时间不能为空");
- txt_SUPPSTARTDATE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商生效结束时间不能为空");
- txt_SUPPENDDATE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
- txt_SUPPTAXSTARTDATE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
- txt_SUPPTAXENDDATE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
- {
- MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
- txt_SUPPLICSTARTDATE.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
- {
- MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
- txt_SUPPLICENDDATE.Focus();
- return false;
- }
- if (txt_suppTaxRate.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("供应商税率不能为空");
- txt_suppTaxRate.Focus();
- return false;
- }
- if (txt_suppType.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("供应商类型不能为空");
- txt_suppType.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
- {
- MessageUtil.ShowTips("供应商邮编不能为空");
- txt_postAdd.Focus();
- return false;
- }
- if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
- {
- if (txt_account_cw.Text.Trim().Length > 10)
- {
- MessageUtil.ShowTips("财务供应商编码最多10位");
- txt_account_cw.Focus();
- return false;
- }
- if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
- {
- MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
- txt_account_cw.Focus();
- return false;
- }
- }
- return true;
- }
- #endregion
- #region 附件上传
- private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- try
- {
- UltraGridRow row = ultraGrid3.ActiveRow;
- string filePathOld = row.GetValue("certPathOld");
- if (e.Button.Key.ToLower().Equals("select"))
- {
- FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
- down.DeleteButton.Visible = false;
- down.ShowDialog();
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("操作失败:" + ex);
- }
- }
- private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
- {
- try
- {
- if (e.Button.Key.ToLower().Equals("insert"))
- {
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = false;
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- fileName = file.FileName;
- string filena = System.IO.Path.GetFileName(fileName);
- string certNo = filena.Split('.')[0];
- String filePathlocal = System.IO.Path.GetFullPath(fileName);
- txt_certPath.Text = filena;
- txt_certpath_local.Text = filePathlocal;
- txt_CERTNO.Text = certNo;
- }
- }
- }
- catch (Exception ex)
- {
- MessageUtil.ShowTips("操作失败:" + ex);
- }
- }
- //上传按钮
- private void btn_submitAppend_Click(object sender, EventArgs e)
- {
- try
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowTips("未选择供应商");
- return;
- }
-
- if (txt_ap_type.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("证书类型不能为空");
- txt_ap_type.Focus();
- return;
- }
- if (txt_ap_constraint.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("证书强制类型不能为空");
- txt_ap_constraint.Focus();
- return;
- }
- if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
- {
- MessageUtil.ShowTips("证书有效期开始时间不能为空");
- txt_CERTVALID_start.Focus();
- return;
- }
- if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
- {
- MessageUtil.ShowTips("证书有效期结束时间不能为空");
- txt_CERTVALID_end.Focus();
- return;
- }
-
- Info();
- UpdateSupp();
- MessageUtil.ShowTips("添加成功");
- ClearTab5();
-
- }
- catch (Exception ex)
- {
- MessageBox.Show("添加失败");
- }
- ////刷新界面并激活当前行
- //Relocate(sat);
- }
-
- private bool testSuppAptitude()
- {
- if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
- {
- MessageUtil.ShowTips("证书文件不能为空");
- txt_certPath.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_certpath_local.Text.Trim()))
- {
- MessageUtil.ShowTips("证书本地地址不能为空");
- txt_certpath_local.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_CERTNO.Text.Trim()))
- {
- MessageUtil.ShowTips("证书文件名不能为空");
- txt_CERTNO.Focus();
- return false;
- }
- if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
- {
- MessageUtil.ShowTips("证书文件不能为空");
- txt_certPath.Focus();
- return false;
- }
- if(txt_ap_constraint.SelectedIndex==-1)
- {
- MessageUtil.ShowTips("证书强制类型不能为空");
- txt_ap_constraint.Focus();
- return false;
- }
- if(txt_ap_type.SelectedIndex==-1)
- {
- MessageUtil.ShowTips("证书类型不能为空");
- txt_ap_type.Focus();
- return false;
- }
- return true;
- }
- private void Relocate(SuppAptitude sat)
- {
- getSuppAptitude(sat.SuppCode, sat.CertPath);
- }
- ///// <summary>
- ///// 加载文件事件
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- //{
- // try
- // {
- // ultraGrid3.UpdateData();
- // UltraGridRow row = ultraGrid3.ActiveRow;
- // string filePathOld = row.GetValue("certPathOld");
- // string strId = row.GetValue("id");
- // string filePathNew = "";
- // if (e.Button.Key.ToLower().Equals("select"))
- // {
- // FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
- // down.DeleteButton.Visible = false;
- // down.ShowDialog();
- // }
- // else if (e.Button.Key.ToLower().Equals("insert"))
- // {
- // if (ultraGrid1.ActiveRow == null)
- // {
- // MessageUtil.ShowTips("未选择供方信息");
- // return;
- // }
- // string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
- // string guid = Guid.NewGuid().ToString("N").ToUpper();
- // //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
- // //down.ctrlFileDown1.FilePath = filePathOld;
- // //if (down.ctrlFileDown1.List.Count > 0)
- // //{
- // // MessageUtil.ShowWarning("只能上传一份文件!");
- // // return;
- // //}
- // List<FileBean> list = new List<FileBean>();
- // FileBean bean = new FileBean();
- // OpenFileDialog file = new OpenFileDialog();
- // file.Multiselect = false;
- // DialogResult drStat;
- // drStat = file.ShowDialog();
- // if (drStat == DialogResult.OK)
- // {
- // string fileName = file.FileName;
- // string filena = System.IO.Path.GetFileName(fileName);
- // string certNo = filena.Split('.')[0];
- // //if (!certNo.ToUpper().Contains("CT"))
- // //{
- // // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
- // // return;
- // //}
- // filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
- // SuppAptitude sat = new SuppAptitude();
- // sat.SuppCode = strsuppCode;
- // sat.CertNo = certNo;
- // sat.CertPath = filena;
- // sat.CertPathOld = filePathNew + filena;
- // sat.CertNoV = guid;
- // sat.Id = strId;
- // if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
- // {
- // if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
- // {
- // return;
- // }
- // }
- // //更新资质行记录
- // if (SaveCert(sat) == false) return;
- // bean = new FileBean();
- // bean.setFileName(filena);
- // bean.setPathName(filePathNew);
- // bean.setFile(FileHelper.FileToArray(fileName));
- // list.Add(bean);
- // bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- // if (isSuccess)
- // {
- // MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- // ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
- // }
- // else
- // {
- // MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- // }
- // //刷新界面并激活当前行
- // Relocate(sat.CertNo);
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageUtil.ShowTips("操作失败:" + ex);
- // }
- //}
- ///// <summary>
- ///// 加载文件事件
- ///// </summary>
- ///// <param name="sender"></param>
- ///// <param name="e"></param>
- //private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
- //{
- // try
- // {
- // //ultraGrid3.UpdateData();
- // //UltraGridRow row = ultraGrid3.ActiveRow;
- // string filePathOld = txt_certpath_old.Text.ToString().Trim();
- // //string strId = row.GetValue("id");
- // string filePathNew = "";
- // if (e.Button.Key.ToLower().Equals("select"))
- // {
- // FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
- // down.DeleteButton.Visible = false;
- // down.ShowDialog();
- // }
- // else if (e.Button.Key.ToLower().Equals("insert"))
- // {
- // if (ultraGrid1.ActiveRow == null)
- // {
- // MessageUtil.ShowTips("未选择供方信息");
- // return;
- // }
- // string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
- // string guid = Guid.NewGuid().ToString("N").ToUpper();
- // //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
- // //down.ctrlFileDown1.FilePath = filePathOld;
- // //if (down.ctrlFileDown1.List.Count > 0)
- // //{
- // // MessageUtil.ShowWarning("只能上传一份文件!");
- // // return;
- // //}
- // List<FileBean> list = new List<FileBean>();
- // FileBean bean = new FileBean();
- // OpenFileDialog file = new OpenFileDialog();
- // file.Multiselect = false;
- // DialogResult drStat;
- // drStat = file.ShowDialog();
- // if (drStat == DialogResult.OK)
- // {
- // string fileName = file.FileName;
- // string filena = System.IO.Path.GetFileName(fileName);
- // string certNo = filena.Split('.')[0];
- // //if (!certNo.ToUpper().Contains("CT"))
- // //{
- // // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
- // // return;
- // //}
- // filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
- // SuppAptitude sat = new SuppAptitude();
- // sat.SuppCode = strsuppCode;
- // sat.CertNo = certNo;
- // txt_CERTNO.Text = certNo;
- // sat.CertPath = filena;
- // txt_certPath.Text = filena;
- // sat.CertPathOld = filePathNew + filena;
- // txt_certpath_old.Text = filePathNew + filena;
- // sat.CertNoV = guid;
- // txt_certNo_v.Text = guid;
- // //sat.Id = strId;
- // if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
- // {
- // if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
- // {
- // return;
- // }
- // }
- // //更新资质行记录
- // //if (SaveCert(sat) == false) return;
- // bean = new FileBean();
- // bean.setFileName(filena);
- // bean.setPathName(filePathNew);
- // bean.setFile(FileHelper.FileToArray(fileName));
- // list.Add(bean);
- // bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- // if (isSuccess)
- // {
- // MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- // //ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
- // }
- // else
- // {
- // MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- // }
- // //刷新界面并激活当前行
- // //Relocate(sat.CertNo);
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // MessageUtil.ShowTips("操作失败:" + ex);
- // }
- //}
- /// <summary>
- /// 判断是否之前已提交相同的文件
- /// </summary>
- /// <param name="craftNo"></param>
- /// <returns></returns>
- private int GetCraftFileCraftNoCnt(string craftNo, string suppCode)
- {
- SuppAptitude sat = new SuppAptitude();
- sat.SuppCode = suppCode;
- sat.CertNo = craftNo;
- int dt = this.execute<int>("com.hnshituo.pur.configure.service.SuppAptitudeService", "count", new object[] { sat });
- return dt;
- }
- /// <summary>
- /// 保存资质信息行
- /// </summary>
- /// <param name="sat"></param>
- /// <returns></returns>
- private bool SaveCert(SuppAptitude sat)
- {
- CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { sat });
- if (re.Resultcode == 0)
- {
- return true;
- }
- else
- {
- MessageUtil.ShowTips("上传失败:" + re.Resultmsg);
- return false;
- }
- }
- //获取供应商文件
- private void getSuppAptitude(String strSuppCode, string craftNo)
- {
- SuppAptitude YY = new SuppAptitude();
- YY.SuppCode = strSuppCode;
- DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "findAptitude", new object[] { YY});
- GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
- GridHelper.RefreshAndAutoSize(ultraGrid3);
- if (!String.IsNullOrEmpty(craftNo))
- {
- ConfigureClassCommon.doActiveSelRow(ultraGrid3, "certNo", craftNo);
- }
- }
- #endregion
- private void Info()
- {
- if (txt_ap_type.Value != null)
- {
- if (txt_ap_type.Value.Equals("1"))
- {
- txt_SUPPLICNUM.Text = txt_arch_code.Text.ToString();//营业执照
- txt_SUPPLICSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
- txt_SUPPLICENDDATE.Text = txt_CERTVALID_end.Text.ToString();
- }
- else if (txt_ap_type.Value.Equals("2"))
- {
- txt_ORGCODE.Text = txt_arch_code.Text.ToString();//组织机构代码证
- txt_SUPPSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
- txt_SUPPENDDATE.Text = txt_CERTVALID_end.Text.ToString();
- }
- else if (txt_ap_type.Value.Equals("3"))
- {
- txt_SUPPTAXID.Text = txt_arch_code.Text.ToString();//税务登记证
- txt_SUPPTAXSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
- txt_SUPPTAXENDDATE.Text = txt_CERTVALID_end.Text.ToString();
- }
- }
- }
- private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow uge5 = ultraGrid5.ActiveRow;
- Combo_Rate.Text = uge5.Cells["rate"].Value.ToString2().Trim();
- txt_Rate_Year.Text = uge5.Cells["rateYear"].Value.ToString2().Trim();
- }
- private void upLoadFile_Click(object sender, EventArgs e)
- {
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowTips("未选择供应商");
- return;
- }
- string strSuppCode = ultraGrid1.ActiveRow.GetValue("SuppCode");
- string strSuppName = ultraGrid1.ActiveRow.GetValue("SuppName");
- if (String.IsNullOrEmpty(strSuppCode))
- {
- }
- String filena = txt_certPath.Text.ToString().Trim();
- if (String.IsNullOrEmpty(filena) || String.IsNullOrEmpty(fileName))
- {
- MessageUtil.ShowTips("请选择待上传文件");
- return;
- }
- if (testSuppAptitude() == false)
- {
- return;
- }
- SuppAptitude sat = new SuppAptitude();
- sat.SuppCode = strSuppCode;
- sat.SuppName = strSuppName;
- String filePathNew = "Pms/CERT/SUPP/" + strSuppCode + "/";
- sat.CertPath = filena;
- sat.CertPathOld = filePathNew + filena;
- sat.CreateUserid = UserInfo.GetUserID();
- sat.CreateName = UserInfo.GetUserName();
- sat.ArchCode = txt_arch_code.Text.Trim();
- sat.CreateTime = DateTime.Now;
- sat.CertNo = txt_CERTNO.Text.Trim();
- sat.CertiOfficer = txt_CERTIOFFICER.Text.Trim();
- if (txt_ap_type.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("证书类型不能为空");
- txt_ap_type.Focus();
- return;
- }
- sat.CertType = txt_ap_type.Value.ToString().Trim();
- if (txt_ap_constraint.SelectedIndex == -1)
- {
- MessageUtil.ShowTips("证书强制类型不能为空");
- txt_ap_constraint.Focus();
- return;
- }
- sat.CertiConstraint = txt_ap_constraint.Value.ToString().Trim();
- if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
- {
- MessageUtil.ShowTips("证书有效期开始时间不能为空");
- txt_CERTVALID_start.Focus();
- return;
- }
- if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
- {
- MessageUtil.ShowTips("证书有效期结束时间不能为空");
- txt_CERTVALID_end.Focus();
- return;
- }
- sat.CertValidStart = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_start.Value).ToShortDateString() + " 00:00:00");
- sat.CertValidEnd = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_end.Value).ToShortDateString() + " 23:59:59");
- sat.Validflag = "1";
- sat.CertDesc = txt_CERTDESC.Text.Trim();
- if (GetCraftFileCraftNoCnt(filena, strSuppCode) > 0)
- {
- MessageUtil.ShowTips("供应商已存在该附件文件:" + filena);
- return;
- }
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- bean = new FileBean();
- bean.setFileName(filena);
- bean.setPathName(filePathNew);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- //开始写数据库
- CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { sat });
- if (crt.Resultcode != 0)
- {
- MessageUtil.ShowTips("上传失败:" + crt.Resultmsg);
- }
- else
- {
- Info();
- UpdateSupp();
- MessageUtil.ShowTips("上传成功");
- ClearTab5();
- }
- }
- else
- {
- MessageBox.Show("上传失败");
- }
- //刷新界面并激活当前行
- Relocate(sat);
- }
- }
- }
|