| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862 |
- 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.OrderManage.entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- 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;
- namespace Core.StlMes.Client.PlnSaleOrd.OrderManage.froms
- {
- public partial class FrmBomConfirm : FrmBase
- {
- private string Bom = "";//原BOM
- private string GradeCode = "";//原钢种代码
- private string GradeName = "";//原钢种
- private string SpecCode = "";//原规格代码
- private string SpecName = "";//原规格
- private string OrdLnDlyPk = "";//交货行PK
- private string ProPlanId = "";//订单编号
- private string GxPlanNo = "";//排产序号
- private string PlineCodeD = "";//轧管产线
- private ArrayList PlineCodeEList = null;//镦拔扩产线
- private ArrayList PlineCodeFList = null;//热处理产线
- private ArrayList PlineCodeGList = null;//加工产线
- private string MscPline = "";//原制程索引号
- private string Month = "";//轧制月份
- private string PassCode = "";//孔型代码
- private string PassName = "";//孔型
- private string DimaterManderl = "";//芯棒直径
- private string AimDimater = "";
- private string AimHeight = "";
- private string specCodeR = "";//轧管规格代码
- private string specNameR = "";//轧管规格
- private string indexSeq = "";//制程号
- public bool Flag = false;
- private string[] groupCic = null;
- private string cicGp = "";
- private string PlineCodeZz = "";//铸造产线
- private int num = 0;
- public FrmBomConfirm()
- {
- InitializeComponent();
- }
- public FrmBomConfirm(string ordLnDlyPk, string proPlanId, string gxPlanNo, OpeBase ob, string[] _groupCic, string _cicGp, int _num)
- {
- InitializeComponent();
- num=_num;
- this.OrdLnDlyPk = ordLnDlyPk;
- this.ProPlanId = proPlanId;
- this.GxPlanNo = gxPlanNo;
- this.ob = ob;
- groupCic = _groupCic;
- cicGp = _cicGp;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- }
- private void FrmBomConfirm_Load(object sender, EventArgs e)
- {
- BaseHelper.setOtherColumnReadOnly(entityGridBom, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridD, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridE, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridF, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridG, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridPass, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(entityGridDimater, new string[] { "" });
- BaseHelper.setOtherColumnReadOnly(ultraGridGrade, new string[] { "" });
- BaseHelper.InitCellPosition(entityGridD, new string[] { "HrCapcty", "PrdRate", "DblLenMax", "RolLenMin", "RolLenMax", "CropEnd", "MandrelSize" });
- BaseHelper.InitCellPosition(entityGridE, new string[] { "HrCapcty" });
- BaseHelper.InitCellPosition(entityGridF, new string[] { "HrCapcty" });
- BaseHelper.InitCellPosition(entityGridG, new string[] { "HrCapcty" });
- BaseHelper.InitCellPosition(entityGridPass, new string[] { "PassName" });
- BaseHelper.InitCellPosition(entityGridDimater, new string[] { "DiameterMandrel" });
- InitData();
- }
- private void InitData()
- {
- GetPlineEByProPlanId(ProPlanId);
- GetPlineFByProPlanId(ProPlanId);
- GetPlineGByProPlanId(ProPlanId);
- GetZgPlanInfo(ProPlanId, GxPlanNo);
- //GetPlanOrderInfo(OrdLnDlyPk, ProPlanId);
- GetSpecBySpecName(SpecName);
- txtSpec.Value = SpecName;
- txtGrade.Value = GradeName;
- txtDimater.Value = DimaterManderl;
- txtPass.Value = PassName;
- GetBomByOrdLnDlyPk(OrdLnDlyPk);
- GetGradeCic(GradeCode);
- GetPlineCodeZz(ProPlanId, GxPlanNo);
- }
- private void GetPlineCodeZz(string ProPlanId, string GxPlanNo)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.queryZzPlin",
- new object[] { ProPlanId, GxPlanNo }, this.ob);
- GridHelper.CopyDataToDatatable(dt, dataTable2, true);
- foreach (UltraGridRow ugr in entityGridZz.Rows)
- {
- string stdIdx = ugr.Cells["PLINE_CODE"].Value.ToString();
- if (stdIdx.Equals(PlineCodeZz))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Activate();
- return;
- }
- }
- }
- /// <summary>
- /// 查询轧管订单信息
- /// </summary>
- /// <param name="proPlanId"></param>
- /// <param name="gxPlanNo"></param>
- public void GetZgPlanInfo(string proPlanId, string gxPlanNo)
- {
- DataTable listSource = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getZgPlanInfo",
- new object[] { ProPlanId, GxPlanNo }, this.ob);
- if (listSource.Rows.Count > 0)
- {
- this.PlineCodeD = listSource.Rows[0]["PLINE_CODE"].ToString();
- this.SpecName = listSource.Rows[0]["DIAMETER_GP"].ToString();
- this.Month = listSource.Rows[0]["PRO_MONTH"].ToString();
- this.PassName = listSource.Rows[0]["PASS_NAME"].ToString();
- this.PassCode = listSource.Rows[0]["PASS_CODE"].ToString();
- this.DimaterManderl = listSource.Rows[0]["DIAMETER_MANDREL"].ToString();
- this.AimDimater = listSource.Rows[0]["OUTDIAMETER_ZG"].ToString();
- this.AimHeight = listSource.Rows[0]["WALLTHICK_ZG"].ToString();
- this.GradeCode = listSource.Rows[0]["GRADECODE"].ToString();
- this.GradeName = listSource.Rows[0]["GRADENAME"].ToString();
- MscPline = listSource.Rows[0]["INDEX_SEQ"].ToString();
- Bom = listSource.Rows[0]["BOM"].ToString();
- PlineCodeZz = listSource.Rows[0]["PLINE_CODE_ZZ"].ToString();
- }
- }
- /// <summary>
- /// 查询轧管工序合同
- /// </summary>
- /// <param name="ordLnDlyPk"></param>
- /// <param name="proPlanId"></param>
- //public void GetPlanOrderInfo(string ordLnDlyPk, string proPlanId)
- //{
- // DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlanOrderInfo", new object[] { ordLnDlyPk, proPlanId }, this.ob);
- // if (dt != null && dt.Rows.Count > 0)
- // {
- // MscPline = dt.Rows[0]["INDEX_SEQ"].ToString();
- // //Bom = dt.Rows[0]["Bom"].ToString();
- // }
- // else { MscPline = ""; Bom = ""; }
- //}
- /// <summary>
- /// 通过规格名称查询规格代码
- /// </summary>
- /// <param name="ordLnDlyPk"></param>
- /// <param name="proPlanId"></param>
- public void GetSpecBySpecName(string specName)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getSpecBySpecName", new object[] { specName }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- SpecCode = dt.Rows[0]["SPEC_CODE"].ToString();
- }
- else { SpecCode = ""; }
- }
- /// <summary>
- /// 查询BOM
- /// </summary>
- /// <param name="ordLnDlyPk"></param>
- public void GetBomByOrdLnDlyPk(string ordLnDlyPk)
- {
- List<SlmOrdDesignBomEntity> listSource = EntityHelper.GetData<SlmOrdDesignBomEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getBomByOrdLnDlyPk",
- new object[] { ordLnDlyPk }, this.ob);
- slmOrdDesignBomEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count > 0)
- {
- foreach (UltraGridRow ugr in entityGridBom.Rows)
- {
- specCodeR = ugr.Cells["SpecCodeR"].Text.ToString();
- specNameR = ugr.Cells["SpecNameR"].Text.ToString();
- string bom = ugr.Cells["Bom"].Value.ToString();
- string grade = ugr.Cells["Gradename"].Value.ToString();
- string plinMsc = ugr.Cells["MscPline"].Value.ToString();
- if (bom.Equals(Bom) && grade.Equals(GradeName) && plinMsc.Equals(MscPline))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Activate();
- return;
- }
- }
- }
- }
- /// <summary>
- /// 通过产线与管坯规格查询孔型
- /// </summary>
- /// <param name="plineCode"></param>
- /// <param name="specName"></param>
- public void GetPassCodeByPlineAndSpec(string plineCode, string speCode)
- {
- List<comBasePassModelEntity> listSource = EntityHelper.GetData<comBasePassModelEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPassCodeByPlineAndSpec",
- new object[] { plineCode, speCode }, this.ob);
- comBasePassModelEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0)
- {
- foreach (UltraGridRow ugr in entityGridPass.Rows)
- {
- comBasePassModelEntity entity = (comBasePassModelEntity)ugr.ListObject;
- if (entity.PassCode.Equals(PassCode))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- ugr.Activate();
- }
- }
- }
- }
- /// <summary>
- /// 查询芯棒
- /// </summary>
- /// <param name="plineCode"></param>
- /// <param name="passCode"></param>
- /// <param name="dimater"></param>
- /// <param name="height"></param>
- public void GetDiameterMandrel(String plineCode, String passCode, String dimater, String height)
- {
- List<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getDiameterMandrel",
- new object[] { plineCode, passCode, dimater, height }, this.ob);
- comBaseMandrelEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0)
- {
- if (DimaterManderl.Equals("") || DimaterManderl == null)
- {
- DimaterManderl = "0";
- }
- foreach (UltraGridRow ugr in entityGridDimater.Rows)
- {
- Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity entity = (Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity)ugr.ListObject;
- string DiameterMandrelEntity = entity.DiameterMandrel.ToString();
- if (entity.DiameterMandrel.ToString().Equals("") || entity.DiameterMandrel.ToString() == null)
- {
- DiameterMandrelEntity = "0";
- }
- if (Math.Abs(Double.Parse(DiameterMandrelEntity) - Double.Parse(DimaterManderl)) <= 0.00001)
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- ugr.Activate();
- }
- }
- }
- }
- /// <summary>
- /// 通过产线与管坯规格查询孔型
- /// </summary>
- /// <param name="plineCode"></param>
- /// <param name="specName"></param>
- public ArrayList getPassCodeByPlineAndMonth(string plineCode, string month)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPassCodeByPlineAndMonth", new object[] { plineCode, month }, this.ob);
- ArrayList passCodeList = null;
- if (dt != null && dt.Rows.Count > 0)
- {
- passCodeList = new ArrayList();
- for(int i=0;i<dt.Rows.Count;i++){
- passCodeList.Add(dt.Rows[i]["PASS_CODE"].ToString());
- }
- }
- return passCodeList;
- }
- /// <summary>
- /// 通过轧制订单编号查询镦拔扩产线
- /// </summary>
- /// <param name="proPlanId"></param>
- public void GetPlineEByProPlanId(string proPlanId)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineEByProPlanId", new object[] { proPlanId }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- PlineCodeEList = new ArrayList();
- foreach (DataRow dr in dt.Rows)
- {
- PlineCodeEList.Add(dr["PLINE_CODE"].ToString());
- }
- }
- }
- /// <summary>
- /// 通过轧制订单编号查询热处理产线
- /// </summary>
- /// <param name="proPlanId"></param>
- public void GetPlineFByProPlanId(string proPlanId)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineFByProPlanId", new object[] { proPlanId }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- PlineCodeFList = new ArrayList();
- foreach (DataRow dr in dt.Rows)
- {
- PlineCodeFList.Add(dr["PLINE_CODE"].ToString());
- }
- }
- }
- /// <summary>
- /// 通过轧制订单编号查询加工产线
- /// </summary>
- /// <param name="proPlanId"></param>
- public void GetPlineGByProPlanId(string proPlanId)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineGByProPlanId", new object[] { proPlanId }, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- PlineCodeGList = new ArrayList();
- foreach (DataRow dr in dt.Rows)
- {
- PlineCodeGList.Add(dr["PLINE_CODE"].ToString());
- }
- }
- }
- /// <summary>
- /// 查询轧管产线能力
- /// </summary>
- /// <param name="inMaterialNo">投入物料</param>
- /// <param name="outMaterialNo">产出物料</param>
- /// <param name="designKey">工艺主键</param>
- /// <param name="mscPline">制程</param>
- public void GetPlineD(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
- {
- List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineD",
- new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
- slmBaseMaterialDPlEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0)
- {
- foreach (UltraGridRow ugr in entityGridD.Rows)
- {
- if (ugr.GetValue("PlineCode").Equals(PlineCodeD))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- ugr.Activate();
- }
- }
- }
- }
- /// <summary>
- /// 查询镦拔扩产线能力
- /// </summary>
- /// <param name="inMaterialNo">投入物料</param>
- /// <param name="outMaterialNo">产出物料</param>
- /// <param name="designKey">工艺主键</param>
- /// <param name="mscPline">制程</param>
- public void GetPlineE(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
- {
- List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineE",
- new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
- slmBaseMaterialEPlEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0 && PlineCodeEList != null)
- {
- foreach (UltraGridRow ugr in entityGridE.Rows)
- {
- if (PlineCodeEList.Contains(ugr.GetValue("PlineCode")))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- }
- }
- }
- }
- /// <summary>
- /// 查询热处理产线能力
- /// </summary>
- /// <param name="inMaterialNo">投入物料</param>
- /// <param name="outMaterialNo">产出物料</param>
- /// <param name="designKey">工艺主键</param>
- /// <param name="mscPline">制程</param>
- public void GetPlineF(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
- {
- List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineF",
- new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
- slmBaseMaterialFPlEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0 && PlineCodeFList != null)
- {
- foreach (UltraGridRow ugr in entityGridF.Rows)
- {
- if (PlineCodeFList.Contains(ugr.GetValue("PlineCode")))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- }
- }
- }
- }
- /// <summary>
- /// 查询加工产线能力
- /// </summary>
- /// <param name="inMaterialNo">投入物料</param>
- /// <param name="outMaterialNo">产出物料</param>
- /// <param name="designKey">工艺主键</param>
- /// <param name="mscPline">制程</param>
- public void GetPlineG(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
- {
- List<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity> listSource = EntityHelper.GetData<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity>
- ("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getPlineG",
- new object[] { inMaterialNo, outMaterialNo, designKey, mscPline }, this.ob);
- slmBaseMaterialKPlEntityBindingSource.DataSource = listSource;
- if (listSource != null && listSource.Count() > 0 && PlineCodeGList != null)
- {
- foreach (UltraGridRow ugr in entityGridG.Rows)
- {
- if (PlineCodeGList.Contains(ugr.GetValue("PlineCode")))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Cells["CHC"].Value = true;
- }
- }
- }
- }
- /// <summary>
- /// 钢种索引码
- /// </summary>
- private void GetGradeCic(string gradCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.getQueryGrade",
- new object[] { groupCic }, ob);
- DataRow[] dr = dt.Select("GRADECODE LIKE '" + gradCode + "'", "");
- if (dr == null || dr.Length == 0)
- {
- DataTable dt1 = new DataTable();
- GridHelper.CopyDataToDatatable(dt1, this.dataTable1, true);
- return;
- }
- DataTable tmp = dr[0].Table.Clone(); // 复制DataRow的表结构
- foreach (DataRow row in dr)
- {
- tmp.ImportRow(row); // 将DataRow添加到DataTable中
- }
- GridHelper.CopyDataToDatatable(tmp, this.dataTable1, true);
- foreach (UltraGridRow ugr in ultraGridGrade.Rows)
- {
- string stdIdx = ugr.Cells["CIC"].Value.ToString();
- if (stdIdx.Equals(cicGp))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Activate();
- return;
- }
- }
- }
- private void entityGridBom_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridBom.ActiveRow;
- if (ugr == null)
- {
- slmBaseMaterialDPlEntityBindingSource.Clear();
- slmBaseMaterialEPlEntityBindingSource.Clear();
- slmBaseMaterialFPlEntityBindingSource.Clear();
- slmBaseMaterialKPlEntityBindingSource.Clear();
- }
- else
- {
- BaseHelper.SetRowChecked(entityGridBom);
- SlmOrdDesignBomEntity entity = (SlmOrdDesignBomEntity)ugr.ListObject;
- string wholeBacklog = entity.WholeBacklog;
- if (wholeBacklog.Contains("D"))
- {
- ultraTabControl1.Tabs[0].Enabled = true;
- GetPlineD(entity.DInMaterialNo, entity.DOutMaterialNo, entity.DesignKey, entity.MscPline);
- }
- else
- {
- ultraTabControl1.Tabs[0].Enabled = false;
- }
- if (wholeBacklog.Contains("E"))
- {
- ultraTabControl1.Tabs[1].Enabled = true;
- GetPlineE(entity.EInMaterialNo, entity.EOutMaterialNo, entity.DesignKey, entity.MscPline);
- }
- else
- {
- ultraTabControl1.Tabs[1].Enabled = false;
- }
- if (wholeBacklog.Contains("F"))
- {
- ultraTabControl1.Tabs[2].Enabled = true;
- GetPlineF(entity.FInMaterialNo, entity.FOutMaterialNo, entity.DesignKey, entity.MscPline);
- }
- else
- {
- ultraTabControl1.Tabs[2].Enabled = false;
- }
- if (wholeBacklog.Contains("G"))
- {
- ultraTabControl1.Tabs[3].Enabled = true;
- GetPlineG(entity.IInMaterialNo, entity.IOutMaterialNo, entity.DesignKey, entity.MscPline);
- }
- else
- {
- ultraTabControl1.Tabs[3].Enabled = false;
- }
- GetGradeCic(entity.Gradecode);
- }
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "ChangeGrade": // ButtonTool
- ChangeZgPlan("1");
- break;
- case "ChangeSpec": // ButtonTool
- ChangeZgPlan("2");
- break;
- case "ChangePline": // ButtonTool
- ChangeZgPlan("3");
- break;
- case "Close": // ButtonTool
- this.Close();
- break;
- }
- }
- private void ChangeZgPlan(string flag)
- {
- entityGridBom.UpdateData();
- entityGridD.UpdateData();
- string cic = "";
- string casTyte = "";
- //BOM
- ArrayList bomList = BaseHelper.GetRows<SlmOrdDesignBomEntity>(entityGridBom, "CHC", "True");
- if (bomList == null || bomList.Count > 1) { MessageUtil.ShowWarning("请选择BOM!", entityGridBom); return; }
- SlmOrdDesignBomEntity bomEntity = (SlmOrdDesignBomEntity)bomList[0];
- if (!bomEntity.MscPline.Equals(MscPline))
- {
- MessageUtil.ShowWarning("制程发生改变,请重新选择BOM(如需变更制程,请重新下发)!", entityGridBom); return;
- }
- //判断投入产出是否禁用
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.changeZgInOutMate", new object[] { PlineCodeD, bomEntity.DInMaterialNo, bomEntity.DOutMaterialNo }, ob);
- if (dt.Rows.Count > 0)
- {
- MessageUtil.ShowWarning("选择的投入产出在投入产出物料及产线能力维护表里已经被禁用了!", entityGridBom); return;
- }
- //轧管产线
- ArrayList plineDList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity>(entityGridD, "CHC", "True");
- if (plineDList == null || plineDList.Count > 1) { MessageUtil.ShowWarning("请选择轧管产线!", entityGridD); return; }
- Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity plineDentiy = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)plineDList[0];
- string plineCode = plineDentiy.PlineCode;
- string plineName = plineDentiy.PlineName;
- //孔型
- ArrayList passList = BaseHelper.GetRows<comBasePassModelEntity>(entityGridPass, "CHC", "True");
- if (passList == null || passList.Count > 1) { MessageUtil.ShowWarning("请选择孔型!", entityGridPass); return; }
- comBasePassModelEntity passEntity = (comBasePassModelEntity)passList[0];
- string passCode = passEntity.PassCode;
- string passName = passEntity.PassName;
- //验证孔型
- ArrayList passCodeList = getPassCodeByPlineAndMonth(plineCode,Month);
- if (passCodeList == null || !passCodeList.Contains(passCode))
- {
- MessageUtil.ShowWarning("没有维护产线:" + plineName+ " "+ Month + "的孔型计划!", entityGridBom); return;
- }
- //芯棒
- ArrayList dimaterList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity>(entityGridDimater, "CHC", "True");
- string dimaterManderl = "0";
- if (dimaterList != null && dimaterList.Count > 0)
- {
- Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity dimaterEntity = (Core.StlMes.Client.PlnSaleOrd.工序排产.entity.ComBaseMandrelEntity)dimaterList[0];
- dimaterManderl = dimaterEntity.DiameterMandrel.ToString();
- }
- //if (PlineCodeEList != null)
- //{
- // ArrayList plineEList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialEPlEntity>(entityGridE, "CHC", "True");
- // if (plineEList == null) { MessageUtil.ShowWarning("BOM没有相应的镦拔扩产线,不能修改!", entityGridE); return; }
- //}
- //if (PlineCodeFList != null)
- //{
- // ArrayList plineFList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialFPlEntity>(entityGridF, "CHC", "True");
- // if (plineFList == null) { MessageUtil.ShowWarning("BOM没有相应的热处理产线,不能修改!", entityGridF); return; }
- //}
- //if (PlineCodeGList != null)
- //{
- // ArrayList plineGList = BaseHelper.GetRows<Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialKPlEntity>(entityGridG, "CHC", "True");
- // if (plineGList == null) { MessageUtil.ShowWarning("BOM没有相应的加工产线,不能修改!", entityGridG); return; }
- //}
-
- //管坯规格
- string specCode = bomEntity.SpecCodeD;//制程管坯规格
- string specName = bomEntity.SpecNameD;
- if (specCode.Equals("")) { specCode = bomEntity.SpecCodeZ; specName = bomEntity.SpecNameZ; }
- if (!bomEntity.SpecCodeR.Equals(specCodeR))
- {
- MessageUtil.ShowWarning("轧管规格不同,不能修改!", entityGridBom); return;
- }
- if (flag.Equals("1"))
- {
- if (bomEntity.Gradecode.Equals(GradeCode) || !specCode.Equals(SpecCode))
- {
- MessageUtil.ShowWarning("钢种没有改变/规格发生改变,不能修改钢种!", entityGridBom); return;
- }
- }
- if (flag.Equals("2"))
- {
- if (specCode.Equals(SpecCode) || !bomEntity.Gradecode.Equals(GradeCode))
- {
- MessageUtil.ShowWarning("规格没有改变/钢种发生改变,不能修改规格!", entityGridBom); return;
- }
- }
- ultraGridGrade.UpdateData();
- UltraGridRow row = ultraGridGrade.ActiveRow;
- if (row != null)
- {
- int count = 0;
- foreach (UltraGridRow rows in ultraGridGrade.Rows)
- {
- if (Convert.ToBoolean(rows.Cells["CHC"].Text) == true)
- {
- count++;
- cic = rows.Cells["CIC"].Text.ToString();
- if (rows.Cells["ALLOW_BUY"].Text.ToString().Equals("自炼"))
- {
- casTyte = "0";
- }
- else
- {
- casTyte = "1";
- }
- }
- }
- if (count == 0)
- {
- MessageUtil.ShowWarning("请选择钢种索引码!", entityGridBom); return;
- }
- }
- else
- {
- MessageUtil.ShowTips("无索引码!"); return;
- }
- entityGridZz.UpdateData();
- UltraGridRow rowZz = entityGridZz.ActiveRow;
- string plineCodeZz = "";
- string plineNameZz = "";
- if (bomEntity.WholeBacklog.ToString().Contains("B"))
- {
- if (rowZz == null) { MessageUtil.ShowTips("无适用铸造产线!"); return; }
- else
- {
- int countZz = 0;
- foreach (UltraGridRow rowsZ in entityGridZz.Rows)
- {
- if (Convert.ToBoolean(rowsZ.Cells["CHC"].Text) == true)
- {
- countZz++;
- plineCodeZz = rowsZ.Cells["PLINE_CODE"].Text.ToString();
- plineNameZz = rowsZ.Cells["PLINE_NAME"].Text.ToString();
- if (casTyte.Equals("1"))
- {
- if (!plineCodeZz.Equals("C063"))
- {
- rowsZ.Cells["CHC"].Value = false;
- plineCodeZz = "C063";
- plineNameZz = "连铸坯(外购)";
- //MessageUtil.ShowTips("请选择适用铸造外购产线!");
- //return;
- }
- }
- else
- {
- if (plineCodeZz.Equals("C063"))
- {
- MessageUtil.ShowTips("请选择适用铸造自炼产线!");
- return;
- }
- }
- }
- }
- if (casTyte.Equals("0"))
- {
- if (countZz == 0)
- {
- MessageUtil.ShowWarning("请选择适用铸造产线!", entityGridBom); return;
- }
- }
- }
- }
- if (num > 0)
- {
- //if (MessageUtil.ShowYesNoAndQuestion("存在LJ,装炉,出库支吨,是否需要拆分行?") == DialogResult.Yes)
- //{
- // return;
- //}
- if (MessageUtil.ShowYesNoAndQuestion("存在LJ支吨,是否需要拆分行?") == DialogResult.Yes)
- {
- return;
- }
- }
- string message = "";
- if (flag.Equals("1")) { message = "是否修改钢种?"; } else if (flag.Equals("2")) { message = "是否修改规格?"; } else { message = "是否修改产线/孔型/芯棒/坯子来源?"; }
- if (MessageUtil.ShowYesNoAndQuestion(message) == DialogResult.No)
- {
- return;
- }
- string[] param = BaseHelper.SetData("com.steering.pss.plnsaleord.orderManage.FrmBomConfirm.changeZgPlan", new object[] { bomEntity.Bom, plineCode,
- plineName, specName, passCode,
- passName, dimaterManderl, ProPlanId,
- GxPlanNo,cic,casTyte,plineCodeZz,plineNameZz}, ob);
- if (param == null) { MessageUtil.ShowWarning("服务端处理失败!", entityGridBom); }
- else
- {
- //MessageUtil.ShowWarning(param[1], entityGridBom);
- MessageUtil.ShowTips(param[1]);
- if ((bool.Parse(param[0]))) { Flag = true; InitData(); }
- }
- }
- private void entityGridD_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridD.ActiveRow;
- if (ugr == null)
- {
- comBasePassModelEntityBindingSource.Clear();
- comBaseMandrelEntityBindingSource.Clear();
- return;
- }
- ArrayList bomList = BaseHelper.GetRows<SlmOrdDesignBomEntity>(entityGridBom, "CHC", "True");
- SlmOrdDesignBomEntity bomEntity = (SlmOrdDesignBomEntity)bomList[0];
- string specCode = bomEntity.SpecCodeD;
- if (specCode.Equals(""))
- {
- specCode = bomEntity.SpecCodeZ;
- }
- BaseHelper.SetRowChecked(entityGridD);
- Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity entity = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)ugr.ListObject;
- string plineCode = entity.PlineCode;
- GetPassCodeByPlineAndSpec(plineCode, specCode);
- }
- private void entityGridPass_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridPass.ActiveRow;
- if (ugr == null)
- {
- comBaseMandrelEntityBindingSource.Clear();
- return;
- }
- BaseHelper.SetRowChecked(entityGridPass);
- comBasePassModelEntity entity = (comBasePassModelEntity)ugr.ListObject;
- string passCode = entity.PassCode;
- UltraGridRow ugrD = entityGridD.ActiveRow;
- Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity entityD = (Core.StlMes.Client.PlnSaleOrd.Entity.SlmBaseMaterialDPlEntity)ugrD.ListObject;
- string plineCode = entityD.PlineCode;
- GetDiameterMandrel(plineCode, passCode, AimDimater, AimHeight);
- }
- private void entityGridDimater_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridDimater.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- BaseHelper.SetRowChecked(entityGridDimater);
- }
- private void ultraGridGrade_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridGrade.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- BaseHelper.SetRowChecked(ultraGridGrade);
- UltraGridRow ugr1 = entityGridZz.ActiveRow;
- if (ugr1 == null)
- {
- return;
- }
- foreach (UltraGridRow row in entityGridZz.Rows)
- {
- string stdIdx = row.Cells["PLINE_CODE"].Value.ToString();
- if (ugr.Cells["ALLOW_BUY"].Text.ToString().Equals("自炼"))
- {
- if (!stdIdx.Equals("C063"))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Activate();
- return;
- }
- }
- else
- {
- if (stdIdx.Equals("C063"))
- {
- ugr.Appearance.BackColor = Color.GreenYellow;
- ugr.Activate();
- return;
- }
- }
- }
- }
- private void entityGridZz_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridZz.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- BaseHelper.SetRowChecked(entityGridZz);
- }
- }
- }
|