| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
- using Core.StlMes.Client.PlnSaleOrd.工序排产;
- using Core.StlMes.Client.PlnSaleOrd.高新.entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- using Core.StlMes.Client.PlnSaleOrd.OrderManage.froms;
- using Newtonsoft.Json;
- using Core.StlMes.Client.PlnSaleOrd.窗体;
- using Core.Mes.Client.Comm;
- using Core.StlMes.Client.PlnSaleOrd.PopupWindow;
- using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
- using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool;
- namespace Core.StlMes.Client.PlnSaleOrd
- {
- ///custominfo==0 表示轧管排产查询界面
- /// <summary>
- /// 加工高新
- /// </summary>
- public partial class FrmHeatProductionMesGXRCL : FrmBase
- {
- private string departm = "";//获取部门ID
- private string[] plineCode = null;//获取产线代码
- /// <summary>
- /// 订单编号
- /// </summary>
- private string _ProPlanId = "";
- DataTable dtPlinGroup = null;
- /// <summary>
- /// 排产序号
- /// </summary>
- private string _GxPlanNo = "";
- UltraComboEditor uceDimaM = new UltraComboEditor();//芯棒直径
- /// <summary>
- /// 行首背景色
- /// </summary>
- private Color _backColor = new Color();
- string proPlanId = "";
- string gxPlanNo = "";
- /// <summary>
- /// 调整行集合
- /// </summary>
- private ArrayList _entityList = null;
- public FrmHeatProductionMesGXRCL()
- {
- InitializeComponent();
- //this.IsLoadUserView = true;
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query"://查询
- Query();
- break;
-
- case "Recalculate"://设置高新
- Recalculate();
- break;
- case "Recalculate2"://撤销高新
- Recalculate2();
- break;
- case "Export": //导出
- // GridHelper.ulGridToExcel(ultraJGGX, "热处理高新");
- ExportData();
- break;
-
- case "Close": //关闭
- this.Close();
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraJGGX, "热处理高新");
- }
- private void FrmPlnOrderZgS_Load(object sender, EventArgs e)
- {
- if (CustomInfo == null) { CustomInfo = ""; }
- //设置列头名称
- EntityHelper.ShowGridCaption<HotHeatProductionMesGxEntity>(ultraJGGX.DisplayLayout.Bands[0]);
- if (CustomInfo == "0")
- {
- PlanComm.setGridActivation(this.ultraJGGX.DisplayLayout.Bands[0], "CHC");//, "OutsBilletFl"
- }
- else
- {
- BaseHelper.setOtherColumnReadOnly(ultraJGGX, new string[] { "CHC", "HighProdWeight", "HighMateWeight", "EstimatedUnitPrice", "EstimatedCost", "HighTechCode" });
- //tzh 后续改颜色
- BaseHelper.setColumnBackColor(ultraJGGX, new string[] { "HighProdWeight", "HighMateWeight", "EstimatedUnitPrice", "EstimatedCost", "HighTechCode" });
- //BaseHelper.setOtherColumnReadOnly(ultraJGGX, new string[] { "CHC"});
- //BaseHelper.setOtherColumnReadOnly(ultraRCLGX, new string[] { "CHC", "Mgcd", "DiameterMandrel", "Zzcd", "Ggfqs", "Cpcd", "Qt", "Qw", "Bcs", "Dbcplcd", "Gpzj", "WgH", "WgD", "QuantityPurchased", "RulerLength", "Ssl", "Mz", "Jhlc" });
- //tzh 后续改颜色
- // BaseHelper.setColumnBackColor(ultraRCLGX, new string[] { "Pass", "Mgcd", "DiameterMandrel", "Zzcd", "Ggfqs", "Cpcd", "Qt", "Qw", "Bcs", "Dbcplcd", "Gpzj", "WgH", "WgD", "HtcgzlMax", "HtcgzlMin", "QuantityPurchased", "RulerLength", "Dbcplzl", "Ssl", "Mz", "Jhlc", "Zzzl", "Zzcd", "Dbcplcd", "QuantityPurchased" });
- //BaseHelper.setColumnBackColor2(ultraGridZgS, new string[] { "Mgbh", "Mgwj" });
-
- }
- //BaseHelper.SetGroupBySum(ultraJGGX, new string[] { "HighMateWeight", "EstimatedCost" }, "CxNo");
- //if (CustomInfo != "0") { BaseHelper.ForbidSort(ultraJGGX); }
- BaseHelper.GridColumnSum(ultraJGGX, new string[] { "HighMateWeight", "EstimatedCost", "ProdWeight", "MateWeight", "SteelWaste", "EstimatedUnitPrice" });
- _backColor = ultraJGGX.DisplayLayout.Override.RowSelectorAppearance.BackColor;
-
- InitColorStyle();
-
- }
- /// <summary>
- /// 初始化列状态
- /// </summary>
- private void InitColorStyle()
- {
-
- UltraNumericEditor[] uneArr = new UltraNumericEditor[3];
- for (int i = 0; i < uneArr.Length; i++)
- {
- uneArr [i]= new UltraNumericEditor();
- uneArr[i].NumericType =NumericType.Double;
- if (i == 1)
- {
- uneArr[i].MaskInput = "nnnnn";
- }
- else
- {
- uneArr[i].MaskInput = "nnnnn.nn";
- }
-
- uneArr[i].SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always;
- this.Controls.Add(uneArr[i]);
- uneArr[i].Visible = false;
- }
-
- decisionFlsg(false);
-
- }
- private void decisionFlsg( Boolean b) {
- //if (b)
- //{
- // UltraComboEditor uceAbc = new UltraComboEditor();
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Pass"].EditorComponent = uceAbc;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Pass"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["DiameterMandrel"].EditorComponent = uceAbc;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["DiameterMandrel"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
-
- // ValueList vlistSteel1 = new ValueList(); ;
- // vlistSteel1.ValueListItems.Insert(0, "1", "1");
- // vlistSteel1.ValueListItems.Insert(1, "2", "2");
- // vlistSteel1.ValueListItems.Insert(2, "3", "3");
- // vlistSteel1.ValueListItems.Insert(3, "4", "4");
- // vlistSteel1.ValueListItems.Insert(4, "5", "5");
- // vlistSteel1.ValueListItems.Insert(5, "6", "6");
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Ggfqs"].ValueList = vlistSteel1;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Ggfqs"].CellActivation = Activation.AllowEdit;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Bcs"].ValueList = vlistSteel1;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Bcs"].CellActivation = Activation.AllowEdit;
- // DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryMandrelSpec",
- // new object[] { "1" }, this.ob);
- // if (dt != null && dt.Rows.Count > 0)
- // {
- // ValueList vlistSteel = PlanComm.GeneralValuelist(ref dt, "XX", "XX");
- // //vlistSteel.ValueListItems.Insert(0, "", "");
- // ultraJGGX.DisplayLayout.Bands[0].Columns["DiameterMandrel"].ValueList = vlistSteel;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["DiameterMandrel"].CellActivation = Activation.AllowEdit;
- // }
- // DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryMandrelSpec",
- // new object[] { "2" }, this.ob);
- // if (dt1 != null && dt1.Rows.Count > 0)
- // {
- // ValueList vlistSteel = PlanComm.GeneralValuelist(ref dt1, "XX", "XX");
- // //vlistSteel.ValueListItems.Insert(0, "", "");
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Pass"].ValueList = vlistSteel;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Pass"].CellActivation = Activation.AllowEdit;
- // }
- // DataTable dt2 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryMandrelSpec",
- // new object[] { "3" }, this.ob);
- // if (dt2 != null && dt2.Rows.Count > 0)
- // {
- // ValueList vlistSteel = PlanComm.GeneralValuelist(ref dt2, "XX", "XX");
- // //vlistSteel.ValueListItems.Insert(0, "", "");
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Mgwj"].ValueList = vlistSteel;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Mgwj"].CellActivation = Activation.AllowEdit;
- // }
- // DataTable dt3 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryMandrelSpec",
- // new object[] { "4" }, this.ob);
- // if (dt3 != null && dt3.Rows.Count > 0)
- // {
- // ValueList vlistSteel = PlanComm.GeneralValuelist(ref dt3, "XX", "XX");
- // //vlistSteel.ValueListItems.Insert(0, "", "");
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Mgbh"].ValueList = vlistSteel;
- // ultraJGGX.DisplayLayout.Bands[0].Columns["Mgbh"].CellActivation = Activation.AllowEdit;
- // }
-
- //}
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp.queryCXcode", new object[] { "1" }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- ValueList vlistSteel = PlanComm.GeneralValuelist(ref dt, "GX_CODE", "GX_NAME");
- ultraJGGX.DisplayLayout.Bands[0].Columns["HighTechCode"].ValueList = vlistSteel;
- ultraJGGX.DisplayLayout.Bands[0].Columns["HighTechCode"].CellActivation = Activation.AllowEdit;
- }
-
- }
- private void InitTime()
- {
- DateTime now = DateTime.Now;
- DateTime d1 = new DateTime(now.Year, now.Month, 1);
- DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
-
- }
-
-
- /// <summary>
- /// 查询
- /// </summary>
- private void Query()
- {
-
-
-
- WaitingForm2 wf3 = new WaitingForm2("正在刷新,请稍候....");
- try
- {
- this.Cursor = Cursors.WaitCursor;
- //执行状态
- // string[] statusArr = contorlPlanStatus1.statusArr;
- //查询时间
- string acctPeriod = "";
- acctPeriod = txtAcctPeriod.Text.Trim();
- List<HotHeatProductionMesGxEntity> listSource = EntityHelper.GetData<HotHeatProductionMesGxEntity>
- ("com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp.selectrclgx", new object[] { acctPeriod }, this.ob);
- HotHeatProductionMesGxEntityBindingSource.DataSource = listSource;
-
-
-
- _entityList = null;
- _ProPlanId = "";
- _ProPlanId = "";
-
- }
- finally
- {
- wf3.Close();
- this.Cursor = Cursors.Default;
- }
- }
-
-
-
- private void ultraRCLGX_CellChange(object sender, CellEventArgs e)
- {
- try
- {
- ultraJGGX.UpdateData();
- //if (e.Cell.Column.Key.Equals("CHC"))
- //{
- // IQueryable<UltraGridRow> chcRows = ultraJGGX.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
- // if (chcRows != null && chcRows.Count() > 0)
- // {
- // decisionFlsg(true);
- // }
- // else
- // {
- // decisionFlsg(false);
- // }
- //}
- foreach (var ultraGridRow in ultraJGGX.Rows)
- {
- if ((bool)ultraGridRow.Cells["CHC"].Value)
- {
- decimal HighProdWeight = 0;
- if (ultraGridRow.Cells["HighProdWeight"].Value.ToString() != "")
- {
- HighProdWeight = decimal.Parse((ultraGridRow.Cells["HighProdWeight"].Value.ToString()));//高新成品
- }
- decimal HighMateWeight = 0;
- if (ultraGridRow.Cells["HighMateWeight"].Value.ToString() != "")
- {
- HighMateWeight = decimal.Parse(ultraGridRow.Cells["HighMateWeight"].Value.ToString());//高新坯料
- }
- decimal EstimatedUnitPrice = 0;
- if (ultraGridRow.Cells["HighMateWeight"].Value.ToString() != "" && ultraGridRow.Cells["EstimatedUnitPrice"].Value.ToString() != "")
- {
- EstimatedUnitPrice = decimal.Parse(ultraGridRow.Cells["EstimatedUnitPrice"].Value.ToString());//单价
- ultraGridRow.Cells["estimatedCost"].Value = HighMateWeight * EstimatedUnitPrice;
- }
- decimal ProdWeight = 0;
- if (ultraGridRow.Cells["ProdWeight"].Value.ToString() != "")
- {
- ProdWeight = decimal.Parse((ultraGridRow.Cells["ProdWeight"].Value.ToString()));//正常成品
- }
- decimal MateWeight = 0;
- if (ultraGridRow.Cells["MateWeight"].Value.ToString() != "")
- {
- MateWeight = decimal.Parse(ultraGridRow.Cells["MateWeight"].Value.ToString());//正常来料
- }
- /*if (HighMateWeight > MateWeight)
- {
- MessageUtil.ShowTips("高新的来料不能大于正常的来料!");
- ultraGridRow.Cells["HighMateWeight"].Value = "0";
- }*/
- if (HighProdWeight > ProdWeight)
- {
- MessageUtil.ShowTips("高新的成品不能大于正常的成品!");
- ultraGridRow.Cells["HighProdWeight"].Value = "0";
- }
- if (ultraGridRow.Cells["HighTechCode"].Value.ToString() != "")
- {
- ultraGridRow.Cells["HighTechName"].Value = ultraGridRow.Cells["HighTechCode"].Text;
- }
- }
- }
- }
- catch (Exception)
- {
- }
-
- }
-
- /// <summary>
- /// 设置高新
- /// </summary>
- private void Recalculate()
- {
- try
- {
- ArrayList messageErr = new ArrayList();
- ultraJGGX.UpdateData();
- ArrayList list = ProducHelper.GetChcRows<HotHeatProductionMesGxEntity>(ultraJGGX);
- if (list == null || list.Count == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
-
- ArrayList jsonList = new ArrayList();
- foreach (HotHeatProductionMesGxEntity entity in list)
- {
- jsonList.Add(JSONFormat.Format(entity));
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否保存高新?") == DialogResult.No)
- {
- return;
- }
- //PlanComm.WaitFromOpen(this.Cursor);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
- ccp.MethodName = "recalculateRCL";
- ccp.ServerParams = new object[] { jsonList,"1" };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // PlanComm.WaitFromColse(this.Cursor);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- Query();
- }
- }
- catch (Exception ex)
- {
- // PlanComm.WaitFromColse(this.Cursor);
- if (!(ex is MESException))
- {
- MessageUtil.ShowError(ex.Message);
- }
- }
- }
- /// <summary>
- /// 撤销高新
- /// </summary>
- private void Recalculate2()
- {
- try
- {
- ArrayList messageErr = new ArrayList();
- ultraJGGX.UpdateData();
- ArrayList list = ProducHelper.GetChcRows<HotHeatProductionMesGxEntity>(ultraJGGX);
- if (list == null || list.Count == 0)
- {
- MessageUtil.ShowTips("请选择数据!");
- return;
- }
- ArrayList jsonList = new ArrayList();
- foreach (HotHeatProductionMesGxEntity entity in list)
- {
- jsonList.Add(JSONFormat.Format(entity));
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否撤销高新?") == DialogResult.No)
- {
- return;
- }
- // PlanComm.WaitFromOpen(this.Cursor);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.plnsaleord.GpOptimize.CorePlnZgMStoGp";
- ccp.MethodName = "recalculateRCL";
- ccp.ServerParams = new object[] { jsonList,"0" };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // PlanComm.WaitFromColse(this.Cursor);
- if (ccp.ReturnCode == -1) return;
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("保存成功!"))
- {
- Query();
- }
- }
- catch (Exception ex)
- {
- //PlanComm.WaitFromColse(this.Cursor);
- if (!(ex is MESException))
- {
- MessageUtil.ShowError(ex.Message);
- }
- }
- }
-
- }
- }
|