| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698 |
- 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.Tool;
- using Core.Mes.Client.Comm.Server;
- using Infragistics.Win.UltraWinGrid;
- using System.Collections;
- using Core.Mes.Client.Comm.Format;
- using Infragistics.Win.UltraWinEditors;
- namespace Core.StlMes.Client.SaleOrder.Dialog
- {
- /// <summary>
- /// 现货合同客户端
- /// </summary>
- public partial class FrmMatInfo : FrmBase
- {
- public FrmMatInfo()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="_ob">OB对象</param>
- public FrmMatInfo(OpeBase _ob)
- {
- InitializeComponent();
- this.ob = _ob;
- }
- //销售组织
- string saleorg = "";
- public string Saleorg
- {
- get { return saleorg; }
- set { saleorg = value; }
- }
- /// <summary>
- /// 合同头PK值
- /// </summary>
- private string ordPk;
- /// <summary>
- /// 合同头PK值
- /// </summary>
- public string OrdPk
- {
- get { return ordPk; }
- set { ordPk = value; }
- }
- /// <summary>
- /// 制造商代码
- /// </summary>
- private string suppUnit;
- /// <summary>
- /// 制造商代码
- /// </summary>
- public string SuppUnit
- {
- get { return suppUnit; }
- set { suppUnit = value; }
- }
- private string orderNo;
- /// <summary>
- /// 合同号
- /// </summary>
- public string OrderNo
- {
- get { return orderNo; }
- set { orderNo = value; }
- }
- /// <summary>
- /// 窗体关闭属性 默认关闭
- /// </summary>
- private string closeEvent = "formClose";
- /// <summary>
- /// 窗体关闭属性
- /// </summary>
- public string CloseEvent
- {
- get { return closeEvent; }
- set { closeEvent = value; }
- }
- private string createDept = "";
- /// <summary>
- /// 创建部门
- /// </summary>
- public string CreateDept
- {
- get { return createDept; }
- set { createDept = value; }
- }
- private string createName = "";
- /// <summary>
- /// 创建人
- /// </summary>
- public string CreateName
- {
- get { return createName; }
- set { createName = value; }
- }
- /// <summary>
- /// 重写基类load事件,屏蔽平台过滤功能。
- /// </summary>
- /// <param name="e"></param>
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- gdMat.DisplayLayout.Override.FilterUIType = Infragistics.Win.UltraWinGrid.FilterUIType.FilterRow;
- gdMat.DisplayLayout.Override.FilterOperatorDefaultValue = Infragistics.Win.UltraWinGrid.FilterOperatorDefaultValue.Contains;
- }
- private void FrmMatInfo_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<MatZcMEntity>(gdMat.DisplayLayout.Bands[0]);
- UltraComboEditor uce = new UltraComboEditor();
- uce.Items.Add("1", "封锁");
- uce.Items.Add("0", "未封锁");
- gdMat.DisplayLayout.Bands[0].Columns["lockFlag"].EditorComponent = uce;
- gdMat.DisplayLayout.Bands[0].Columns["mngLockFlag"].EditorComponent = uce;
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "Query":
- QueryMat();
- break;
- case "Add":
- string dept = UserInfo.GetDeptid();
- string name = UserInfo.GetUserName();
- if (dept == this.CreateDept && name == this.CreateName)
- {
- AddOrderLine();
- }
- else
- {
- MessageUtil.ShowWarning("操作权限不够!此合同是'" + this.CreateName + "'录入的!");
- return;
- }
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 库存信息查询
- /// </summary>
- public void QueryMat()
- {
- string[] arr = new string[4];
- string saleOrg = ClsBaseInfo.GetSaleOrg(UserInfo.GetDeptid());
- if (UserInfo.GetUserName() == "admin")
- {
- arr[0] = "100101";
- arr[1] = "100102";
- arr[2] = "100103";
- arr[3] = "100105";
- }
- if (saleOrg == "100101" || saleOrg == "100103")
- {
- arr[0] = "100101";
- arr[1] = "100103";
- arr[2] = "100103";
- arr[3] = "100105";
- }
- else if (saleOrg == "100102")
- {
- arr[0] = "100102";
- arr[1] = "100102";
- arr[2] = "100102";
- arr[3] = "100105";
- }
- else if (saleOrg == "100105")
- {
- arr[0] = "100101";
- arr[1] = "100102";
- arr[2] = "100103";
- arr[3] = "100105";
- }
- string judgeStoveNo = "";
- string proName = "";
- string steelName = "";
- string specName = "";
- if (chkJudgeStoveNo.Checked)
- judgeStoveNo = txtJudgeStoveNo.Text.Trim();
- if (chkPro.Checked)
- proName = txtPro.Text.Trim();
- if (chkSteel.Checked)
- steelName = txtSteel.Text.Trim();
- if (chkSpec.Checked)
- specName = txtSpec.Text.Trim();
- ArrayList parm = new ArrayList();
- parm.Add(judgeStoveNo);
- parm.Add(proName);
- parm.Add(steelName);
- parm.Add(specName);
- parm.Add(suppUnit);
- List<MatZcMEntity> listSource = EntityHelper.GetData<MatZcMEntity>(
- "com.steering.pss.sale.order.CoreMatInfo.queryMatInfo", new object[] { arr, parm }, this.ob);
- matZcMEntityBindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 新增现货合同行
- /// </summary>
- public void AddOrderLine()
- {
- gdMat.UpdateData();
- gdOrderLine.UpdateData();
- string saleOrg = Saleorg;
- UltraGridRow[] rows = gdMat.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString() == "True").ToArray();
- if (rows.Length <= 0)
- {
- MessageUtil.ShowWarning("请选择库存数据来新增现货合同!");
- return;
- }
- ArrayList orderLine = new ArrayList();
- foreach (UltraGridRow line in gdOrderLine.Rows)
- {
- SlmOrderLineNewEntity ole = new SlmOrderLineNewEntity();
- ole.Psc = "N/A";
- ole.PscDesc = "N/A";
- ole.OrderSpecCode = "N/A";
- ole.OrderSpecDesc = "N/A";
- ole.Produccode = line.Cells["PRODUCCODE"].Value.ToString();
- ole.Producname = line.Cells["PRODUCNAME"].Value.ToString();
- if (line.Cells["JUDGESTDNAME"].Value != null && line.Cells["JUDGESTDNAME"].Value.ToString() != "" && string.IsNullOrEmpty(line.Cells["STDNAME"].Value.ToString()))
- {
- ole.StdCode = "N/A";
- ole.StdName = line.Cells["JUDGESTDNAME"].Value.ToString();
- }
- else
- {
- ole.StdCode = line.Cells["STDCODE"].Value.ToString();
- ole.StdName = line.Cells["STDNAME"].Value.ToString();
- }
- ole.Steelcode = line.Cells["STEELCODE"].Value.ToString();
- ole.Steelname = line.Cells["STEELNAME"].Value.ToString();
- ole.StdStyle = line.Cells["STDSTYLE"].Value.ToString();
- ole.StdStyleDesc = line.Cells["STDSTYLEDESC"].Value.ToString();
- ole.SpecCode = line.Cells["SPECCODE"].Value.ToString();
- ole.SpecName = line.Cells["SPECNAME"].Value.ToString();
- ole.Dimater = Convert.ToDecimal(line.Cells["ACTDIMATER"].Value.ToString() == "" ? "0" : line.Cells["ACTDIMATER"].Value);
- ole.Height = Convert.ToDecimal(line.Cells["ACTHEIGHT"].Value.ToString() == "" ? "0" : line.Cells["ACTHEIGHT"].Value);
- ole.ModelCode = line.Cells["MODELCODE"].Value.ToString();
- ole.ModelDesc = line.Cells["MODELDESC"].Value.ToString();
- ole.LenDesc = line.Cells["ACTLENMIN"].Value.ToString() + "-" + line.Cells["ACTLENMAX"].Value.ToString();
- ole.LenMin = Convert.ToDecimal(line.Cells["ACTLENMIN"].Value.ToString3());
- ole.LenMax = Convert.ToDecimal(line.Cells["ACTLENMAX"].Value.ToString3());
- if (rdbD.Checked)
- {
- ole.OrderUnit = rdbD.Tag.ToString();
- }
- else
- {
- ole.OrderUnit = rdbZ.Tag.ToString();
- }
-
- ole.FinalUser = "N/A";
- ole.FinalUserDesc = "N/A";
- ole.CreateName = UserInfo.GetUserName();
- ole.OrdPk = this.OrdPk;
- if (rdbD.Checked)
- {
- ole.OrderQty = Convert.ToDecimal(line.Cells["ORDERQTY"].Value);
- }
- else
- {
- ole.OrderQty = Convert.ToDecimal(line.Cells["ORDERCOUNT"].Value);
- }
- ole.PrdctWgt = Convert.ToDecimal(line.Cells["ORDERQTY"].Value);
- ole.DelvryRangeTpe = "%";
- ole.DelvryRangeMin = 100;
- ole.DelvryRangeMax = 50;
- ole.OrderLnStatus = "12020101";
- ole.StoveBatchGroup = line.Cells["STOBATCHGROUP"].Value.ToString(); //这一行合同行 由哪些炉号批号组号 组成
- ole.OrderCount = line.Cells["ORDERCOUNT"].Value.ToString();
- orderLine.Add(JSONFormat.Format(ole));
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in rows)
- {
- ArrayList list = new ArrayList();
- list.Add(row.Cells["JUDGESTOVENO"].Value.ToString());
- list.Add(row.Cells["BATCHNO"].Value.ToString());
- list.Add(row.Cells["BATCHGROUDNO"].Value.ToString());
- list.Add(row.Cells["LKACTCOUNT"].Value.ToString());
- list.Add(row.Cells["BELONGCODE"].Text);
- list.Add(row.Cells["ActLen"].Text);
- list.Add(row.Cells["ActLenMin"].Text);
- list.Add(row.Cells["ActLenMax"].Text);
- if (!saleOrg.Equals(row.Cells["BELONGCODE"].Text))
- {
- MessageUtil.ShowWarning("炉号"+row.Cells["JUDGESTOVENO"].Value.ToString()+"库存销售组织与您当前的销售组织不一致,请所属权转移至您当前销售组织!");
- return;
- }
- parm.Add(list);
- //decimal actCount = Convert.ToDecimal(row.Cells["ACTCOUNT"].Value.ToString());
- //decimal lkActCount = Convert.ToDecimal(row.Cells["LKACTCOUNT"].Value.ToString());
- //decimal weight = Convert.ToDecimal(row.Cells["ACTWEIGHT"].Value.ToString());
- //qty += Math.Round(Convert.ToDecimal(lkActCount / actCount * weight), 3);
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否使用勾选的库存信息新增[ " + gdOrderLine.Rows.Count + " ]行现货合同行?") == DialogResult.No) return;
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.sale.order.CoreMatInfo";
- ccp.MethodName = "addSpotOrderLine";
- ccp.ServerParams = new object[] { orderLine, parm, this.OrderNo, this.OrdPk, saleOrg,UserInfo.GetUserName() };
- ccp.IfShowErrMsg = false;
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp != null)
- {
- if (ccp.ReturnCode == -1)
- {
- MessageUtil.ShowWarning(ccp.ReturnInfo);
- return;
- }
- MessageUtil.ShowTips("现货合同新增成功,请维护最终用户,交货信息!");
- this.CloseEvent = "Add";
- this.Close();
- }
- }
- /// <summary>
- /// 勾选炉号信息 之前只能新增一个合同行(相同产品信息),后改成根据产品信息自动生成多个合同行
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void gdMat_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
- {
- gdMat.UpdateData();
- if (e.Cell.Column.Key.Equals("CHK"))
- {
- //如果材料是被 质量锁定或者管理锁定 将无法作现货合同
- if (e.Cell.Row.Cells["lockFlag"].Value.ToString2() == "1")
- {
- MessageUtil.ShowWarning("所选材料已被质量封锁,不能用于现货合同!");
- e.Cell.Value = false;
- return;
- }
- if (e.Cell.Row.Cells["mngLockFlag"].Value.ToString2() == "1")
- {
- MessageUtil.ShowWarning("所选材料已被管理封锁,不能用于现货合同!");
- e.Cell.Value = false;
- return;
- }
- dataTable1.Clear();
- Dictionary<string, decimal> dic = new Dictionary<string, decimal>(); //重量
- Dictionary<string, MyPoint> dicLen = new Dictionary<string, MyPoint>(); //长度上下限
- Dictionary<string, string> dicStove = new Dictionary<string, string>(); //炉批组
- Dictionary<string, decimal> dicCount = new Dictionary<string, decimal>(); //支数
- UltraGridRow[] rows = gdMat.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString() == "True").ToArray();
- foreach (UltraGridRow row in rows)
- {
- decimal qty = 0;
- DataRow dr = dataTable1.NewRow();
- string str = row.Cells["PRODUCCODE"].Value.ToString() + row.Cells["STDSTYLE"].Value.ToString() +
- row.Cells["STEELCODE"].Value.ToString() + row.Cells["JUDGESTDNAME"].Value.ToString()
- + row.Cells["MODELCODE"].Value.ToString() + row.Cells["SPECCODE"].Value.ToString();
- decimal actCount = Convert.ToDecimal(row.Cells["ACTCOUNT"].Value.ToString());
- decimal lkActCount = Convert.ToDecimal(row.Cells["LKACTCOUNT"].Value.ToString());
- decimal weight = Convert.ToDecimal(row.Cells["ACTWEIGHT"].Value.ToString());
- qty = Math.Round(Convert.ToDecimal(lkActCount / actCount * weight), 3);
- //炉批组 @符号分割
- string stove = row.Cells["JudgeStoveNo"].Value.ToString() + "@" + row.Cells["BatchNo"].Value.ToString() + "@" + row.Cells["BatchGroudNo"].Value.ToString();
- if (!dic.ContainsKey(str) && dic.Count > 0)
- {
- //MessageUtil.ShowWarning("品种、标准类别、钢级、判定标准、扣型、规格不完全一样,不能勾选!");
- //e.Cell.Value = false;
- //return;
- dic.Add(str, qty);
- dicStove.Add(str, stove);
- dr["KEYSTR"] = str;
- dr["PRODUCCODE"] = row.Cells["PRODUCCODE"].Value.ToString();
- dr["PRODUCNAME"] = row.Cells["PRODUCNAME"].Value.ToString();
- dr["STEELCODE"] = row.Cells["STEELCODE"].Value.ToString();
- dr["STEELNAME"] = row.Cells["STEELNAME"].Value.ToString();
- dr["STDCODE"] = row.Cells["STDCODE"].Value.ToString();
- dr["STDNAME"] = row.Cells["STDNAME"].Value.ToString();
- dr["STDSTYLE"] = row.Cells["STDSTYLE"].Value.ToString();
- dr["STDSTYLEDESC"] = row.Cells["STDSTYLEDESC"].Value.ToString();
- dr["JUDGESTDNAME"] = row.Cells["JUDGESTDNAME"].Value.ToString();
- dr["MODELCODE"] = row.Cells["MODELCODE"].Value.ToString();
- dr["MODELDESC"] = row.Cells["MODELDESC"].Value.ToString();
- dr["ACTLENMIN"] = row.Cells["ACTLENMIN"].Value.ToString();
- dr["ACTLENMAX"] = row.Cells["ACTLENMAX"].Value.ToString();
- dr["ACTDIMATER"] = row.Cells["ACTDIMATER"].Value.ToString();
- dr["ACTHEIGHT"] = row.Cells["ACTHEIGHT"].Value.ToString();
- dr["SPECCODE"] = row.Cells["SPECCODE"].Value.ToString();
- dr["SPECNAME"] = row.Cells["SPECNAME"].Value.ToString();
- dr["ORDERQTY"] = qty;
- dr["STOBATCHGROUP"] = stove;
- dr["ORDERCOUNT"] = lkActCount;
- decimal x = Convert.ToDecimal(dr["ACTLENMIN"].ToString() == "" ? "0" : dr["ACTLENMIN"].ToString());
- decimal y = Convert.ToDecimal(dr["ACTLENMAX"].ToString() == "" ? "0" : dr["ACTLENMAX"].ToString());
- MyPoint point = new MyPoint(x, y);
- dicLen.Add(str, point);
- dicCount.Add(str, lkActCount);
- dataTable1.Rows.Add(dr);
- }
- else
- {
- if (dic.Count <= 0)
- {
- dic.Add(str, qty);
- dr["KEYSTR"] = str;
- dr["PRODUCCODE"] = row.Cells["PRODUCCODE"].Value.ToString();
- dr["PRODUCNAME"] = row.Cells["PRODUCNAME"].Value.ToString();
- dr["STEELCODE"] = row.Cells["STEELCODE"].Value.ToString();
- dr["STEELNAME"] = row.Cells["STEELNAME"].Value.ToString();
- dr["STDCODE"] = row.Cells["STDCODE"].Value.ToString();
- dr["STDNAME"] = row.Cells["STDNAME"].Value.ToString();
- dr["STDSTYLE"] = row.Cells["STDSTYLE"].Value.ToString();
- dr["STDSTYLEDESC"] = row.Cells["STDSTYLEDESC"].Value.ToString();
- dr["JUDGESTDNAME"] = row.Cells["JUDGESTDNAME"].Value.ToString();
- dr["MODELCODE"] = row.Cells["MODELCODE"].Value.ToString();
- dr["MODELDESC"] = row.Cells["MODELDESC"].Value.ToString();
- dr["ACTLENMIN"] = row.Cells["ACTLENMIN"].Value.ToString();
- dr["ACTLENMAX"] = row.Cells["ACTLENMAX"].Value.ToString();
- dr["ACTDIMATER"] = row.Cells["ACTDIMATER"].Value.ToString();
- dr["ACTHEIGHT"] = row.Cells["ACTHEIGHT"].Value.ToString();
- dr["SPECCODE"] = row.Cells["SPECCODE"].Value.ToString();
- dr["SPECNAME"] = row.Cells["SPECNAME"].Value.ToString();
- dr["ORDERQTY"] = qty;
- dr["STOBATCHGROUP"] = stove;
- dr["ORDERCOUNT"] = lkActCount;
- decimal x = Convert.ToDecimal(dr["ACTLENMIN"].ToString() == "" ? "0" : dr["ACTLENMIN"].ToString());
- decimal y = Convert.ToDecimal(dr["ACTLENMAX"].ToString() == "" ? "0" : dr["ACTLENMAX"].ToString());
- MyPoint point = new MyPoint(x, y);
- dicLen.Add(str, point);
- dicStove.Add(str, stove);
- dicCount.Add(str, lkActCount);
- dataTable1.Rows.Add(dr);
- }
- else
- {
- dic[str] = dic[str] + qty;
- MyPoint oldPoint = dicLen[str];
- decimal x = Convert.ToDecimal(row.Cells["ACTLENMIN"].Value.ToString() == "" ? "0" : row.Cells["ACTLENMIN"].Value.ToString());
- decimal y = Convert.ToDecimal(row.Cells["ACTLENMAX"].Value.ToString() == "" ? "0" : row.Cells["ACTLENMAX"].Value.ToString());
- if (oldPoint.X > x) //小中取小 大中取大
- oldPoint.X = x;
- if (oldPoint.Y < y)
- oldPoint.Y = y;
- dicLen[str] = oldPoint;
- dicCount[str] = dicCount[str] + lkActCount;
- string stove1 = dicStove[str];
- dicStove[str] = stove1 + "&" + stove;
- foreach (DataRow dRow in dataTable1.Rows)
- {
- if (dRow["KEYSTR"].ToString() == str)
- {
- dRow["ORDERQTY"] = dic[str];
- dRow["ACTLENMIN"] = dicLen[str].X.ToString();
- dRow["ACTLENMAX"] = dicLen[str].Y.ToString();
- dRow["STOBATCHGROUP"] = dicStove[str];
- dRow["ORDERCOUNT"] = dicCount[str];
- break;
- }
- }
- }
- }
- }
- if (e.Cell.Value.ToString() == "True")
- {
- e.Cell.Row.Cells["LKACTCOUNT"].Activation = Activation.AllowEdit;
- }
- }
- else if (e.Cell.Column.Key.ToUpper().Equals("LKACTCOUNT"))
- {
- if (e.Cell.Value == null)
- {
- MessageUtil.ShowWarning("请输入利库支数!");
- return;
- }
- else if (Convert.ToDecimal(e.Cell.Value) > Convert.ToDecimal(e.Cell.Row.Cells["ACTCOUNT"].Value))
- {
- MessageUtil.ShowWarning("输入的利库支数不能大于炉号的支数!");
- e.Cell.Value = e.Cell.Row.Cells["ACTCOUNT"].Value;
- return;
- }
- Dictionary<string, decimal> dic = new Dictionary<string, decimal>();
- Dictionary<string, decimal> dicCount = new Dictionary<string, decimal>(); //支数
- UltraGridRow[] rows = gdMat.Rows.AsQueryable().Where(a => a.Cells["CHK"].Value.ToString() == "True").ToArray();
- decimal qty = 0;
- foreach (UltraGridRow row in rows)
- {
- string str = row.Cells["PRODUCCODE"].Value.ToString() + row.Cells["STDSTYLE"].Value.ToString() +
- row.Cells["STEELCODE"].Value.ToString() + row.Cells["JUDGESTDNAME"].Value.ToString()
- + row.Cells["MODELCODE"].Value.ToString() + row.Cells["SPECCODE"].Value.ToString();
- decimal actCount = Convert.ToDecimal(row.Cells["ACTCOUNT"].Value.ToString());
- decimal lkActCount = Convert.ToDecimal(row.Cells["LKACTCOUNT"].Value.ToString());
- decimal weight = Convert.ToDecimal(row.Cells["ACTWEIGHT"].Value.ToString());
- qty = Math.Round(Convert.ToDecimal(lkActCount / actCount * weight), 3);
- if (!dic.ContainsKey(str) && dic.Count > 0)
- {
- dic.Add(str, qty);
- dicCount.Add(str, lkActCount);
- }
- else
- {
- if (dic.Count <= 0)
- {
- dic.Add(str, qty);
- dicCount.Add(str, lkActCount);
- }
- else
- {
- dic[str] += qty;
- dicCount[str] += lkActCount;
- }
- }
- }
- foreach (DataRow dRow in dataTable1.Rows)
- {
- if (dic.ContainsKey(dRow["KEYSTR"].ToString()))
- {
- dRow["ORDERQTY"] = dic[dRow["KEYSTR"].ToString()];
- dRow["ORDERCOUNT"] = dicCount[dRow["KEYSTR"].ToString()];
- }
- }
- }
- }
- private void gdMat_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow row = gdMat.ActiveRow;
- if (row == null)
- return;
- foreach (UltraGridCell cell in row.Cells)
- {
- if (!cell.Column.Key.Equals("CHK"))
- {
- cell.Activation = Activation.ActivateOnly;
- }
- }
- if (row.Cells["CHK"].Value.ToString().ToUpper() == "TRUE")
- {
- row.Cells["LKACTCOUNT"].Activation = Activation.AllowEdit;
- }
- }
- private void chkJudgeStoveNo_CheckedChanged(object sender, EventArgs e)
- {
- if (chkJudgeStoveNo.Checked)
- {
- txtJudgeStoveNo.ReadOnly = false;
- }
- else
- {
- txtJudgeStoveNo.ReadOnly = true;
- }
- }
- private void txtJudgeStoveNo_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- QueryMat();
- }
- private void chkPro_CheckedChanged(object sender, EventArgs e)
- {
- if (chkPro.Checked)
- {
- txtPro.ReadOnly = false;
- }
- else
- {
- txtPro.ReadOnly = true;
- }
- }
- private void chkSteel_CheckedChanged(object sender, EventArgs e)
- {
- if (chkSteel.Checked)
- {
- txtSteel.ReadOnly = false;
- }
- else
- {
- txtSteel.ReadOnly = true;
- }
- }
- private void chkSpec_CheckedChanged(object sender, EventArgs e)
- {
- if (chkSpec.Checked)
- {
- txtSpec.ReadOnly = false;
- }
- else
- {
- txtSpec.ReadOnly = true;
- }
- }
- private void txtPro_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- QueryMat();
- }
- private void txtSteel_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- QueryMat();
- }
- private void txtSpec_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- QueryMat();
- }
- }
- /// <summary>
- /// 坐标
- /// </summary>
- struct MyPoint
- {
- decimal x;
- public decimal X
- {
- get { return x; }
- set { x = value; }
- }
- decimal y;
- public decimal Y
- {
- get { return y; }
- set { y = value; }
- }
- public MyPoint(decimal x, decimal y)
- {
- this.x = x;
- this.y = y;
- }
- }
- }
|