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;
}
}
}
///
/// 查询轧管订单信息
///
///
///
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();
}
}
///
/// 查询轧管工序合同
///
///
///
//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 = ""; }
//}
///
/// 通过规格名称查询规格代码
///
///
///
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 = ""; }
}
///
/// 查询BOM
///
///
public void GetBomByOrdLnDlyPk(string ordLnDlyPk)
{
List listSource = EntityHelper.GetData
("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;
}
}
}
}
///
/// 通过产线与管坯规格查询孔型
///
///
///
public void GetPassCodeByPlineAndSpec(string plineCode, string speCode)
{
List listSource = EntityHelper.GetData
("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();
}
}
}
}
///
/// 查询芯棒
///
///
///
///
///
public void GetDiameterMandrel(String plineCode, String passCode, String dimater, String height)
{
List listSource = EntityHelper.GetData
("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();
}
}
}
}
///
/// 通过产线与管坯规格查询孔型
///
///
///
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
/// 通过轧制订单编号查询镦拔扩产线
///
///
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());
}
}
}
///
/// 通过轧制订单编号查询热处理产线
///
///
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());
}
}
}
///
/// 通过轧制订单编号查询加工产线
///
///
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());
}
}
}
///
/// 查询轧管产线能力
///
/// 投入物料
/// 产出物料
/// 工艺主键
/// 制程
public void GetPlineD(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
{
List listSource = EntityHelper.GetData
("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();
}
}
}
}
///
/// 查询镦拔扩产线能力
///
/// 投入物料
/// 产出物料
/// 工艺主键
/// 制程
public void GetPlineE(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
{
List listSource = EntityHelper.GetData
("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;
}
}
}
}
///
/// 查询热处理产线能力
///
/// 投入物料
/// 产出物料
/// 工艺主键
/// 制程
public void GetPlineF(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
{
List listSource = EntityHelper.GetData
("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;
}
}
}
}
///
/// 查询加工产线能力
///
/// 投入物料
/// 产出物料
/// 工艺主键
/// 制程
public void GetPlineG(string inMaterialNo, string outMaterialNo, string designKey, string mscPline)
{
List listSource = EntityHelper.GetData
("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;
}
}
}
}
///
/// 钢种索引码
///
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(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(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(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(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(entityGridE, "CHC", "True");
// if (plineEList == null) { MessageUtil.ShowWarning("BOM没有相应的镦拔扩产线,不能修改!", entityGridE); return; }
//}
//if (PlineCodeFList != null)
//{
// ArrayList plineFList = BaseHelper.GetRows(entityGridF, "CHC", "True");
// if (plineFList == null) { MessageUtil.ShowWarning("BOM没有相应的热处理产线,不能修改!", entityGridF); return; }
//}
//if (PlineCodeGList != null)
//{
// ArrayList plineGList = BaseHelper.GetRows(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(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);
}
}
}