FrmBuyerBase.cs 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325
  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 Infragistics.Win.UltraWinGrid;
  13. using Core.Mes.Client.Comm.Tool;
  14. using System.Collections;
  15. namespace Core.StlMes.Client.SaleBase
  16. {
  17. public partial class FrmBuyerBase : FrmBase
  18. {
  19. string strShift = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserOrder();
  20. string strOperator = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
  21. string saleorg = "";//部门
  22. string combelText = "";//省市区域名称
  23. string combelonCity = "";//省市区域代码
  24. string combleTo = "";//州或国
  25. string stacustomerNo = "";//全局客户编码
  26. string bigarea = "";//行政片区
  27. string customerID = "";
  28. string expanlixName = "";//客户名称
  29. //用于展开操作项
  30. ArrayList listExpanl = new ArrayList();
  31. protected override void OnLoad(EventArgs e)
  32. {
  33. try
  34. {
  35. base.OnLoad(e);
  36. ultraBaseGrid.DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;
  37. ultraBaseGrid.DisplayLayout.Override.FilterOperatorDefaultValue = Infragistics.Win.UltraWinGrid.FilterOperatorDefaultValue.Contains;
  38. for (int i = 0; i < ultraBaseGrid.DisplayLayout.Bands.Count; i++)
  39. {
  40. if (i > 0)
  41. {
  42. ultraBaseGrid.DisplayLayout.Bands[i].Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.HeaderIcons;
  43. }
  44. }
  45. }
  46. catch (System.Exception ex)
  47. { }
  48. }
  49. public FrmBuyerBase()
  50. {
  51. InitializeComponent();
  52. ExceptionHelper.RegistException();
  53. this.ComBelongsCity.AfterExpand += new TreeViewEventHandler(ComBelongsCity_AfterExpand);
  54. this.ComBelongsCity.AfterCollapse += new TreeViewEventHandler(ComBelongsCity_AfterCollapse);
  55. }
  56. void ComBelongsCity_AfterCollapse(object sender, TreeViewEventArgs e)
  57. {
  58. if (e.Node.ImageIndex == 1)
  59. e.Node.ImageIndex = e.Node.SelectedImageIndex = 0;
  60. }
  61. void ComBelongsCity_AfterExpand(object sender, TreeViewEventArgs e)
  62. {
  63. if (e.Node.ImageIndex == 0)
  64. e.Node.ImageIndex = e.Node.SelectedImageIndex = 1;
  65. }
  66. private void FrmBuyerBase_Load(object sender, EventArgs e)
  67. {
  68. this.doLoadSource();
  69. }
  70. private void doLoadSource()
  71. {
  72. //市场系统
  73. DataTable isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1006" }, this.ob);
  74. comBoStation.DataSource = isx;
  75. comBoStation.DisplayMember = "BASENAME";
  76. comBoStation.ValueMember = "BASECODE";
  77. ClsBaseInfo.SetComboItemHeight(comBoStation);
  78. //区域
  79. isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1007" }, this.ob);
  80. comboRegIon.DataSource = isx;
  81. comboRegIon.DisplayMember = "BASENAME";
  82. comboRegIon.ValueMember = "BASECODE";
  83. ClsBaseInfo.SetComboItemHeight(comboRegIon);
  84. doGetSaleOrg();
  85. QueryTree();
  86. }
  87. //刷新Tree
  88. public void QueryTree()
  89. {
  90. this.ComBelongsCity.Nodes.Clear();
  91. DataTable dt = new DataTable();
  92. dt = ServerHelper.GetData("com.steering.pss.sale.base.CoreStation.GetTivCode", new Object[] { }, this.ob);
  93. //树控件递归绑定方法。
  94. Bind_Tv(dt, ComBelongsCity.Nodes, null, "REGION_NO", "P_REGION_NO", "REGION_NM");
  95. }
  96. private void Bind_Tv(DataTable dt, TreeNodeCollection tnc, string pid_val, string id, string pid, string text)
  97. {
  98. DataView dv = new DataView(dt);//将DataTable存到DataView中,以便于筛选数据
  99. TreeNode tn;//建立TreeView的节点(TreeNode),以便将取出的数据添加到节点中
  100. //以下为三元运算符,如果父id为空,则为构建“父id字段 is null”的查询条件,否则构建“父id字段=父id字段值”的查询条件
  101. string filter = string.IsNullOrEmpty(pid_val) ? pid + " is null" : string.Format(pid + "='{0}'", pid_val);
  102. dv.RowFilter = filter;//利用DataView将数据进行筛选,选出相同 父id值 的数据
  103. foreach (DataRowView drv in dv)
  104. {
  105. tn = new TreeNode();//建立一个新节点(学名叫:一个实例)
  106. tn.Tag = drv[id].ToString();//节点的Value值,一般为数据库的id值
  107. tn.Text = drv[text].ToString();//节点的Text,节点的文本显示
  108. tn.Name = drv["REGION_LVL_NO"].ToString();//区域属性代码
  109. tn.ImageKey = drv["REGION_LVL_NM"].ToString();
  110. tn.StateImageKey = drv["BIGAREA"].ToString();
  111. if (!string.IsNullOrEmpty(drv["P_REGION_NO"].ToString()))
  112. {
  113. tn.ToolTipText = drv["P_REGION_NO"].ToString();
  114. }
  115. else
  116. {
  117. tn.ImageIndex = 0;
  118. }
  119. tnc.Add(tn);//将该节点加入到TreeNodeCollection(节点集合)中
  120. Bind_Tv(dt, tn.Nodes, tn.Tag.ToString(), id, pid, text);//递归(反复调用这个方法,直到把数据取完为止)
  121. }
  122. }
  123. /// <summary>
  124. /// 重写基类方法
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="ToolbarKey"></param>
  128. public override void ToolBar_Click(object sender, string ToolbarKey)
  129. {
  130. //if (UserInfo.SaleOrg.Equals("NONE"))
  131. //{
  132. // MessageBox.Show("未授权,不允许查看!");
  133. // return;
  134. //}
  135. switch (ToolbarKey)
  136. {
  137. case "doQuery":
  138. doQuery();
  139. break;
  140. case "doAdd":
  141. if (MessageUtil.ShowQuestion("是否新增数据?").ToString().ToLower().Equals("yes"))
  142. {
  143. try
  144. {
  145. string dosave = doSave();
  146. if (dosave.Equals("true"))
  147. {
  148. MessageUtil.ShowTips("添加成功!");
  149. doQuery();
  150. }
  151. else if (dosave.Equals("BugCustomer"))
  152. {
  153. MessageUtil.ShowTips("数据插入客户编码表失败!"); return;
  154. }
  155. else if (dosave.Equals("doInsertCustmRight"))
  156. {
  157. MessageUtil.ShowTips("数据插入客户授权表失败!"); return;
  158. }
  159. else if (dosave.Equals("BugCustmUseRight"))
  160. {
  161. MessageUtil.ShowTips("数据插入客户用途类型表失败!"); return;
  162. }
  163. }
  164. catch (Exception ex)
  165. {
  166. MessageBox.Show(ex.Message);
  167. return;
  168. }
  169. }
  170. break;
  171. case "doDelete":
  172. if (ultraBaseGrid.ActiveRow == null)
  173. {
  174. MessageBox.Show("请选择要作废的客户信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  175. return;
  176. }
  177. if (MessageUtil.ShowQuestion("是否确认作废【" + ultraBaseGrid.ActiveRow.Cells["CUSTOMER_NM"].Value.ToString() + "】客户数据?").ToString().ToLower().Equals("yes"))
  178. {
  179. if (doDelete("0"))
  180. {
  181. MessageUtil.ShowTips("作废成功!");
  182. doQuery();
  183. }
  184. else
  185. {
  186. MessageUtil.ShowTips("作废失败!");
  187. }
  188. }
  189. break;
  190. case "doCancel":
  191. if (ultraBaseGrid.ActiveRow == null)
  192. {
  193. MessageBox.Show("请选择要取消作废的客户信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  194. return;
  195. }
  196. if (MessageUtil.ShowQuestion("是否确认取消作废的【" + ultraBaseGrid.ActiveRow.Cells["CUSTOMER_NM"].Value.ToString() + "】客户数据?").ToString().ToLower().Equals("yes"))
  197. {
  198. if (doDelete("1"))
  199. {
  200. MessageUtil.ShowTips("取消作废成功!");
  201. doQuery();
  202. }
  203. else
  204. {
  205. MessageUtil.ShowTips("取消作废失败!");
  206. }
  207. }
  208. break;
  209. case "doUpdate":
  210. string doUp = doUpdate();
  211. if (doUp.Equals("true"))
  212. {
  213. MessageUtil.ShowTips("修改成功!");
  214. doQuery();
  215. }
  216. else if (doUp.Equals("BugCustomer"))
  217. {
  218. MessageUtil.ShowTips("修改失败!");
  219. }
  220. break;
  221. case "doLoad":
  222. this.doLoadSource();
  223. break;
  224. case "OutExcel":
  225. OutExcel();
  226. break;
  227. case "Close":
  228. this.Close();
  229. break;
  230. }
  231. }
  232. private void OutExcel()
  233. {
  234. ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_ORDER"].Hidden = true;
  235. ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_RECEIVE"].Hidden = true;
  236. GridHelper.ulGridToExcel(ultraBaseGrid, "客户基础信息");
  237. ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_ORDER"].Hidden = false;
  238. ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_RECEIVE"].Hidden = false;
  239. //string customerName = "";
  240. //string validFlag = "";
  241. //string strSaleOrg = "";
  242. ////销售与钢贸数据共享
  243. //if (UserInfo.SaleOrg == "100101" || UserInfo.SaleOrg == "100103")
  244. // strSaleOrg = "100101','100103";
  245. //else if (UserInfo.SaleOrg == "100102")
  246. // strSaleOrg = "100102";
  247. //else
  248. // strSaleOrg = "NONE";
  249. //customerName = ultxtBaseName.Text.Trim();
  250. //if (chkValid.Checked)
  251. // validFlag = "0','1";
  252. //else
  253. // validFlag = "1";
  254. //FrmOutExcel fBug = new FrmOutExcel(ob, customerName, validFlag, strSaleOrg);
  255. //fBug.AutoSize = true;
  256. //fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
  257. //fBug.WindowState = FormWindowState.Maximized;
  258. //fBug.Show();
  259. }
  260. private bool doDelete(string strValidFlag)
  261. {
  262. ArrayList parm = new ArrayList();
  263. parm.Add(strValidFlag);
  264. parm.Add(strOperator);
  265. parm.Add(stacustomerNo);
  266. CoreClientParam ccp = new CoreClientParam();
  267. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  268. ccp.MethodName = "GetUpdateCustomerALLS";
  269. ccp.ServerParams = new object[] { parm };
  270. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  271. parm = new ArrayList();
  272. parm.Add(strValidFlag);
  273. parm.Add(stacustomerNo);
  274. parm.Add(saleorg);
  275. ccp = new CoreClientParam();
  276. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  277. ccp.MethodName = "GetUpdateRightALL";
  278. ccp.ServerParams = new object[] { parm };
  279. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  280. ccp = new CoreClientParam();
  281. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  282. ccp.MethodName = "GetUpdateUseALL";
  283. ccp.ServerParams = new object[] { parm };
  284. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  285. ccp = new CoreClientParam();
  286. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  287. ccp.MethodName = "GetUpdateReceivUnitALL";
  288. ccp.ServerParams = new object[] { parm };
  289. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  290. ccp = new CoreClientParam();
  291. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  292. ccp.MethodName = "GetUpdateOrderUnitALL";
  293. ccp.ServerParams = new object[] { parm };
  294. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  295. parm = new ArrayList();
  296. parm.Add(strValidFlag);
  297. parm.Add(stacustomerNo);
  298. ccp = new CoreClientParam();
  299. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  300. ccp.MethodName = "GetUpdateFreightALL";
  301. ccp.ServerParams = new object[] { parm };
  302. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  303. if (ccp.ReturnCode == -1)
  304. {
  305. return false;
  306. }
  307. return true;
  308. }
  309. private string doUpdate()
  310. {
  311. string returnBug = ""; //记录bug信息
  312. string customerName = textEditorBaseName.Text;//客户名称
  313. string abrvition = textAbrviTion.Text;//客户简称
  314. string org = textEditorORG.Text;//组织机构
  315. string combelname = ComBelongsCity.Text;//省市区域名称
  316. treeSelect(combelname);
  317. string combelon = combelonCity;//省市区域代码
  318. string comble = combleTo;//州或国
  319. string py = this.textEditorABC.Text;//拼音
  320. if(UserInfo.SaleOrg == "")
  321. if (combelonCity.Equals(""))
  322. {
  323. MessageUtil.ShowTips("请选择‘洲’以下区域新增客户信息,找不到对应地区请维护!");
  324. return returnBug;
  325. }
  326. if (stacustomerNo.Equals(""))
  327. {
  328. MessageUtil.ShowTips("请选中一条客户编码进行修改!");
  329. return returnBug;
  330. }
  331. if (customerName.Trim().Equals(""))
  332. {
  333. MessageUtil.ShowTips("客户名称不允许为空!");
  334. return returnBug;
  335. }
  336. if (abrvition.Trim().Equals(""))
  337. {
  338. MessageUtil.ShowTips("客户简称不允许为空!");
  339. return returnBug;
  340. }
  341. //if (org.Trim().Equals(""))
  342. //{
  343. // MessageUtil.ShowTips("组织机构不允许为空!");
  344. // return returnBug;
  345. //}
  346. if (combelname.Trim().Equals(""))
  347. {
  348. MessageUtil.ShowTips("省市/区域不允许为空!");
  349. return returnBug;
  350. }
  351. if (comBoStation.Text.Trim().Equals(""))
  352. {
  353. MessageUtil.ShowTips("请选择[市场系统]!");
  354. return returnBug;
  355. }
  356. else if (comBoStation.IsItemInList(comBoStation.Text.Trim()) == false)
  357. {
  358. MessageUtil.ShowTips("输入的[市场系统]不在,请选择[市场系统]!");
  359. comBoStation.Focus();
  360. return returnBug;
  361. }
  362. if (ultraBaseGrid.ActiveRow != null)
  363. {
  364. UltraGridRow row = ultraBaseGrid.ActiveRow;
  365. while (row.HasParent())
  366. {
  367. row = row.ParentRow;
  368. }
  369. if (!row.Cells["CUSTOMER_NM"].Value.Equals(customerName))
  370. {
  371. DataTable customerTable = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob);
  372. if (customerTable.Rows.Count > 0)
  373. {
  374. MessageUtil.ShowTips(customerName + ",客户名称已存在!");
  375. return returnBug;
  376. }
  377. }
  378. if (!row.Cells["ABRVITION"].Value.Equals(abrvition))
  379. {
  380. int customerCount = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryAbrviTion", new Object[] { abrvition }, this.ob).Rows.Count;
  381. if (customerCount > 0)
  382. {
  383. MessageUtil.ShowTips(abrvition + ",简称已存在!");
  384. return returnBug;
  385. }
  386. }
  387. }
  388. if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return "";
  389. expanlixName = customerName;
  390. ArrayList parm = new ArrayList();
  391. parm.Add(customerName);
  392. parm.Add(comboRegIon.Value);
  393. parm.Add(combelon);
  394. parm.Add(abrvition);
  395. parm.Add(org);
  396. parm.Add(strOperator);
  397. parm.Add(py);
  398. parm.Add(comBoStation.Text); // LX 修改 comBoStation.Value
  399. parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);
  400. parm.Add(strOperator);
  401. parm.Add(stacustomerNo);
  402. CoreClientParam ccp = new CoreClientParam();
  403. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  404. ccp.MethodName = "GetUpdateCustomer";
  405. ccp.ServerParams = new object[] { parm };
  406. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  407. if (ccp.ReturnCode == -1)
  408. {
  409. returnBug = "BugCustomer";
  410. return returnBug;
  411. }
  412. else
  413. {
  414. returnBug = "true";
  415. }
  416. return returnBug;
  417. }
  418. /// <summary>
  419. /// 根据登录账户,判断所属部门。
  420. /// </summary>
  421. private void doGetSaleOrg()
  422. {
  423. UserInfo.SaleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
  424. saleorg = UserInfo.SaleOrg;
  425. }
  426. private string doSave()
  427. {
  428. string returnBug = ""; //记录bug信息
  429. string customerName = textEditorBaseName.Text;//客户名称
  430. string abrvition = textAbrviTion.Text;//客户简称
  431. string org = textEditorORG.Text;//组织机构
  432. treeSelect(ComBelongsCity.Text);//加载省市
  433. string combelname = ComBelongsCity.Text;//省市区域名称
  434. treeSelect(combelname);
  435. string combelon = combelonCity;//省市区域代码
  436. string comble = combleTo;//州或国
  437. string zjabc = textEditorABC.Text;//拼音助记
  438. string customerNo = "";
  439. if (combelonCity.Trim().Equals(""))
  440. {
  441. MessageUtil.ShowTips("请选择[区域/省市]中省市不允许选择洲,请正确填写省市!");
  442. return returnBug;
  443. }
  444. if (customerName.Trim().Equals(""))
  445. {
  446. MessageUtil.ShowTips("请输入[客户名称]!");
  447. return returnBug;
  448. }
  449. if (abrvition.Trim().Equals(""))
  450. {
  451. MessageUtil.ShowTips("请输入[客户简称]!");
  452. return returnBug;
  453. }
  454. //if (org.Trim().Equals(""))
  455. //{
  456. // MessageUtil.ShowTips("组织机构不允许为空!");
  457. // return returnBug;
  458. //}
  459. if (combelname.Trim().Equals(""))
  460. {
  461. MessageUtil.ShowTips("请选择[省市/区域]!");
  462. return returnBug;
  463. }
  464. //if (zjabc.Trim().Equals(""))
  465. //{
  466. // MessageUtil.ShowTips("拼音助记不允许为空!");
  467. // return returnBug;
  468. //}
  469. //if (comboRegIon.Text.Trim().Equals(""))
  470. //{
  471. // MessageUtil.ShowTips("区域不允许为空!");
  472. // return returnBug;
  473. //}
  474. if (comBoStation.Text.Trim().Equals(""))
  475. {
  476. MessageUtil.ShowTips("请选择[市场系统]!");
  477. return returnBug;
  478. }
  479. else if (comBoStation.IsItemInList(comBoStation.Text.Trim()) == false)
  480. {
  481. MessageUtil.ShowTips("输入的[市场系统]不在,请选择[市场系统]!");
  482. comBoStation.Focus();
  483. return returnBug;
  484. }
  485. ArrayList parm = new ArrayList();
  486. CoreClientParam ccp = new CoreClientParam();
  487. //判断客户名称已存在而且无效 Update除了客户名称和简称以外的数据。
  488. DataTable customerCTME = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCTMR", new Object[] { customerName }, this.ob);
  489. if (customerCTME.Rows.Count > 0)
  490. {
  491. parm = new ArrayList();
  492. parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);//用户组
  493. parm.Add(comboRegIon.Value);//行政片区
  494. parm.Add(combelon);//省市/区域
  495. parm.Add(abrvition);//简称
  496. parm.Add(org);//机构代码
  497. parm.Add(strOperator);//创建人
  498. parm.Add(zjabc);//拼音助记
  499. parm.Add(comBoStation.Text);//市场系统(1006) LX 修改 comBoStation.Value
  500. parm.Add("1");//有效标志(1:有效,0:无效)
  501. parm.Add(customerCTME.Rows[0][0].ToString());//客户代码
  502. ccp = new CoreClientParam();
  503. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  504. ccp.MethodName = "GetUpdateDeleteCTMR";
  505. ccp.ServerParams = new object[] { parm };
  506. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  507. if (ccp.ReturnCode == -1)
  508. {
  509. MessageUtil.ShowTips("还原新增失败!");
  510. return returnBug;
  511. }
  512. else
  513. {
  514. returnBug = "true";
  515. parm = new ArrayList();
  516. parm.Add(customerCTME.Rows[0][0].ToString()); //客户编码
  517. parm.Add("100204");
  518. parm.Add(saleorg);
  519. ccp = new CoreClientParam();
  520. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  521. ccp.MethodName = "SetUpCustm_Use";
  522. ccp.ServerParams = new object[] { parm };
  523. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  524. return returnBug;
  525. }
  526. }
  527. DataTable customerTable = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob);
  528. if (customerTable.Rows.Count > 0)
  529. {
  530. customerNo = customerTable.Rows[0][0].ToString();
  531. int countRight = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetCustmRight", new Object[] { customerNo, saleorg }, this.ob).Rows.Count;
  532. if (countRight > 0)
  533. {
  534. MessageUtil.ShowTips(customerName + ",客户名称已存在!");
  535. return returnBug;
  536. }
  537. else
  538. {
  539. try
  540. {
  541. parm = new ArrayList();
  542. parm.Add(customerNo); //客户编码
  543. parm.Add(saleorg);
  544. parm.Add("");
  545. parm.Add(strOperator);
  546. ccp = new CoreClientParam();
  547. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  548. ccp.MethodName = "GetInsertCustmRight";
  549. ccp.ServerParams = new object[] { parm };
  550. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  551. }
  552. catch (Exception ex)
  553. {
  554. MessageBox.Show(ex.Message);
  555. return returnBug;
  556. }
  557. }
  558. int countRights = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetCustmUse", new Object[] { customerNo, saleorg }, this.ob).Rows.Count;
  559. if (countRights > 0)
  560. {
  561. MessageUtil.ShowTips(customerName + ",客户名称已存在!");
  562. return returnBug;
  563. }
  564. else
  565. {
  566. parm = new ArrayList();
  567. parm.Add(customerNo); //客户编码
  568. parm.Add(saleorg);
  569. parm.Add("100204");
  570. parm.Add(strOperator);
  571. ccp = new CoreClientParam();
  572. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  573. ccp.MethodName = "GetInsertCustmUse";
  574. ccp.ServerParams = new object[] { parm };
  575. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  576. parm = new ArrayList();
  577. parm.Add(customerNo); //客户编码
  578. parm.Add(saleorg);
  579. parm.Add("100205");
  580. parm.Add(strOperator);
  581. ccp = new CoreClientParam();
  582. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  583. ccp.MethodName = "GetInsertCustmUse";
  584. ccp.ServerParams = new object[] { parm };
  585. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  586. }
  587. return "true";
  588. }
  589. int customerCount = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryAbrviTion", new Object[] { abrvition }, this.ob).Rows.Count;
  590. if (customerCount > 0)
  591. {
  592. MessageUtil.ShowTips(abrvition + ",简称已存在!");
  593. return returnBug;
  594. }
  595. //customer_nm, bigarea, region_no, abrvition, org, create_name
  596. expanlixName = customerName;
  597. parm = new ArrayList();
  598. parm.Add(combelon);
  599. parm.Add(combelon);
  600. parm.Add(combelon);
  601. parm.Add(combelon);
  602. parm.Add(combelon);
  603. parm.Add(customerName);
  604. parm.Add(comboRegIon.Value);
  605. parm.Add(combelon);
  606. parm.Add(abrvition);
  607. parm.Add(org);
  608. parm.Add(strOperator);
  609. parm.Add(zjabc);
  610. parm.Add(comBoStation.Text); //LX 修改 comBoStation.Value
  611. parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);
  612. ccp = new CoreClientParam();
  613. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  614. ccp.MethodName = "GetInsertCustomer";
  615. ccp.ServerParams = new object[] { parm };
  616. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  617. if (ccp.ReturnCode == -1)
  618. {
  619. returnBug = "BugCustomer";
  620. return returnBug;
  621. }
  622. else
  623. {
  624. returnBug = "Next";
  625. }
  626. if (returnBug.Equals("Next"))
  627. {
  628. customerNo = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob).Rows[0][0].ToString();
  629. parm = new ArrayList();
  630. parm.Add(customerNo); //客户编码
  631. parm.Add(saleorg);
  632. parm.Add(" ");
  633. parm.Add(strOperator);
  634. ccp = new CoreClientParam();
  635. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  636. ccp.MethodName = "GetInsertCustmRight";
  637. ccp.ServerParams = new object[] { parm };
  638. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  639. if (ccp.ReturnCode == -1)
  640. {
  641. returnBug = "BugCustmRight";
  642. return returnBug;
  643. }
  644. else
  645. {
  646. returnBug = "Next";
  647. }
  648. }
  649. //customer_no, sale_org, custm_use, create_name, create_time
  650. if (returnBug.Equals("Next"))
  651. {
  652. parm = new ArrayList();
  653. parm.Add(customerNo); //客户编码
  654. parm.Add(saleorg);
  655. parm.Add("100205");
  656. parm.Add(strOperator);
  657. ccp = new CoreClientParam();
  658. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  659. ccp.MethodName = "GetInsertCustmUse";
  660. ccp.ServerParams = new object[] { parm };
  661. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  662. if (ccp.ReturnCode == -1)
  663. {
  664. returnBug = "BugCustmUseRight";
  665. return returnBug;
  666. }
  667. else
  668. {
  669. returnBug = "true";
  670. }
  671. }
  672. int countsig = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustm_Use", new Object[] { customerNo, "100204", saleorg }, this.ob).Rows.Count;
  673. if (countsig == 0)
  674. {
  675. parm = new ArrayList();
  676. parm.Add(customerNo); //客户编码
  677. parm.Add(saleorg);
  678. parm.Add("100204");
  679. parm.Add(strOperator);
  680. ccp = new CoreClientParam();
  681. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  682. ccp.MethodName = "GetInsertCustmUse";
  683. ccp.ServerParams = new object[] { parm };
  684. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  685. }
  686. return returnBug;
  687. }
  688. //查询
  689. public void doQuery()
  690. {
  691. string customerName = ""; //sql
  692. string customerNo = ""; //客户简称
  693. string custmuse = ""; //组织机构
  694. string merPorSql = "";
  695. string strSaleOrg = "'" + UserInfo.SaleOrg + "'"; //组织(销售、国贸、钢贸)
  696. bool validFlag = chkValid.Checked;
  697. if (!ultxtBaseName.Text.Trim().Equals(""))
  698. {
  699. customerName += " AND Upper(CUSTOMER_NM) like'%' || Upper('" + ultxtBaseName.Text.Trim() + "')||'%'";
  700. }
  701. if (!validFlag)
  702. {
  703. customerName += " AND validflag = '1' ";
  704. merPorSql = " AND validflag = '1' ";
  705. }
  706. //销售与钢贸数据共享
  707. if (UserInfo.SaleOrg == "100101" || UserInfo.SaleOrg == "100103")
  708. strSaleOrg = "'100101','100103'";
  709. DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustmright",
  710. new Object[] { strSaleOrg, customerName, merPorSql }, this.ob);
  711. slmBaseCartransport.Clear();
  712. slmBaseReceivunit.Clear();
  713. slmBaseOrderUnit.Clear();
  714. slmBaseCustomer.Clear();
  715. GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCustomer, true);
  716. string strValidFlag = validFlag ? "0" : "1";
  717. dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.getBaseReceiveUnit",
  718. new Object[] { ultxtBaseName.Text.Trim(), strValidFlag, strSaleOrg}, this.ob);
  719. GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
  720. dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.getBaseOrderUnit",
  721. new Object[] { ultxtBaseName.Text.Trim(), strValidFlag, strSaleOrg}, this.ob);
  722. GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
  723. dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll",
  724. new Object[] { }, this.ob);
  725. GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
  726. foreach (UltraGridRow row in ultraBaseGrid.Rows)
  727. {
  728. row.Cells["BTN_ORDER"].Value = "维护";
  729. row.Cells["BTN_RECEIVE"].Value = "维护";
  730. if (row.Cells["CUSTOMER_NO"].Value.Equals(expanlixName))
  731. {
  732. row.Activate();
  733. row.ExpandAll();
  734. }
  735. if (row.Cells["CUSTOMER_NM"].Value.Equals(expanlixName))
  736. {
  737. row.Activate();
  738. row.ExpandAll();
  739. }
  740. }
  741. this.ultraBaseGrid.UpdateData();
  742. ////内容自适应
  743. //GridHelper.RefreshAndAutoSizeExceptRows(ultraBaseGrid, new UltraGridColumn[] {
  744. //});
  745. }
  746. private void ultraBaseGrid_AfterRowActivate(object sender, EventArgs e)
  747. {
  748. Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultraBaseGrid.DisplayLayout.ActiveRow;
  749. if (row.IsFilterRow) return;
  750. if (row != null && row.Band.Key.Equals("slmBaseCustomer"))
  751. {
  752. this.stacustomerNo = row.Cells["CUSTOMER_NO"].Value == null ? "" : row.Cells["CUSTOMER_NO"].Value.ToString();
  753. this.textEditorBaseName.Text = row.Cells["CUSTOMER_NM"].Value == null ? "" : row.Cells["CUSTOMER_NM"].Value.ToString();
  754. this.textAbrviTion.Text = row.Cells["ABRVITION"].Value == null ? "" : row.Cells["ABRVITION"].Value.ToString();
  755. this.textEditorORG.Text = row.Cells["ORG"].Value == null ? "" : row.Cells["ORG"].Value.ToString();
  756. this.bigarea = row.Cells["BIGAREA"].Value == null ? "" : row.Cells["BIGAREA"].Value.ToString();
  757. this.textEditorABC.Text = row.Cells["PY"].Value == null ? "" : row.Cells["PY"].Value.ToString();
  758. this.comBoStation.Text = row.Cells["MARKET_SYS"].Value == null ? "" : row.Cells["MARKET_SYS"].Value.ToString();
  759. this.comboRegIon.Text = this.bigarea;
  760. this.ultraTextUserGrp.Text = row.Cells["USER_GRP"].Value == null ? "" : row.Cells["USER_GRP"].Value.ToString();
  761. treeSelect(row.Cells["REGION_NO"].Value == null ? "" : row.Cells["REGION_NO"].Value.ToString());
  762. }
  763. //bool validFlag = chkValid.Checked;
  764. //string merPorSql = "";
  765. //if (!validFlag)
  766. //{
  767. // merPorSql = " AND validflag = '1' ";
  768. //}
  769. //UltraGridRow atvRow = ultraBaseGrid.ActiveRow;
  770. //if (atvRow != null && atvRow.Band.AddButtonCaption.ToString().Equals("slmBaseCustomer"))
  771. //{
  772. // string customerNo = atvRow.Cells["CUSTOMER_NO"].Value.ToString();
  773. // string custmuse = "''";
  774. // if (atvRow.Cells["DINGJIE"].Value.ToString().Equals("true"))
  775. // {
  776. // custmuse += ", '" + "100202" + "'";
  777. // }
  778. // if (atvRow.Cells["SH"].Value.ToString().Equals("true"))
  779. // {
  780. // custmuse += ", '" + "100203" + "'";
  781. // }
  782. // if (custmuse != "")
  783. // {
  784. // DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceiv", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
  785. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
  786. // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryUnit", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
  787. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
  788. // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll", new Object[] { }, this.ob);
  789. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
  790. // }
  791. //}
  792. }
  793. //展开下拉列表树节点
  794. public void treeSelect(string Name)
  795. {
  796. if (!string.IsNullOrEmpty(Name))
  797. {
  798. for (int e = 0; e < this.ComBelongsCity.Nodes.Count; e++)
  799. {
  800. ComBelongsCity.Nodes[e].Collapse();
  801. combelonCity = "";
  802. //展开一级节点 LX 修改
  803. if (this.ComBelongsCity.Nodes[e].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Tag.Equals(Name))
  804. {
  805. this.ComBelongsCity.Nodes[e].Expand();
  806. this.ComBelongsCity.Nodes[e].ExpandAll();
  807. ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Text.ToString();
  808. combelonCity = this.ComBelongsCity.Nodes[e].Tag.ToString();
  809. combleTo = this.ComBelongsCity.Nodes[e].ToolTipText;
  810. return;
  811. }
  812. //展开二级节点
  813. for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
  814. {
  815. if (this.ComBelongsCity.Nodes[e].Nodes[w].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Nodes[w].Tag.Equals(Name))
  816. {
  817. this.ComBelongsCity.Nodes[e].Expand();
  818. this.ComBelongsCity.Nodes[e].Nodes[w].ExpandAll();
  819. ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Text.ToString();
  820. combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Tag.ToString();
  821. combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].ToolTipText;
  822. return;
  823. }
  824. }
  825. //展开三级子节点
  826. for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
  827. {
  828. for (int r = 0; r < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes.Count; r++)
  829. {
  830. if (this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Tag.Equals(Name))
  831. {
  832. this.ComBelongsCity.Nodes[e].Expand();
  833. this.ComBelongsCity.Nodes[e].Nodes[w].Expand();
  834. this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].ExpandAll();
  835. ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Text.ToString();
  836. combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Tag.ToString();
  837. combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].ToolTipText;
  838. return;
  839. }
  840. }
  841. }
  842. //展开四级子节点
  843. for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
  844. {
  845. for (int r = 0; r < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes.Count; r++)
  846. {
  847. for (int x = 0; x < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes.Count; x++)
  848. {
  849. if (this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Tag.Equals(Name))
  850. {
  851. this.ComBelongsCity.Nodes[e].Expand();
  852. this.ComBelongsCity.Nodes[e].Nodes[w].Expand();
  853. this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Expand();
  854. this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].ExpandAll();
  855. ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Text.ToString();
  856. combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Tag.ToString();
  857. combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].ToolTipText;
  858. return;
  859. }
  860. }
  861. }
  862. }
  863. }
  864. }
  865. }
  866. /**
  867. *1.勾选订货或者收货单位如果为true,判断是否存在:存在修改有效标记1,不存在弹窗新增一条。
  868. *2.勾选订货或者收货单位如果为False,修改有效标记0;
  869. */
  870. private void ultraBaseGrid_CellChange(object sender, CellEventArgs e)
  871. {
  872. if (e.Cell.Row.Index == -1)
  873. {
  874. return;
  875. }
  876. listExpanl.Clear();
  877. Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultraBaseGrid.DisplayLayout.ActiveRow;
  878. expanlixName = row.Cells["CUSTOMER_NO"].Text;
  879. customerID = row.Cells["CUSTOMER_NO"].Text;
  880. int count = 0;
  881. if (e.Cell.Column.Key.Equals("VALIDFLAG"))
  882. {
  883. //用于修改增加后展开
  884. listExpanl.Add(e.Cell.Row.Index);
  885. if (row.Cells["VALIDFLAG"].Text.Equals("True"))
  886. {
  887. ArrayList parm = new ArrayList();
  888. parm.Add("1");
  889. parm.Add(stacustomerNo);
  890. CoreClientParam ccp = new CoreClientParam();
  891. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  892. ccp.MethodName = "GetUpdateCustomerALLS";
  893. ccp.ServerParams = new object[] { parm };
  894. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  895. parm = new ArrayList();
  896. parm.Add("1");
  897. parm.Add(stacustomerNo);
  898. parm.Add(saleorg);
  899. ccp = new CoreClientParam();
  900. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  901. ccp.MethodName = "GetUpdateRightALL";
  902. ccp.ServerParams = new object[] { parm };
  903. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  904. ccp = new CoreClientParam();
  905. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  906. ccp.MethodName = "GetUpdateUseALL";
  907. ccp.ServerParams = new object[] { parm };
  908. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  909. ccp = new CoreClientParam();
  910. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  911. ccp.MethodName = "GetUpdateReceivUnitALL";
  912. ccp.ServerParams = new object[] { parm };
  913. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  914. ccp = new CoreClientParam();
  915. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  916. ccp.MethodName = "GetUpdateOrderUnitALL";
  917. ccp.ServerParams = new object[] { parm };
  918. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  919. parm = new ArrayList();
  920. parm.Add("1");
  921. parm.Add(stacustomerNo);
  922. ccp = new CoreClientParam();
  923. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  924. ccp.MethodName = "GetUpdateFreightALL";
  925. ccp.ServerParams = new object[] { parm };
  926. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  927. }
  928. else
  929. {
  930. ArrayList parm = new ArrayList();
  931. parm.Add("0");
  932. parm.Add(stacustomerNo);
  933. CoreClientParam ccp = new CoreClientParam();
  934. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  935. ccp.MethodName = "GetUpdateCustomerALLS";
  936. ccp.ServerParams = new object[] { parm };
  937. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  938. parm = new ArrayList();
  939. parm.Add("0");
  940. parm.Add(stacustomerNo);
  941. parm.Add(saleorg);
  942. ccp = new CoreClientParam();
  943. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  944. ccp.MethodName = "GetUpdateRightALL";
  945. ccp.ServerParams = new object[] { parm };
  946. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  947. ccp = new CoreClientParam();
  948. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  949. ccp.MethodName = "GetUpdateUseALL";
  950. ccp.ServerParams = new object[] { parm };
  951. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  952. ccp = new CoreClientParam();
  953. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  954. ccp.MethodName = "GetUpdateReceivUnitALL";
  955. ccp.ServerParams = new object[] { parm };
  956. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  957. ccp = new CoreClientParam();
  958. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  959. ccp.MethodName = "GetUpdateOrderUnitALL";
  960. ccp.ServerParams = new object[] { parm };
  961. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  962. parm = new ArrayList();
  963. parm.Add("0");
  964. parm.Add(stacustomerNo);
  965. ccp = new CoreClientParam();
  966. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  967. ccp.MethodName = "GetUpdateFreightALL";
  968. ccp.ServerParams = new object[] { parm };
  969. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  970. }
  971. }
  972. if (e.Cell.Column.Key.Equals("DINGJIE"))
  973. { //用于修改增加后展开
  974. listExpanl.Add(e.Cell.Row.Index);
  975. if (row.Cells["DINGJIE"].Text.Equals("True"))
  976. {
  977. count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryOrderUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
  978. if(count == 0)
  979. {
  980. MessageUtil.ShowWarning("请先维护订/结单位!");
  981. row.Cells["DINGJIE"].Value = false;
  982. return;
  983. }
  984. ArrayList parm = new ArrayList();
  985. parm.Add("1");
  986. parm.Add(stacustomerNo);
  987. parm.Add(saleorg);
  988. parm.Add("100202");
  989. CoreClientParam ccp = new CoreClientParam();
  990. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  991. ccp.MethodName = "GetUpdateOrderUnit";
  992. ccp.ServerParams = new object[] { parm };
  993. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  994. ccp = new CoreClientParam();
  995. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  996. ccp.MethodName = "GetUpdateUse";
  997. ccp.ServerParams = new object[] { parm };
  998. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  999. }
  1000. else if (row.Cells["DINGJIE"].Text.Equals("False"))
  1001. {
  1002. count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryOrderUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
  1003. if (count > 0)
  1004. {
  1005. if (MessageUtil.ShowQuestion("是否删除订/结客户信息,删除之后该客户信息失效,相关合同生成无法调用该客户信息!").ToString().ToLower().Equals("yes"))
  1006. {
  1007. ArrayList parm = new ArrayList();
  1008. parm.Add("0");
  1009. parm.Add(stacustomerNo);
  1010. parm.Add(saleorg);
  1011. parm.Add("100202");
  1012. CoreClientParam ccp = new CoreClientParam();
  1013. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1014. ccp.MethodName = "GetUpdateOrderUnit";
  1015. ccp.ServerParams = new object[] { parm };
  1016. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1017. ccp = new CoreClientParam();
  1018. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1019. ccp.MethodName = "GetUpdateUse";
  1020. ccp.ServerParams = new object[] { parm };
  1021. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1022. }
  1023. }
  1024. }
  1025. doQuery();
  1026. }
  1027. if (e.Cell.Column.Key.Equals("SH"))
  1028. {
  1029. //用于修改增加后展开
  1030. listExpanl.Add(e.Cell.Row.Index);
  1031. if (row.Cells["SH"].Text.Equals("True"))
  1032. {
  1033. count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceivUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
  1034. if (count == 0)
  1035. {
  1036. MessageUtil.ShowWarning("请先维护收货单位!");
  1037. row.Cells["SH"].Value = false;
  1038. return;
  1039. }
  1040. ArrayList parm = new ArrayList();
  1041. parm.Add("1");
  1042. parm.Add(stacustomerNo);
  1043. parm.Add(saleorg);
  1044. parm.Add("100203");
  1045. CoreClientParam ccp = new CoreClientParam();
  1046. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1047. ccp.MethodName = "GetUpdateReceivUnit";
  1048. ccp.ServerParams = new object[] { parm };
  1049. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1050. ccp = new CoreClientParam();
  1051. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1052. ccp.MethodName = "GetUpdateUse";
  1053. ccp.ServerParams = new object[] { parm };
  1054. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1055. }
  1056. else if (row.Cells["SH"].Text.Equals("False"))
  1057. {
  1058. count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceivUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
  1059. if (count > 0)
  1060. {
  1061. if (MessageUtil.ShowQuestion("是否删除收货客户信息,删除之后该客户信息失效,相关合同生成无法调用该客户信息!").ToString().ToLower().Equals("yes"))
  1062. {
  1063. ArrayList parm = new ArrayList();
  1064. parm.Add("0");
  1065. parm.Add(stacustomerNo);
  1066. parm.Add(saleorg);
  1067. parm.Add("100203");
  1068. CoreClientParam ccp = new CoreClientParam();
  1069. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1070. ccp.MethodName = "GetUpdateReceivUnit";
  1071. ccp.ServerParams = new object[] { parm };
  1072. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1073. ccp = new CoreClientParam();
  1074. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1075. ccp.MethodName = "GetUpdateUse";
  1076. ccp.ServerParams = new object[] { parm };
  1077. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1078. }
  1079. }
  1080. }
  1081. }
  1082. string keyName = e.Cell.Column.Key.ToUpper().Trim();
  1083. //if (keyName.Equals("UNBOUNDUP"))
  1084. //{
  1085. // treeSelect(e.Cell.Row.Cells["REGION_NO"].Value == null ? " " : e.Cell.Row.Cells["REGION_NO"].Value.ToString());
  1086. // //用于修改增加后展开
  1087. // listExpanl.Add(e.Cell.Row.ParentRow.Index);
  1088. // FrmBuyerSend frmSend = new FrmBuyerSend(this.ob);
  1089. // frmSend.Customer_no = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
  1090. // frmSend.Sale_org = saleorg;
  1091. // frmSend.Custm_use = "100203";
  1092. // frmSend.Region_no = combelonCity;
  1093. // frmSend.StrOperator = strOperator;
  1094. // frmSend.ShowDialog();
  1095. //}
  1096. //if (keyName.Equals("UNITUP"))
  1097. //{
  1098. // treeSelect(e.Cell.Row.Cells["REGION_NO"].Value == null ? " " : e.Cell.Row.Cells["REGION_NO"].Value.ToString());
  1099. // //用于修改增加后展开
  1100. // listExpanl.Add(e.Cell.Row.ParentRow.Index);
  1101. // FrmBuyerOrder frmorder = new FrmBuyerOrder(this.ob);
  1102. // frmorder.Customer_no = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
  1103. // frmorder.Sale_org = saleorg;
  1104. // frmorder.Custm_use = "100202";
  1105. // frmorder.Chn_fl = combleTo == "1001" ? "1" : "0";
  1106. // frmorder.Bigarea = e.Cell.Row.Cells["BIGAREA"].Value.ToString(); ;
  1107. // frmorder.Region_no = combelonCity;
  1108. // frmorder.StrOperator = strOperator;
  1109. // frmorder.ShowDialog();
  1110. //}
  1111. if (keyName.Equals("USERBOS"))
  1112. {
  1113. ArrayList parm = new ArrayList();
  1114. CoreClientParam ccp = new CoreClientParam();
  1115. expanlixName = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
  1116. if (row.Cells["USERBOS"].Text.Equals("True"))
  1117. {
  1118. int countsig = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustm_Use",
  1119. new Object[] { e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString(), "100204", saleorg }, this.ob).Rows.Count;
  1120. if (countsig == 0)
  1121. {
  1122. parm = new ArrayList();
  1123. parm.Add(e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString()); //客户编码
  1124. parm.Add(saleorg);
  1125. parm.Add("100204");
  1126. parm.Add(strOperator);
  1127. ccp = new CoreClientParam();
  1128. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1129. ccp.MethodName = "GetInsertCustmUse";
  1130. ccp.ServerParams = new object[] { parm };
  1131. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1132. }
  1133. }
  1134. else
  1135. {
  1136. parm = new ArrayList();
  1137. parm.Add(e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString()); //客户编码
  1138. parm.Add("100204");
  1139. ccp = new CoreClientParam();
  1140. ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
  1141. ccp.MethodName = "SetDeleteUseALL";
  1142. ccp.ServerParams = new object[] { parm };
  1143. ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  1144. }
  1145. }
  1146. doQuery();
  1147. ultraBaseGrid.UpdateData();
  1148. }
  1149. private void ComBelongsCity_DropDownClosed(object sender, EventArgs e)
  1150. {
  1151. this.comboRegIon.Value = this.ComBelongsCity.SelectedNode.StateImageKey;
  1152. }
  1153. private void ultraBaseGrid_BeforeRowExpanded(object sender, CancelableRowEventArgs e)
  1154. {
  1155. //if (e.Row.IsFilterRow) return;
  1156. //bool validFlag = chkValid.Checked;
  1157. //string merPorSql = "";
  1158. //if (!validFlag)
  1159. //{
  1160. // merPorSql = " AND validflag = '1' ";
  1161. //}
  1162. //if (e.Row != null && e.Row.Band.AddButtonCaption.ToString().Equals("slmBaseCustomer"))
  1163. //{
  1164. // string customerNo = e.Row.Cells["CUSTOMER_NO"].Value.ToString();
  1165. // string custmuse = "''";
  1166. // if (e.Row.Cells["DINGJIE"].Value.ToString().Equals("true"))
  1167. // {
  1168. // custmuse += ", '" + "100202" + "'";
  1169. // }
  1170. // if (e.Row.Cells["SH"].Value.ToString().Equals("true"))
  1171. // {
  1172. // custmuse += ", '" + "100203" + "'";
  1173. // }
  1174. // if (custmuse != "")
  1175. // {
  1176. // DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceiv", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
  1177. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
  1178. // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryUnit", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
  1179. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
  1180. // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll", new Object[] { }, this.ob);
  1181. // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
  1182. // }
  1183. //}
  1184. }
  1185. private void textEditorBaseName_ValueChanged(object sender, EventArgs e)
  1186. {
  1187. //ChineseWord
  1188. textEditorABC.Text = ChineseWord.GetChineseSpell(textEditorBaseName.Text.Trim());
  1189. }
  1190. private void ultraBaseGrid_ClickCellButton(object sender, CellEventArgs e)
  1191. {
  1192. customerID = e.Cell.Row.Cells["CUSTOMER_NO"].Text;
  1193. if (e.Cell.Column.Key == "BTN_ORDER")
  1194. {
  1195. FrmBuyerOrder frmorder = new FrmBuyerOrder(this.ob);
  1196. frmorder.Customer_no = customerID;
  1197. frmorder.Sale_org = saleorg;
  1198. frmorder.Custm_use = "100202";
  1199. frmorder.Chn_fl = combleTo == "101" ? "1" : "0";
  1200. frmorder.Bigarea = bigarea;
  1201. frmorder.Region_no = combelonCity == "" ? "8" : combelonCity; ;
  1202. frmorder.StrOperator = strOperator;
  1203. frmorder.ShowDialog();
  1204. }
  1205. else if (e.Cell.Column.Key == "BTN_RECEIVE")
  1206. {
  1207. FrmBuyerSend frmSend = new FrmBuyerSend(this.ob);
  1208. frmSend.Customer_no = customerID;
  1209. frmSend.Sale_org = saleorg;
  1210. frmSend.Custm_use = "100203";
  1211. frmSend.Region_no = combelonCity == "" ? "8" : combelonCity;
  1212. frmSend.StrOperator = strOperator;
  1213. frmSend.ShowDialog();
  1214. }
  1215. //CUSTOMER_NM
  1216. expanlixName = e.Cell.Row.Cells["CUSTOMER_NM"].Text;
  1217. doQuery();
  1218. }
  1219. private void textEditorBaseName_Validating(object sender, CancelEventArgs e)
  1220. {
  1221. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textEditorBaseName.Text) > 100)
  1222. {
  1223. MessageBox.Show("录入客户名称【中文名不能大于50个字符/英文名不能大于100个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1224. e.Cancel = true;
  1225. }
  1226. }
  1227. private void textAbrviTion_Validating(object sender, CancelEventArgs e)
  1228. {
  1229. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textAbrviTion.Text) > 60)
  1230. {
  1231. MessageBox.Show("录入客户简称【中文名不能大于30个字符/英文名不能大于60个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1232. e.Cancel = true;
  1233. }
  1234. }
  1235. private void ultraTextUserGrp_Validating(object sender, CancelEventArgs e)
  1236. {
  1237. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(ultraTextUserGrp.Text) > 40)
  1238. {
  1239. MessageBox.Show("录入用户组【中文名不能大于20个字符/英文名不能大于40个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1240. e.Cancel = true;
  1241. }
  1242. }
  1243. private void textEditorORG_Validating(object sender, CancelEventArgs e)
  1244. {
  1245. if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textEditorORG.Text) > 60)
  1246. {
  1247. MessageBox.Show("录入机构代码【中文名不能大于30个字符/英文名不能大于60个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
  1248. e.Cancel = true;
  1249. }
  1250. }
  1251. }
  1252. }