ComBaseSuppFrm.cs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. using Core.Mes.Client.Comm.Server;
  2. using Core.Mes.Client.Comm.Tool;
  3. using Core.StlMes.Client.Qcm.BLL;
  4. using Core.StlMes.Client.Qcm.Control;
  5. using Core.StlMes.Client.Qcm.model;
  6. using CoreFS.CA06;
  7. using Infragistics.Win;
  8. using Infragistics.Win.UltraWinEditors;
  9. using Infragistics.Win.UltraWinGrid;
  10. using System;
  11. using System.Collections;
  12. using System.Data;
  13. using System.Windows.Forms;
  14. namespace Core.StlMes.Client.Qcm
  15. {
  16. public partial class ComBaseSuppFrm : FrmBase
  17. {
  18. private ComBaseSuppCtrl _suppCtrl;
  19. private ComBaseSuppBLL _suppBLL;
  20. private ComBaseSuppBankBLL _suppBankBLL;
  21. public ComBaseSuppFrm()
  22. {
  23. InitializeComponent();
  24. }
  25. private DataTable regions;
  26. private void ComBaseSuppFrm_Load(object sender, EventArgs e)
  27. {
  28. _suppCtrl = new ComBaseSuppCtrl(panel1, ob);
  29. _suppCtrl.UltraGrid1.AfterRowActivate += UltraGrid1_AfterRowActivate;
  30. _suppCtrl.UltraGrid2.AfterRowActivate += UltraGrid2_AfterRowActivate;
  31. _suppCtrl.UltraGrid3.AfterRowActivate += UltraGrid3_AfterRowActivate;
  32. _suppCtrl.PurchaseRangeCtrl.EntityGrid1.AfterRowActivate += PurchaseRangeCtrl_AfterRowActivate;
  33. _suppCtrl.PurchaseRangeCtrl.EntityGrid1.Click += EntityGrid1_Click;
  34. _suppCtrl.PurchaseRangeCtrl.EntityGrid1.ClickCell += EntityGrid1_ClickCell;
  35. _suppCtrl.UltraGrid1.Click += UltraGrid1_Click;
  36. _suppCtrl.UltraGrid2.Click += UltraGrid2_Click;
  37. _suppCtrl.UltraGrid3.Click += UltraGrid3_Click;
  38. _suppCtrl.UltraGrid1.ClickCell += UltraGrid1_ClickCell;
  39. _suppCtrl.UltraGrid2.ClickCell += UltraGrid2_ClickCell;
  40. _suppCtrl.UltraGrid3.ClickCell += UltraGrid3_ClickCell;
  41. _suppBLL = new ComBaseSuppBLL(ob);
  42. _suppBankBLL = new ComBaseSuppBankBLL(ob);
  43. regions = _suppBLL.QueryRegion();
  44. //加载基础数据
  45. FillComboxItems(txt_island, regions, "region_No", "region_Nm", "region_Type='A'");
  46. FillComboxItems(txt_SUPPNATIONALITY, regions, "region_No", "region_Nm", "region_Type='AC'");
  47. FillComboxItems(txt_SUPPPROVINCE, regions, "region_No", "region_Nm", "region_Type NOT in ('A','AC','/')");
  48. FillComboxItems(txt_SUPPOFFICEPROVINCENATION, regions, "region_No", "region_Nm", "region_Type='AC'");
  49. FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "region_No", "region_Nm", "region_Type NOT in ('A','AC','/')");
  50. //加载税率下拉框
  51. DataTable dtTaxRate = ClsBaseInfo.GetComBaseInfo("900301", ob);
  52. txt_suppTaxRate.DataSource = dtTaxRate;
  53. txt_suppTaxRate.DisplayMember = "BASENAME";
  54. txt_suppTaxRate.ValueMember = "BASECODE";
  55. //加载供应商等级下拉框
  56. txt_SUPPPERGRADE.DataSource = ClsBaseInfo.GetComBaseInfo("900302", ob);
  57. txt_SUPPPERGRADE.DisplayMember = "BASENAME";
  58. txt_SUPPPERGRADE.ValueMember = "BASECODE";
  59. //供应商货币类型
  60. txt_SUPPREGCAPCURRENCY.DataSource = ClsBaseInfo.GetComBaseInfo("900303", ob);
  61. txt_SUPPREGCAPCURRENCY.DisplayMember = "BASENAME";
  62. txt_SUPPREGCAPCURRENCY.ValueMember = "BASECODE";
  63. QcmBaseQuery.NitializeSpec(ultraComboEditor3, "B", false, ob);
  64. }
  65. void PurchaseRangeCtrl_AfterRowActivate(object sender, EventArgs e)
  66. {
  67. ComBasePurchaseRangeEntity purchaseRange = EntityHelper.CopyEntity<ComBasePurchaseRangeEntity>(
  68. _suppCtrl.PurchaseRangeCtrl.EntityGrid1.ActiveRow.ListObject);
  69. ultraComboEditor3.Value = purchaseRange.SpecCode;
  70. ultraNumericEditor1.Value = purchaseRange.LenMax;
  71. ultraNumericEditor2.Value = purchaseRange.LenMin;
  72. ultraTabControl1.Tabs[3].Selected = true;
  73. }
  74. public override void ToolBar_Click(object sender, string ToolbarKey)
  75. {
  76. base.ToolBar_Click(sender, ToolbarKey);
  77. switch (ToolbarKey)
  78. {
  79. case "Query":
  80. Query();
  81. break;
  82. case "Add":
  83. Add();
  84. break;
  85. case "Modify":
  86. Modify();
  87. break;
  88. case "Delete":
  89. Delete();
  90. break;
  91. case "Resume":
  92. Resume();
  93. break;
  94. case "Close":
  95. this.Close();
  96. break;
  97. }
  98. }
  99. /// <summary>
  100. /// 初始化Combox数据,加入数据筛选
  101. /// </summary>
  102. /// <param name="cmbx">ComboBox控件</param>
  103. /// <param name="dt">DataTable</param>
  104. /// <param name="filterCondition">RowFilter条件</param>
  105. public static void FillComboxItems(UltraComboEditor cmbx, DataTable dt, string valueCol, string textCol, string filterCondition)
  106. {
  107. if (dt != null && dt.Rows.Count > 0)
  108. {
  109. DataView dvw = dt.DefaultView;
  110. dvw.RowFilter = filterCondition;
  111. ArrayList aryTmp = new ArrayList();
  112. aryTmp.Add(new ValueListItem(" ", " "));
  113. for (int i = 0; i < dvw.Count; i++)
  114. {
  115. aryTmp.Add(new ValueListItem(dvw[i][valueCol].ToString(), dvw[i][textCol].ToString()));
  116. }
  117. cmbx.DataSource = aryTmp;
  118. cmbx.DisplayMember = "DisplayText";
  119. cmbx.ValueMember = "DataValue";
  120. }
  121. }
  122. private void Query()
  123. {
  124. string suppCode = textBox3.Text.Trim();
  125. string suppName = textBox1.Text.Trim();
  126. string suppLinkMan = textBox2.Text.Trim();
  127. string validflag = labelCheckBox1.Checked ? "0" : "1";
  128. _suppCtrl.PurchaseRangeCtrl.Clear();
  129. _suppCtrl.Query(suppCode, suppName, suppLinkMan, validflag);
  130. }
  131. private ComBaseSuppEntity CheckSuppData(string action)
  132. {
  133. ComBaseSuppEntity Supp_Entity = new ComBaseSuppEntity();
  134. Supp_Entity.SuppName = txt_SUPPNAME.Text.Trim();
  135. Supp_Entity.SuppCode = txt_SUPPCODE.Text.ToString().Trim();
  136. Supp_Entity.OrgCode = txt_ORGCODE.Text;
  137. Supp_Entity.SuppShortName = txt_SUPPSHORTNAME.Text;
  138. Supp_Entity.SuppTaxId = txt_SUPPTAXID.Text;
  139. Supp_Entity.SuppCharacter = txt_SUPPCHARACTER.Text;
  140. Supp_Entity.SuppRegistrarName = txt_SUPPREGISTRARNAME.Text;
  141. //Supp_Entity.SuppNationality = txt_SUPPNATIONALITY.Text;
  142. Supp_Entity.SuppNationalityCode = txt_SUPPNATIONALITY.Value.ToString2();
  143. //Supp_Entity.SuppProvince = txt_SUPPPROVINCE.Text;
  144. Supp_Entity.SuppProvinceCode = txt_SUPPPROVINCE.Value.ToString2();
  145. Supp_Entity.SuppCity = txt_SUPPCITY.Text;
  146. //Supp_Entity.SuppOfficeProvince = txt_SUPPOFFICEPROVINCE.Text;
  147. Supp_Entity.SuppOfficeProvinceCode = txt_SUPPOFFICEPROVINCE.Value.ToString2();
  148. Supp_Entity.SuppStartDate = Convert.ToDateTime(this.txt_SUPPSTARTDATE.Value).ToShortDateString();
  149. Supp_Entity.SuppEndDate = Convert.ToDateTime(this.txt_SUPPENDDATE.Value).ToShortDateString();
  150. Supp_Entity.SuppTaxStartDate = Convert.ToDateTime(this.txt_SUPPTAXSTARTDATE.Value).ToShortDateString();
  151. Supp_Entity.SuppTaxEndDate = Convert.ToDateTime(this.txt_SUPPTAXENDDATE.Value).ToShortDateString();
  152. Supp_Entity.SuppLicStartDate = Convert.ToDateTime(this.txt_SUPPLICSTARTDATE.Value).ToShortDateString();
  153. Supp_Entity.SuppLicEndDate = Convert.ToDateTime(this.txt_SUPPLICENDDATE.Value).ToShortDateString();
  154. Supp_Entity.SuppLicNum = this.txt_SUPPLICNUM.Text;
  155. Supp_Entity.SuppOperateScope = txt_SUPPOPERATESCOPE.Text;
  156. Supp_Entity.SupplierLinkMan = txt_SUPPLIERLINKMAN.Text;
  157. Supp_Entity.SuppContactCellPhone = txt_SUPPCONTACTCELLPHONE.Text;
  158. Supp_Entity.SuppContactEmail = txt_SUPPCONTACTEMAIL.Text;
  159. Supp_Entity.SuppContactFax = txt_SUPPCONTACTFAX.Text;
  160. Supp_Entity.SuppContactTel = txt_SUPPCONTACTTEL.Text;
  161. Supp_Entity.SuppContactTitle = txt_SUPPCONTACTTITLE.Text;
  162. Supp_Entity.SuppIsInternal = txt_SUPPISINTERNAL.Value.ToString2();
  163. Supp_Entity.SuppIsManufacturer = txt_SUPPISMANUFACTURER.Value.ToString2();
  164. Supp_Entity.SuppIsSubCompany = txt_SUPPISSUBCOMPANY.Value.ToString2();
  165. Supp_Entity.SuppIndustryType = txt_SUPPINDUSTRYTYPE.Text;
  166. Supp_Entity.SuppRegCapCurrency = txt_SUPPREGCAPCURRENCY.Value.ToString2();
  167. Supp_Entity.SuppRegCapital = txt_SUPPREGCAPITAL.Value == null ? 0 : Convert.ToInt32(txt_SUPPREGCAPITAL.Text);
  168. Supp_Entity.SuppRelationGrade = txt_SUPPRELATIONGRADE.Text;
  169. Supp_Entity.SuppPerGrade = txt_SUPPPERGRADE.Value.ToString2();
  170. Supp_Entity.SuppAddress = txt_SUPPADDRESS.Text;
  171. Supp_Entity.CreateName = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  172. Supp_Entity.CreateUserid = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID();
  173. Supp_Entity.Status = "1";
  174. Supp_Entity.SuspendStatus = "0";
  175. Supp_Entity.Validflag = "1";
  176. Supp_Entity.SuppTaxRate = txt_suppTaxRate.Value.ToString2();
  177. Supp_Entity.SuppType = txt_SUPPTYPE.Value.ToString2();
  178. string suppCode = action == "Add" ? "1" : Supp_Entity.SuppCode;
  179. if (_suppBLL.IsRepeat(Supp_Entity.SuppName, suppCode))
  180. {
  181. MessageUtil.ShowWarning("系统已存在该供应商名称!");
  182. txt_SUPPNAME.Focus();
  183. return null;
  184. }
  185. if (Supp_Entity.SuppTaxRate == "")
  186. {
  187. MessageUtil.ShowWarning("请选择税率!");
  188. txt_suppTaxRate.Focus();
  189. return null;
  190. }
  191. if (Supp_Entity.SuppType == "")
  192. {
  193. MessageUtil.ShowWarning("请选择供应商类型!");
  194. txt_suppTaxRate.Focus();
  195. return null;
  196. }
  197. return Supp_Entity;
  198. }
  199. private ComBaseSuppBankEntity CheckSuppBank(string action)
  200. {
  201. if (_suppCtrl.UltraGrid1.ActiveRow == null)
  202. {
  203. MessageUtil.ShowWarning("请先新增供应商!");
  204. return null;
  205. }
  206. if (action == "Modify")
  207. {
  208. if (_suppCtrl.UltraGrid2.ActiveRow == null)
  209. {
  210. MessageUtil.ShowWarning("请先新增银行信息!");
  211. return null;
  212. }
  213. }
  214. ComBaseSuppBankEntity Banks = new ComBaseSuppBankEntity();
  215. Banks.BankAccount = txt_BANKACCOUNT.Text;
  216. Banks.BankName = txt_BANKNAME.Text;
  217. Banks.SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  218. Banks.SuppName = _suppCtrl.UltraGrid1.GetActiveRowValue("suppName");
  219. Banks.SuppShortName = _suppCtrl.UltraGrid1.GetActiveRowValue("suppShortName");
  220. Banks.SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  221. if (action == "Modify")
  222. {
  223. Banks.Id = _suppCtrl.UltraGrid2.GetActiveRowValue("id");
  224. }
  225. if (Banks.BankAccount == "")
  226. {
  227. MessageUtil.ShowWarning("银行帐号不能为空!");
  228. txt_BANKACCOUNT.Focus();
  229. return null;
  230. }
  231. string id = action == "Add" ? "1" : Banks.Id;
  232. if (_suppBankBLL.IsRepeat(Banks.BankAccount, id))
  233. {
  234. MessageUtil.ShowWarning("系统已存在该银行帐号!");
  235. txt_BANKACCOUNT.Focus();
  236. return null;
  237. }
  238. return Banks;
  239. }
  240. private ComBaseSuppAptitudeEntity CheckSuppAptitude(string action)
  241. {
  242. if (_suppCtrl.UltraGrid1.ActiveRow == null)
  243. {
  244. MessageUtil.ShowWarning("请先新增供应商!");
  245. return null;
  246. }
  247. if (action == "Modify")
  248. {
  249. if (_suppCtrl.UltraGrid3.ActiveRow == null)
  250. {
  251. MessageUtil.ShowWarning("请先新资质行信息!");
  252. return null;
  253. }
  254. }
  255. ComBaseSuppAptitudeEntity Aptis = new ComBaseSuppAptitudeEntity();
  256. Aptis.CertDesc = txt_CERTDESC.Text;
  257. Aptis.CertiConstraint = ultraComboEditor1.Text;
  258. Aptis.CertiOfficer = txt_CERTIOFFICER.Text;
  259. Aptis.CertNo = txt_CERTNO.Text;
  260. Aptis.CertType = ultraComboEditor2.Text;
  261. Aptis.CertValidStart = Convert.ToDateTime(txt_CERTVALID_start.Value).ToString("yyyy-MM-DD");
  262. Aptis.CertValidEnd = Convert.ToDateTime(txt_CERTVALID_end.Value).ToString("yyyy-MM-DD");
  263. Aptis.SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  264. Aptis.SuppName = _suppCtrl.UltraGrid1.GetActiveRowValue("suppName");
  265. Aptis.SuppShortName = _suppCtrl.UltraGrid1.GetActiveRowValue("suppShortName");
  266. //txt_certNo_v.Text = uge.Cells["CERTNOV"].Value.ToString();
  267. //txt_certpath_old.Text = uge.Cells["CERTPATHOLD"].Value.ToString();
  268. //craftImg.Text = uge.Cells["CERTPATH"].Value.ToString();
  269. Aptis.CertNoV = txt_certNo_v.Text.ToString().Trim();
  270. Aptis.CertPath = txt_certPath.Text.ToString().Trim();
  271. Aptis.CertPathOld = txt_certpath_old.Text.ToString().Trim();
  272. Aptis.SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  273. if (action == "Modify")
  274. {
  275. Aptis.Id = _suppCtrl.UltraGrid3.GetActiveRowValue("id");
  276. }
  277. if (Aptis.CertNo == "")
  278. {
  279. MessageUtil.ShowWarning("请输入证书名称!");
  280. txt_CERTNO.Focus();
  281. return null;
  282. }
  283. //string id = action == "Add" ? "1" : Aptis.Id;
  284. //if (_suppBankBLL.IsRepeat(Aptis.CertNo, id))
  285. //{
  286. // MessageUtil.ShowWarning("系统已存在该证书名称!");
  287. // txt_BANKACCOUNT.Focus();
  288. // return null;
  289. //}
  290. if (Aptis.CertiConstraint == "")
  291. {
  292. MessageUtil.ShowWarning("请选择证书强制类型!");
  293. ultraComboEditor1.Focus();
  294. return null;
  295. }
  296. if (Aptis.CertType == "")
  297. {
  298. MessageUtil.ShowWarning("请选择证书类型!");
  299. ultraComboEditor2.Focus();
  300. return null;
  301. }
  302. return Aptis;
  303. }
  304. private ComBasePurchaseRangeEntity CheckPurchaseRange(string action)
  305. {
  306. if (_suppCtrl.UltraGrid1.ActiveRow == null)
  307. {
  308. MessageUtil.ShowWarning("请先新增供应商!");
  309. return null;
  310. }
  311. if (action == "Modify")
  312. {
  313. if (_suppCtrl.PurchaseRangeCtrl.EntityGrid1.ActiveRow == null)
  314. {
  315. MessageUtil.ShowWarning("请先供应能力范围!");
  316. return null;
  317. }
  318. }
  319. if (ultraComboEditor3.Value == null)
  320. {
  321. MessageUtil.ShowWarning("请选择管坯规格!");
  322. ultraComboEditor3.Focus();
  323. return null;
  324. }
  325. if (ultraNumericEditor1.Value == null)
  326. {
  327. MessageUtil.ShowWarning("请选输入长度最长mm!");
  328. ultraNumericEditor1.Focus();
  329. return null;
  330. }
  331. if (ultraNumericEditor2.Value == null)
  332. {
  333. MessageUtil.ShowWarning("请选输入长度最短mm!");
  334. ultraNumericEditor2.Focus();
  335. return null;
  336. }
  337. ComBasePurchaseRangeEntity parm = new ComBasePurchaseRangeEntity();
  338. parm.SpecCode = ultraComboEditor3.Value.ToString2();
  339. parm.SpecName = ultraComboEditor3.Text;
  340. parm.LenMax = decimal.Parse(ultraNumericEditor1.Value.ToString2());
  341. parm.LenMin = decimal.Parse(ultraNumericEditor2.Value.ToString2());
  342. return parm;
  343. }
  344. public void Add()
  345. {
  346. if (ultraTabControl1.ActiveTab.Index == 0)
  347. {
  348. ComBaseSuppEntity Supp_Entity = CheckSuppData("Add");
  349. if (Supp_Entity == null) return;
  350. _suppCtrl.AddSupp(Supp_Entity);
  351. }
  352. else if (ultraTabControl1.ActiveTab.Index == 1)
  353. {
  354. ComBaseSuppBankEntity Banks = CheckSuppBank("Add");
  355. if (Banks == null) return;
  356. _suppCtrl.AddSuppBank(Banks);
  357. }
  358. else if (ultraTabControl1.ActiveTab.Index == 2)
  359. {
  360. ComBaseSuppAptitudeEntity Aptis = CheckSuppAptitude("Add");
  361. if (Aptis == null) return;
  362. _suppCtrl.AddSuppAptitude(Aptis);
  363. }
  364. else if (ultraTabControl1.ActiveTab.Index == 3)
  365. {
  366. ComBasePurchaseRangeEntity purchaseRange = CheckPurchaseRange("Add");
  367. if (purchaseRange == null) return;
  368. purchaseRange.CreateName = this.UserInfo.GetUserName();
  369. _suppCtrl.PurchaseRangeCtrl.Add(purchaseRange);
  370. string suppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  371. _suppCtrl.RelocateSupp(suppCode);
  372. }
  373. }
  374. public void Modify()
  375. {
  376. if (ultraTabControl1.ActiveTab.Index == 0)
  377. {
  378. ComBaseSuppEntity Supp_Entity = CheckSuppData("Modify");
  379. if (Supp_Entity == null) return;
  380. _suppCtrl.ModifySupp(Supp_Entity);
  381. }
  382. else if (ultraTabControl1.ActiveTab.Index == 1)
  383. {
  384. ComBaseSuppBankEntity Banks = CheckSuppBank("Modify");
  385. if (Banks == null) return;
  386. _suppCtrl.ModifySuppBank(Banks);
  387. }
  388. else if (ultraTabControl1.ActiveTab.Index == 2)
  389. {
  390. ComBaseSuppAptitudeEntity Aptis = CheckSuppAptitude("Modify");
  391. if (Aptis == null) return;
  392. _suppCtrl.ModifySuppAptitude(Aptis);
  393. }
  394. else if (ultraTabControl1.ActiveTab.Index == 3)
  395. {
  396. ComBasePurchaseRangeEntity purchaseRange = CheckPurchaseRange("Modify");
  397. if (purchaseRange == null) return;
  398. purchaseRange.UpdateName = this.UserInfo.GetUserName();
  399. _suppCtrl.PurchaseRangeCtrl.Update(purchaseRange);
  400. string suppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  401. _suppCtrl.RelocateSupp(suppCode);
  402. }
  403. }
  404. public void Delete()
  405. {
  406. if (clickGrid == "grid1")
  407. {
  408. _suppCtrl.UpdateSuppValidflag(new ComBaseSuppEntity()
  409. {
  410. SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode"),
  411. DeleteName = UserInfo.GetUserName(),
  412. DeleteUserid = UserInfo.GetUserID()
  413. }, "0");
  414. }
  415. else if (clickGrid == "grid2")
  416. {
  417. _suppCtrl.DeleteSuppBank(new ComBaseSuppBankEntity()
  418. {
  419. Id = _suppCtrl.UltraGrid2.GetActiveRowValue("id")
  420. });
  421. }
  422. else if (clickGrid == "grid3")
  423. {
  424. _suppCtrl.DeleteSuppAptitude(new ComBaseSuppAptitudeEntity()
  425. {
  426. Id = _suppCtrl.UltraGrid3.GetActiveRowValue("id")
  427. });
  428. }
  429. else
  430. {
  431. _suppCtrl.PurchaseRangeCtrl.Delete(new ComBasePurchaseRangeEntity()
  432. {
  433. RangeId = _suppCtrl.PurchaseRangeCtrl.EntityGrid1.GetActiveRowValue("rangeId"),
  434. DeleteName = this.UserInfo.GetUserName()
  435. });
  436. string suppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  437. _suppCtrl.RelocateSupp(suppCode);
  438. }
  439. }
  440. public void Resume()
  441. {
  442. _suppCtrl.UpdateSuppValidflag(new ComBaseSuppEntity()
  443. {
  444. SuppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode"),
  445. DeleteName = UserInfo.GetUserName(),
  446. DeleteUserid = UserInfo.GetUserID()
  447. }, "1");
  448. }
  449. void UltraGrid1_AfterRowActivate(object sender, EventArgs e)
  450. {
  451. try
  452. {
  453. this.Cursor = Cursors.WaitCursor;
  454. ClearTab();
  455. string suppCode = _suppCtrl.UltraGrid1.GetActiveRowValue("suppCode");
  456. ComBaseSuppEntity suppone_entity = _suppBLL.QueryByPk(suppCode);
  457. txt_SUPPISSUBCOMPANY.Value = suppone_entity.SuppIsSubCompany;//创建时间
  458. txt_SUPPISMANUFACTURER.Value = suppone_entity.SuppIsManufacturer;//创建人
  459. txt_SUPPISINTERNAL.Value = suppone_entity.SuppIsInternal;//采购管理科室描叙
  460. txt_SUPPADDRESS.Text = suppone_entity.SuppAddress;//供应商名称
  461. txt_SUPPRELATIONGRADE.Value = suppone_entity.SuppRelationGrade;//供应商代码
  462. txt_SUPPPERGRADE.Value = suppone_entity.SuppPerGrade;//是否暂挂1:暂挂 0:正常
  463. txt_SUPPREGCAPCURRENCY.Value = suppone_entity.SuppRegCapCurrency;//废除时间
  464. txt_SUPPREGCAPITAL.Value = suppone_entity.SuppRegCapital;//废除人
  465. txt_SUPPLICENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicEndDate);//采购管理部门描叙
  466. txt_SUPPTAXENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxEndDate);//管理科室代码
  467. txt_SUPPLICSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppLicStartDate);//采购管理部门代码
  468. txt_SUPPENDDATE.Value = Convert.ToDateTime(suppone_entity.SuppEndDate);//管理部门代码
  469. txt_SUPPSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppStartDate);//供应商信用等级
  470. txt_SUPPTAXSTARTDATE.Value = Convert.ToDateTime(suppone_entity.SuppTaxStartDate);//管理部门描叙
  471. txt_SUPPOPERATESCOPE.Text = suppone_entity.SuppOperateScope;//采购管理科室代码
  472. txt_SUPPLICNUM.Text = suppone_entity.SuppLicNum;//管理科室描叙
  473. txt_SUPPCITY.Text = suppone_entity.SuppCity;//供应商联系人职务
  474. txt_SUPPREGISTRARNAME.Text = suppone_entity.SuppRegistrarName;//供应商联系人电话
  475. txt_SUPPSHORTNAME.Text = suppone_entity.SuppShortName;//供应商地址邮编
  476. txt_ORGCODE.Text = suppone_entity.OrgCode;//供应商地址
  477. txt_SUPPPROVINCE.Value = suppone_entity.SuppProvinceCode;//供应商省份
  478. txt_SUPPCHARACTER.Text = suppone_entity.SuppCharacter;//供应商联系人传真
  479. txt_SUPPNAME.Text = suppone_entity.SuppName;//供应商合作关系等级
  480. txt_SUPPINDUSTRYTYPE.Text = suppone_entity.SuppIndustryType;//修改人
  481. txt_SUPPOFFICEPROVINCE.Value = suppone_entity.SuppOfficeProvinceCode;//供应商办公省份
  482. txt_SUPPNATIONALITY.Value = suppone_entity.SuppNationalityCode;//供应商国家
  483. txt_SUPPTAXID.Text = suppone_entity.SuppTaxId;//供应商联系人名称
  484. txt_SUPPCODE.Text = suppone_entity.SuppCode;//供应商评定等级
  485. txt_SUPPCONTACTTITLE.Text = suppone_entity.SuppContactTitle;//供应商联系人职务
  486. txt_SUPPCONTACTTEL.Text = suppone_entity.SuppContactTel;//供应商联系人电话
  487. txt_SUPPCONTACTFAX.Text = suppone_entity.SuppContactFax;//供应商联系人传真
  488. txt_SUPPCONTACTCELLPHONE.Text = suppone_entity.SuppContactCellPhone;//供应商联系人手机
  489. txt_SUPPCONTACTEMAIL.Text = suppone_entity.SuppContactEmail;//供应商联系人EMAIL
  490. txt_SUPPLIERLINKMAN.Text = suppone_entity.SupplierLinkMan;//供应商联系人名称
  491. txt_suppTaxRate.Value = suppone_entity.SuppTaxRate.ToString().Trim();//税率
  492. txt_SUPPTYPE.Value = suppone_entity.SuppType;
  493. _suppCtrl.QuerySuppAptitude();
  494. _suppCtrl.QuerySuppBank();
  495. _suppCtrl.PurchaseRangeCtrl.Query(suppCode);
  496. }
  497. finally
  498. {
  499. this.Cursor = Cursors.Default;
  500. }
  501. }
  502. void UltraGrid2_AfterRowActivate(object sender, EventArgs e)
  503. {
  504. try
  505. {
  506. this.Cursor = Cursors.WaitCursor;
  507. txt_BANKACCOUNT.Text = _suppCtrl.UltraGrid2.GetActiveRowValue("BANKACCOUNT");
  508. txt_BANKNAME.Text = _suppCtrl.UltraGrid2.GetActiveRowValue("BANKNAME");
  509. }
  510. finally
  511. {
  512. this.Cursor = Cursors.Default;
  513. }
  514. }
  515. void UltraGrid3_AfterRowActivate(object sender, EventArgs e)
  516. {
  517. try
  518. {
  519. this.Cursor = Cursors.WaitCursor;
  520. txt_CERTNO.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTNO");
  521. txt_CERTDESC.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTDESC");
  522. txt_CERTIOFFICER.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTIOFFICER");
  523. ultraComboEditor1.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTICONSTRAINT");
  524. ultraComboEditor2.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTTYPE");
  525. txt_CERTVALID_start.Value = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTVALIDSTART");
  526. txt_CERTVALID_end.Value = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTVALIDEND");
  527. txt_certNo_v.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTNOV");
  528. txt_certpath_old.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTPATHOLD");
  529. txt_certPath.Text = _suppCtrl.UltraGrid3.GetActiveRowValue("CERTPATH");
  530. }
  531. finally
  532. {
  533. this.Cursor = Cursors.Default;
  534. }
  535. }
  536. private string clickGrid = "grid1";
  537. void UltraGrid1_Click(object sender, EventArgs e)
  538. {
  539. this.toolMenu.Toolbars[0].Tools["Delete"].SharedProps.Caption = "作废";
  540. this.toolMenu.Toolbars[0].Tools["Resume"].SharedProps.Visible = true;
  541. clickGrid = "grid1";
  542. ultraTabControl1.Tabs[0].Selected = true;
  543. }
  544. void UltraGrid2_Click(object sender, EventArgs e)
  545. {
  546. this.toolMenu.Toolbars[0].Tools["Delete"].SharedProps.Caption = "删除";
  547. this.toolMenu.Toolbars[0].Tools["Resume"].SharedProps.Visible = false;
  548. clickGrid = "grid2";
  549. ultraTabControl1.Tabs[1].Selected = true;
  550. }
  551. void UltraGrid3_Click(object sender, EventArgs e)
  552. {
  553. this.toolMenu.Toolbars[0].Tools["Delete"].SharedProps.Caption = "删除";
  554. this.toolMenu.Toolbars[0].Tools["Resume"].SharedProps.Visible = false;
  555. clickGrid = "grid3";
  556. ultraTabControl1.Tabs[2].Selected = true;
  557. }
  558. void UltraGrid3_ClickCell(object sender, ClickCellEventArgs e)
  559. {
  560. UltraGrid3_Click(null, null);
  561. }
  562. void UltraGrid2_ClickCell(object sender, ClickCellEventArgs e)
  563. {
  564. UltraGrid2_Click(null, null);
  565. }
  566. void UltraGrid1_ClickCell(object sender, ClickCellEventArgs e)
  567. {
  568. UltraGrid1_Click(null, null);
  569. }
  570. void EntityGrid1_ClickCell(object sender, ClickCellEventArgs e)
  571. {
  572. EntityGrid1_Click(null, null);
  573. }
  574. void EntityGrid1_Click(object sender, EventArgs e)
  575. {
  576. this.toolMenu.Toolbars[0].Tools["Delete"].SharedProps.Caption = "删除";
  577. this.toolMenu.Toolbars[0].Tools["Resume"].SharedProps.Visible = false;
  578. clickGrid = "grid4";
  579. ultraTabControl1.Tabs[3].Selected = true;
  580. }
  581. private void txt_island_SelectionChanged(object sender, EventArgs e)
  582. {
  583. try
  584. {
  585. String strisland = txt_island.Value.ToString().Trim();
  586. txt_SUPPNATIONALITY.SelectedIndex = -1;
  587. txt_SUPPPROVINCE.SelectedIndex = -1;
  588. FillComboxItems(txt_SUPPNATIONALITY, regions, "region_No", "region_Nm", "region_Type='AC' AND p_Region_No like '" + strisland + "%'");
  589. FillComboxItems(txt_SUPPPROVINCE, regions, "region_No", "region_Nm", "region_Type NOT in ('A','AC','/') AND p_Region_No like '" + strisland + "%'");
  590. }
  591. catch (Exception ex)
  592. {
  593. //MessageUtil.ShowTips("地点数据加载失败");
  594. }
  595. }
  596. private void txt_SUPPNATIONALITY_SelectionChanged(object sender, EventArgs e)
  597. {
  598. try
  599. {
  600. String strsuppNationCode = txt_SUPPNATIONALITY.Value.ToString().Trim();
  601. txt_SUPPPROVINCE.SelectedIndex = -1;
  602. //FillComboxItems(txt_island, regions, "regionNo", "regionNm", "regionType = 'A' AND regionNo like '" + strsuppNationCode.Substring(0,1) + "%'");
  603. FillComboxItems(txt_SUPPPROVINCE, regions, "region_No", "region_Nm", "region_Type NOT in ('A','AC','/') AND p_Region_No like '%" + strsuppNationCode + "%'");
  604. }
  605. catch (Exception ex)
  606. { }
  607. }
  608. private void txt_SUPPOFFICEPROVINCENATION_SelectionChanged(object sender, EventArgs e)
  609. {
  610. try
  611. {
  612. String strsuppNationCode = txt_SUPPOFFICEPROVINCENATION.Value.ToString().Trim();
  613. txt_SUPPOFFICEPROVINCE.SelectedIndex = -1;
  614. FillComboxItems(txt_SUPPOFFICEPROVINCE, regions, "region_No", "region_Nm", "region_Type NOT in ('A','AC','/') AND p_Region_No like '%" + strsuppNationCode + "%'");
  615. }
  616. catch (Exception ex)
  617. { }
  618. }
  619. /// <summary>
  620. /// 清空tab页控件值
  621. /// </summary>
  622. private void ClearTab()
  623. {
  624. txt_BANKACCOUNT.Text = "";
  625. txt_BANKNAME.Text = "";
  626. txt_CERTNO.Text = "";
  627. txt_CERTDESC.Text = "";
  628. txt_CERTIOFFICER.Text = "";
  629. ultraComboEditor1.Text = "";
  630. ultraComboEditor2.Text = "";
  631. txt_CERTVALID_start.Text = "";
  632. txt_certPath.Text = "";
  633. txt_certpath_old.Text = "";
  634. txt_certNo_v.Text = "";
  635. txt_CERTVALID_start.Value = DateTime.Now.AddDays(1).ToString();
  636. txt_CERTVALID_end.Value = DateTime.Now.AddYears(1).ToString();
  637. ultraComboEditor3.Value = null;
  638. ultraNumericEditor1.Value = null;
  639. ultraNumericEditor2.Value = null;
  640. }
  641. }
  642. }