SupplierManagement.cs 118 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;using Pur.Entity;
  10. using Core.Mes.Client.Comm.Control;
  11. using Pur.Entity.configureEntity;
  12. using Infragistics.Win.UltraWinGrid;
  13. using System.Collections;
  14. using Core.Mes.Client.Comm.Tool;
  15. using System.Data.OracleClient;
  16. using com.hnshituo.pur.vo;
  17. using System.Text.RegularExpressions;
  18. using Infragistics.Win;
  19. using Infragistics.Win.UltraWinEditors;
  20. using com.hnshituo.sel.vo;
  21. using Core.Mes.Client.Comm.Server;
  22. using Pur.Pop_upWindow;
  23. using CoreFS.SA06;
  24. using Pur.configure;
  25. using Pur.PublicTools;
  26. using Core.Mes.Client.Comm.Format;
  27. namespace Pur
  28. {
  29. public partial class SupplierManagement : FrmPmsBase
  30. {
  31. //地址(国家省份)信息
  32. DataTable regions;
  33. //附件上传
  34. String fileName = "";
  35. public SupplierManagement()
  36. {
  37. InitializeComponent();
  38. this.IsLoadUserView = true;
  39. }
  40. private void SupplierManagement_Load(object sender, EventArgs e)
  41. {
  42. init();
  43. GetPUR_SUPP();
  44. ultraExpandableGroupBox1.Expanded = false;
  45. ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
  46. GridHelper.SetExcludeColumnsActive(ultraGrid1.DisplayLayout.Bands[0], new string[] { });
  47. GridHelper.SetExcludeColumnsActive(ultraGrid2.DisplayLayout.Bands[0], new string[] { });
  48. GridHelper.SetExcludeColumnsActive(ultraGrid3.DisplayLayout.Bands[0], new string[] { "certPath" });
  49. GridHelper.SetExcludeColumnsActive(ultraGrid4.DisplayLayout.Bands[0], new string[] { });
  50. string basecode = "1217";
  51. DataTable dt = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { basecode }, this.ob);
  52. dt = dt.AsEnumerable().Where(p => p["VALIDFLAG"].ToString().Equals("1")).CopyToDataTable();
  53. Combo_Rate.DataSource = dt;
  54. Combo_Rate.DisplayMember = "BASENAME";
  55. Combo_Rate.ValueMember = "BASECODE";
  56. //ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  57. //ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  58. //ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  59. }
  60. #region toolbar菜单
  61. public override void ToolBar_Click(object sender, string ToolbarKey)
  62. {
  63. switch (ToolbarKey)
  64. {
  65. case "Query":
  66. GetPUR_SUPP();
  67. break;
  68. case "Add":
  69. AddPUR_SUPP();
  70. break;
  71. case "Update":
  72. UpdPUR_SUPP();
  73. break;
  74. case "Delete":
  75. DelPUR_SUPP();
  76. break;
  77. case "close":
  78. CloPUR_SUPP();
  79. break;
  80. case "Enable":
  81. EnaPUR_SUPP();
  82. break;
  83. case "Pending":
  84. PenPUR_SUPP();
  85. break;
  86. case "ShenXIao":
  87. ShenPUR_SUPP();
  88. break;
  89. case "ChangePWD":
  90. ChangePWD();
  91. break;
  92. case "doExcel":
  93. doExcel();
  94. break;
  95. }
  96. }
  97. //导出Excel
  98. private void doExcel()
  99. {
  100. try
  101. {
  102. this.Cursor = Cursors.Default;
  103. ArrayList alUltraGrid = new ArrayList();
  104. alUltraGrid.Add(ultraGrid1);
  105. ArrayList alSheeft = new ArrayList();
  106. alSheeft.Add("供应商清单");
  107. if (ultraGrid1.Rows.Count > 0)
  108. {
  109. GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "供应商清单");//导出excel
  110. }
  111. else
  112. {
  113. MessageUtil.ShowTips("无可导出明细!");
  114. }
  115. }
  116. catch (Exception e)
  117. {
  118. MessageUtil.ShowTips("导出失败" + e.Message);
  119. }
  120. finally
  121. {
  122. this.Cursor = Cursors.Default;
  123. }
  124. }
  125. /// <summary>
  126. /// 修改供应商密码
  127. /// </summary>
  128. private void ChangePWD()
  129. {
  130. UltraGridRow uRow = ultraGrid1.ActiveRow;
  131. if (uRow == null)
  132. {
  133. MessageUtil.ShowTips("请选择供应商");
  134. return;
  135. }
  136. String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
  137. String strSuppName = uRow.Cells["suppName"].Value.ToString().Trim();
  138. if (String.IsNullOrEmpty(strSuppCode))
  139. {
  140. MessageUtil.ShowTips("选择供应商的编号为空!");
  141. return;
  142. }
  143. FrmSuppChangePassword frm = new FrmSuppChangePassword(strSuppName, strSuppCode,this.ob);
  144. frm.ShowDialog();
  145. }
  146. #endregion
  147. #region toolbar菜单事件
  148. /// <summary>
  149. /// 生效
  150. /// </summary>
  151. private void ShenPUR_SUPP()//生效
  152. {
  153. try
  154. {
  155. UltraGridRow uRow = ultraGrid1.ActiveRow;
  156. if (uRow == null)
  157. {
  158. MessageUtil.ShowTips("请选择供应商");
  159. return;
  160. }
  161. ArrayList list = new ArrayList();
  162. Supp Supp_Entity = new Supp();
  163. Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
  164. Supp_Entity.Status = "4";
  165. Supp_Entity.Validflag = "1";
  166. Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  167. Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  168. Supp_Entity.UpdateTime = System.DateTime.Now;
  169. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
  170. if (sc == null)
  171. {
  172. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
  173. return;
  174. }
  175. if (sc.SuspendStatus == "1")
  176. {
  177. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】被暂挂,或请刷新页面再操作");
  178. return;
  179. }
  180. if (sc.Status == "4")
  181. {
  182. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已生效,或请刷新页面再操作");
  183. return;
  184. }
  185. if (MessageUtil.ShowYesNoAndQuestion("确定生效供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
  186. {
  187. return;
  188. }
  189. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
  190. if (re.Resultcode != 0)
  191. {
  192. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  193. return;
  194. }
  195. // 作废数据到计量系统
  196. string json = JSONFormat.Format(Supp_Entity);
  197. CoreClientParam ccp = new CoreClientParam();
  198. ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
  199. ccp.MethodName = "logicDelete";
  200. ccp.ServerParams = new object[] { json };
  201. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  202. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("生效信息成功!");
  203. GetPUR_SUPP();
  204. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
  205. }
  206. catch (Exception e)
  207. {
  208. MessageUtil.ShowTips("操作失败:"+e);
  209. }
  210. }
  211. /// <summary>
  212. /// 暂挂
  213. /// </summary>
  214. private void PenPUR_SUPP()//暂挂
  215. {
  216. ultraGrid1.UpdateData();
  217. UltraGridRow uRow = ultraGrid1.ActiveRow;
  218. if (uRow.Cells["SuspendStatus"].Value.ToString() == "暂挂")
  219. {
  220. MessageUtil.ShowTips("信息已暂挂,无需再次操作!");
  221. return;
  222. }
  223. Supp Supp_Entity = new Supp();
  224. Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
  225. Supp_Entity.SuspendStatus = "1";
  226. Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  227. Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  228. Supp_Entity.UpdateTime = System.DateTime.Now;
  229. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
  230. if (sc == null)
  231. {
  232. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
  233. return;
  234. }
  235. if (sc.Validflag == "0")
  236. {
  237. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
  238. return;
  239. }
  240. if (sc.SuspendStatus == "1")
  241. {
  242. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已被被暂挂,无需重复操作,或请刷新页面再操作");
  243. return;
  244. }
  245. if (MessageUtil.ShowYesNoAndQuestion("确定暂挂供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
  246. {
  247. return;
  248. }
  249. CoreResult re= this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
  250. if (re.Resultcode != 0)
  251. {
  252. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  253. return;
  254. }
  255. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("暂挂信息成功!");
  256. GetPUR_SUPP();
  257. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
  258. }
  259. /// <summary>
  260. /// 启用
  261. /// </summary>
  262. private void EnaPUR_SUPP()//启用
  263. {
  264. ultraGrid1.UpdateData();
  265. ArrayList list = new ArrayList();
  266. UltraGridRow uRow = ultraGrid1.ActiveRow;
  267. if (uRow.Cells["SuspendStatus"].Value.ToString() == "正常")
  268. {
  269. MessageUtil.ShowTips("该供应商已启用,无需再次操作!");
  270. return;
  271. }
  272. Supp Supp_Entity = new Supp();
  273. Supp_Entity.SuppCode = uRow.Cells["suppCode"].Value.ToString();
  274. Supp_Entity.SuspendStatus = "0";
  275. Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  276. Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  277. Supp_Entity.UpdateTime = System.DateTime.Now;
  278. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { Supp_Entity.SuppCode });
  279. if (sc == null)
  280. {
  281. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据不存在或异常,或请刷新页面再操作");
  282. return;
  283. }
  284. if (sc.Validflag == "0")
  285. {
  286. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】数据可能被废除,或请刷新页面再操作");
  287. return;
  288. }
  289. if (sc.SuspendStatus == "0")
  290. {
  291. MessageUtil.ShowTips("供应商【" + Supp_Entity.SuppCode + "】已启用,无需重复操作,或请刷新页面再操作");
  292. return;
  293. }
  294. if (MessageUtil.ShowYesNoAndQuestion("确定启用供应商【" + Supp_Entity.SuppCode + "】?") == DialogResult.No)
  295. {
  296. return;
  297. }
  298. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
  299. if (re.Resultcode != 0)
  300. {
  301. MessageUtil.ShowTips("操作失败:" + re.Resultmsg);
  302. return;
  303. }
  304. MessageUtil.ShowTips("启用成功!");
  305. GetPUR_SUPP();
  306. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "suppCode", Supp_Entity.SuppCode);
  307. }
  308. /// <summary>
  309. /// 关闭
  310. /// </summary>
  311. private void CloPUR_SUPP()//关闭
  312. {
  313. this.Close();
  314. }
  315. /// <summary>
  316. /// 删除
  317. /// </summary>
  318. private void DelPUR_SUPP()//删除
  319. {
  320. if (SQ == 1)
  321. {
  322. UltraGridRow uRow = ultraGrid1.ActiveRow;
  323. if (uRow == null)
  324. {
  325. MessageUtil.ShowTips("请选择供应商进行操作");
  326. return;
  327. }
  328. String strSuppCode = uRow.Cells["suppCode"].Value.ToString().Trim();
  329. if (String.IsNullOrEmpty(strSuppCode))
  330. {
  331. MessageUtil.ShowTips("请选择供应商编码不能为空");
  332. return;
  333. }
  334. string resStr = "";
  335. resStr = this.execute<string>("com.hnshituo.pur.configure.service.SuppService", "SuppIsUsing", new object[] { uRow.Cells["suppCode"].Value.ToString() });//删除操作
  336. if (resStr != "")
  337. {
  338. MessageUtil.ShowTips("供应商在" + resStr + "中使用,若物料中使用,请先取消物料和供应商的关联,若已在任务单中使用,请先完成招标,否则将不予作废");
  339. return;
  340. }
  341. ultraGrid1.UpdateData();
  342. ArrayList list = new ArrayList();
  343. Supp Supp_Entity = new Supp();
  344. Supp_Entity.SuppCode = strSuppCode;
  345. Supp_Entity.Validflag = "0";
  346. Supp_Entity.DeleteName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  347. Supp_Entity.DeleteUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  348. Supp_Entity.DeleteTime = System.DateTime.Now;
  349. if (MessageUtil.ShowYesNoAndQuestion("确定要作废供应商【" + uRow.Cells["suppName"].Value.ToString() + "】?") == DialogResult.No)
  350. {
  351. return;
  352. }
  353. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "delete_Supp", new object[] { Supp_Entity });
  354. if (rt.Resultcode != 0)
  355. {
  356. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作失败!:" + rt.Resultmsg);
  357. }
  358. // 生效数据到计量系统
  359. string json = JSONFormat.Format(Supp_Entity);
  360. CoreClientParam ccp = new CoreClientParam();
  361. ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
  362. ccp.MethodName = "logicDelete";
  363. ccp.ServerParams = new object[] { json };
  364. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  365. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("操作成功!");
  366. GetPUR_SUPP();
  367. }
  368. else if (SQ == 2)
  369. {
  370. UltraGridRow uge = ultraGrid2.ActiveRow;
  371. SuppBank Banks = new SuppBank();
  372. Banks.Id = uge.Cells["id"].Value.ToString();
  373. if (MessageUtil.ShowYesNoAndQuestion("确定要删除该司在【" + uge.Cells["bankName"].Value.ToString() + "】的账号信息?") == DialogResult.No)
  374. {
  375. return;
  376. }
  377. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "delete_SuppBank", new object[] { Banks });
  378. if (rt.Resultcode != 0)
  379. {
  380. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
  381. return;
  382. }
  383. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
  384. SuppBank YY = new SuppBank();
  385. YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  386. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
  387. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  388. }
  389. else if (SQ == 3)
  390. {
  391. UltraGridRow uge = ultraGrid3.ActiveRow;
  392. SuppAptitude Aptis = new SuppAptitude();
  393. Aptis.Id = uge.Cells["id"].Value.ToString();
  394. if (MessageUtil.ShowYesNoAndQuestion("确定要删除供应商资质【" + uge.Cells["certNo"].Value.ToString() + "】信息?") == DialogResult.No)
  395. {
  396. return;
  397. }
  398. //CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete", new object[] { Aptis });
  399. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "delete_SuppAptitude", new object[] { Aptis });
  400. if (rt.Resultcode != 0)
  401. {
  402. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + rt.Resultmsg);
  403. return;
  404. }
  405. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("删除信息成功!");
  406. SuppAptitude YY = new SuppAptitude();
  407. YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  408. DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
  409. GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
  410. }
  411. else if (SQ == 0)
  412. {
  413. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("请点击你要删除的信息!");
  414. return;
  415. }
  416. else if(SQ == 5)
  417. {
  418. if (MessageUtil.ShowYesNoAndQuestion("确定要删除改供应商评级?") == DialogResult.No)
  419. {
  420. return;
  421. }
  422. UltraGridRow uge5 = ultraGrid5.ActiveRow;
  423. CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppRateService", "doDelete", new object[] { uge5.Cells["id"].Value.ToString().Trim() });
  424. if (cr.Resultcode != 0)
  425. {
  426. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("删除失败!" + cr.Resultmsg);
  427. return;
  428. }
  429. MessageUtil.ShowWarning("删除成功!");
  430. GetPUR_SUPP();
  431. }
  432. }
  433. ///添加资质信息时修改
  434. private void UpdateSupp()
  435. {
  436. UltraGridRow uge = ultraGrid1.ActiveRow;
  437. if (uge == null)
  438. {
  439. MessageUtil.ShowTips("请选择供应商");
  440. return;
  441. }
  442. String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
  443. Supp Supp_Entity1 = new Supp();
  444. Supp_Entity1.SuppCode = StrnewsuppCode;
  445. Supp_Entity1.SuppLicNum = this.txt_SUPPLICNUM.Text;
  446. if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
  447. {
  448. txt_SUPPSTARTDATE.Text = "";
  449. }
  450. else
  451. {
  452. Supp_Entity1.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
  453. }
  454. if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text == null)
  455. {
  456. txt_SUPPENDDATE.Text = "";
  457. }
  458. else
  459. {
  460. Supp_Entity1.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
  461. }
  462. if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
  463. {
  464. txt_SUPPTAXSTARTDATE.Text = "";
  465. }
  466. else
  467. {
  468. Supp_Entity1.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
  469. }
  470. if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
  471. {
  472. txt_SUPPTAXENDDATE.Text = "";
  473. }
  474. else
  475. {
  476. Supp_Entity1.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
  477. }
  478. if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
  479. {
  480. txt_SUPPLICSTARTDATE.Text = "";
  481. }
  482. else
  483. {
  484. Supp_Entity1.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
  485. }
  486. if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text == null)
  487. {
  488. txt_SUPPLICENDDATE.Text = "";
  489. }
  490. else
  491. {
  492. Supp_Entity1.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
  493. }
  494. ////Supp_Entity1.OrgCode = txt_ORGCODE.Text;
  495. ////Supp_Entity1.SuppTaxId = txt_SUPPTAXID.Text;
  496. ////CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity1 });
  497. //GetPUR_SUPP();
  498. }
  499. /// <summary>
  500. /// 更新
  501. /// </summary>
  502. private void UpdPUR_SUPP()//更新
  503. {
  504. UltraGridRow uge = ultraGrid1.ActiveRow;
  505. if (uge == null)
  506. {
  507. MessageUtil.ShowTips("请选择供应商");
  508. return;
  509. }
  510. String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
  511. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
  512. if (sc == null)
  513. {
  514. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
  515. return;
  516. }
  517. if (sc.Validflag == "0")
  518. {
  519. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
  520. return;
  521. }
  522. if (sc.SuspendStatus == "1")
  523. {
  524. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
  525. return;
  526. }
  527. try
  528. {
  529. if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[0])
  530. {
  531. //校验名称重复
  532. Supp Supp_Entity = new Supp();
  533. Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
  534. Supp_Entity.Validflag = "1";
  535. string strsuppname = uge.Cells["SuppName"].Value.ToString().Trim();
  536. if (!Supp_Entity.SuppName.Equals(strsuppname))
  537. {
  538. if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity)>0)
  539. {
  540. MessageUtil.ShowTips("添加失败:数据库中已存在相同的供应商名称");
  541. return;
  542. }
  543. }
  544. //校验组织机构代码重复
  545. Supp Supp_Entity1 = new Supp();
  546. Supp_Entity.OrgCode = txt_ORGCODE.Text.ToString().Trim();
  547. Supp_Entity.Validflag = "1";
  548. string strorgCode = ultraGrid1.ActiveRow.Cells["orgCode"].Value.ToString().Trim();
  549. if (!Supp_Entity.OrgCode.Equals(strorgCode))
  550. {
  551. if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
  552. {
  553. MessageUtil.ShowTips("添加失败: 数据库中已存在相同的组织机构代码");
  554. return;
  555. }
  556. }
  557. if (testSupp() == false)
  558. {
  559. return;
  560. }
  561. if (!StrnewsuppCode.Equals(txt_SUPPCODE.Text.ToString().Trim()))
  562. {
  563. MessageBox.Show("供应商编号不允许修改", "提示");
  564. txt_SUPPCODE.Focus();
  565. return;
  566. }
  567. Supp_Entity.SuppCode = StrnewsuppCode;
  568. Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
  569. //Supp_Entity.OrgCode = txt_ORGCODE.Text;//组织结构代码
  570. Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;
  571. Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
  572. //Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;//税号
  573. Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;
  574. Supp_Entity.SuppCharacter = cop_suppType.Text;
  575. Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
  576. //Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
  577. Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value == null ? null : txt_SUPPNATIONALITY.Value.ToString().Trim();
  578. //Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
  579. Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
  580. Supp_Entity.SuppCity = txt_SUPPCITY.Text;
  581. //Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
  582. Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
  583. //if (txt_SUPPSTARTDATE.Text == "" || txt_SUPPSTARTDATE.Text == null)
  584. //{
  585. // txt_SUPPSTARTDATE.Text = "";
  586. //}
  587. //else
  588. //{
  589. // Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Text).ToShortDateString();
  590. //}
  591. //if (txt_SUPPENDDATE.Text == "" || txt_SUPPENDDATE.Text==null)
  592. //{
  593. // txt_SUPPENDDATE.Text = "";
  594. //}
  595. //else
  596. //{
  597. // Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Text).ToShortDateString();
  598. //}
  599. //if (txt_SUPPTAXSTARTDATE.Text == "" || txt_SUPPTAXSTARTDATE.Text == null)
  600. //{
  601. // txt_SUPPTAXSTARTDATE.Text = "";
  602. //}
  603. //else
  604. //{
  605. // Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Text).ToShortDateString();
  606. //}
  607. //if (txt_SUPPTAXENDDATE.Text == "" || txt_SUPPTAXENDDATE.Text == null)
  608. //{
  609. // txt_SUPPTAXENDDATE.Text = "";
  610. //}
  611. //else
  612. //{
  613. // Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Text).ToShortDateString();
  614. //}
  615. if (txt_SUPPLICSTARTDATE.Text == "" || txt_SUPPLICSTARTDATE.Text == null)
  616. {
  617. txt_SUPPLICSTARTDATE.Text = "";
  618. }
  619. else
  620. {
  621. Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
  622. Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
  623. Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Text).ToShortDateString();
  624. }
  625. if (txt_SUPPLICENDDATE.Text == "" || txt_SUPPLICENDDATE.Text== null)
  626. {
  627. txt_SUPPLICENDDATE.Text = "";
  628. }
  629. else
  630. {
  631. Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
  632. Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
  633. Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Text).ToShortDateString();
  634. }
  635. Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;//营业执照
  636. Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
  637. Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
  638. Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
  639. Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
  640. Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
  641. Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
  642. Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
  643. Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value==null?"0":txt_SUPPISINTERNAL.Value.ToString();
  644. Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? "0" : txt_SUPPISMANUFACTURER.Value.ToString();
  645. Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? "0" : txt_SUPPISSUBCOMPANY.Value.ToString();
  646. Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
  647. Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Text.ToString().Trim();
  648. Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
  649. double bSuppRegCapital = 0;
  650. double.TryParse(txt_SUPPREGCAPITAL.Text,out bSuppRegCapital);
  651. Supp_Entity.SuppRegCapital = bSuppRegCapital;
  652. Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
  653. Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
  654. Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
  655. Supp_Entity.UpdateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  656. Supp_Entity.UpdateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  657. Supp_Entity.UpdateTime = System.DateTime.Now;
  658. Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
  659. Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
  660. Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
  661. if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
  662. {
  663. MessageUtil.ShowTips("请选择税率");
  664. txt_suppTaxRate.Focus();
  665. //return;
  666. }
  667. Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
  668. if (MessageBox.Show("是否需要修改供应商【" + strsuppname + "】的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  669. {
  670. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "doUpdate", new object[] { Supp_Entity });
  671. if (rt.Resultcode != 0)
  672. {
  673. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改信息失败:" + rt.Resultmsg);
  674. return;
  675. }
  676. // 更新数据到计量系统
  677. string json = JSONFormat.Format(Supp_Entity);
  678. CoreClientParam ccp = new CoreClientParam();
  679. ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
  680. ccp.MethodName = "update";
  681. ccp.ServerParams = new object[] { json };
  682. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  683. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
  684. GetPUR_SUPP();
  685. ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SUPPNAME", strsuppname);
  686. }
  687. }
  688. else if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
  689. {
  690. UltraGridRow ugc = ultraGrid2.ActiveRow;
  691. if (ugc == null)
  692. {
  693. MessageUtil.ShowTips("请选择供应商开户行");
  694. return;
  695. }
  696. SuppBank Banks = new SuppBank();
  697. Banks.Id = ugc.GetCellValue("id").ToString().Trim();
  698. if (String.IsNullOrEmpty(Banks.Id))
  699. {
  700. MessageUtil.ShowTips("请选择供应商开户行编码为空");
  701. return;
  702. }
  703. Banks.BankAccount = txt_BANKACCOUNT.Text.Trim();
  704. Banks.BankName = txt_BANKNAME.Text.Trim();
  705. Banks.PayTypeName = txtPayType.Text.Trim();
  706. if (String.IsNullOrEmpty(Banks.BankAccount))
  707. {
  708. MessageUtil.ShowTips("开户行账号不能为空");
  709. txt_BANKACCOUNT.Focus();
  710. return;
  711. }
  712. if (String.IsNullOrEmpty(Banks.BankName))
  713. {
  714. MessageUtil.ShowTips("开户行名称不能为空");
  715. txt_BANKNAME.Focus();
  716. return;
  717. }
  718. if (!StringUtil.IsOnlyLetterAndDigit(Banks.BankAccount))
  719. {
  720. MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
  721. txt_BANKACCOUNT.Focus();
  722. return;
  723. }
  724. Banks.SuppCode = StrnewsuppCode;
  725. Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
  726. Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
  727. if (MessageBox.Show("确定修改供应商【" + Banks.SuppName + "】的该条开户行?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  728. {
  729. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "doUpdate", new object[] { Banks });
  730. if (rt.Resultcode != 0)
  731. {
  732. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改失败!" + rt.Resultmsg);
  733. return;
  734. }
  735. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
  736. SuppBank YY = new SuppBank();
  737. YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  738. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
  739. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  740. ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
  741. }
  742. }
  743. else if ((ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[2]))
  744. {
  745. SuppAptitude Aptis = new SuppAptitude();
  746. Aptis.CertDesc = txt_CERTDESC.Text;
  747. Aptis.CertiConstraint = txt_ap_constraint.Text;
  748. Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
  749. Aptis.CertNo = txt_CERTNO.Text;
  750. Aptis.CertType = txt_ap_type.Text;
  751. Aptis.CertValidStart =Convert.ToDateTime(txt_CERTVALID_start.Value);
  752. Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
  753. Aptis.SuppCode = StrnewsuppCode;
  754. Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
  755. Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
  756. Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
  757. Aptis.CertPath = txt_certPath.Text.ToString().Trim();
  758. Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
  759. Aptis.Id = ultraGrid3.ActiveRow.Cells["id"].Text.ToString().Trim();
  760. if (MessageBox.Show("是否需要修改供应商ID为[" + Aptis.SuppCode + "]的资质信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
  761. {
  762. CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { Aptis });
  763. if (rt1.Resultcode != 0)
  764. {
  765. Core.Mes.Client.Comm.Tool.MessageUtil.ShowTips("修改失败!" + rt1.Resultmsg);
  766. return;
  767. }
  768. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改成功!");
  769. SuppAptitude YY = new SuppAptitude();
  770. YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  771. DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
  772. GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
  773. ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
  774. }
  775. }
  776. }
  777. catch (Exception e)
  778. {
  779. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("修改信息失败!"+ e);
  780. return;
  781. }
  782. }
  783. /// <summary>
  784. /// 新增
  785. /// </summary>
  786. private void AddPUR_SUPP()//新增
  787. {
  788. try
  789. {
  790. if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[0].Text )
  791. {
  792. if (txt_SUPPNAME.Value == null)
  793. {
  794. MessageUtil.ShowWarning("供应商名称不能为空");
  795. return;
  796. }
  797. Supp Supp_Entity = new Supp();
  798. Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
  799. //信息验证
  800. //if (isExsitRow("com.hnshituo.pur.configure.service.SuppService", Supp_Entity) > 0)
  801. //{
  802. // MessageUtil.ShowTips("添加失败 " + "数据库中已存在相同的供应商名称");
  803. // return;
  804. //}
  805. if (TestSupp() == false)
  806. {
  807. return;
  808. }
  809. Supp_Entity.SuppCode = txt_SUPPCODE.Text.ToString().Trim();
  810. Supp_Entity.Account = txt_SUPPCODE.Text.ToString().Trim().ToLower();
  811. //Supp_Entity.OrgCode = txt_ORGCODE.Text;
  812. Supp_Entity.OrgCode = txt_SUPPLICNUM.Text;//组织机构代码
  813. Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
  814. //Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;
  815. Supp_Entity.SuppTaxId = txt_SUPPLICNUM.Text;//税号
  816. Supp_Entity.SuppCharacter = cop_suppType.Text;
  817. Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
  818. //Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
  819. Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value==null?null:txt_SUPPNATIONALITY.Value.ToString().Trim();
  820. //Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
  821. Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value == null ? null : txt_SUPPPROVINCE.Value.ToString().Trim();
  822. Supp_Entity.SuppCity = txt_SUPPCITY.Text;
  823. //Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
  824. Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value == null ? null : txt_SUPPOFFICEPROVINCE.Value.ToString().Trim();
  825. Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
  826. Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
  827. Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
  828. Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
  829. Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
  830. Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
  831. Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;
  832. Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
  833. Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
  834. Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
  835. Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
  836. Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
  837. Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
  838. Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
  839. Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value == null ? null : txt_SUPPISINTERNAL.Value.ToString();
  840. Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value == null ? null : txt_SUPPISMANUFACTURER.Value.ToString();
  841. Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value == null ? null : txt_SUPPISSUBCOMPANY.Value.ToString();
  842. Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
  843. Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Value.ToString();
  844. Supp_Entity.SuppRegCapital =txt_SUPPREGCAPITAL.Value==null?0:Convert.ToInt32(txt_SUPPREGCAPITAL.Text);
  845. Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
  846. Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value == null ? null : txt_SUPPPERGRADE.Value.ToString().Trim();
  847. Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
  848. Supp_Entity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  849. Supp_Entity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  850. Supp_Entity.CreateTime = System.DateTime.Now;
  851. Supp_Entity.SuppType = txt_suppType.Value.ToString().Trim();
  852. Supp_Entity.Status = "1";
  853. Supp_Entity.SuspendStatus = "0";
  854. Supp_Entity.Validflag = "1";
  855. Supp_Entity.SuppAddPostal = txt_postAdd.Text.Trim();
  856. Supp_Entity.AccountCw = txt_account_cw.Text.Trim();
  857. if (txt_suppTaxRate.Value.ToString().Trim() == null || txt_suppTaxRate.Value.ToString().Trim() == "")
  858. {
  859. MessageUtil.ShowTips("请选择税率");
  860. txt_suppTaxRate.Focus();
  861. return;
  862. }
  863. Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString().Trim();
  864. Supp_Entity.BalanceCode = txt_balanceCode.Text.ToString().Trim();
  865. CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppService", "insert_Supp", new object[] { Supp_Entity });
  866. if (cr.Resultcode != 0)
  867. {
  868. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+cr.Resultmsg);
  869. return;
  870. }
  871. // 添加数据到计量系统
  872. string json = JSONFormat.Format(Supp_Entity);
  873. CoreClientParam ccp = new CoreClientParam();
  874. ccp.ServerName = "com.hnshituo.pur.configure.service.impl.MeterBaseCustomerSupplierService";
  875. ccp.MethodName = "insert";
  876. ccp.ServerParams = new object[] { json };
  877. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  878. MessageUtil.ShowWarning("添加成功!");
  879. GetPUR_SUPP();
  880. Pur.configure.ConfigureClassCommon.doActiveSelRow(ultraGrid1, "SuppName", Supp_Entity.SuppName);
  881. }
  882. else if (ultraTabControl1.SelectedTab.Text == ultraTabControl1.Tabs[3].Text)
  883. {
  884. UltraGridRow uge = ultraGrid1.ActiveRow;
  885. SuppRate suppRate = new SuppRate();
  886. suppRate.Id = System.Guid.NewGuid().ToString("N");
  887. suppRate.SuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
  888. suppRate.Rate = Combo_Rate.Text;
  889. suppRate.RateYear = txt_Rate_Year.Text;
  890. suppRate.ValidFlag = "1";
  891. suppRate.CreateName = UserInfo.GetUserName();
  892. suppRate.CreateTime = System.DateTime.Now;
  893. CoreResult cr = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppRateService", "doInsert", new object[] { suppRate });
  894. if (cr.Resultcode != 0)
  895. {
  896. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + cr.Resultmsg);
  897. return;
  898. }
  899. MessageUtil.ShowWarning("添加成功!");
  900. GetPUR_SUPP();
  901. } else
  902. {
  903. UltraGridRow uge = ultraGrid1.ActiveRow;
  904. if (uge == null)
  905. {
  906. MessageUtil.ShowTips("请选择需要新增银行或者资质信息的供应商");
  907. return;
  908. }
  909. String StrnewsuppCode = uge.Cells["SuppCode"].Value.ToString().Trim();
  910. if (uge.Cells["SuspendStatus"].Value.ToString() == "暂挂")
  911. {
  912. MessageUtil.ShowTips("信息已暂挂,无权限进行增删!");
  913. return;
  914. }
  915. Supp sc = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { StrnewsuppCode });
  916. if (sc == null)
  917. {
  918. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据不存在或异常,或请刷新页面再操作");
  919. return;
  920. }
  921. if (sc.Validflag == "0")
  922. {
  923. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】数据可能被废除,或请刷新页面再操作");
  924. return;
  925. }
  926. if (sc.SuspendStatus == "1")
  927. {
  928. MessageUtil.ShowTips("供应商【" + StrnewsuppCode + "】被暂挂,无权限增删改,或请刷新页面再操作");
  929. return;
  930. }
  931. if (ultraTabControl1.SelectedTab == ultraTabControl1.Tabs[1])
  932. {
  933. String strAccount = txt_BANKACCOUNT.Text.Trim();
  934. String strAccountName = txt_BANKNAME.Text.Trim();
  935. String strPay = "";
  936. if(txtPayType.Text.Trim()!=""||txtPayType.Text.Trim()!=null)
  937. {
  938. strPay = txtPayType.Text.Trim();
  939. }
  940. if (String.IsNullOrEmpty(strAccount))
  941. {
  942. MessageUtil.ShowWarning("开户行账号不能为空");
  943. txt_BANKACCOUNT.Focus();
  944. return;
  945. }
  946. if (String.IsNullOrEmpty(strAccountName))
  947. {
  948. MessageUtil.ShowWarning("开户行名称不能为空");
  949. txt_BANKNAME.Focus();
  950. return;
  951. }
  952. if (!StringUtil.IsOnlyLetterAndDigit(strAccount))
  953. {
  954. MessageUtil.ShowWarning("开户行账号只能包含字母与数字");
  955. txt_BANKACCOUNT.Focus();
  956. return;
  957. }
  958. SuppBank Banks = new SuppBank();
  959. Banks.BankAccount = strAccount;
  960. Banks.BankName = strAccountName;
  961. Banks.PayTypeName = strPay;
  962. Banks.SuppCode = uge.Cells["suppCode"].Value.ToString().Trim();
  963. Banks.SuppName = uge.Cells["suppName"].Value.ToString().Trim();
  964. Banks.SuppShortName = uge.Cells["suppShortName"].Value.ToString().Trim();
  965. Banks.Id = uge.Cells["suppCode"].Value.ToString() + strAccount;
  966. Banks.Validflag = "1";
  967. SuppBank CC2= new SuppBank();
  968. CC2.SuppCode = StrnewsuppCode;
  969. CC2.PayTypeName = strPay;
  970. CC2.Validflag = "1";
  971. int count2 = this.execute<int>("com.hnshituo.pur.configure.service.SuppBankService", "count", new object[] { CC2 });
  972. if (count2 > 0)
  973. {
  974. MessageUtil.ShowTips("该供应商的有效开户行信息只能有一个,请先作废该供应商当前有效的开户行信息再添加");
  975. return;
  976. }
  977. CoreResult rt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppBankService", "insert_SuppBank", new object[] { Banks });
  978. if (rt.Resultcode != 0)
  979. {
  980. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt.Resultmsg);
  981. return;
  982. }
  983. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
  984. SuppBank YY = new SuppBank();
  985. YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  986. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY, 0, 0 });
  987. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  988. ConfigureClassCommon.doActiveSelRow(ultraGrid2, "BANKACCOUNT", Banks.BankAccount);
  989. }
  990. else
  991. {
  992. //if (txt_CERTNO.Value == null)
  993. //{
  994. // MessageUtil.ShowWarning("证书编号不能为空");
  995. // return;
  996. //}
  997. //SuppAptitude CC = new SuppAptitude();
  998. //CC.SuppCode = uge.Cells["suppCode"].Value.ToString();
  999. //DataTable dtC1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { CC, 0, 0 });
  1000. //for (int i = 0; i < dtC1.Rows.Count; i++)
  1001. //{
  1002. // if (dtC1.Rows[i]["CertNo"].Equals(txt_CERTNO.Text))
  1003. // {
  1004. // MessageUtil.ShowTips("证书编号不能重复,请核实后在操作!");
  1005. // return;
  1006. // }
  1007. //}
  1008. //SuppAptitude Aptis = new SuppAptitude();
  1009. //Aptis.CertDesc = txt_CERTDESC.Text;
  1010. //Aptis.CertiConstraint = txt_ap_constraint.Text;
  1011. //Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
  1012. //Aptis.CertNo = txt_CERTNO.Text;
  1013. //Aptis.CertType = txt_ap_type.Text;
  1014. //Aptis.CertValidStart = Convert.ToDateTime(txt_CERTVALID_start.Value);
  1015. //Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value);
  1016. //Aptis.SuppCode = uge.Cells["suppCode"].Value.ToString();
  1017. //Aptis.SuppName = uge.Cells["suppName"].Value.ToString();
  1018. //Aptis.SuppShortName = uge.Cells["suppShortName"].Value.ToString();
  1019. //Aptis.ArchCode = txt_arch_code.Text;
  1020. ////Aptis.Id = uge.Cells["suppCode"].Value.ToString() + txt_CERTNO.Text;//后台生成
  1021. ////txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
  1022. ////txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
  1023. ////craftImg.Text = uge.Cells["CERTPATH"].Value.ToString();
  1024. //Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
  1025. //Aptis.CertPath = txt_certPath.Text.ToString().Trim();
  1026. //Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
  1027. //CoreResult rt1 = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { Aptis });
  1028. //if (rt1.Resultcode != 0)
  1029. //{
  1030. // Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!" + rt1.Resultmsg);
  1031. // return;
  1032. //}
  1033. //Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加成功!");
  1034. //SuppAptitude YY = new SuppAptitude();
  1035. //YY.SuppCode = uge.Cells["suppCode"].Value.ToString();
  1036. //DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "find", new object[] { YY, 0, 0 });
  1037. //GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
  1038. //ConfigureClassCommon.doActiveSelRow(ultraGrid3, "CERTNOV", Aptis.CertNoV);
  1039. //Info();
  1040. //UpdateSupp();
  1041. MessageUtil.ShowTips("请点击上传按钮!");
  1042. return;
  1043. }
  1044. }
  1045. }
  1046. catch (Exception e)
  1047. {
  1048. Core.Mes.Client.Comm.Tool.MessageUtil.ShowWarning("添加失败!"+e);
  1049. return;
  1050. }
  1051. }
  1052. /// <summary>
  1053. /// 查询
  1054. /// </summary>
  1055. private void GetPUR_SUPP()//查询
  1056. {
  1057. try
  1058. {
  1059. dataTable1.Clear();
  1060. dataTable2.Clear();
  1061. dataTable3.Clear();
  1062. dataTable4.Clear();
  1063. Supp suppE = new Supp();
  1064. suppE.SuppName = textBox1.Text.ToString().Trim();
  1065. suppE.SupplierLinkMan = textBox2.Text.ToString().Trim();
  1066. suppE.SuppCode = textBox3.Text.ToString().Trim();
  1067. if (Qstatus.SelectedIndex != -1)
  1068. {
  1069. suppE.Status = Qstatus.Value.ToString().Trim();
  1070. }
  1071. if (QsuspendStatus.SelectedIndex != -1)
  1072. {
  1073. suppE.SuspendStatus = QsuspendStatus.Value.ToString().Trim();
  1074. }
  1075. if (cop_suppType.SelectedIndex != -1)
  1076. {
  1077. suppE.SuppType = cop_suppType.Value.ToString().Trim();
  1078. }
  1079. suppE.Validflag = "1";
  1080. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppService", "get_Supp", new object[] { suppE, 0, 0 });
  1081. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);//绑定物料分类表
  1082. foreach (UltraGridRow urg in ultraGrid1.Rows)
  1083. {
  1084. if (urg.Cells["end"].Value.Equals("1"))
  1085. {
  1086. urg.Appearance.BackColor = Color.Red;
  1087. }
  1088. if (urg.Cells["end"].Text.Equals("2"))
  1089. {
  1090. urg.Appearance.BackColor = Color.Yellow;
  1091. }
  1092. }
  1093. GridHelper.RefreshAndAutoSize(ultraGrid1);
  1094. }
  1095. catch (Exception ex)
  1096. {
  1097. MessageUtil.ShowTips("查询失败:"+ex);
  1098. }
  1099. }
  1100. #endregion
  1101. #region 控件事件
  1102. /// <summary>
  1103. /// 点击表格事件
  1104. /// </summary>
  1105. /// <param name="sender"></param>
  1106. /// <param name="e"></param>
  1107. int SQ = 0;//判断删除前点击那个界面
  1108. private void ultraGrid2_AfterRowActivate(object sender, EventArgs e)
  1109. {
  1110. ClearTab();
  1111. UltraGridRow uge = ultraGrid2.ActiveRow;
  1112. if (uge == null)
  1113. return;
  1114. txt_BANKACCOUNT.Text = uge.Cells["BANKACCOUNT"].Value.ToString();
  1115. txt_BANKNAME.Text = uge.Cells["BANKNAME"].Value.ToString();
  1116. }
  1117. private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
  1118. {
  1119. ClearTab();
  1120. UltraGridRow uge = ultraGrid3.ActiveRow;
  1121. if (uge == null)
  1122. return;
  1123. txt_CERTNO.Text = uge.Cells["CERTNO"].Value.ToString();
  1124. txt_CERTDESC.Text = uge.Cells["CERTDESC"].Value.ToString();
  1125. txt_CERTIOFFICER.Text = uge.Cells["CERTIOFFICER"].Value.ToString();
  1126. txt_ap_constraint.Text = uge.Cells["CERTICONSTRAINT"].Value.ToString();
  1127. txt_ap_type.Text = uge.Cells["CERTTYPE"].Value.ToString();
  1128. txt_CERTVALID_start.Value = uge.Cells["CERTVALIDSTART"].Value.ToString();
  1129. txt_CERTVALID_end.Value = uge.Cells["CERTVALIDEND"].Value.ToString();
  1130. txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
  1131. txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
  1132. txt_certPath.Text = uge.Cells["CERTPATH"].Value.ToString();
  1133. txt_arch_code.Text = uge.Cells["archCode"].Value.ToString();
  1134. }
  1135. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  1136. {
  1137. dataTable2.Clear();
  1138. dataTable3.Clear();
  1139. dataTable4.Clear();
  1140. ClearTab();
  1141. ClearTabM();
  1142. ClearTab5();
  1143. UltraGridRow uge = ultraGrid1.ActiveRow;
  1144. if (uge == null)
  1145. return;
  1146. Supp suppone = new Supp();
  1147. suppone.SuppCode = uge.Cells["SUPPCODE"].Value.ToString();
  1148. Supp suppone_entity = this.execute<Supp>("com.hnshituo.pur.configure.service.SuppService", "findById", new object[] { uge.Cells["SUPPCODE"].Value.ToString() });
  1149. txt_SUPPISSUBCOMPANY.Value = suppone_entity.SuppIsSubCompany;//创建时间
  1150. txt_SUPPISMANUFACTURER.Value = suppone_entity.SuppIsManufacturer;//创建人
  1151. txt_SUPPISINTERNAL.Value = suppone_entity.SuppIsInternal;//采购管理科室描叙
  1152. txt_SUPPADDRESS.Text = suppone_entity.SuppAddress;//供应商名称
  1153. txt_SUPPRELATIONGRADE.Value = suppone_entity.SuppRelationGrade;//供应商代码
  1154. txt_SUPPPERGRADE.Value = suppone_entity.SuppPerGrade;//是否暂挂1:暂挂 0:正常
  1155. txt_SUPPREGCAPCURRENCY.Value = suppone_entity.SuppRegCapCurrency;//废除时间
  1156. txt_SUPPREGCAPITAL.Value = suppone_entity.SuppRegCapital;//废除人
  1157. txt_SUPPLICENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicEndDate);//采购管理部门描叙
  1158. txt_SUPPTAXENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxEndDate);//管理科室代码
  1159. txt_SUPPLICSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicStartDate);//采购管理部门代码
  1160. txt_SUPPENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppEndDate);//管理部门代码
  1161. txt_SUPPSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppStartDate);//供应商信用等级
  1162. txt_SUPPTAXSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxStartDate);//管理部门描叙
  1163. txt_SUPPOPERATESCOPE.Text = suppone_entity.SuppOperateScope;//采购管理科室代码
  1164. txt_SUPPLICNUM.Text = suppone_entity.SuppLicNum;//管理科室描叙
  1165. txt_SUPPCITY.Text = suppone_entity.SuppCity;//供应商联系人职务
  1166. txt_SUPPREGISTRARNAME.Text = suppone_entity.SuppRegistrarName;//供应商联系人电话
  1167. txt_SUPPSHORTNAME.Text = suppone_entity.SuppShortName;//供应商地址邮编
  1168. txt_ORGCODE.Text = suppone_entity.OrgCode;//供应商地址
  1169. txt_SUPPPROVINCE.Value = suppone_entity.SuppProvinceCode;//供应商省份
  1170. cop_suppType.Text = suppone_entity.SuppCharacter;//供应商联系人传真
  1171. txt_SUPPNAME.Text = suppone_entity.SuppName;//供应商合作关系等级
  1172. txt_SUPPINDUSTRYTYPE.Text = suppone_entity.SuppIndustryType;//修改人
  1173. txt_SUPPOFFICEPROVINCE.Value = suppone_entity.SuppOfficeProvinceCode;//供应商办公省份
  1174. txt_SUPPNATIONALITY.Value = suppone_entity.SuppNationalityCode;//供应商国家
  1175. txt_SUPPTAXID.Text = suppone_entity.SuppTaxId;//供应商联系人名称
  1176. txt_SUPPCODE.Text = suppone_entity.SuppCode;//供应商评定等级
  1177. txt_suppType.Value = suppone_entity.SuppType;
  1178. txt_SUPPCONTACTTITLE.Text = suppone_entity.SuppContactTitle;//供应商联系人职务
  1179. txt_SUPPCONTACTTEL.Text = suppone_entity.SuppContactTel;//供应商联系人电话
  1180. txt_SUPPCONTACTFAX.Text = suppone_entity.SuppContactFax;//供应商联系人传真
  1181. txt_SUPPCONTACTCELLPHONE.Text = suppone_entity.SuppContactCellPhone;//供应商联系人手机
  1182. txt_SUPPCONTACTEMAIL.Text = suppone_entity.SuppContactEmail;//供应商联系人EMAIL
  1183. txt_SUPPLIERLINKMAN.Text = suppone_entity.SupplierLinkMan;//供应商联系人名称
  1184. txt_suppTaxRate.Value = suppone_entity.SuppTaxRate;//税率
  1185. txt_postAdd.Text = suppone_entity.SuppAddPostal;
  1186. txt_account_cw.Text = suppone_entity.AccountCw;
  1187. txt_balanceCode.Text = suppone_entity.BalanceCode;//结算代码
  1188. String strSuppCode=uge.Cells["suppCode"].Value.ToString();
  1189. getSuppAptitude(strSuppCode,"");
  1190. SuppBank YY1 = new SuppBank();
  1191. YY1.SuppCode = strSuppCode;
  1192. YY1.Validflag = "1";
  1193. DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppBankService", "find", new object[] { YY1, 0, 0 });
  1194. GridHelper.CopyDataToDatatable(dt, dataTable2, true);
  1195. GridHelper.RefreshAndAutoSize(ultraGrid2);
  1196. MatEntity mat = new MatEntity();
  1197. mat.Remark2 = strSuppCode;
  1198. mat.Validflag = "1";
  1199. DataTable dt_mat = this.execute<DataTable>("com.hnshituo.pur.configure.service.MatService", "getMat", new object[] { mat});
  1200. GridHelper.CopyDataToDatatable(dt_mat, dataTable4, true);
  1201. GridHelper.RefreshAndAutoSize(ultraGrid4);
  1202. SuppRate suppRate = new SuppRate();
  1203. suppRate.SuppCode = strSuppCode;
  1204. suppRate.ValidFlag = "1";
  1205. DataTable dt_rate = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppRateService", "find", new object[] { suppRate, 0, 0 });
  1206. GridHelper.CopyDataToDatatable(dt_rate, dataTable5, true);
  1207. GridHelper.RefreshAndAutoSize(ultraGrid5);
  1208. }
  1209. private void ClearTabM()
  1210. {
  1211. publicPms.clearOldData(ultraTabPageControl1,new string[]{});
  1212. //txt_SUPPISSUBCOMPANY.SelectedIndex = -1;//创建时间
  1213. //txt_SUPPISMANUFACTURER.SelectedIndex = -1;//创建人
  1214. //txt_SUPPISINTERNAL.SelectedIndex = -1;//采购管理科室描叙
  1215. //txt_SUPPADDRESS.Clear();//供应商名称
  1216. //txt_SUPPRELATIONGRADE.SelectedIndex = -1;//供应商代码
  1217. //txt_SUPPPERGRADE.SelectedIndex = -1;
  1218. //txt_SUPPREGCAPCURRENCY.SelectedIndex = -1;//废除时间
  1219. //txt_SUPPREGCAPITAL.Clear();//废除人
  1220. txt_SUPPLICENDDATE.Value = DateTime.Now.AddYears(2);//采购管理部门描叙
  1221. txt_SUPPTAXENDDATE.Value = DateTime.Now.AddYears(2);//管理科室代码
  1222. //txt_SUPPLICSTARTDATE.Value = DateTime.Now;//采购管理部门代码
  1223. txt_SUPPENDDATE.Value = DateTime.Now.AddYears(2);//管理部门代码
  1224. //txt_SUPPSTARTDATE.Value = DateTime.Now; ;//供应商信用等级
  1225. //txt_SUPPTAXSTARTDATE.Value = DateTime.Now; ;//管理部门描叙
  1226. //txt_SUPPOPERATESCOPE.Clear();//采购管理科室代码
  1227. //txt_SUPPLICNUM.Clear();//管理科室描叙
  1228. //txt_SUPPCITY.Clear();//供应商联系人职务
  1229. //txt_SUPPREGISTRARNAME.Clear();//供应商联系人电话
  1230. //txt_SUPPSHORTNAME.Clear();//供应商地址邮编
  1231. //txt_ORGCODE.Clear();//供应商地址
  1232. //txt_SUPPPROVINCE.SelectedIndex = -1;//供应商省份
  1233. //cop_suppType.Clear();//供应商联系人传真
  1234. //txt_SUPPNAME.Clear();//供应商合作关系等级
  1235. //txt_SUPPINDUSTRYTYPE.Clear();//修改人
  1236. //txt_SUPPOFFICEPROVINCE.SelectedIndex = -1;//供应商办公省份
  1237. //txt_SUPPNATIONALITY.SelectedIndex = -1;//供应商国家
  1238. //txt_SUPPTAXID.Clear();//供应商联系人名称
  1239. //txt_SUPPCODE.Clear();//供应商评定等级
  1240. //txt_suppType.SelectedIndex = -1;
  1241. //txt_SUPPCONTACTTITLE.Clear();//供应商联系人职务
  1242. //txt_SUPPCONTACTTEL.Clear();//供应商联系人电话
  1243. //txt_SUPPCONTACTFAX.Clear();//供应商联系人传真
  1244. //txt_SUPPCONTACTCELLPHONE.Clear();//供应商联系人手机
  1245. //txt_SUPPCONTACTEMAIL.Clear();//供应商联系人EMAIL
  1246. //txt_SUPPLIERLINKMAN.Clear();//供应商联系人名称
  1247. //txt_suppTaxRate.SelectedIndex = -1;//税率
  1248. //txt_postAdd.Clear();
  1249. //txt_account_cw.Clear();
  1250. }
  1251. private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
  1252. {
  1253. this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
  1254. SQ = 1;
  1255. }
  1256. private void ultraGrid2_ClickCell(object sender, ClickCellEventArgs e)
  1257. {
  1258. SQ = 2;
  1259. this.ultraTabControl1.SelectedTab = ultraTabPageControl3.Tab;
  1260. }
  1261. private void ultraGrid3_ClickCell(object sender, ClickCellEventArgs e)
  1262. {
  1263. SQ = 3;
  1264. this.ultraTabControl1.SelectedTab = ultraTabPageControl4.Tab;
  1265. }
  1266. private void ultraGrid5_ClickCell(object sender, ClickCellEventArgs e)
  1267. {
  1268. SQ = 5;
  1269. this.ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[3];
  1270. }
  1271. private void txt_SUPPLICSTARTDATE_BeforeDropDown(object sender, CancelEventArgs e)
  1272. {
  1273. }
  1274. ///// <summary>
  1275. ///// 洲际筛选事件
  1276. ///// </summary>
  1277. ///// <param name="sender"></param>
  1278. ///// <param name="e"></param>
  1279. //private void txt_island_ValueChanged(object sender, EventArgs e)
  1280. //{
  1281. // try
  1282. // {
  1283. // String strisland = txt_island.Text.ToString().Trim();
  1284. // //AdminRegion ar = new AdminRegion();
  1285. // //ar.Validflag = "1";
  1286. // //DataTable dt = this.execute<DataTable>("com.hnshituo.pur.configure.service.AdminRegionService", "find", new object[] { ar, 0, 0 });
  1287. // //FillComboxItems(txt_island, dt, "regionNo", "regionNm", "regionType='A'");
  1288. // FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A' AND regionNm like '%" + strisland + "%'");
  1289. // }
  1290. // catch(Exception ex)
  1291. // {
  1292. // //MessageUtil.ShowTips("地点数据加载失败");
  1293. // }
  1294. //}
  1295. /// <summary>
  1296. /// 根据洲际对省份和国家进行筛选
  1297. /// </summary>
  1298. /// <param name="sender"></param>
  1299. /// <param name="e"></param>
  1300. private void txt_island_SelectionChanged(object sender, EventArgs e)
  1301. {
  1302. try
  1303. {
  1304. String strisland = txt_island.Value.ToString().Trim();
  1305. FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND pRegionNo like '" + strisland + "%'");
  1306. FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '" + strisland + "%'");
  1307. }
  1308. catch (Exception ex)
  1309. {
  1310. //MessageUtil.ShowTips("地点数据加载失败");
  1311. }
  1312. }
  1313. ///// <summary>
  1314. ///// 国家选择事件
  1315. ///// </summary>
  1316. ///// <param name="sender"></param>
  1317. ///// <param name="e"></param>
  1318. //private void txt_SUPPNATIONALITY_ValueChanged(object sender, EventArgs e)
  1319. //{
  1320. // try
  1321. // {
  1322. // String strsuppNationName = txt_SUPPNATIONALITY.Text.ToString().Trim();
  1323. // FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
  1324. // }
  1325. // catch (Exception ex)
  1326. // {
  1327. // }
  1328. //}
  1329. /// <summary>
  1330. /// 国家选择事件对省份进行晒选
  1331. /// </summary>
  1332. /// <param name="sender"></param>
  1333. /// <param name="e"></param>
  1334. private void txt_SUPPNATIONALITY_SelectionChanged(object sender, EventArgs e)
  1335. {
  1336. try
  1337. {
  1338. String strsuppNationCode = txt_SUPPNATIONALITY.Value.ToString().Trim();
  1339. //FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + strsuppNationCode.Substring(0,1) + "%'");
  1340. FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
  1341. }
  1342. catch(Exception ex)
  1343. {}
  1344. //}
  1345. ///// <summary>
  1346. ///// 省份选择事件
  1347. ///// </summary>
  1348. ///// <param name="sender"></param>
  1349. ///// <param name="e"></param>
  1350. //private void txt_SUPPPROVINCE_ValueChanged(object sender, EventArgs e)
  1351. //{
  1352. // try
  1353. // {
  1354. // String strproName = txt_SUPPPROVINCE.Text.ToString().Trim();
  1355. // FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND regionNm like '%" + strproName + "%'");
  1356. // }
  1357. // catch (Exception ex)
  1358. // {
  1359. // }
  1360. }
  1361. /// <summary>
  1362. /// 省份选择对洲际和国家进行筛选
  1363. /// </summary>
  1364. /// <param name="sender"></param>
  1365. /// <param name="e"></param>
  1366. private void txt_SUPPPROVINCE_SelectionChanged(object sender, EventArgs e)
  1367. {
  1368. try
  1369. {
  1370. String txt_SUPPPROVINCECode = txt_SUPPPROVINCE.Value.ToString().Trim();
  1371. String tr1 = txt_SUPPPROVINCECode.Substring(0,1);
  1372. String tr2 = txt_SUPPPROVINCECode.Substring(0,3);
  1373. //FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + tr1 + "%'");
  1374. FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC' AND regionNo like '" + tr2 + "%'");
  1375. }
  1376. catch (Exception ex)
  1377. { }
  1378. }
  1379. ///// <summary>
  1380. ///// 办公国家选择(对办公地点进行筛选)
  1381. ///// </summary>
  1382. ///// <param name="sender"></param>
  1383. ///// <param name="e"></param>
  1384. //private void txt_SUPPOFFICEPROVINCENATION_ValueChanged(object sender, EventArgs e)
  1385. //{
  1386. // try
  1387. // {
  1388. // String strsuppNationName = txt_SUPPOFFICEPROVINCENATION.Text.ToString().Trim();
  1389. // FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType ='AC' AND regionNm like '%" + strsuppNationName + "%'");
  1390. // }
  1391. // catch (Exception ex)
  1392. // {
  1393. // }
  1394. //}
  1395. private void txt_SUPPOFFICEPROVINCENATION_SelectionChanged(object sender, EventArgs e)
  1396. {
  1397. try
  1398. {
  1399. String strsuppNationCode = txt_SUPPOFFICEPROVINCENATION.Value.ToString().Trim();
  1400. FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/') AND pRegionNo like '%" + strsuppNationCode + "%'");
  1401. }
  1402. catch (Exception ex)
  1403. { }
  1404. }
  1405. #endregion
  1406. #region 正则表达式
  1407. /**
  1408. * 是否为小数
  1409. *
  1410. * */
  1411. public bool Isdecimal(string str)
  1412. {
  1413. decimal y;
  1414. return decimal.TryParse(str, out y);
  1415. }
  1416. /// <summary>
  1417. /// 是否为整数
  1418. /// </summary>
  1419. /// <param name="str"></param>
  1420. /// <returns></returns>
  1421. public bool IsInts(string str)
  1422. {
  1423. int y;
  1424. return int.TryParse(str, out y);
  1425. }
  1426. /// <summary>
  1427. /// 手机/电话号码的验证
  1428. /// </summary>
  1429. /// <param name="str"></param>
  1430. /// <returns></returns>
  1431. public bool isTelPhoneNum(String str)
  1432. {
  1433. //return Regex.IsMatch(str, @"^1[358][0-9]{9}$") || Regex.IsMatch(str, @"^(\d{3.4}-)\d{7,8}$|1[358][0-9]{9}$");
  1434. return Regex.IsMatch(str, @"^(\d{3,4}-)\d{7,8}$|1[358][0-9]{9}$");
  1435. //Regex rx = new Regex(@"((d{3,4})|d{3,4}-)?d{7,8}(-d{3})*");
  1436. // return rx.IsMatch(str);
  1437. }
  1438. //身份证的验证
  1439. public bool isId(String str)
  1440. {
  1441. return Regex.IsMatch(str, @"^\d{15}|\d{18}$");
  1442. }
  1443. //邮箱的验证
  1444. public bool isEmail(String str)
  1445. {
  1446. return Regex.IsMatch(str, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
  1447. }
  1448. /// <summary>
  1449. /// 判断数据库中是否存在相同的列
  1450. /// </summary>
  1451. /// <param name="strJavaPackName"></param>
  1452. /// <param name="o"></param>
  1453. /// <returns>true存在</returns>
  1454. public int isExsitRow(string strJavaPackName, object o)
  1455. {
  1456. DataTable dt = this.execute<DataTable>(strJavaPackName, "find", new object[] { o, 0, 0 });
  1457. if (dt != null && dt.Rows.Count > 0)//存在相同的行
  1458. {
  1459. return dt.Rows.Count;
  1460. }
  1461. return 0;
  1462. }
  1463. #endregion
  1464. #region 初始化
  1465. public void init()
  1466. {
  1467. try
  1468. {
  1469. txt_SUPPISSUBCOMPANY.Value = "0";
  1470. txt_SUPPISMANUFACTURER.Value = "0";
  1471. txt_SUPPISINTERNAL.Value = "0";
  1472. Qstatus.SelectedIndex = 0;
  1473. QsuspendStatus.SelectedIndex = 1;
  1474. //加载下拉列表数据
  1475. //加载国家身份下拉框
  1476. AdminRegion ar = new AdminRegion();
  1477. ar.Validflag = "1";
  1478. regions = this.execute<DataTable>("com.hnshituo.pur.configure.service.AreaService", "find", new object[] { ar, 0, 0 });
  1479. FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType='A'");
  1480. FillComboxItems(txt_SUPPNATIONALITY, regions, "regionNo", "regionNm", "regionType='AC'");
  1481. FillComboxItems(txt_SUPPPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
  1482. FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "regionNo", "regionNm", "regionType='AC'");
  1483. FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "regionNo", "regionNm", "regionType NOT in ('A','AC','/')");
  1484. //加载税率下拉框
  1485. DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1109" }, this.ob);
  1486. ConfigureClassCommon.FilComboboxAdd(txt_suppTaxRate, dt1, "memo", "baseName", "validflag NOT in ('0')",true,"","");
  1487. //加载供应商等级下拉框
  1488. DataTable dt2 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1217" }, this.ob);
  1489. ConfigureClassCommon.FilComboboxAdd(txt_SUPPPERGRADE, dt2, "baseCode", "baseName", "validflag NOT in ('0')",false,"","");
  1490. //供应商货币类型
  1491. DataTable dt3 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1001" }, this.ob);
  1492. ConfigureClassCommon.FilComboboxAdd(txt_SUPPREGCAPCURRENCY, dt3, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
  1493. //付款方式
  1494. DataTable dt5 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME", new Object[] { }, this.ob);
  1495. ConfigureClassCommon.FilComboboxAdd(txtPayType, dt5, "BASECODE", "BASENAME", "validflag NOT in ('0')", false, "", "");
  1496. //供应商类别
  1497. DataTable dt4 = ServerHelper.GetData("com.hnshituo.pur.configure.service.impl.CoreBaseInfoNew.doQuery", new Object[] { "1231" }, this.ob);
  1498. ConfigureClassCommon.FilComboboxAdd(txt_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", false, "", "");
  1499. ConfigureClassCommon.FilComboboxAdd(cop_suppType, dt4, "baseCode", "baseName", "validflag NOT in ('0')", true, "全部", " ");
  1500. cop_suppType.SelectedIndex = 0;
  1501. //设定gd不可编辑
  1502. ultraGrid1.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  1503. ultraGrid2.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  1504. ultraGrid3.DisplayLayout.Bands[0].Override.AllowUpdate = DefaultableBoolean.False;
  1505. }
  1506. catch (Exception ex)
  1507. {
  1508. MessageUtil.ShowTips("界面加载初始化数据失败");
  1509. }
  1510. }
  1511. #endregion
  1512. // private void QueryPayType()
  1513. // {
  1514. // try
  1515. // {
  1516. // txtPayType.Items.Clear();
  1517. // DataTable dt = PublicServer.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceBillManage.QueryPAY_TYPE_NAME",
  1518. //new Object[] { }, ob);
  1519. // if (dt == null || dt.Rows.Count == 0)
  1520. // {
  1521. // return;
  1522. // }
  1523. // txtPayType.DataSource = dt;
  1524. // txtPayType.DisplayMember = "BASENAME";
  1525. // txtPayType.ValueMember = "BASECODE";
  1526. // }
  1527. // catch (Exception e)
  1528. // {
  1529. // MessageUtil.ShowWarning(e.Message);
  1530. // return;
  1531. // }
  1532. // }
  1533. #region 公共函数
  1534. /// <summary>
  1535. /// 清空tab页控件值
  1536. /// </summary>
  1537. private void ClearTab()
  1538. {
  1539. txt_BANKACCOUNT.Text = "";
  1540. txt_BANKNAME.Text = "";
  1541. txt_CERTNO.Text = "";
  1542. txt_CERTDESC.Text = "";
  1543. txt_CERTIOFFICER.Text = "";
  1544. txt_ap_constraint.Text = "";
  1545. txt_ap_type.Text = "";
  1546. txt_CERTVALID_start.Text = "";
  1547. txt_certPath.Text = "";
  1548. txt_certpath_old.Text = "";
  1549. txt_certNo_v.Text = "";
  1550. txt_CERTVALID_start.Value = DateTime.Now.AddDays(1).ToString();
  1551. txt_CERTVALID_end.Value = DateTime.Now.AddYears(1).ToString();
  1552. }
  1553. private void ClearTab5()
  1554. {
  1555. publicPms.clearOldData(ultraTabPageControl4);
  1556. }
  1557. /// <summary>
  1558. /// 初始化Combox数据,加入数据筛选
  1559. /// </summary>
  1560. /// <param name="cmbx">ComboBox控件</param>
  1561. /// <param name="dt">DataTable</param>
  1562. /// <param name="filterCondition">RowFilter条件</param>
  1563. public static void FillComboxItems(UltraComboEditor cmbx, DataTable dt, string valueCol, string textCol, string filterCondition)
  1564. {
  1565. if (dt != null && dt.Rows.Count > 0)
  1566. {
  1567. DataView dvw = dt.DefaultView;
  1568. dvw.RowFilter = filterCondition;
  1569. ArrayList aryTmp = new ArrayList();
  1570. aryTmp.Add(new ValueListItem(" "," "));
  1571. for (int i = 0; i < dvw.Count; i++)
  1572. {
  1573. aryTmp.Add(new ValueListItem( dvw[i][valueCol].ToString(),dvw[i][textCol].ToString()));
  1574. }
  1575. cmbx.DataSource = aryTmp;
  1576. cmbx.DisplayMember = "DisplayText";
  1577. cmbx.ValueMember = "DataValue";
  1578. }
  1579. }
  1580. /// <summary>
  1581. /// 校验供方数据
  1582. /// </summary>
  1583. /// <returns></returns>
  1584. private bool testSupp()// 校验供方数据
  1585. {
  1586. if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
  1587. {
  1588. MessageBox.Show("请输入供应商编号", "提示");
  1589. txt_SUPPCODE.Focus();
  1590. //return false;
  1591. }
  1592. if (txt_SUPPCODE.Text.Trim().Length>11)
  1593. {
  1594. MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
  1595. txt_SUPPCODE.Focus();
  1596. //return false;
  1597. }
  1598. if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
  1599. {
  1600. MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
  1601. txt_SUPPCODE.Focus();
  1602. // return false;
  1603. }
  1604. if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
  1605. {
  1606. MessageBox.Show("请输入供应商名称", "提示");
  1607. txt_SUPPNAME.Focus();
  1608. //return false;
  1609. }
  1610. if (txt_SUPPNAME.Text.Trim().Length>120)
  1611. {
  1612. MessageBox.Show("请输入供应商名称最多120位", "提示");
  1613. txt_SUPPNAME.Focus();
  1614. //return false;
  1615. }
  1616. //if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
  1617. //{
  1618. // MessageBox.Show("请输入供应商法人", "提示");
  1619. // txt_SUPPREGISTRARNAME.Focus();
  1620. // return false;
  1621. //}
  1622. if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
  1623. {
  1624. MessageBox.Show("请输入组织机构代码", "提示");
  1625. txt_ORGCODE.Focus();
  1626. //return false;
  1627. }
  1628. if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
  1629. {
  1630. MessageBox.Show("请输入供应商税号", "提示");
  1631. txt_SUPPTAXID.Focus();
  1632. //return false;
  1633. }
  1634. if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
  1635. {
  1636. MessageBox.Show("请输入供应商营业执照", "提示");
  1637. txt_SUPPLICNUM.Focus();
  1638. //return false;
  1639. }
  1640. //手机号码验证
  1641. if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
  1642. {
  1643. MessageBox.Show("请输入有效的手机号码", "提示");
  1644. txt_SUPPCONTACTCELLPHONE.Focus();
  1645. //return false;
  1646. }
  1647. //电话号码验证
  1648. if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
  1649. {
  1650. MessageBox.Show("请输入有效的电话号码", "提示");
  1651. txt_SUPPCONTACTTEL.Focus();
  1652. //return false;
  1653. }
  1654. //传真验证
  1655. if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
  1656. {
  1657. MessageBox.Show("请输入有效的传真号码", "提示");
  1658. txt_SUPPCONTACTFAX.Focus();
  1659. //return false;
  1660. }
  1661. //邮箱验证
  1662. if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
  1663. {
  1664. MessageBox.Show("请输入有效的邮箱", "提示");
  1665. txt_SUPPCONTACTEMAIL.Focus();
  1666. //return false;
  1667. }
  1668. if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
  1669. {
  1670. MessageUtil.ShowTips("供应商编号需大于6位");
  1671. txt_SUPPCODE.Focus();
  1672. //return false;
  1673. }
  1674. if (txt_SUPPCODE.Text.ToString().Trim().Length >10)
  1675. {
  1676. MessageUtil.ShowTips("供应商编号需小于等于10位");
  1677. txt_SUPPCODE.Focus();
  1678. //return false;
  1679. }
  1680. if (txt_SUPPREGCAPCURRENCY.Text == "")
  1681. {
  1682. MessageUtil.ShowTips("供应商货币类型不能为空");
  1683. txt_SUPPREGCAPCURRENCY.Focus();
  1684. //return false;
  1685. }
  1686. if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
  1687. {
  1688. MessageUtil.ShowTips("供应商生效开始时间不能为空");
  1689. txt_SUPPSTARTDATE.Focus();
  1690. //return false;
  1691. }
  1692. if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
  1693. {
  1694. MessageUtil.ShowTips("供应商生效结束时间不能为空");
  1695. txt_SUPPENDDATE.Focus();
  1696. //return false;
  1697. }
  1698. if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
  1699. {
  1700. MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
  1701. txt_SUPPTAXSTARTDATE.Focus();
  1702. //return false;
  1703. }
  1704. if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
  1705. {
  1706. MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
  1707. txt_SUPPTAXENDDATE.Focus();
  1708. //return false;
  1709. }
  1710. if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
  1711. {
  1712. MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
  1713. txt_SUPPLICSTARTDATE.Focus();
  1714. //return false;
  1715. }
  1716. if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
  1717. {
  1718. MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
  1719. txt_SUPPLICENDDATE.Focus();
  1720. //return false;
  1721. }
  1722. if (txt_suppTaxRate.SelectedIndex == -1)
  1723. {
  1724. MessageUtil.ShowTips("供应商税率不能为空");
  1725. txt_suppTaxRate.Focus();
  1726. //return false;
  1727. }
  1728. if (txt_suppType.SelectedIndex == -1)
  1729. {
  1730. MessageUtil.ShowTips("供应商类型不能为空");
  1731. txt_suppType.Focus();
  1732. //return false;
  1733. }
  1734. if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
  1735. {
  1736. MessageUtil.ShowTips("供应商邮编不能为空");
  1737. txt_postAdd.Focus();
  1738. //return false;
  1739. }
  1740. if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
  1741. {
  1742. if (txt_account_cw.Text.Trim().Length > 10)
  1743. {
  1744. MessageUtil.ShowTips("财务供应商编码最多10位");
  1745. txt_account_cw.Focus();
  1746. //return false;
  1747. }
  1748. if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
  1749. {
  1750. MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
  1751. txt_account_cw.Focus();
  1752. // return false;
  1753. }
  1754. }
  1755. return true;
  1756. }
  1757. /// <summary>
  1758. /// 校验供方数据
  1759. /// </summary>
  1760. /// <returns></returns>
  1761. private bool TestSupp()// 校验供方数据
  1762. {
  1763. if (String.IsNullOrEmpty(txt_SUPPCODE.Text.Trim()))
  1764. {
  1765. MessageBox.Show("请输入供应商编号", "提示");
  1766. txt_SUPPCODE.Focus();
  1767. //return false;
  1768. }
  1769. if (txt_SUPPCODE.Text.Trim().Length > 11)
  1770. {
  1771. MessageBox.Show("请输入供应商编号最多10位(建议采用10位)", "提示");
  1772. txt_SUPPCODE.Focus();
  1773. //return false;
  1774. }
  1775. if (!StringUtil.IsOnlyLetterAndDigit(txt_SUPPCODE.Text.Trim()))
  1776. {
  1777. MessageUtil.ShowTips("供应商编码只允许数字和字母组合");
  1778. txt_SUPPCODE.Focus();
  1779. // return false;
  1780. }
  1781. if (String.IsNullOrEmpty(txt_SUPPNAME.Text.Trim()))
  1782. {
  1783. MessageBox.Show("请输入供应商名称", "提示");
  1784. txt_SUPPNAME.Focus();
  1785. return false;
  1786. }
  1787. if (txt_SUPPNAME.Text.Trim().Length > 120)
  1788. {
  1789. MessageBox.Show("请输入供应商名称最多120位", "提示");
  1790. txt_SUPPNAME.Focus();
  1791. return false;
  1792. }
  1793. //if (String.IsNullOrEmpty(txt_SUPPREGISTRARNAME.Text.Trim()))
  1794. //{
  1795. // MessageBox.Show("请输入供应商法人", "提示");
  1796. // txt_SUPPREGISTRARNAME.Focus();
  1797. // return false;
  1798. //}
  1799. if (String.IsNullOrEmpty(txt_ORGCODE.Text.Trim()))
  1800. {
  1801. MessageBox.Show("请输入组织机构代码", "提示");
  1802. txt_ORGCODE.Focus();
  1803. return false;
  1804. }
  1805. if (String.IsNullOrEmpty(txt_SUPPTAXID.Text.Trim()))
  1806. {
  1807. MessageBox.Show("请输入供应商税号", "提示");
  1808. txt_SUPPTAXID.Focus();
  1809. return false;
  1810. }
  1811. if (String.IsNullOrEmpty(txt_SUPPLICNUM.Text.Trim()))
  1812. {
  1813. MessageBox.Show("请输入供应商营业执照", "提示");
  1814. txt_SUPPLICNUM.Focus();
  1815. return false;
  1816. }
  1817. //手机号码验证
  1818. if (!string.IsNullOrEmpty(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTCELLPHONE.Text.ToString().Trim()))
  1819. {
  1820. MessageBox.Show("请输入有效的手机号码", "提示");
  1821. txt_SUPPCONTACTCELLPHONE.Focus();
  1822. return false;
  1823. }
  1824. //电话号码验证
  1825. if (!string.IsNullOrEmpty(txt_SUPPCONTACTTEL.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTTEL.Text.ToString().Trim()))
  1826. {
  1827. MessageBox.Show("请输入有效的电话号码", "提示");
  1828. txt_SUPPCONTACTTEL.Focus();
  1829. return false;
  1830. }
  1831. //传真验证
  1832. if (!string.IsNullOrEmpty(txt_SUPPCONTACTFAX.Text.ToString().Trim()) && !isTelPhoneNum(txt_SUPPCONTACTFAX.Text.ToString().Trim()))
  1833. {
  1834. MessageBox.Show("请输入有效的传真号码", "提示");
  1835. txt_SUPPCONTACTFAX.Focus();
  1836. return false;
  1837. }
  1838. //邮箱验证
  1839. if (!string.IsNullOrEmpty(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()) && !isEmail(txt_SUPPCONTACTEMAIL.Text.ToString().Trim()))
  1840. {
  1841. MessageBox.Show("请输入有效的邮箱", "提示");
  1842. txt_SUPPCONTACTEMAIL.Focus();
  1843. return false;
  1844. }
  1845. if (txt_SUPPCODE.Text.ToString().Trim().Length < 6)
  1846. {
  1847. MessageUtil.ShowTips("供应商编号需大于6位");
  1848. txt_SUPPCODE.Focus();
  1849. return false;
  1850. }
  1851. if (txt_SUPPCODE.Text.ToString().Trim().Length > 10)
  1852. {
  1853. MessageUtil.ShowTips("供应商编号需小于等于10位");
  1854. txt_SUPPCODE.Focus();
  1855. return false;
  1856. }
  1857. if (txt_SUPPREGCAPCURRENCY.Text == "")
  1858. {
  1859. MessageUtil.ShowTips("供应商货币类型不能为空");
  1860. txt_SUPPREGCAPCURRENCY.Focus();
  1861. return false;
  1862. }
  1863. if (String.IsNullOrEmpty(txt_SUPPSTARTDATE.Text))
  1864. {
  1865. MessageUtil.ShowTips("供应商生效开始时间不能为空");
  1866. txt_SUPPSTARTDATE.Focus();
  1867. return false;
  1868. }
  1869. if (String.IsNullOrEmpty(txt_SUPPENDDATE.Text))
  1870. {
  1871. MessageUtil.ShowTips("供应商生效结束时间不能为空");
  1872. txt_SUPPENDDATE.Focus();
  1873. return false;
  1874. }
  1875. if (String.IsNullOrEmpty(txt_SUPPTAXSTARTDATE.Text))
  1876. {
  1877. MessageUtil.ShowTips("供应商税号有效开始时间不能为空");
  1878. txt_SUPPTAXSTARTDATE.Focus();
  1879. return false;
  1880. }
  1881. if (String.IsNullOrEmpty(txt_SUPPTAXENDDATE.Text))
  1882. {
  1883. MessageUtil.ShowTips("供应商税号生效结束时间不能为空");
  1884. txt_SUPPTAXENDDATE.Focus();
  1885. return false;
  1886. }
  1887. if (String.IsNullOrEmpty(txt_SUPPLICSTARTDATE.Text))
  1888. {
  1889. MessageUtil.ShowTips("供应商执照有效开始时间不能为空");
  1890. txt_SUPPLICSTARTDATE.Focus();
  1891. return false;
  1892. }
  1893. if (String.IsNullOrEmpty(txt_SUPPLICENDDATE.Text))
  1894. {
  1895. MessageUtil.ShowTips("供应商执照生效结束时间不能为空");
  1896. txt_SUPPLICENDDATE.Focus();
  1897. return false;
  1898. }
  1899. if (txt_suppTaxRate.SelectedIndex == -1)
  1900. {
  1901. MessageUtil.ShowTips("供应商税率不能为空");
  1902. txt_suppTaxRate.Focus();
  1903. return false;
  1904. }
  1905. if (txt_suppType.SelectedIndex == -1)
  1906. {
  1907. MessageUtil.ShowTips("供应商类型不能为空");
  1908. txt_suppType.Focus();
  1909. return false;
  1910. }
  1911. if (String.IsNullOrEmpty(txt_postAdd.Text.Trim()))
  1912. {
  1913. MessageUtil.ShowTips("供应商邮编不能为空");
  1914. txt_postAdd.Focus();
  1915. return false;
  1916. }
  1917. if (!String.IsNullOrEmpty(txt_account_cw.Text.Trim()))
  1918. {
  1919. if (txt_account_cw.Text.Trim().Length > 10)
  1920. {
  1921. MessageUtil.ShowTips("财务供应商编码最多10位");
  1922. txt_account_cw.Focus();
  1923. return false;
  1924. }
  1925. if (!StringUtil.IsOnlyLetterAndDigit(txt_account_cw.Text.Trim()))
  1926. {
  1927. MessageUtil.ShowTips("财务供应商编码只允许数字和字母组合");
  1928. txt_account_cw.Focus();
  1929. return false;
  1930. }
  1931. }
  1932. return true;
  1933. }
  1934. #endregion
  1935. #region 附件上传
  1936. private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1937. {
  1938. try
  1939. {
  1940. UltraGridRow row = ultraGrid3.ActiveRow;
  1941. string filePathOld = row.GetValue("certPathOld");
  1942. if (e.Button.Key.ToLower().Equals("select"))
  1943. {
  1944. FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  1945. down.DeleteButton.Visible = false;
  1946. down.ShowDialog();
  1947. }
  1948. }
  1949. catch (Exception ex)
  1950. {
  1951. MessageUtil.ShowTips("操作失败:" + ex);
  1952. }
  1953. }
  1954. private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
  1955. {
  1956. try
  1957. {
  1958. if (e.Button.Key.ToLower().Equals("insert"))
  1959. {
  1960. OpenFileDialog file = new OpenFileDialog();
  1961. file.Multiselect = false;
  1962. DialogResult drStat;
  1963. drStat = file.ShowDialog();
  1964. if (drStat == DialogResult.OK)
  1965. {
  1966. fileName = file.FileName;
  1967. string filena = System.IO.Path.GetFileName(fileName);
  1968. string certNo = filena.Split('.')[0];
  1969. String filePathlocal = System.IO.Path.GetFullPath(fileName);
  1970. txt_certPath.Text = filena;
  1971. txt_certpath_local.Text = filePathlocal;
  1972. txt_CERTNO.Text = certNo;
  1973. }
  1974. }
  1975. }
  1976. catch (Exception ex)
  1977. {
  1978. MessageUtil.ShowTips("操作失败:" + ex);
  1979. }
  1980. }
  1981. //上传按钮
  1982. private void btn_submitAppend_Click(object sender, EventArgs e)
  1983. {
  1984. try
  1985. {
  1986. if (ultraGrid1.ActiveRow == null)
  1987. {
  1988. MessageUtil.ShowTips("未选择供应商");
  1989. return;
  1990. }
  1991. if (txt_ap_type.SelectedIndex == -1)
  1992. {
  1993. MessageUtil.ShowTips("证书类型不能为空");
  1994. txt_ap_type.Focus();
  1995. return;
  1996. }
  1997. if (txt_ap_constraint.SelectedIndex == -1)
  1998. {
  1999. MessageUtil.ShowTips("证书强制类型不能为空");
  2000. txt_ap_constraint.Focus();
  2001. return;
  2002. }
  2003. if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
  2004. {
  2005. MessageUtil.ShowTips("证书有效期开始时间不能为空");
  2006. txt_CERTVALID_start.Focus();
  2007. return;
  2008. }
  2009. if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
  2010. {
  2011. MessageUtil.ShowTips("证书有效期结束时间不能为空");
  2012. txt_CERTVALID_end.Focus();
  2013. return;
  2014. }
  2015. Info();
  2016. UpdateSupp();
  2017. MessageUtil.ShowTips("添加成功");
  2018. ClearTab5();
  2019. }
  2020. catch (Exception ex)
  2021. {
  2022. MessageBox.Show("添加失败");
  2023. }
  2024. ////刷新界面并激活当前行
  2025. //Relocate(sat);
  2026. }
  2027. private bool testSuppAptitude()
  2028. {
  2029. if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
  2030. {
  2031. MessageUtil.ShowTips("证书文件不能为空");
  2032. txt_certPath.Focus();
  2033. return false;
  2034. }
  2035. if (String.IsNullOrEmpty(txt_certpath_local.Text.Trim()))
  2036. {
  2037. MessageUtil.ShowTips("证书本地地址不能为空");
  2038. txt_certpath_local.Focus();
  2039. return false;
  2040. }
  2041. if (String.IsNullOrEmpty(txt_CERTNO.Text.Trim()))
  2042. {
  2043. MessageUtil.ShowTips("证书文件名不能为空");
  2044. txt_CERTNO.Focus();
  2045. return false;
  2046. }
  2047. if (String.IsNullOrEmpty(txt_certPath.Text.Trim()))
  2048. {
  2049. MessageUtil.ShowTips("证书文件不能为空");
  2050. txt_certPath.Focus();
  2051. return false;
  2052. }
  2053. if(txt_ap_constraint.SelectedIndex==-1)
  2054. {
  2055. MessageUtil.ShowTips("证书强制类型不能为空");
  2056. txt_ap_constraint.Focus();
  2057. return false;
  2058. }
  2059. if(txt_ap_type.SelectedIndex==-1)
  2060. {
  2061. MessageUtil.ShowTips("证书类型不能为空");
  2062. txt_ap_type.Focus();
  2063. return false;
  2064. }
  2065. return true;
  2066. }
  2067. private void Relocate(SuppAptitude sat)
  2068. {
  2069. getSuppAptitude(sat.SuppCode, sat.CertPath);
  2070. }
  2071. ///// <summary>
  2072. ///// 加载文件事件
  2073. ///// </summary>
  2074. ///// <param name="sender"></param>
  2075. ///// <param name="e"></param>
  2076. //private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  2077. //{
  2078. // try
  2079. // {
  2080. // ultraGrid3.UpdateData();
  2081. // UltraGridRow row = ultraGrid3.ActiveRow;
  2082. // string filePathOld = row.GetValue("certPathOld");
  2083. // string strId = row.GetValue("id");
  2084. // string filePathNew = "";
  2085. // if (e.Button.Key.ToLower().Equals("select"))
  2086. // {
  2087. // FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  2088. // down.DeleteButton.Visible = false;
  2089. // down.ShowDialog();
  2090. // }
  2091. // else if (e.Button.Key.ToLower().Equals("insert"))
  2092. // {
  2093. // if (ultraGrid1.ActiveRow == null)
  2094. // {
  2095. // MessageUtil.ShowTips("未选择供方信息");
  2096. // return;
  2097. // }
  2098. // string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
  2099. // string guid = Guid.NewGuid().ToString("N").ToUpper();
  2100. // //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  2101. // //down.ctrlFileDown1.FilePath = filePathOld;
  2102. // //if (down.ctrlFileDown1.List.Count > 0)
  2103. // //{
  2104. // // MessageUtil.ShowWarning("只能上传一份文件!");
  2105. // // return;
  2106. // //}
  2107. // List<FileBean> list = new List<FileBean>();
  2108. // FileBean bean = new FileBean();
  2109. // OpenFileDialog file = new OpenFileDialog();
  2110. // file.Multiselect = false;
  2111. // DialogResult drStat;
  2112. // drStat = file.ShowDialog();
  2113. // if (drStat == DialogResult.OK)
  2114. // {
  2115. // string fileName = file.FileName;
  2116. // string filena = System.IO.Path.GetFileName(fileName);
  2117. // string certNo = filena.Split('.')[0];
  2118. // //if (!certNo.ToUpper().Contains("CT"))
  2119. // //{
  2120. // // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
  2121. // // return;
  2122. // //}
  2123. // filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
  2124. // SuppAptitude sat = new SuppAptitude();
  2125. // sat.SuppCode = strsuppCode;
  2126. // sat.CertNo = certNo;
  2127. // sat.CertPath = filena;
  2128. // sat.CertPathOld = filePathNew + filena;
  2129. // sat.CertNoV = guid;
  2130. // sat.Id = strId;
  2131. // if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
  2132. // {
  2133. // if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
  2134. // {
  2135. // return;
  2136. // }
  2137. // }
  2138. // //更新资质行记录
  2139. // if (SaveCert(sat) == false) return;
  2140. // bean = new FileBean();
  2141. // bean.setFileName(filena);
  2142. // bean.setPathName(filePathNew);
  2143. // bean.setFile(FileHelper.FileToArray(fileName));
  2144. // list.Add(bean);
  2145. // bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  2146. // if (isSuccess)
  2147. // {
  2148. // MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
  2149. // ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
  2150. // }
  2151. // else
  2152. // {
  2153. // MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
  2154. // }
  2155. // //刷新界面并激活当前行
  2156. // Relocate(sat.CertNo);
  2157. // }
  2158. // }
  2159. // }
  2160. // catch (Exception ex)
  2161. // {
  2162. // MessageUtil.ShowTips("操作失败:" + ex);
  2163. // }
  2164. //}
  2165. ///// <summary>
  2166. ///// 加载文件事件
  2167. ///// </summary>
  2168. ///// <param name="sender"></param>
  2169. ///// <param name="e"></param>
  2170. //private void txt_certPath_EditorButtonClick(object sender, EditorButtonEventArgs e)
  2171. //{
  2172. // try
  2173. // {
  2174. // //ultraGrid3.UpdateData();
  2175. // //UltraGridRow row = ultraGrid3.ActiveRow;
  2176. // string filePathOld = txt_certpath_old.Text.ToString().Trim();
  2177. // //string strId = row.GetValue("id");
  2178. // string filePathNew = "";
  2179. // if (e.Button.Key.ToLower().Equals("select"))
  2180. // {
  2181. // FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  2182. // down.DeleteButton.Visible = false;
  2183. // down.ShowDialog();
  2184. // }
  2185. // else if (e.Button.Key.ToLower().Equals("insert"))
  2186. // {
  2187. // if (ultraGrid1.ActiveRow == null)
  2188. // {
  2189. // MessageUtil.ShowTips("未选择供方信息");
  2190. // return;
  2191. // }
  2192. // string strsuppCode = ultraGrid1.ActiveRow.GetValue("suppCode");
  2193. // string guid = Guid.NewGuid().ToString("N").ToUpper();
  2194. // //FrmPopFileShow down = new FrmPopFileShow(this.ob, filePathOld);
  2195. // //down.ctrlFileDown1.FilePath = filePathOld;
  2196. // //if (down.ctrlFileDown1.List.Count > 0)
  2197. // //{
  2198. // // MessageUtil.ShowWarning("只能上传一份文件!");
  2199. // // return;
  2200. // //}
  2201. // List<FileBean> list = new List<FileBean>();
  2202. // FileBean bean = new FileBean();
  2203. // OpenFileDialog file = new OpenFileDialog();
  2204. // file.Multiselect = false;
  2205. // DialogResult drStat;
  2206. // drStat = file.ShowDialog();
  2207. // if (drStat == DialogResult.OK)
  2208. // {
  2209. // string fileName = file.FileName;
  2210. // string filena = System.IO.Path.GetFileName(fileName);
  2211. // string certNo = filena.Split('.')[0];
  2212. // //if (!certNo.ToUpper().Contains("CT"))
  2213. // //{
  2214. // // MessageUtil.ShowWarning("资质文件号文件名头两位需为CT!");
  2215. // // return;
  2216. // //}
  2217. // filePathNew = "Pms/CERT/" + strsuppCode + "/" + guid + "/";
  2218. // SuppAptitude sat = new SuppAptitude();
  2219. // sat.SuppCode = strsuppCode;
  2220. // sat.CertNo = certNo;
  2221. // txt_CERTNO.Text = certNo;
  2222. // sat.CertPath = filena;
  2223. // txt_certPath.Text = filena;
  2224. // sat.CertPathOld = filePathNew + filena;
  2225. // txt_certpath_old.Text = filePathNew + filena;
  2226. // sat.CertNoV = guid;
  2227. // txt_certNo_v.Text = guid;
  2228. // //sat.Id = strId;
  2229. // if (GetCraftFileCraftNoCnt(certNo, strsuppCode) > 0)
  2230. // {
  2231. // if (MessageUtil.ShowYesNoAndQuestion("系统已存在该资质文件,是否确认覆盖" + certNo + "?") == DialogResult.No)
  2232. // {
  2233. // return;
  2234. // }
  2235. // }
  2236. // //更新资质行记录
  2237. // //if (SaveCert(sat) == false) return;
  2238. // bean = new FileBean();
  2239. // bean.setFileName(filena);
  2240. // bean.setPathName(filePathNew);
  2241. // bean.setFile(FileHelper.FileToArray(fileName));
  2242. // list.Add(bean);
  2243. // bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  2244. // if (isSuccess)
  2245. // {
  2246. // MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
  2247. // //ultraGrid3.ActiveRow.Cells["certPathOld"].Value = sat.CertPathOld;
  2248. // }
  2249. // else
  2250. // {
  2251. // MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
  2252. // }
  2253. // //刷新界面并激活当前行
  2254. // //Relocate(sat.CertNo);
  2255. // }
  2256. // }
  2257. // }
  2258. // catch (Exception ex)
  2259. // {
  2260. // MessageUtil.ShowTips("操作失败:" + ex);
  2261. // }
  2262. //}
  2263. /// <summary>
  2264. /// 判断是否之前已提交相同的文件
  2265. /// </summary>
  2266. /// <param name="craftNo"></param>
  2267. /// <returns></returns>
  2268. private int GetCraftFileCraftNoCnt(string craftNo, string suppCode)
  2269. {
  2270. SuppAptitude sat = new SuppAptitude();
  2271. sat.SuppCode = suppCode;
  2272. sat.CertNo = craftNo;
  2273. int dt = this.execute<int>("com.hnshituo.pur.configure.service.SuppAptitudeService", "count", new object[] { sat });
  2274. return dt;
  2275. }
  2276. /// <summary>
  2277. /// 保存资质信息行
  2278. /// </summary>
  2279. /// <param name="sat"></param>
  2280. /// <returns></returns>
  2281. private bool SaveCert(SuppAptitude sat)
  2282. {
  2283. CoreResult re = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "doUpdate", new object[] { sat });
  2284. if (re.Resultcode == 0)
  2285. {
  2286. return true;
  2287. }
  2288. else
  2289. {
  2290. MessageUtil.ShowTips("上传失败:" + re.Resultmsg);
  2291. return false;
  2292. }
  2293. }
  2294. //获取供应商文件
  2295. private void getSuppAptitude(String strSuppCode, string craftNo)
  2296. {
  2297. SuppAptitude YY = new SuppAptitude();
  2298. YY.SuppCode = strSuppCode;
  2299. DataTable dt1 = this.execute<DataTable>("com.hnshituo.pur.configure.service.SuppAptitudeService", "findAptitude", new object[] { YY});
  2300. GridHelper.CopyDataToDatatable(dt1, dataTable3, true);
  2301. GridHelper.RefreshAndAutoSize(ultraGrid3);
  2302. if (!String.IsNullOrEmpty(craftNo))
  2303. {
  2304. ConfigureClassCommon.doActiveSelRow(ultraGrid3, "certNo", craftNo);
  2305. }
  2306. }
  2307. #endregion
  2308. private void Info()
  2309. {
  2310. if (txt_ap_type.Value != null)
  2311. {
  2312. if (txt_ap_type.Value.Equals("1"))
  2313. {
  2314. txt_SUPPLICNUM.Text = txt_arch_code.Text.ToString();//营业执照
  2315. txt_SUPPLICSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
  2316. txt_SUPPLICENDDATE.Text = txt_CERTVALID_end.Text.ToString();
  2317. }
  2318. else if (txt_ap_type.Value.Equals("2"))
  2319. {
  2320. txt_ORGCODE.Text = txt_arch_code.Text.ToString();//组织机构代码证
  2321. txt_SUPPSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
  2322. txt_SUPPENDDATE.Text = txt_CERTVALID_end.Text.ToString();
  2323. }
  2324. else if (txt_ap_type.Value.Equals("3"))
  2325. {
  2326. txt_SUPPTAXID.Text = txt_arch_code.Text.ToString();//税务登记证
  2327. txt_SUPPTAXSTARTDATE.Text = txt_CERTVALID_start.Text.ToString();
  2328. txt_SUPPTAXENDDATE.Text = txt_CERTVALID_end.Text.ToString();
  2329. }
  2330. }
  2331. }
  2332. private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
  2333. {
  2334. UltraGridRow uge5 = ultraGrid5.ActiveRow;
  2335. Combo_Rate.Text = uge5.Cells["rate"].Value.ToString2().Trim();
  2336. txt_Rate_Year.Text = uge5.Cells["rateYear"].Value.ToString2().Trim();
  2337. }
  2338. private void upLoadFile_Click(object sender, EventArgs e)
  2339. {
  2340. if (ultraGrid1.ActiveRow == null)
  2341. {
  2342. MessageUtil.ShowTips("未选择供应商");
  2343. return;
  2344. }
  2345. string strSuppCode = ultraGrid1.ActiveRow.GetValue("SuppCode");
  2346. string strSuppName = ultraGrid1.ActiveRow.GetValue("SuppName");
  2347. if (String.IsNullOrEmpty(strSuppCode))
  2348. {
  2349. }
  2350. String filena = txt_certPath.Text.ToString().Trim();
  2351. if (String.IsNullOrEmpty(filena) || String.IsNullOrEmpty(fileName))
  2352. {
  2353. MessageUtil.ShowTips("请选择待上传文件");
  2354. return;
  2355. }
  2356. if (testSuppAptitude() == false)
  2357. {
  2358. return;
  2359. }
  2360. SuppAptitude sat = new SuppAptitude();
  2361. sat.SuppCode = strSuppCode;
  2362. sat.SuppName = strSuppName;
  2363. String filePathNew = "Pms/CERT/SUPP/" + strSuppCode + "/";
  2364. sat.CertPath = filena;
  2365. sat.CertPathOld = filePathNew + filena;
  2366. sat.CreateUserid = UserInfo.GetUserID();
  2367. sat.CreateName = UserInfo.GetUserName();
  2368. sat.ArchCode = txt_arch_code.Text.Trim();
  2369. sat.CreateTime = DateTime.Now;
  2370. sat.CertNo = txt_CERTNO.Text.Trim();
  2371. sat.CertiOfficer = txt_CERTIOFFICER.Text.Trim();
  2372. if (txt_ap_type.SelectedIndex == -1)
  2373. {
  2374. MessageUtil.ShowTips("证书类型不能为空");
  2375. txt_ap_type.Focus();
  2376. return;
  2377. }
  2378. sat.CertType = txt_ap_type.Value.ToString().Trim();
  2379. if (txt_ap_constraint.SelectedIndex == -1)
  2380. {
  2381. MessageUtil.ShowTips("证书强制类型不能为空");
  2382. txt_ap_constraint.Focus();
  2383. return;
  2384. }
  2385. sat.CertiConstraint = txt_ap_constraint.Value.ToString().Trim();
  2386. if (String.IsNullOrEmpty(txt_CERTVALID_start.Text))
  2387. {
  2388. MessageUtil.ShowTips("证书有效期开始时间不能为空");
  2389. txt_CERTVALID_start.Focus();
  2390. return;
  2391. }
  2392. if (String.IsNullOrEmpty(txt_CERTVALID_end.Text))
  2393. {
  2394. MessageUtil.ShowTips("证书有效期结束时间不能为空");
  2395. txt_CERTVALID_end.Focus();
  2396. return;
  2397. }
  2398. sat.CertValidStart = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_start.Value).ToShortDateString() + " 00:00:00");
  2399. sat.CertValidEnd = DateTime.Parse(Convert.ToDateTime(txt_CERTVALID_end.Value).ToShortDateString() + " 23:59:59");
  2400. sat.Validflag = "1";
  2401. sat.CertDesc = txt_CERTDESC.Text.Trim();
  2402. if (GetCraftFileCraftNoCnt(filena, strSuppCode) > 0)
  2403. {
  2404. MessageUtil.ShowTips("供应商已存在该附件文件:" + filena);
  2405. return;
  2406. }
  2407. List<FileBean> list = new List<FileBean>();
  2408. FileBean bean = new FileBean();
  2409. bean = new FileBean();
  2410. bean.setFileName(filena);
  2411. bean.setPathName(filePathNew);
  2412. bean.setFile(FileHelper.FileToArray(fileName));
  2413. list.Add(bean);
  2414. bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
  2415. if (isSuccess)
  2416. {
  2417. //开始写数据库
  2418. CoreResult crt = this.execute<CoreResult>("com.hnshituo.pur.configure.service.SuppAptitudeService", "insert_SuppAptitude", new object[] { sat });
  2419. if (crt.Resultcode != 0)
  2420. {
  2421. MessageUtil.ShowTips("上传失败:" + crt.Resultmsg);
  2422. }
  2423. else
  2424. {
  2425. Info();
  2426. UpdateSupp();
  2427. MessageUtil.ShowTips("上传成功");
  2428. ClearTab5();
  2429. }
  2430. }
  2431. else
  2432. {
  2433. MessageBox.Show("上传失败");
  2434. }
  2435. //刷新界面并激活当前行
  2436. Relocate(sat);
  2437. }
  2438. }
  2439. }