FrmBuyerOrder.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  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;
  10. using Core.Mes.Client.Comm.Server;
  11. using Core.Mes.Client.Comm.Control;
  12. using Core.StlMes.Client.SaleComm;
  13. using Infragistics.Win.UltraWinGrid;
  14. using Core.Mes.Client.Comm.Tool;
  15. using System.Collections;
  16. using System.IO;
  17. namespace Core.StlMes.Client.SaleBase
  18. {
  19. public partial class FrmBuyerOrder : FrmBase
  20. {
  21. OpeBase ob = new OpeBase();
  22. bool blValidating = false; // 验证状态返回 LX
  23. string customer_no = "";//客户编码
  24. public string Customer_no
  25. {
  26. get { return customer_no; }
  27. set { customer_no = value; }
  28. }
  29. string sale_org = "";//销售组织
  30. public string Sale_org
  31. {
  32. get { return sale_org; }
  33. set { sale_org = value; }
  34. }
  35. string custm_use = "";//用途类型
  36. public string Custm_use
  37. {
  38. get { return custm_use; }
  39. set { custm_use = value; }
  40. }
  41. string strOperator = "";//登录名称
  42. public string StrOperator
  43. {
  44. get { return strOperator; }
  45. set { strOperator = value; }
  46. }
  47. string chn_fl = "";//国内/国外
  48. public string Chn_fl
  49. {
  50. get { return chn_fl; }
  51. set { chn_fl = value; }
  52. }
  53. string bigarea = "";//行政片区
  54. public string Bigarea
  55. {
  56. get { return bigarea; }
  57. set { bigarea = value; }
  58. }
  59. string region_no = "";//省市/区域
  60. public string Region_no
  61. {
  62. get { return region_no; }
  63. set { region_no = value; }
  64. }
  65. //查询结果
  66. private DataTable _dtBuerOrder;
  67. public FrmBuyerOrder(OpeBase ops)
  68. {
  69. this.ob = ops;
  70. InitializeComponent();
  71. }
  72. private void FrmBuyerOrder_Load(object sender, EventArgs e)
  73. {
  74. load();//初始化
  75. DataTable table = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryOrderunitDj", new Object[] { customer_no, sale_org, custm_use }, this.ob);
  76. _dtBuerOrder = table;
  77. if (table.Rows.Count > 0)
  78. {
  79. //主界面点击修改查询该条数据加载到对应控件文本内。
  80. this.cmbCustomerType.Text = table.Rows[0]["CUSTM_CTGRY"].ToString();
  81. this.cmbCustoRating.Text = table.Rows[0]["CUSTM_LVL"].ToString();
  82. this.cmbCustoNature.Text = table.Rows[0]["CUSTM_PRPTY"].ToString();
  83. this.textACCOUNT.Text = table.Rows[0]["ACCOUNT"].ToString();
  84. this.textADDRESS.Text = table.Rows[0]["ADDRESS"].ToString();
  85. this.textAGENT.Text = table.Rows[0]["AGENT"].ToString();
  86. this.textBANK.Text = table.Rows[0]["BANK"].ToString();
  87. this.textFAX.Text = table.Rows[0]["FAX"].ToString();
  88. this.textLEGAL_PSN.Text = table.Rows[0]["LEGAL_PSN"].ToString();
  89. this.customer_nm.Text = table.Rows[0]["CUSTOMER_NM"].ToString();
  90. this.textMEMO.Text = table.Rows[0]["MEMO"].ToString();
  91. this.textPHONE.Text = table.Rows[0]["PHONE"].ToString();
  92. this.textTAX_ID.Text = table.Rows[0]["TAX_ID"].ToString();
  93. this.textZIP_CODE.Text = table.Rows[0]["ZIP_CODE"].ToString();
  94. this.ultraText.Text = table.Rows[0]["CUSTM_DATA"].ToString();
  95. if (!string.IsNullOrEmpty(table.Rows[0]["CUSTM_DATA"].ToString().Trim()))
  96. {
  97. try
  98. {
  99. ctrlFileDown1.FilePath = "sale/buyer/" + customer_no;//路径
  100. }
  101. catch (Exception ex)
  102. {
  103. }
  104. }
  105. }
  106. else
  107. {
  108. table = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueyPubuleCustomer", new Object[] { customer_no, sale_org }, this.ob);
  109. if (table.Rows.Count > 0)
  110. {
  111. this.textPHONE.Text = table.Rows[0]["PHONE"].ToString();
  112. this.textFAX.Text = table.Rows[0]["FAX"].ToString();
  113. this.textZIP_CODE.Text = table.Rows[0]["ZIP_CODE"].ToString();
  114. this.textAGENT.Text = table.Rows[0]["CONSIGNEE"].ToString();
  115. this.customer_nm.Text = table.Rows[0]["CUSTOMER_NM"].ToString();
  116. this.textADDRESS.Text = table.Rows[0]["ADDRESS"].ToString();
  117. }
  118. }
  119. }
  120. private void load()
  121. {
  122. DataTable isx = new DataTable();
  123. DataTable unLoad = new DataTable();
  124. unLoad.Columns.Add("Name", typeof(System.String));
  125. unLoad.Columns.Add("Code", typeof(System.String));
  126. ////销售区域
  127. //this.cmbArea.DataSource = null;
  128. //isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryOrder", new Object[] { sale_org }, this.ob);
  129. //this.cmbArea.DataSource = isx;
  130. //cmbArea.DisplayMember = "SALE_AREA_DESC";
  131. //cmbArea.ValueMember = "SALE_AREA_NO";
  132. /*客户类别:1003
  133. 客户性质:1004
  134. 客户等级:1005*/
  135. isx = new DataTable();
  136. this.cmbCustomerType.DataSource = null;
  137. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1003" }, this.ob);
  138. unLoad = new DataTable();
  139. unLoad.Columns.Add("Name", typeof(System.String));
  140. unLoad.Columns.Add("Code", typeof(System.String));
  141. for (int i = 0; i < isx.Rows.Count; i++)
  142. {
  143. unLoad.Rows.Add(isx.Rows[i]["BASENAME"].ToString(), isx.Rows[i]["BASECODE"].ToString());
  144. }
  145. if (isx.Rows.Count > 0)
  146. {
  147. unLoad.Columns["Name"].Caption = "客户名称";
  148. unLoad.Columns["Code"].Caption = "客户编码";
  149. this.cmbCustomerType.DataSource = unLoad;
  150. DataRow dr = unLoad.NewRow();
  151. cmbCustomerType.DataSource = unLoad;
  152. cmbCustomerType.DisplayMember = "Name";
  153. cmbCustomerType.ValueMember = "Code";
  154. }
  155. isx = new DataTable();
  156. this.cmbCustoRating.DataSource = null;
  157. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1005" }, this.ob);
  158. unLoad = new DataTable();
  159. unLoad.Columns.Add("Name", typeof(System.String));
  160. unLoad.Columns.Add("Code", typeof(System.String));
  161. for (int i = 0; i < isx.Rows.Count; i++)
  162. {
  163. unLoad.Rows.Add(isx.Rows[i]["BASENAME"].ToString(), isx.Rows[i]["BASECODE"].ToString());
  164. }
  165. if (isx.Rows.Count > 0)
  166. {
  167. unLoad.Columns["Name"].Caption = "客户名称";
  168. unLoad.Columns["Code"].Caption = "客户编码";
  169. this.cmbCustoRating.DataSource = unLoad;
  170. DataRow dr = unLoad.NewRow();
  171. cmbCustoRating.DataSource = unLoad;
  172. cmbCustoRating.DisplayMember = "Name";
  173. cmbCustoRating.ValueMember = "Code";
  174. }
  175. isx = new DataTable();
  176. this.cmbCustoNature.DataSource = null;
  177. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1004" }, this.ob);
  178. unLoad = new DataTable();
  179. unLoad.Columns.Add("Name", typeof(System.String));
  180. unLoad.Columns.Add("Code", typeof(System.String));
  181. for (int i = 0; i < isx.Rows.Count; i++)
  182. {
  183. unLoad.Rows.Add(isx.Rows[i]["BASENAME"].ToString(), isx.Rows[i]["BASECODE"].ToString());
  184. }
  185. if (isx.Rows.Count > 0)
  186. {
  187. unLoad.Columns["Name"].Caption = "客户名称";
  188. unLoad.Columns["Code"].Caption = "客户编码";
  189. this.cmbCustoNature.DataSource = unLoad;
  190. DataRow dr = unLoad.NewRow();
  191. cmbCustoNature.DataSource = unLoad;
  192. cmbCustoNature.DisplayMember = "Name";
  193. cmbCustoNature.ValueMember = "Code";
  194. }
  195. //到站信息
  196. this.comBoStation.DataSource = null;
  197. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetSlmBaseStation", new Object[] { }, this.ob);
  198. this.comBoStation.DataSource = isx;
  199. comBoStation.DisplayMember = "STATION_NM";
  200. comBoStation.ValueMember = "STATION_NO";
  201. //运输方式
  202. this.ultraComboys.DataSource = null;
  203. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1105" }, this.ob);
  204. this.ultraComboys.DataSource = isx;
  205. ultraComboys.DisplayMember = "BASENAME";
  206. ultraComboys.ValueMember = "BASECODE";
  207. //专用线路
  208. this.comboSPCL.DataSource = null;
  209. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetSlmBasesPclLn", new Object[] { }, this.ob);
  210. this.comboSPCL.DataSource = isx;
  211. comboSPCL.DisplayMember = "SPCL_LN_NM";
  212. comboSPCL.ValueMember = "SPCL_LN_NO";
  213. }
  214. private void ultraToolbarsOrder_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  215. {
  216. switch (e.Tool.Key)
  217. {
  218. case "Save":
  219. if (_dtBuerOrder.Rows.Count > 0)
  220. {
  221. if (_dtBuerOrder.Rows[0]["SALE_ORG"].ToString() != UserInfo.SaleOrg)
  222. {
  223. MessageUtil.ShowWarning("该条记录不是您所在的销售组织创建,无法进行修改!");
  224. return;
  225. }
  226. }
  227. ultraTabControl2.Focus();
  228. if (blValidating == true)
  229. return;
  230. int countTable = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryOrderunitDj",
  231. new Object[] { customer_no, sale_org, custm_use }, this.ob).Rows.Count;
  232. if (countTable > 0)
  233. {
  234. //修改该条数据
  235. string custmctgryName = this.cmbCustomerType.Text.Trim();
  236. string custmctgryCode = this.cmbCustomerType.Value == null ? "" : this.cmbCustomerType.Value.ToString();
  237. string custmlvlName = this.cmbCustoRating.Text.Trim();
  238. string custmlvlCode = this.cmbCustoRating.Value == null ? "" : this.cmbCustoRating.Value.ToString();
  239. string custmprptyName = this.cmbCustoNature.Text.Trim();
  240. string custmprptyCode = this.cmbCustoNature.Value == null ? "" : this.cmbCustoNature.Value.ToString();
  241. string account = this.textACCOUNT.Text.Trim();
  242. string address = this.textADDRESS.Text.Trim();
  243. string agent = this.textAGENT.Text.Trim();
  244. string bank = this.textBANK.Text.Trim();
  245. string fax = this.textFAX.Text.Trim();
  246. string legalpsn = this.textLEGAL_PSN.Text.Trim();
  247. string memo = this.textMEMO.Text.Trim();
  248. string phone = this.textPHONE.Text.Trim();
  249. string taxid = this.textTAX_ID.Text.Trim();
  250. string zipcode = this.textZIP_CODE.Text.Trim();
  251. if (string.IsNullOrEmpty(custmctgryName))
  252. {
  253. MessageUtil.ShowTips("请选择客户类别!");
  254. return;
  255. }
  256. if (string.IsNullOrEmpty(custmlvlName) && sale_org != "100102")
  257. {
  258. MessageUtil.ShowTips("请选择客户等级!");
  259. return;
  260. }
  261. if (string.IsNullOrEmpty(custmprptyName) && sale_org != "100102")
  262. {
  263. MessageUtil.ShowTips("请选择客户性质!");
  264. return;
  265. }
  266. if (string.IsNullOrEmpty(legalpsn) && sale_org != "100102")
  267. {
  268. MessageUtil.ShowTips("法人不能为空!");
  269. return;
  270. }
  271. //if (string.IsNullOrEmpty(agent))
  272. //{
  273. // MessageUtil.ShowTips("代理人不能为空!");
  274. // return;
  275. //}
  276. if (string.IsNullOrEmpty(account) && sale_org != "100102")
  277. {
  278. MessageUtil.ShowTips("帐号不能为空!");
  279. return;
  280. }
  281. if (string.IsNullOrEmpty(zipcode) && sale_org != "100102")
  282. {
  283. MessageUtil.ShowTips("邮编不能为空!");
  284. return;
  285. }
  286. //if (string.IsNullOrEmpty(account))
  287. //{
  288. // MessageUtil.ShowTips("地址不能为空!");
  289. // return;
  290. //}
  291. if (string.IsNullOrEmpty(taxid) && sale_org != "100102")
  292. {
  293. MessageUtil.ShowTips("税号不能为空!");
  294. return;
  295. }
  296. if (string.IsNullOrEmpty(bank) && sale_org != "100102")
  297. {
  298. MessageUtil.ShowTips("开户银行不能为空!");
  299. return;
  300. }
  301. //if (string.IsNullOrEmpty(fax))
  302. //{
  303. // MessageUtil.ShowTips("传真不能为空!");
  304. // return;
  305. //}
  306. ArrayList parm = new ArrayList();
  307. parm.Add(custmctgryCode);
  308. parm.Add(custmprptyCode);
  309. parm.Add(custmlvlCode);
  310. parm.Add(legalpsn);
  311. parm.Add(agent);
  312. parm.Add(address);
  313. parm.Add(region_no);
  314. parm.Add(zipcode);
  315. parm.Add(bank);
  316. parm.Add(account);
  317. parm.Add(taxid);
  318. parm.Add(phone);
  319. parm.Add(fax);
  320. parm.Add(memo);
  321. parm.Add(strOperator);
  322. parm.Add(this.ultraText.Text.Trim());
  323. parm.Add(customer_no);
  324. parm.Add(sale_org);
  325. CoreClientParam ccp = new CoreClientParam();
  326. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerOrder";
  327. ccp.MethodName = "SetUpdateCustmFreight";
  328. ccp.ServerParams = new object[] { parm };
  329. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  330. parm = new ArrayList();
  331. parm.Add(customer_no);
  332. ccp = new CoreClientParam();
  333. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerOrder";
  334. ccp.MethodName = "GetDeleteFreight";
  335. ccp.ServerParams = new object[] { parm };
  336. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  337. //ultraGridOrder.UpdateData();
  338. //foreach (UltraGridRow ugr in this.ultraGridOrder.Rows)
  339. //{
  340. // if (ugr.Cells["CD"].Value.ToString().ToLower() == "true")
  341. // {
  342. // /*customer_no, freight_no, address, station_no, spcl_ln_no,
  343. // trans_typ, memo, create_name, create_time*/
  344. // parm = new ArrayList();
  345. // parm.Add(customer_no);
  346. // parm.Add(sale_org);
  347. // parm.Add(customer_no);
  348. // parm.Add(customer_no);
  349. // parm.Add(ugr.Cells["ADDRESS"].Value.ToString() == "" ? " " : ugr.Cells["ADDRESS"].Value.ToString());
  350. // parm.Add(ugr.Cells["STATION_NO"].Value.ToString() == "" ? " " : ugr.Cells["STATION_NO"].Value.ToString());
  351. // parm.Add(ugr.Cells["SPCL_LN_NO"].Value.ToString() == "" ? " " : ugr.Cells["SPCL_LN_NO"].Value.ToString());
  352. // parm.Add(ugr.Cells["TRANS_TYP"].Value.ToString() == "" ? " " : ugr.Cells["TRANS_TYP"].Value.ToString());
  353. // parm.Add(ugr.Cells["MEMO"].Value.ToString() == "" ? " " : ugr.Cells["MEMO"].Value.ToString());
  354. // parm.Add(strOperator);
  355. // ccp = new CoreClientParam();
  356. // ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerOrder";
  357. // ccp.MethodName = "SetInsertCustmFreight";
  358. // ccp.ServerParams = new object[] { parm };
  359. // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  360. // }
  361. //}
  362. if (ccp.ReturnCode == 0)
  363. {
  364. MessageUtil.ShowTips("更新成功!");
  365. this.Close();
  366. }
  367. }
  368. else
  369. {
  370. ArrayList parm = new ArrayList();
  371. CoreClientParam ccp = new CoreClientParam();
  372. int countMuseCount = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetSlmCustMuseCount", new Object[] { customer_no, sale_org, custm_use }, this.ob).Rows.Count;
  373. if (countMuseCount == 0)
  374. {
  375. parm.Add(customer_no);
  376. parm.Add(sale_org);
  377. parm.Add(custm_use);
  378. parm.Add(strOperator);
  379. ccp = new CoreClientParam();
  380. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerSend";
  381. ccp.MethodName = "GetInsertCustmUse";
  382. ccp.ServerParams = new object[] { parm };
  383. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  384. }
  385. if (ccp.ReturnCode == 0 || countMuseCount>0)
  386. {
  387. /*customer_no, sale_org, custm_use, chn_fl, custm_ctgry,
  388. custm_prpty, custm_lvl, legal_psn, AGENT, address, bigarea,
  389. region_no, disarea, zip_code, bank, ACCOUNT, tax_id, phone, fax,
  390. memo, create_name, create_time
  391. */
  392. string custmctgryName = this.cmbCustomerType.Text.Trim();
  393. string custmctgryCode = this.cmbCustomerType.Value == null ? "" : this.cmbCustomerType.Value.ToString();
  394. string custmlvlName = this.cmbCustoRating.Text.Trim();
  395. string custmlvlCode = this.cmbCustoRating.Value == null ? "" : this.cmbCustoRating.Value.ToString();
  396. string custmprptyName = this.cmbCustoNature.Text.Trim();
  397. string custmprptyCode = this.cmbCustoNature.Value == null ? "" : this.cmbCustoNature.Value.ToString();
  398. string account = this.textACCOUNT.Text.Trim();
  399. string address = this.textADDRESS.Text.Trim();
  400. string agent = this.textAGENT.Text.Trim();
  401. string bank = this.textBANK.Text.Trim();
  402. string fax = this.textFAX.Text.Trim();
  403. string legalpsn = this.textLEGAL_PSN.Text.Trim();
  404. string memo = this.textMEMO.Text.Trim();
  405. string phone = this.textPHONE.Text.Trim();
  406. string taxid = this.textTAX_ID.Text.Trim();
  407. string zipcode = this.textZIP_CODE.Text.Trim();
  408. if (string.IsNullOrEmpty(custmctgryName))
  409. {
  410. MessageUtil.ShowTips("请选择客户类别!");
  411. return;
  412. }
  413. if (string.IsNullOrEmpty(custmlvlName) && sale_org != "100102")
  414. {
  415. MessageUtil.ShowTips("请选择客户等级!");
  416. return;
  417. }
  418. if (string.IsNullOrEmpty(custmprptyName) && sale_org != "100102")
  419. {
  420. MessageUtil.ShowTips("请选择客户性质!");
  421. return;
  422. }
  423. if (string.IsNullOrEmpty(legalpsn) && sale_org != "100102")
  424. {
  425. MessageUtil.ShowTips("法人不能为空!");
  426. return;
  427. }
  428. if (string.IsNullOrEmpty(agent) && sale_org != "100102")
  429. {
  430. MessageUtil.ShowTips("代理人不能为空!");
  431. return;
  432. }
  433. if (string.IsNullOrEmpty(account) && sale_org != "100102")
  434. {
  435. MessageUtil.ShowTips("帐号不能为空!");
  436. return;
  437. }
  438. if (string.IsNullOrEmpty(zipcode) && sale_org != "100102")
  439. {
  440. MessageUtil.ShowTips("邮编不能为空!");
  441. return;
  442. }
  443. //if (string.IsNullOrEmpty(account))
  444. //{
  445. // MessageUtil.ShowTips("地址不能为空!");
  446. // return;
  447. //}
  448. if (string.IsNullOrEmpty(taxid) && sale_org != "100102")
  449. {
  450. MessageUtil.ShowTips("税号不能为空!");
  451. return;
  452. }
  453. if (string.IsNullOrEmpty(bank) && sale_org != "100102")
  454. {
  455. MessageUtil.ShowTips("开户银行不能为空!");
  456. return;
  457. }
  458. //if (string.IsNullOrEmpty(fax))
  459. //{
  460. // MessageUtil.ShowTips("传真不能为空!");
  461. // return;
  462. //}
  463. parm = new ArrayList();
  464. parm.Add(customer_no);
  465. parm.Add(sale_org);
  466. parm.Add(custm_use);
  467. parm.Add(chn_fl);
  468. parm.Add(custmctgryCode);
  469. parm.Add(custmprptyCode);
  470. parm.Add(custmlvlCode);
  471. parm.Add(legalpsn);
  472. parm.Add(agent);
  473. parm.Add(address);
  474. parm.Add(bigarea);
  475. parm.Add(region_no);
  476. parm.Add(zipcode);
  477. parm.Add(bank);
  478. parm.Add(account);
  479. parm.Add(taxid);
  480. parm.Add(phone);
  481. parm.Add(fax);
  482. parm.Add(memo);
  483. parm.Add(strOperator);
  484. parm.Add(this.ultraText.Text.Trim());
  485. ccp = new CoreClientParam();
  486. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerOrder";
  487. ccp.MethodName = "SetInsertOrderunit";
  488. ccp.ServerParams = new object[] { parm };
  489. ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  490. //if (ccp.ReturnCode == 0)
  491. //{
  492. // ultraGridOrder.UpdateData();
  493. // foreach (UltraGridRow ugr in this.ultraGridOrder.Rows)
  494. // {
  495. // if (ugr.Cells["CD"].Value.ToString().ToLower() == "true")
  496. // {
  497. // /*customer_no, freight_no, address, station_no, spcl_ln_no,
  498. // trans_typ, memo, create_name, create_time*/
  499. // parm = new ArrayList();
  500. // parm.Add(customer_no);
  501. // parm.Add(sale_org);
  502. // parm.Add(customer_no);
  503. // parm.Add(customer_no);
  504. // parm.Add(ugr.Cells["ADDRESS"].Value.ToString() == "" ? " " : ugr.Cells["ADDRESS"].Value.ToString());
  505. // parm.Add(ugr.Cells["STATION_NO"].Value.ToString() == "" ? " " : ugr.Cells["STATION_NO"].Value.ToString());
  506. // parm.Add(ugr.Cells["SPCL_LN_NO"].Value.ToString() == "" ? " " : ugr.Cells["SPCL_LN_NO"].Value.ToString());
  507. // parm.Add(ugr.Cells["TRANS_TYP"].Value.ToString() == "" ? " " : ugr.Cells["TRANS_TYP"].Value.ToString());
  508. // parm.Add(ugr.Cells["MEMO"].Value.ToString() == "" ? " " : ugr.Cells["MEMO"].Value.ToString());
  509. // parm.Add(strOperator);
  510. // try
  511. // {
  512. // ccp = new CoreClientParam();
  513. // ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerOrder";
  514. // ccp.MethodName = "SetInsertCustmFreight";
  515. // ccp.ServerParams = new object[] { parm };
  516. // ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  517. // }
  518. // catch (Exception ex)
  519. // {
  520. // throw ex;
  521. // }
  522. // }
  523. // }
  524. //}
  525. }
  526. if (ccp.ReturnCode == -1)
  527. {
  528. MessageUtil.ShowTips("新增失败!");
  529. }
  530. else
  531. {
  532. MessageUtil.ShowTips("新增成功!");
  533. this.Close();
  534. }
  535. }
  536. break;
  537. case "Esc":
  538. this.Close();
  539. break;
  540. }
  541. }
  542. private void ultraText_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  543. {
  544. string messageLabel = "sale/buyer/" + customer_no;
  545. if(FlileUploadcomm.FlileUpload(messageLabel))
  546. {
  547. ultraText.Text = messageLabel;
  548. try
  549. {
  550. ctrlFileDown1.FilePath = "sale/buyer/" + customer_no;
  551. }
  552. catch (Exception ex)
  553. {
  554. }
  555. }
  556. }
  557. /// <summary>
  558. /// 法人录入验证
  559. /// </summary>
  560. /// <param name="sender"></param>
  561. /// <param name="e"></param>
  562. private void textLEGAL_PSN_Validating(object sender, CancelEventArgs e)
  563. {
  564. blValidating = false;
  565. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textLEGAL_PSN.Text) > 20)
  566. {
  567. MessageBox.Show("录入法人【中文名不能大于10个字符/英文名不能大于20个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  568. blValidating = true;
  569. e.Cancel = true;
  570. }
  571. }
  572. /// <summary>
  573. /// 代理人录入验证
  574. /// </summary>
  575. /// <param name="sender"></param>
  576. /// <param name="e"></param>
  577. private void textAGENT_Validating(object sender, CancelEventArgs e)
  578. {
  579. blValidating = false;
  580. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textAGENT.Text) > 20)
  581. {
  582. MessageBox.Show("录入代理人数据验证失败【中文名不能大于10个字符/英文名不能大于20个字符】,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  583. blValidating = true;
  584. e.Cancel = true;
  585. }
  586. }
  587. /// <summary>
  588. /// 地址录入验证
  589. /// </summary>
  590. /// <param name="sender"></param>
  591. /// <param name="e"></param>
  592. private void textADDRESS_Validating(object sender, CancelEventArgs e)
  593. {
  594. blValidating = false;
  595. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textADDRESS.Text) > 500)
  596. {
  597. MessageBox.Show("录入地址数据验证失败【中文地址不能大于250个字符/英文地址不能大于500个字符】,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  598. blValidating = true;
  599. e.Cancel = true;
  600. }
  601. }
  602. /// <summary>
  603. /// 开户银行录入验证
  604. /// </summary>
  605. /// <param name="sender"></param>
  606. /// <param name="e"></param>
  607. private void textBANK_Validating(object sender, CancelEventArgs e)
  608. {
  609. blValidating = false;
  610. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textBANK.Text) > 50)
  611. {
  612. MessageBox.Show("录入开户银行数据验证失败【中文名不能大于25个字符/英文名不能大于50个字符】,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  613. blValidating = true;
  614. e.Cancel = true;
  615. }
  616. }
  617. /// <summary>
  618. /// 电话码号录入验证
  619. /// </summary>
  620. /// <param name="sender"></param>
  621. /// <param name="e"></param>
  622. private void textPHONE_Validating(object sender, CancelEventArgs e)
  623. {
  624. blValidating = false;
  625. if (Core.Mes.Client.Comm.Globals.IsChinese(textPHONE.Text))
  626. {
  627. MessageBox.Show("录入电话号码数据验证失败【电话号码不能为中文】,请按国内/国际电话规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  628. blValidating = true;
  629. e.Cancel = true;
  630. }
  631. else
  632. {
  633. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textPHONE.Text) > 20)
  634. {
  635. MessageBox.Show("录入电话号码数据验证失败【不能大于20个字符】,请按国内/国际电话规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  636. blValidating = true;
  637. e.Cancel = true;
  638. }
  639. }
  640. }
  641. /// <summary>
  642. /// 传真录入验证
  643. /// </summary>
  644. /// <param name="sender"></param>
  645. /// <param name="e"></param>
  646. private void textFAX_Validating(object sender, CancelEventArgs e)
  647. {
  648. blValidating = false;
  649. if (Core.Mes.Client.Comm.Globals.IsChinese(textFAX.Text))
  650. {
  651. MessageBox.Show("录入传真号码数据验证失败【传真号码不能为中文】,请按国内/国际传真号码规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  652. blValidating = true;
  653. e.Cancel = true;
  654. }
  655. else
  656. {
  657. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textFAX.Text) > 20)
  658. {
  659. MessageBox.Show("录入传真号码数据验证失败【不能大于20个字符】,请按国内/国际传真号码规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  660. blValidating = true;
  661. e.Cancel = true;
  662. }
  663. }
  664. }
  665. /// <summary>
  666. /// 邮编录入验证
  667. /// </summary>
  668. /// <param name="sender"></param>
  669. /// <param name="e"></param>
  670. private void textZIP_CODE_Validating(object sender, CancelEventArgs e)
  671. {
  672. blValidating = false;
  673. if (Core.Mes.Client.Comm.Globals.IsChinese(textZIP_CODE.Text))
  674. {
  675. MessageBox.Show("录入邮编数据验证失败【邮编不能为中文】,请按国内/国际邮编规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  676. blValidating = true;
  677. e.Cancel = true;
  678. }
  679. else
  680. {
  681. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textZIP_CODE.Text) > 20)
  682. {
  683. MessageBox.Show("录入邮编数据验证失败【不能大于20个字符】,请按国内/国际邮编规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  684. blValidating = true;
  685. e.Cancel = true;
  686. }
  687. }
  688. }
  689. /// <summary>
  690. /// 税号录入验证
  691. /// </summary>
  692. /// <param name="sender"></param>
  693. /// <param name="e"></param>
  694. private void textTAX_ID_Validating(object sender, CancelEventArgs e)
  695. {
  696. blValidating = false;
  697. if (Core.Mes.Client.Comm.Globals.IsChinese(textTAX_ID.Text))
  698. {
  699. MessageBox.Show("录入税号数据验证失败【税号不能为中文】,请按国内/国际税号规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  700. blValidating = true;
  701. e.Cancel = true;
  702. }
  703. else
  704. {
  705. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textTAX_ID.Text) > 20)
  706. {
  707. MessageBox.Show("录入税号数据验证失败【不能大于50个字符】,请按国内/国际税号规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  708. blValidating = true;
  709. e.Cancel = true;
  710. }
  711. }
  712. }
  713. /// <summary>
  714. /// 帐号录入验证
  715. /// </summary>
  716. /// <param name="sender"></param>
  717. /// <param name="e"></param>
  718. private void textACCOUNT_Validating(object sender, CancelEventArgs e)
  719. {
  720. blValidating = false;
  721. if (Core.Mes.Client.Comm.Globals.IsChinese(textACCOUNT.Text))
  722. {
  723. MessageBox.Show("录入帐号数据验证失败【帐号不能为中文】,请按国内/国际帐号规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  724. blValidating = true;
  725. e.Cancel = true;
  726. }
  727. else
  728. {
  729. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textACCOUNT.Text) > 50)
  730. {
  731. MessageBox.Show("录入帐号数据验证失败【不能大于50个字符】,请按国内/国际帐号规则重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  732. blValidating = true;
  733. e.Cancel = true;
  734. }
  735. }
  736. }
  737. private void textMEMO_Validating(object sender, CancelEventArgs e)
  738. {
  739. blValidating = false;
  740. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textMEMO.Text) > 200)
  741. {
  742. MessageBox.Show("录入备注数据验证失败【备注不能大于100个字符/英文地址不能大于200个字符】,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  743. blValidating = true;
  744. e.Cancel = true;
  745. }
  746. }
  747. }
  748. }