| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using CoreFS.CA06;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Tool;
- using System.Collections;
- namespace Core.StlMes.Client.SaleBase
- {
- public partial class FrmBuyerBase : FrmBase
- {
- string strShift = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserOrder();
- string strOperator = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName();
- string saleorg = "";//部门
- string combelText = "";//省市区域名称
- string combelonCity = "";//省市区域代码
- string combleTo = "";//州或国
- string stacustomerNo = "";//全局客户编码
- string bigarea = "";//行政片区
- string customerID = "";
- string expanlixName = "";//客户名称
- //用于展开操作项
- ArrayList listExpanl = new ArrayList();
- protected override void OnLoad(EventArgs e)
- {
- try
- {
- base.OnLoad(e);
- ultraBaseGrid.DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;
- ultraBaseGrid.DisplayLayout.Override.FilterOperatorDefaultValue = Infragistics.Win.UltraWinGrid.FilterOperatorDefaultValue.Contains;
- for (int i = 0; i < ultraBaseGrid.DisplayLayout.Bands.Count; i++)
- {
- if (i > 0)
- {
- ultraBaseGrid.DisplayLayout.Bands[i].Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.HeaderIcons;
- }
- }
- }
- catch (System.Exception ex)
- { }
- }
- public FrmBuyerBase()
- {
- InitializeComponent();
- ExceptionHelper.RegistException();
- this.ComBelongsCity.AfterExpand += new TreeViewEventHandler(ComBelongsCity_AfterExpand);
- this.ComBelongsCity.AfterCollapse += new TreeViewEventHandler(ComBelongsCity_AfterCollapse);
- }
- void ComBelongsCity_AfterCollapse(object sender, TreeViewEventArgs e)
- {
- if (e.Node.ImageIndex == 1)
- e.Node.ImageIndex = e.Node.SelectedImageIndex = 0;
- }
- void ComBelongsCity_AfterExpand(object sender, TreeViewEventArgs e)
- {
- if (e.Node.ImageIndex == 0)
- e.Node.ImageIndex = e.Node.SelectedImageIndex = 1;
- }
- private void FrmBuyerBase_Load(object sender, EventArgs e)
- {
- this.doLoadSource();
- }
- private void doLoadSource()
- {
- //市场系统
- DataTable isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1006" }, this.ob);
- comBoStation.DataSource = isx;
- comBoStation.DisplayMember = "BASENAME";
- comBoStation.ValueMember = "BASECODE";
- ClsBaseInfo.SetComboItemHeight(comBoStation);
- //区域
- isx = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryBaseInfo", new Object[] { "1007" }, this.ob);
- comboRegIon.DataSource = isx;
- comboRegIon.DisplayMember = "BASENAME";
- comboRegIon.ValueMember = "BASECODE";
- ClsBaseInfo.SetComboItemHeight(comboRegIon);
- doGetSaleOrg();
- QueryTree();
- }
- //刷新Tree
- public void QueryTree()
- {
- this.ComBelongsCity.Nodes.Clear();
- DataTable dt = new DataTable();
- dt = ServerHelper.GetData("com.steering.pss.sale.base.CoreStation.GetTivCode", new Object[] { }, this.ob);
- //树控件递归绑定方法。
- Bind_Tv(dt, ComBelongsCity.Nodes, null, "REGION_NO", "P_REGION_NO", "REGION_NM");
- }
- private void Bind_Tv(DataTable dt, TreeNodeCollection tnc, string pid_val, string id, string pid, string text)
- {
- DataView dv = new DataView(dt);//将DataTable存到DataView中,以便于筛选数据
- TreeNode tn;//建立TreeView的节点(TreeNode),以便将取出的数据添加到节点中
- //以下为三元运算符,如果父id为空,则为构建“父id字段 is null”的查询条件,否则构建“父id字段=父id字段值”的查询条件
- string filter = string.IsNullOrEmpty(pid_val) ? pid + " is null" : string.Format(pid + "='{0}'", pid_val);
- dv.RowFilter = filter;//利用DataView将数据进行筛选,选出相同 父id值 的数据
- foreach (DataRowView drv in dv)
- {
- tn = new TreeNode();//建立一个新节点(学名叫:一个实例)
- tn.Tag = drv[id].ToString();//节点的Value值,一般为数据库的id值
- tn.Text = drv[text].ToString();//节点的Text,节点的文本显示
- tn.Name = drv["REGION_LVL_NO"].ToString();//区域属性代码
- tn.ImageKey = drv["REGION_LVL_NM"].ToString();
- tn.StateImageKey = drv["BIGAREA"].ToString();
- if (!string.IsNullOrEmpty(drv["P_REGION_NO"].ToString()))
- {
- tn.ToolTipText = drv["P_REGION_NO"].ToString();
- }
- else
- {
- tn.ImageIndex = 0;
- }
- tnc.Add(tn);//将该节点加入到TreeNodeCollection(节点集合)中
- Bind_Tv(dt, tn.Nodes, tn.Tag.ToString(), id, pid, text);//递归(反复调用这个方法,直到把数据取完为止)
- }
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- //if (UserInfo.SaleOrg.Equals("NONE"))
- //{
- // MessageBox.Show("未授权,不允许查看!");
- // return;
- //}
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doAdd":
- if (MessageUtil.ShowQuestion("是否新增数据?").ToString().ToLower().Equals("yes"))
- {
- try
- {
- string dosave = doSave();
- if (dosave.Equals("true"))
- {
- MessageUtil.ShowTips("添加成功!");
- doQuery();
- }
- else if (dosave.Equals("BugCustomer"))
- {
- MessageUtil.ShowTips("数据插入客户编码表失败!"); return;
- }
- else if (dosave.Equals("doInsertCustmRight"))
- {
- MessageUtil.ShowTips("数据插入客户授权表失败!"); return;
- }
- else if (dosave.Equals("BugCustmUseRight"))
- {
- MessageUtil.ShowTips("数据插入客户用途类型表失败!"); return;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- return;
- }
- }
- break;
- case "doDelete":
- if (ultraBaseGrid.ActiveRow == null)
- {
- MessageBox.Show("请选择要作废的客户信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- if (MessageUtil.ShowQuestion("是否确认作废【" + ultraBaseGrid.ActiveRow.Cells["CUSTOMER_NM"].Value.ToString() + "】客户数据?").ToString().ToLower().Equals("yes"))
- {
- if (doDelete("0"))
- {
- MessageUtil.ShowTips("作废成功!");
- doQuery();
- }
- else
- {
- MessageUtil.ShowTips("作废失败!");
- }
- }
- break;
- case "doCancel":
- if (ultraBaseGrid.ActiveRow == null)
- {
- MessageBox.Show("请选择要取消作废的客户信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- if (MessageUtil.ShowQuestion("是否确认取消作废的【" + ultraBaseGrid.ActiveRow.Cells["CUSTOMER_NM"].Value.ToString() + "】客户数据?").ToString().ToLower().Equals("yes"))
- {
- if (doDelete("1"))
- {
- MessageUtil.ShowTips("取消作废成功!");
- doQuery();
- }
- else
- {
- MessageUtil.ShowTips("取消作废失败!");
- }
- }
- break;
- case "doUpdate":
- string doUp = doUpdate();
- if (doUp.Equals("true"))
- {
- MessageUtil.ShowTips("修改成功!");
- doQuery();
- }
- else if (doUp.Equals("BugCustomer"))
- {
- MessageUtil.ShowTips("修改失败!");
- }
- break;
- case "doLoad":
- this.doLoadSource();
- break;
- case "OutExcel":
-
- OutExcel();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void OutExcel()
- {
- ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_ORDER"].Hidden = true;
- ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_RECEIVE"].Hidden = true;
- GridHelper.ulGridToExcel(ultraBaseGrid, "客户基础信息");
- ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_ORDER"].Hidden = false;
- ultraBaseGrid.DisplayLayout.Bands[0].Columns["BTN_RECEIVE"].Hidden = false;
- //string customerName = "";
- //string validFlag = "";
- //string strSaleOrg = "";
- ////销售与钢贸数据共享
- //if (UserInfo.SaleOrg == "100101" || UserInfo.SaleOrg == "100103")
- // strSaleOrg = "100101','100103";
- //else if (UserInfo.SaleOrg == "100102")
- // strSaleOrg = "100102";
- //else
- // strSaleOrg = "NONE";
- //customerName = ultxtBaseName.Text.Trim();
- //if (chkValid.Checked)
- // validFlag = "0','1";
- //else
- // validFlag = "1";
- //FrmOutExcel fBug = new FrmOutExcel(ob, customerName, validFlag, strSaleOrg);
- //fBug.AutoSize = true;
- //fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- //fBug.WindowState = FormWindowState.Maximized;
- //fBug.Show();
- }
- private bool doDelete(string strValidFlag)
- {
- ArrayList parm = new ArrayList();
- parm.Add(strValidFlag);
- parm.Add(strOperator);
- parm.Add(stacustomerNo);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateCustomerALLS";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add(strValidFlag);
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateRightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUseALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateReceivUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateOrderUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add(strValidFlag);
- parm.Add(stacustomerNo);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateFreightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- return false;
- }
- return true;
- }
- private string doUpdate()
- {
- string returnBug = ""; //记录bug信息
- string customerName = textEditorBaseName.Text;//客户名称
- string abrvition = textAbrviTion.Text;//客户简称
- string org = textEditorORG.Text;//组织机构
- string combelname = ComBelongsCity.Text;//省市区域名称
- treeSelect(combelname);
- string combelon = combelonCity;//省市区域代码
- string comble = combleTo;//州或国
- string py = this.textEditorABC.Text;//拼音
- if(UserInfo.SaleOrg == "")
- if (combelonCity.Equals(""))
- {
- MessageUtil.ShowTips("请选择‘洲’以下区域新增客户信息,找不到对应地区请维护!");
- return returnBug;
- }
- if (stacustomerNo.Equals(""))
- {
- MessageUtil.ShowTips("请选中一条客户编码进行修改!");
- return returnBug;
- }
- if (customerName.Trim().Equals(""))
- {
- MessageUtil.ShowTips("客户名称不允许为空!");
- return returnBug;
- }
- if (abrvition.Trim().Equals(""))
- {
- MessageUtil.ShowTips("客户简称不允许为空!");
- return returnBug;
- }
- //if (org.Trim().Equals(""))
- //{
- // MessageUtil.ShowTips("组织机构不允许为空!");
- // return returnBug;
- //}
- if (combelname.Trim().Equals(""))
- {
- MessageUtil.ShowTips("省市/区域不允许为空!");
- return returnBug;
- }
- if (comBoStation.Text.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请选择[市场系统]!");
- return returnBug;
- }
- else if (comBoStation.IsItemInList(comBoStation.Text.Trim()) == false)
- {
- MessageUtil.ShowTips("输入的[市场系统]不在,请选择[市场系统]!");
- comBoStation.Focus();
- return returnBug;
- }
- if (ultraBaseGrid.ActiveRow != null)
- {
-
- UltraGridRow row = ultraBaseGrid.ActiveRow;
- while (row.HasParent())
- {
- row = row.ParentRow;
- }
- if (!row.Cells["CUSTOMER_NM"].Value.Equals(customerName))
- {
- DataTable customerTable = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob);
- if (customerTable.Rows.Count > 0)
- {
- MessageUtil.ShowTips(customerName + ",客户名称已存在!");
- return returnBug;
- }
- }
- if (!row.Cells["ABRVITION"].Value.Equals(abrvition))
- {
- int customerCount = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryAbrviTion", new Object[] { abrvition }, this.ob).Rows.Count;
- if (customerCount > 0)
- {
- MessageUtil.ShowTips(abrvition + ",简称已存在!");
- return returnBug;
- }
- }
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No) return "";
-
- expanlixName = customerName;
- ArrayList parm = new ArrayList();
- parm.Add(customerName);
- parm.Add(comboRegIon.Value);
- parm.Add(combelon);
- parm.Add(abrvition);
- parm.Add(org);
- parm.Add(strOperator);
- parm.Add(py);
- parm.Add(comBoStation.Text); // LX 修改 comBoStation.Value
- parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);
- parm.Add(strOperator);
- parm.Add(stacustomerNo);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateCustomer";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- returnBug = "BugCustomer";
- return returnBug;
- }
- else
- {
- returnBug = "true";
- }
- return returnBug;
- }
- /// <summary>
- /// 根据登录账户,判断所属部门。
- /// </summary>
- private void doGetSaleOrg()
- {
- UserInfo.SaleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
- saleorg = UserInfo.SaleOrg;
- }
- private string doSave()
- {
- string returnBug = ""; //记录bug信息
- string customerName = textEditorBaseName.Text;//客户名称
- string abrvition = textAbrviTion.Text;//客户简称
- string org = textEditorORG.Text;//组织机构
- treeSelect(ComBelongsCity.Text);//加载省市
-
- string combelname = ComBelongsCity.Text;//省市区域名称
- treeSelect(combelname);
- string combelon = combelonCity;//省市区域代码
- string comble = combleTo;//州或国
- string zjabc = textEditorABC.Text;//拼音助记
- string customerNo = "";
- if (combelonCity.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请选择[区域/省市]中省市不允许选择洲,请正确填写省市!");
- return returnBug;
- }
- if (customerName.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请输入[客户名称]!");
- return returnBug;
- }
- if (abrvition.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请输入[客户简称]!");
- return returnBug;
- }
- //if (org.Trim().Equals(""))
- //{
- // MessageUtil.ShowTips("组织机构不允许为空!");
- // return returnBug;
- //}
- if (combelname.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请选择[省市/区域]!");
- return returnBug;
- }
- //if (zjabc.Trim().Equals(""))
- //{
- // MessageUtil.ShowTips("拼音助记不允许为空!");
- // return returnBug;
- //}
- //if (comboRegIon.Text.Trim().Equals(""))
- //{
- // MessageUtil.ShowTips("区域不允许为空!");
- // return returnBug;
- //}
- if (comBoStation.Text.Trim().Equals(""))
- {
- MessageUtil.ShowTips("请选择[市场系统]!");
- return returnBug;
- }
- else if (comBoStation.IsItemInList(comBoStation.Text.Trim()) == false)
- {
- MessageUtil.ShowTips("输入的[市场系统]不在,请选择[市场系统]!");
- comBoStation.Focus();
- return returnBug;
- }
- ArrayList parm = new ArrayList();
- CoreClientParam ccp = new CoreClientParam();
- //判断客户名称已存在而且无效 Update除了客户名称和简称以外的数据。
- DataTable customerCTME = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCTMR", new Object[] { customerName }, this.ob);
- if (customerCTME.Rows.Count > 0)
- {
- parm = new ArrayList();
- parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);//用户组
- parm.Add(comboRegIon.Value);//行政片区
- parm.Add(combelon);//省市/区域
- parm.Add(abrvition);//简称
- parm.Add(org);//机构代码
- parm.Add(strOperator);//创建人
- parm.Add(zjabc);//拼音助记
- parm.Add(comBoStation.Text);//市场系统(1006) LX 修改 comBoStation.Value
- parm.Add("1");//有效标志(1:有效,0:无效)
- parm.Add(customerCTME.Rows[0][0].ToString());//客户代码
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateDeleteCTMR";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowTips("还原新增失败!");
- return returnBug;
- }
- else
- {
- returnBug = "true";
- parm = new ArrayList();
- parm.Add(customerCTME.Rows[0][0].ToString()); //客户编码
- parm.Add("100204");
- parm.Add(saleorg);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "SetUpCustm_Use";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- return returnBug;
- }
- }
- DataTable customerTable = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob);
-
- if (customerTable.Rows.Count > 0)
- {
- customerNo = customerTable.Rows[0][0].ToString();
- int countRight = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetCustmRight", new Object[] { customerNo, saleorg }, this.ob).Rows.Count;
- if (countRight > 0)
- {
- MessageUtil.ShowTips(customerName + ",客户名称已存在!");
- return returnBug;
- }
- else
- {
- try
- {
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add("");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmRight";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
-
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- return returnBug;
- }
- }
- int countRights = ServerHelper.GetData("com.steering.pss.sale.order.CoreOrderManager.GetCustmUse", new Object[] { customerNo, saleorg }, this.ob).Rows.Count;
- if (countRights > 0)
- {
- MessageUtil.ShowTips(customerName + ",客户名称已存在!");
- return returnBug;
- }
- else
- {
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add("100204");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add("100205");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- return "true";
- }
- int customerCount = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryAbrviTion", new Object[] { abrvition }, this.ob).Rows.Count;
- if (customerCount > 0)
- {
- MessageUtil.ShowTips(abrvition + ",简称已存在!");
- return returnBug;
- }
- //customer_nm, bigarea, region_no, abrvition, org, create_name
- expanlixName = customerName;
- parm = new ArrayList();
- parm.Add(combelon);
- parm.Add(combelon);
- parm.Add(combelon);
- parm.Add(combelon);
- parm.Add(combelon);
- parm.Add(customerName);
- parm.Add(comboRegIon.Value);
- parm.Add(combelon);
- parm.Add(abrvition);
- parm.Add(org);
- parm.Add(strOperator);
- parm.Add(zjabc);
- parm.Add(comBoStation.Text); //LX 修改 comBoStation.Value
- parm.Add(ultraTextUserGrp.Text == "" ? "N/A" : ultraTextUserGrp.Text);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustomer";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- returnBug = "BugCustomer";
- return returnBug;
- }
- else
- {
- returnBug = "Next";
- }
- if (returnBug.Equals("Next"))
- {
- customerNo = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustomer", new Object[] { customerName }, this.ob).Rows[0][0].ToString();
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add(" ");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmRight";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- returnBug = "BugCustmRight";
- return returnBug;
- }
- else
- {
- returnBug = "Next";
- }
- }
- //customer_no, sale_org, custm_use, create_name, create_time
- if (returnBug.Equals("Next"))
- {
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add("100205");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1)
- {
- returnBug = "BugCustmUseRight";
- return returnBug;
- }
- else
- {
- returnBug = "true";
- }
- }
- int countsig = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustm_Use", new Object[] { customerNo, "100204", saleorg }, this.ob).Rows.Count;
- if (countsig == 0)
- {
- parm = new ArrayList();
- parm.Add(customerNo); //客户编码
- parm.Add(saleorg);
- parm.Add("100204");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- return returnBug;
- }
- //查询
- public void doQuery()
- {
- string customerName = ""; //sql
- string customerNo = ""; //客户简称
- string custmuse = ""; //组织机构
- string merPorSql = "";
- string strSaleOrg = "'" + UserInfo.SaleOrg + "'"; //组织(销售、国贸、钢贸)
- bool validFlag = chkValid.Checked;
- if (!ultxtBaseName.Text.Trim().Equals(""))
- {
- customerName += " AND Upper(CUSTOMER_NM) like'%' || Upper('" + ultxtBaseName.Text.Trim() + "')||'%'";
- }
- if (!validFlag)
- {
- customerName += " AND validflag = '1' ";
- merPorSql = " AND validflag = '1' ";
- }
- //销售与钢贸数据共享
- if (UserInfo.SaleOrg == "100101" || UserInfo.SaleOrg == "100103")
- strSaleOrg = "'100101','100103'";
- DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustmright",
- new Object[] { strSaleOrg, customerName, merPorSql }, this.ob);
- slmBaseCartransport.Clear();
- slmBaseReceivunit.Clear();
- slmBaseOrderUnit.Clear();
- slmBaseCustomer.Clear();
- GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCustomer, true);
- string strValidFlag = validFlag ? "0" : "1";
- dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.getBaseReceiveUnit",
- new Object[] { ultxtBaseName.Text.Trim(), strValidFlag, strSaleOrg}, this.ob);
- GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
- dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.getBaseOrderUnit",
- new Object[] { ultxtBaseName.Text.Trim(), strValidFlag, strSaleOrg}, this.ob);
- GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
- dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll",
- new Object[] { }, this.ob);
- GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
-
- foreach (UltraGridRow row in ultraBaseGrid.Rows)
- {
- row.Cells["BTN_ORDER"].Value = "维护";
- row.Cells["BTN_RECEIVE"].Value = "维护";
- if (row.Cells["CUSTOMER_NO"].Value.Equals(expanlixName))
- {
- row.Activate();
- row.ExpandAll();
- }
- if (row.Cells["CUSTOMER_NM"].Value.Equals(expanlixName))
- {
- row.Activate();
- row.ExpandAll();
- }
- }
- this.ultraBaseGrid.UpdateData();
- ////内容自适应
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraBaseGrid, new UltraGridColumn[] {
- //});
- }
- private void ultraBaseGrid_AfterRowActivate(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultraBaseGrid.DisplayLayout.ActiveRow;
- if (row.IsFilterRow) return;
- if (row != null && row.Band.Key.Equals("slmBaseCustomer"))
- {
- this.stacustomerNo = row.Cells["CUSTOMER_NO"].Value == null ? "" : row.Cells["CUSTOMER_NO"].Value.ToString();
- this.textEditorBaseName.Text = row.Cells["CUSTOMER_NM"].Value == null ? "" : row.Cells["CUSTOMER_NM"].Value.ToString();
- this.textAbrviTion.Text = row.Cells["ABRVITION"].Value == null ? "" : row.Cells["ABRVITION"].Value.ToString();
- this.textEditorORG.Text = row.Cells["ORG"].Value == null ? "" : row.Cells["ORG"].Value.ToString();
- this.bigarea = row.Cells["BIGAREA"].Value == null ? "" : row.Cells["BIGAREA"].Value.ToString();
- this.textEditorABC.Text = row.Cells["PY"].Value == null ? "" : row.Cells["PY"].Value.ToString();
- this.comBoStation.Text = row.Cells["MARKET_SYS"].Value == null ? "" : row.Cells["MARKET_SYS"].Value.ToString();
- this.comboRegIon.Text = this.bigarea;
- this.ultraTextUserGrp.Text = row.Cells["USER_GRP"].Value == null ? "" : row.Cells["USER_GRP"].Value.ToString();
- treeSelect(row.Cells["REGION_NO"].Value == null ? "" : row.Cells["REGION_NO"].Value.ToString());
- }
- //bool validFlag = chkValid.Checked;
- //string merPorSql = "";
- //if (!validFlag)
- //{
- // merPorSql = " AND validflag = '1' ";
- //}
- //UltraGridRow atvRow = ultraBaseGrid.ActiveRow;
- //if (atvRow != null && atvRow.Band.AddButtonCaption.ToString().Equals("slmBaseCustomer"))
- //{
- // string customerNo = atvRow.Cells["CUSTOMER_NO"].Value.ToString();
- // string custmuse = "''";
- // if (atvRow.Cells["DINGJIE"].Value.ToString().Equals("true"))
- // {
- // custmuse += ", '" + "100202" + "'";
- // }
- // if (atvRow.Cells["SH"].Value.ToString().Equals("true"))
- // {
- // custmuse += ", '" + "100203" + "'";
- // }
- // if (custmuse != "")
- // {
- // DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceiv", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
- // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryUnit", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
- // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll", new Object[] { }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
- // }
- //}
- }
- //展开下拉列表树节点
- public void treeSelect(string Name)
- {
- if (!string.IsNullOrEmpty(Name))
- {
- for (int e = 0; e < this.ComBelongsCity.Nodes.Count; e++)
- {
- ComBelongsCity.Nodes[e].Collapse();
- combelonCity = "";
- //展开一级节点 LX 修改
- if (this.ComBelongsCity.Nodes[e].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Tag.Equals(Name))
- {
- this.ComBelongsCity.Nodes[e].Expand();
- this.ComBelongsCity.Nodes[e].ExpandAll();
- ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Text.ToString();
- combelonCity = this.ComBelongsCity.Nodes[e].Tag.ToString();
- combleTo = this.ComBelongsCity.Nodes[e].ToolTipText;
- return;
- }
- //展开二级节点
- for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
- {
- if (this.ComBelongsCity.Nodes[e].Nodes[w].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Nodes[w].Tag.Equals(Name))
- {
- this.ComBelongsCity.Nodes[e].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].ExpandAll();
- ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Text.ToString();
- combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Tag.ToString();
- combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].ToolTipText;
- return;
- }
- }
- //展开三级子节点
- for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
- {
- for (int r = 0; r < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes.Count; r++)
- {
- if (this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Text.Equals(Name) || this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Tag.Equals(Name))
- {
- this.ComBelongsCity.Nodes[e].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].ExpandAll();
- ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Text.ToString();
- combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Tag.ToString();
- combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].ToolTipText;
- return;
- }
- }
- }
- //展开四级子节点
- for (int w = 0; w < this.ComBelongsCity.Nodes[e].Nodes.Count; w++)
- {
- for (int r = 0; r < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes.Count; r++)
- {
- for (int x = 0; x < this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes.Count; x++)
- {
- 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))
- {
- this.ComBelongsCity.Nodes[e].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Expand();
- this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].ExpandAll();
- ComBelongsCity.Text = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Text.ToString();
- combelonCity = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].Tag.ToString();
- combleTo = this.ComBelongsCity.Nodes[e].Nodes[w].Nodes[r].Nodes[x].ToolTipText;
- return;
- }
- }
- }
- }
- }
- }
- }
- /**
- *1.勾选订货或者收货单位如果为true,判断是否存在:存在修改有效标记1,不存在弹窗新增一条。
- *2.勾选订货或者收货单位如果为False,修改有效标记0;
- */
- private void ultraBaseGrid_CellChange(object sender, CellEventArgs e)
- {
- if (e.Cell.Row.Index == -1)
- {
- return;
- }
- listExpanl.Clear();
- Infragistics.Win.UltraWinGrid.UltraGridRow row = this.ultraBaseGrid.DisplayLayout.ActiveRow;
- expanlixName = row.Cells["CUSTOMER_NO"].Text;
- customerID = row.Cells["CUSTOMER_NO"].Text;
- int count = 0;
- if (e.Cell.Column.Key.Equals("VALIDFLAG"))
- {
- //用于修改增加后展开
- listExpanl.Add(e.Cell.Row.Index);
- if (row.Cells["VALIDFLAG"].Text.Equals("True"))
- {
- ArrayList parm = new ArrayList();
- parm.Add("1");
- parm.Add(stacustomerNo);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateCustomerALLS";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add("1");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateRightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUseALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateReceivUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateOrderUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add("1");
- parm.Add(stacustomerNo);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateFreightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- else
- {
- ArrayList parm = new ArrayList();
- parm.Add("0");
- parm.Add(stacustomerNo);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateCustomerALLS";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add("0");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateRightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUseALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateReceivUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateOrderUnitALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- parm = new ArrayList();
- parm.Add("0");
- parm.Add(stacustomerNo);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateFreightALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- }
- if (e.Cell.Column.Key.Equals("DINGJIE"))
- { //用于修改增加后展开
- listExpanl.Add(e.Cell.Row.Index);
- if (row.Cells["DINGJIE"].Text.Equals("True"))
- {
- count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryOrderUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
- if(count == 0)
- {
- MessageUtil.ShowWarning("请先维护订/结单位!");
- row.Cells["DINGJIE"].Value = false;
- return;
- }
- ArrayList parm = new ArrayList();
- parm.Add("1");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- parm.Add("100202");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateOrderUnit";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- else if (row.Cells["DINGJIE"].Text.Equals("False"))
- {
- count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryOrderUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
- if (count > 0)
- {
- if (MessageUtil.ShowQuestion("是否删除订/结客户信息,删除之后该客户信息失效,相关合同生成无法调用该客户信息!").ToString().ToLower().Equals("yes"))
- {
- ArrayList parm = new ArrayList();
- parm.Add("0");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- parm.Add("100202");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateOrderUnit";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- }
- }
- doQuery();
- }
- if (e.Cell.Column.Key.Equals("SH"))
- {
- //用于修改增加后展开
- listExpanl.Add(e.Cell.Row.Index);
- if (row.Cells["SH"].Text.Equals("True"))
- {
- count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceivUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
- if (count == 0)
- {
- MessageUtil.ShowWarning("请先维护收货单位!");
- row.Cells["SH"].Value = false;
- return;
- }
- ArrayList parm = new ArrayList();
- parm.Add("1");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- parm.Add("100203");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateReceivUnit";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- else if (row.Cells["SH"].Text.Equals("False"))
- {
- count = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceivUnit", new Object[] { customerID, saleorg }, this.ob).Rows.Count;
- if (count > 0)
- {
- if (MessageUtil.ShowQuestion("是否删除收货客户信息,删除之后该客户信息失效,相关合同生成无法调用该客户信息!").ToString().ToLower().Equals("yes"))
- {
- ArrayList parm = new ArrayList();
- parm.Add("0");
- parm.Add(stacustomerNo);
- parm.Add(saleorg);
- parm.Add("100203");
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateReceivUnit";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetUpdateUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- }
- }
- }
- string keyName = e.Cell.Column.Key.ToUpper().Trim();
- //if (keyName.Equals("UNBOUNDUP"))
- //{
- // treeSelect(e.Cell.Row.Cells["REGION_NO"].Value == null ? " " : e.Cell.Row.Cells["REGION_NO"].Value.ToString());
- // //用于修改增加后展开
- // listExpanl.Add(e.Cell.Row.ParentRow.Index);
- // FrmBuyerSend frmSend = new FrmBuyerSend(this.ob);
- // frmSend.Customer_no = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
- // frmSend.Sale_org = saleorg;
- // frmSend.Custm_use = "100203";
- // frmSend.Region_no = combelonCity;
- // frmSend.StrOperator = strOperator;
- // frmSend.ShowDialog();
- //}
- //if (keyName.Equals("UNITUP"))
- //{
- // treeSelect(e.Cell.Row.Cells["REGION_NO"].Value == null ? " " : e.Cell.Row.Cells["REGION_NO"].Value.ToString());
- // //用于修改增加后展开
- // listExpanl.Add(e.Cell.Row.ParentRow.Index);
- // FrmBuyerOrder frmorder = new FrmBuyerOrder(this.ob);
- // frmorder.Customer_no = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
- // frmorder.Sale_org = saleorg;
- // frmorder.Custm_use = "100202";
- // frmorder.Chn_fl = combleTo == "1001" ? "1" : "0";
- // frmorder.Bigarea = e.Cell.Row.Cells["BIGAREA"].Value.ToString(); ;
- // frmorder.Region_no = combelonCity;
- // frmorder.StrOperator = strOperator;
- // frmorder.ShowDialog();
- //}
- if (keyName.Equals("USERBOS"))
- {
- ArrayList parm = new ArrayList();
- CoreClientParam ccp = new CoreClientParam();
- expanlixName = e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString();
- if (row.Cells["USERBOS"].Text.Equals("True"))
- {
- int countsig = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryCustm_Use",
- new Object[] { e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString(), "100204", saleorg }, this.ob).Rows.Count;
- if (countsig == 0)
- {
- parm = new ArrayList();
- parm.Add(e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString()); //客户编码
- parm.Add(saleorg);
- parm.Add("100204");
- parm.Add(strOperator);
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "GetInsertCustmUse";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- }
- else
- {
- parm = new ArrayList();
- parm.Add(e.Cell.Row.Cells["CUSTOMER_NO"].Value.ToString()); //客户编码
- parm.Add("100204");
- ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.base.CoreBuyerBase";
- ccp.MethodName = "SetDeleteUseALL";
- ccp.ServerParams = new object[] { parm };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- }
- }
- doQuery();
- ultraBaseGrid.UpdateData();
- }
- private void ComBelongsCity_DropDownClosed(object sender, EventArgs e)
- {
- this.comboRegIon.Value = this.ComBelongsCity.SelectedNode.StateImageKey;
- }
- private void ultraBaseGrid_BeforeRowExpanded(object sender, CancelableRowEventArgs e)
- {
- //if (e.Row.IsFilterRow) return;
- //bool validFlag = chkValid.Checked;
- //string merPorSql = "";
- //if (!validFlag)
- //{
- // merPorSql = " AND validflag = '1' ";
- //}
- //if (e.Row != null && e.Row.Band.AddButtonCaption.ToString().Equals("slmBaseCustomer"))
- //{
- // string customerNo = e.Row.Cells["CUSTOMER_NO"].Value.ToString();
- // string custmuse = "''";
- // if (e.Row.Cells["DINGJIE"].Value.ToString().Equals("true"))
- // {
- // custmuse += ", '" + "100202" + "'";
- // }
- // if (e.Row.Cells["SH"].Value.ToString().Equals("true"))
- // {
- // custmuse += ", '" + "100203" + "'";
- // }
- // if (custmuse != "")
- // {
- // DataTable dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryReceiv", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseReceivunit, true);
- // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerBase.GetQueryUnit", new Object[] { customerNo, UserInfo.SaleOrg, custmuse, merPorSql }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseOrderUnit, true);
- // dts = ServerHelper.GetData("com.steering.pss.sale.base.CoreBuyerOrder.GetQueryCustmFreightAll", new Object[] { }, this.ob);
- // GridHelper.CopyDataToDatatable(ref dts, ref this.slmBaseCartransport, true);
- // }
- //}
- }
- private void textEditorBaseName_ValueChanged(object sender, EventArgs e)
- {
- //ChineseWord
- textEditorABC.Text = ChineseWord.GetChineseSpell(textEditorBaseName.Text.Trim());
- }
- private void ultraBaseGrid_ClickCellButton(object sender, CellEventArgs e)
- {
- customerID = e.Cell.Row.Cells["CUSTOMER_NO"].Text;
- if (e.Cell.Column.Key == "BTN_ORDER")
- {
- FrmBuyerOrder frmorder = new FrmBuyerOrder(this.ob);
- frmorder.Customer_no = customerID;
- frmorder.Sale_org = saleorg;
- frmorder.Custm_use = "100202";
- frmorder.Chn_fl = combleTo == "101" ? "1" : "0";
- frmorder.Bigarea = bigarea;
- frmorder.Region_no = combelonCity == "" ? "8" : combelonCity; ;
- frmorder.StrOperator = strOperator;
- frmorder.ShowDialog();
- }
- else if (e.Cell.Column.Key == "BTN_RECEIVE")
- {
- FrmBuyerSend frmSend = new FrmBuyerSend(this.ob);
- frmSend.Customer_no = customerID;
- frmSend.Sale_org = saleorg;
- frmSend.Custm_use = "100203";
- frmSend.Region_no = combelonCity == "" ? "8" : combelonCity;
- frmSend.StrOperator = strOperator;
- frmSend.ShowDialog();
- }
- //CUSTOMER_NM
- expanlixName = e.Cell.Row.Cells["CUSTOMER_NM"].Text;
- doQuery();
- }
- private void textEditorBaseName_Validating(object sender, CancelEventArgs e)
- {
- if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textEditorBaseName.Text) > 100)
- {
- MessageBox.Show("录入客户名称【中文名不能大于50个字符/英文名不能大于100个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- }
- }
- private void textAbrviTion_Validating(object sender, CancelEventArgs e)
- {
- if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textAbrviTion.Text) > 60)
- {
- MessageBox.Show("录入客户简称【中文名不能大于30个字符/英文名不能大于60个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- }
- }
- private void ultraTextUserGrp_Validating(object sender, CancelEventArgs e)
- {
- if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(ultraTextUserGrp.Text) > 40)
- {
- MessageBox.Show("录入用户组【中文名不能大于20个字符/英文名不能大于40个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- }
- }
- private void textEditorORG_Validating(object sender, CancelEventArgs e)
- {
- if (Core.Mes.Client.Comm.Globals.GetStrBytesLength(textEditorORG.Text) > 60)
- {
- MessageBox.Show("录入机构代码【中文名不能大于30个字符/英文名不能大于60个字符】数据验证失败,请重新录入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
- e.Cancel = true;
- }
- }
- }
- }
|