using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Format;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
using Core.StlMes.Client.PlnSaleOrd.工序排产;
using Core.StlMes.Client.PlnSaleOrd.炼钢计划;
using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool;
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.炉计划
{
public partial class FrmPlanStoveD : FrmBase
{
///
/// 调整行集合
///
private ArrayList _EntityList = null;
private string[] plineCode = null;//获取产线代码
///
/// 虚拟炉计划id
///
private string _heatPlanNo = "";
///
/// 行首背景色
///
private Color _backColor = new Color();
public FrmPlanStoveD()
{
this.IsLoadUserView = true;
InitializeComponent();
}
private void FrmPlanStoveD_Load(object sender, EventArgs e)
{
//订单排产
EntityHelper.ShowGridCaption(ultraGridZyD.DisplayLayout.Bands[0]);
EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]);
BaseHelper.setUltraGridColumnMaxInput(ultraGridZyD, new string[] { "WtGpSingle", "PlnInsingleWt", "PlnOutsingleW", "ReducedWt" });
BaseHelper.setUltraGridColumnBits(ultraGridZyD, new string[] { "PlnInsingleNum", "PlnOutsingleNum" });
BaseHelper.InitCellPosition(ultraGridZyD, new string[] { "GxProSeq", "GxPlanNo","OrderSeq", "DeliveryNo", "LenRollMax", "LenRollMin", "Aimoutdiameter","Aimwallthick","CcmGxPlanNo","Aimlength" ,"Diameter","LenGpSingle","WtGpSingle","PlnInsingleNum","PlnInsingleWt","PlnOutsingleNum",
"PlnOutsingleW","Outdiameter", "Wallthick","OutdiameterZg","WallthickZg","RollLength","OutnumCut","LenCutend","LenCuthead","DiameterMandrel","CraftSeq", "ReducedWt"});
//BaseHelper.InitCellPositionC(ultraGridZyD, new string[] { "Diameter", "LenGpSingle", "WtGpSingle", "CutNumGp", "LengthM", "WeightM", "PlanIndoubleNum", "PlanIndoubleWt", "RealIndoubleNum", "RealIndoubleWt", "GxPlanNo" });
BaseHelper.GridColumnSum(ultraGridZyD, new string[] { "PlnInsingleWt", "PlnOutsingleW", "ReducedWt" });
BaseHelper.GridColumnCount(ultraGridZyD, new string[] { "PlnInsingleNum", "PlnOutsingleNum" });
//BaseHelper.InitCellPositionMiddle(ultraGridZyD, new string[] { "Isendgx", "IfWlMatched", "IfMonitorZg" });
plineCode = PlanHelper.InitDropPlinePower("D", txtLine, this.ValidDataPurviewIds, this.ob);
StoveHelper.ForbidSort(ultraGridZyD);
BaseHelper.setUltraGridColumnMaxInput(ultraGrid1, new string[] { "WtGpSingle", "PlnInsingleWt", "PlnOutsingleW", "ActuaWt", "TotWeightM", "CutWeight", "ReducedWt", "RealIndoubleWt" });
BaseHelper.setUltraGridColumnBits(ultraGrid1, new string[] { "PlnInsingleNum", "PlnOutsingleNum", "ActuaNum", "TotMumM" });
BaseHelper.InitCellPosition(ultraGrid1, new string[] { "GxProSeq", "GxPlanNo","OrderSeq", "DeliveryNo", "LenRollMax", "LenRollMin", "Aimoutdiameter","Aimwallthick","CcmGxPlanNo","Aimlength" ,"Diameter","LenGpSingle","WtGpSingle","PlnInsingleNum","PlnInsingleWt","PlnOutsingleNum",
"PlnOutsingleW","Outdiameter", "Wallthick","OutdiameterZg","WallthickZg","RollLength","OutnumCut","LenCutend","LenCuthead","DiameterMandrel","CraftSeq","LenGpSingleD","LengthM","CutNumGp","ActuaWt","ActuaNum","TotMumM","TotWeightM","CutWeight","CutLength", "ReducedWt","RealIndoubleNum","RealIndoubleWt"});
//BaseHelper.InitCellPositionC(ultraGridZyD, new string[] { "Diameter", "LenGpSingle", "WtGpSingle", "CutNumGp", "LengthM", "WeightM", "PlanIndoubleNum", "PlanIndoubleWt", "RealIndoubleNum", "RealIndoubleWt", "GxPlanNo" });
BaseHelper.GridColumnSum(ultraGrid1, new string[] { "ActuaWt", "CutWeight", "RealIndoubleWt" });
BaseHelper.GridColumnCount(ultraGrid1, new string[] { "ActuaNum", "RealIndoubleNum" });
StoveHelper.ForbidSort(ultraGrid1);
InitDate();
BaseHelper.SetGroupBySum(ultraGrid1, new string[] { "PlnOutsingleNum", "PlnOutsingleW", "ReducedWt" }, "HeatPlanNo");
BaseHelper.InitComboEditor(ultraComboEditor1, "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD.doQueryStorageNo", "STORAGE_NO", ob, true);
}
private void chcLine_CheckedChanged(object sender, EventArgs e)
{
if (chcLine.Checked) { txtLine.Enabled = true; } else { txtLine.Enabled = false; }
if (chcProPlanId.Checked) { txtProPlanId.Enabled = true; } else { txtProPlanId.Enabled = false; }
if (chcOrderNo.Checked) { txtOrderNo.Enabled = true; } else { txtOrderNo.Enabled = false; }
if (chcId.Checked) { txtId.Enabled = true; } else { txtId.Enabled = false; }
if (chcTime.Checked) { dateBegin.Enabled = true; dateEnd.Enabled = true; } else { dateBegin.Enabled = false; dateEnd.Enabled = false; }
if (chcJudgeNo.Checked) { txtJudgeNo.Enabled = true; } else { txtJudgeNo.Enabled = false; }
if (ultraCheckEditor1.Checked) { txtFeedHeatNo.Enabled = true; } else { txtFeedHeatNo.Enabled = false; }
if (ultraCheckEditor3.Checked) { ultraTextEditor3.Enabled = true; } else { ultraTextEditor3.Enabled = false; }
}
///
/// 初始时间
///
private void InitDate()
{
DateTime datetime = DateTime.Now;
dateBegin.Value = datetime.AddDays(1 - datetime.Day);
dateEnd.Value = datetime.AddDays(1 - datetime.Day).AddMonths(1).AddDays(-1);
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
base.ToolBar_Click(sender, ToolbarKey);
switch (ToolbarKey)
{
case "Query"://查询
QueryM();
break;
case "Issued"://下发
Issued("0");
break;
case "IssuedU"://撤销
Issued("1");
break;
case "UpdateMemo"://修改备注
UpdateMemo();
break;
case"UpdateGoWhere":
updateGoWhere();
break;
case "UpdateFlagHeatNo":
updateFlagHeatNo();
break;
case "CancleFlagHeatNo":
cancleFlagHeatNo();
break;
case "Print"://打印
doPrint();
break;
case "PrintTH"://打印
doPrintTH();
break;
case "PrintTH2"://打印
doPrintTH2();
break;
case "AddFeedLien"://获取上料行
doAddFeedLien();
break;
case "UpdateHeat"://修改轧管判定炉号
UpdateFeedHeattNo();
break;
case "Import"://导出
doImport();
break;
case "Close": //关闭
this.Close();
break;
default:
break;
}
}
///
/// 打印(天淮)
///
private void doPrintTH()
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
string judgeStoveNo = "";
string plineCode = "";
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
if (item.Cells["Planstatus"].Text.ToString().Trim().Equals("计划"))
{
MessageUtil.ShowTips("选中该轧管炉计划状态是计划状态,不能打印!");
return;
}
plineCode = item.Cells["PlineCode"].Text.ToString().Trim();
judgeStoveNo += "'" + item.Cells["FeedHeatNo"].Text.ToString().Trim() + "',";
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要打印的轧管炉计划主信息!");
return;
}
if (judgeStoveNo.Equals("")) return;
judgeStoveNo = judgeStoveNo.Substring(1, judgeStoveNo.Length - 3);
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilZgPlanTH.cpt&op=view" + "&JUDGE_STOVE_NO=" + judgeStoveNo + "&PLINE_CODE=" + plineCode;
FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
fBug.AutoSize = true;
fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fBug.Text = "轧管炉计划打印";
fBug.ShowDialog();
}
///
/// 打印(天淮)
///
private void doPrintTH2()
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
string judgeStoveNo = "";
string plineCode = "";
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
if (item.Cells["Planstatus"].Text.ToString().Trim().Equals("计划"))
{
MessageUtil.ShowTips("选中该轧管炉计划状态是计划状态,不能打印!");
return;
}
plineCode = item.Cells["PlineCode"].Text.ToString().Trim();
judgeStoveNo += "'" + item.Cells["FeedHeatNo"].Text.ToString().Trim() + "',";
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要打印的轧管炉计划主信息!");
return;
}
if (judgeStoveNo.Equals("")) return;
judgeStoveNo = judgeStoveNo.Substring(1, judgeStoveNo.Length - 3);
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilZgPlanTH.cpt&op=view" + "&JUDGE_STOVE_NO=" + judgeStoveNo + "&PLINE_CODE=" + plineCode;
System.Diagnostics.Process.Start(strurl);
//FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
//fBug.AutoSize = true;
//fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
//fBug.Text = "轧管炉计划打印";
//fBug.ShowDialog();
}
///
/// 修改物流去向
///
private void updateGoWhere()
{
this.ultraGridZyD.UpdateData();
IQueryable checkMagRows = this.ultraGridZyD.Rows.AsQueryable().Where(" CHC = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要修改物流去向的数据信息!");
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
PlnZyZgMEntity plnZgTity = (PlnZyZgMEntity)row.ListObject;
plnZgTity.GowhereCode = row.Cells["GowhereCode"].Value.ToString();
plnZgTity.GowhereName = row.Cells["GowhereCode"].Text.ToString();
string plnZgEntity = JSONFormat.Format(plnZgTity);
parmList.Add(plnZgEntity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "updateGoWhere";
ccp.ServerParams = new object[] { parmList };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
QueryM();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 获取天津喷印炉号
///
private void updateFlagHeatNo()
{
this.ultraGridZyD.UpdateData();
IQueryable checkMagRows = this.ultraGridZyD.Rows.AsQueryable().Where(" CHC = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要获取天津喷印炉号的数据信息!");
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
PlnZyZgMEntity plnZgTity = (PlnZyZgMEntity)row.ListObject;
if (!plnZgTity.FlagHeatNo.Equals(""))
{
MessageUtil.ShowTips("已有喷印炉号,不能获取喷印炉号!");
return;
}
string plnZgEntity = JSONFormat.Format(plnZgTity);
parmList.Add(plnZgEntity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "updateFlagHeatNo";
ccp.ServerParams = new object[] { parmList };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("获取成功!"))
{
QueryM();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 撤销喷印炉号
///
private void cancleFlagHeatNo()
{
this.ultraGridZyD.UpdateData();
IQueryable checkMagRows = this.ultraGridZyD.Rows.AsQueryable().Where(" CHC = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要撤销喷印炉号的数据信息!");
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
PlnZyZgMEntity plnZgTity = (PlnZyZgMEntity)row.ListObject;
string plnZgEntity = JSONFormat.Format(plnZgTity);
parmList.Add(plnZgEntity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "cancleFlagHeatNo";
ccp.ServerParams = new object[] { parmList };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("撤销成功!"))
{
QueryM();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
private int activation= 0;
///
/// 导出
///
private void doImport()
{
if (activation < 2)
{
GridHelper.ulGridToExcel(ultraGridZyD, "轧管炉计划主信息");
}
else
{
GridHelper.ulGridToExcel(ultraGrid1, "轧管炉计划详情");
}
}
private void QueryM()
{
if (ultraExpandableGroupBox1.Expanded == false)
{
QueryC();
}
else
{
Query();
}
}
private void Query()
{
//产线
string plineCode = "";
if (chcLine.Checked)
{
plineCode = txtLine.Value == null ? "" : txtLine.Value.ToString();
}
//if (txtLine.Text.Equals(""))
//{
// MessageUtil.ShowTips("请选择产线!");
// return;
//}
string timeBegin = "";
string timeEnd = "";
if (chcTime.Checked && dateBegin.Value != null && dateEnd.Value != null)
{
timeBegin = DateTime.Parse(dateBegin.Value.ToString()).ToString("yyyy-MM-dd");
timeEnd = DateTime.Parse(dateEnd.Value.ToString()).ToString("yyyy-MM-dd");
}
//string plineCode = "";
//if(chcLine.Checked&& txtLine.Value != null){plineCode=txtLine.Value.ToString();}
string orderNo = "";
if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
string proPlanId = "";
if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
string heatId = "";
if (chcId.Checked) { heatId = txtId.Text.Trim(); }
string judgeNo = "";
if (chcJudgeNo.Checked) { judgeNo = txtJudgeNo.Text.Trim(); }
string feedHeatNo = "";
if (ultraCheckEditor1.Checked) { feedHeatNo = txtFeedHeatNo.Text.Trim(); }
string feedHeatNo2 = "";
if (ultraCheckEditor3.Checked) { feedHeatNo2 = ultraTextEditor3.Text.Trim(); }
string lotNo = "";
if (chkLotNo.Checked) {
lotNo = txtLotNo.Text.Trim();
}
string lotNo1 = "";
string lotNo2 = "";
if (this.ultraCheckEditor2.Checked)
{
lotNo1 = this.ultraTextEditor1.Text.Trim();
lotNo2 = this.ultraTextEditor2.Text.Trim();
}
//执行状态
string[] statusArr = contorlPlanStatusZy1.statusArr;
List listSourceM = EntityHelper.GetData
("com.steering.pss.plnsaleord.planStove.FrmPlanStoveD.queryPlanStoveD", new object[] { timeBegin, timeEnd, plineCode, orderNo, proPlanId, heatId, statusArr, judgeNo, feedHeatNo, lotNo, lotNo1, lotNo2, feedHeatNo2 }, ob);
plnZyZgMEntityBindingSource.DataSource = listSourceM;
//GridHelper.RefreshAndAutoSize(ultraGridZyD);
foreach (UltraGridRow ugr in ultraGridZyD.Rows)
{
int countMess = 0;
if (!_heatPlanNo.Equals(""))
{
if (ugr.Cells["HeatPlanNo"].Text.Trim().Equals(_heatPlanNo))
{
ugr.Activate();
break;
}
}
if (_EntityList != null)
{
for (int i = 0; i < _EntityList.Count; i++)
{
PlnZyZgMEntity entity = (PlnZyZgMEntity)_EntityList[i];
if (ugr.Cells["HeatPlanNo"].Text.Trim().Equals(entity.HeatPlanNo))
{
ugr.Appearance.BackColor = Color.Wheat;
ugr.Activate();
}
}
}
//没有实际炉计划,主炉计划变颜色
////foreach (UltraGridRow itemc in ugr.ChildBands[0].Rows)
////{
//// countMess++;
////}
////if (countMess == 0)
////{
//// ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
////}
//if (countMess > 0)
//{
// ugr.Cells["PlnInsingleNum"].Appearance.BackColor = Color.Red;
// ugr.Cells["PlnInsingleWt"].Appearance.BackColor = Color.Red;
//}
}
_EntityList = null;
_heatPlanNo = "";
}
private void QueryC()
{
//产线
string plineCode = "";
if (chcLine.Checked)
{
plineCode = txtLine.Value == null ? "" : txtLine.Value.ToString();
}
//if (txtLine.Text.Equals(""))
//{
// MessageUtil.ShowTips("请选择产线!");
// return;
//}
string timeBegin = "";
string timeEnd = "";
if (chcTime.Checked && dateBegin.Value != null && dateEnd.Value != null)
{
timeBegin = DateTime.Parse(dateBegin.Value.ToString()).ToString("yyyy-MM-dd");
timeEnd = DateTime.Parse(dateEnd.Value.ToString()).ToString("yyyy-MM-dd");
}
//string plineCode = "";
//if(chcLine.Checked&& txtLine.Value != null){plineCode=txtLine.Value.ToString();}
string orderNo = "";
if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
string proPlanId = "";
if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
string heatId = "";
if (chcId.Checked) { heatId = txtId.Text.Trim(); }
string judgeNo = "";
if (chcJudgeNo.Checked) { judgeNo = txtJudgeNo.Text.Trim(); }
string feedHeatNo = "";
if (ultraCheckEditor1.Checked) { feedHeatNo = txtFeedHeatNo.Text.Trim(); }
string lotNo = "";
if(chkLotNo.Checked)
{
lotNo = txtLotNo.Text.Trim();
}
//执行状态
string[] statusArr = contorlPlanStatusZy1.statusArr;
List listSourceC = EntityHelper.GetData
("com.steering.pss.plnsaleord.planStove.FrmPlanStoveD.queryPlanStoveM", new object[] { timeBegin, timeEnd, plineCode, orderNo, proPlanId, heatId, statusArr, judgeNo, feedHeatNo, lotNo }, ob);
plnZyZgMCEntityBindingSource.DataSource = listSourceC;
//GridHelper.RefreshAndAutoSize(ultraGridZyD);
foreach (UltraGridRow ugr in ultraGrid1.Rows)
{
//没有实际炉计划,主炉计划变颜色
if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
{
//ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
ugr.Appearance.BackColor = Color.Orange;
}
}
}
///
/// 顺序调整
///
///
///
private void ultraGridZyD_MouseDown(object sender, MouseEventArgs e)
{
try
{ ultraGridZyD.UpdateData(); }
catch (Exception)
{
MessageUtil.ShowWarning("数据异常,请刷新数据!"); return;
}
if (e.Button == MouseButtons.Right)
{
string plineCodeB = "";
int count = 0;
foreach (UltraGridRow ugrca in ultraGridZyD.Rows)
{
if (plineCodeB.Equals(""))
{
plineCodeB = ugrca.Cells["PlineCode"].Text.ToString();
}
if (!plineCodeB.Equals(ugrca.Cells["PlineCode"].Text.ToString()))
{
count++;
}
}
if (count > 1)
{
MessageUtil.ShowTips("调整顺序时只允许界面存在相同产线,请重新查询!");
return;
}
//移动行
ArrayList entityList = ProducHelper.GetChcRows(ultraGridZyD);
if (entityList == null || entityList.Count == 0)
{
return;
}
//定位行
UIElement myUIElement = ultraGridZyD.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
UltraGridCell myCell = (UltraGridCell)myUIElement.GetContext(typeof(UltraGridCell));
if (myCell == null) { return; }
UltraGridRow ugr = myCell.Row;
if (ugr == null) { return; }
PlnZyZgMEntity entityD = (PlnZyZgMEntity)ugr.ListObject;
bool flag = StoveHelper.SortPlanOrder(entityList, entityD, "D", "", this.ob);
if (flag)
{
_EntityList = entityList;
Query();
}
}
}
///
/// 修改备注
///
private void UpdateMemo()
{
ultraGridZyD.UpdateData();
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
//if (!item.Cells["Planstatus"].Text.ToString().Equals("计划"))
//{
// MessageUtil.ShowTips("选中该炉计划已下发,不能修改备注!");
// return;
//}
list1.Add(item.Cells["Memo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["FeedHeatNo"].Text.ToString().Trim());
list.Add(list1);
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要修改的轧管炉计划主信息!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否确认修改备注?") ==
DialogResult.No)
return;
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "doUpdateMemo";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) ;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
}
}
///
/// 修改轧批号,炉号
///
private void UpdateFeedHeattNo()
{
ultraGridZyD.UpdateData();
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (!item.Cells["Planstatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选中的炉计划已不是计划状态,不能修改!");
return;
}
//list1.Add(item.Cells["ZyBatchId"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["FeedHeatNo"].Text.ToString().Trim());
list.Add(list1);
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要修改的轧管炉计划主信息!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否确认修改轧批号或判定炉号?") ==
DialogResult.No)
return;
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "doUpdateFeedHeattNo";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) ;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
}
}
///
/// 获取上料行
///
private void doAddFeedLien()
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (!item.HasParent() && Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (!item.Cells["Planstatus"].Text.ToString().Equals("下发"))
{
MessageUtil.ShowTips("选中该炉计划不是下发状态,不能获取上料行!");
return;
}
if (!item.Cells["FeedRowNo"].Text.ToString().Equals("未生成上料行"))
{
MessageUtil.ShowTips("选中该炉计划已生成上料行,不能重复获取上料行!");
return;
}
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list.Add(list1);
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要获取上料行并且是下发状态的轧管炉计划!");
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "doAddFeedLien";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) ;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("获取成功!"))
{
Query();
}
}
///
/// 打印
///
private void doPrint()
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
string judgeStoveNo = "";
string plineCode="";
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
if (item.Cells["Planstatus"].Text.ToString().Trim().Equals("计划"))
{
MessageUtil.ShowTips("选中该轧管炉计划状态是计划状态,不能打印!");
return;
}
//if (!item.Cells["Planstatus"].Text.ToString().Equals("计划"))
//{
// MessageUtil.ShowTips("选中该炉计划已下发,不能修改备注!");
// return;
//}
plineCode= item.Cells["PlineCode"].Text.ToString().Trim();
judgeStoveNo += "'" + item.Cells["FeedHeatNo"].Text.ToString().Trim() + "',";
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选需要打印的轧管炉计划主信息!");
return;
}
//if (MessageUtil.ShowYesNoAndQuestion("是否确认打印炉计划?") ==
//DialogResult.No)
// return;
if (judgeStoveNo.Equals("")) return;
judgeStoveNo = judgeStoveNo.Substring(1, judgeStoveNo.Length - 3);
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilZgPlan.cpt&op=view" + "&JUDGE_STOVE_NO=" + judgeStoveNo + "&PLINE_CODE=" + plineCode;
FrmRepExcel fBug = new FrmRepExcel(ob, strurl);
fBug.AutoSize = true;
fBug.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
fBug.Text = "轧管炉计划打印";
fBug.ShowDialog();
}
///
/// 下发炉计划
///
///
private void Issued(string flag)
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int countM = 0;
int countC = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGridZyD.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (flag.Equals("0") && !item.Cells["Planstatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选中该炉计划已下发,不能重复下发!");
return;
}
//if (flag.Equals("0") && item.Cells["SteelFalg"].Text.ToString().Trim().Equals("未结炉"))
//{
// MessageUtil.ShowTips("选中该炉计划未炼钢切割结炉,不能下发!");
// return;
//}
if (flag.Equals("1") && item.Cells["Planstatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选中该炉计划不处于下发状态,不能撤销!");
return;
}
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["JudgeStoveNo"].Text.ToString().Trim());
list1.Add(item.Cells["StoveNo"].Text.ToString().Trim());
list1.Add(item.Cells["ZyBatchId"].Text.ToString().Trim());
list.Add(list1);
//if (flag.Equals("0"))
//{
// foreach (UltraGridRow itemc in item.ChildBands[0].Rows)
// {
// countC++;
// }
// if (countC == 0)
// {
// MessageUtil.ShowTips("该炉未生成实际炉计划,不能下发!");
// return;
// }
//}
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选轧管炉计划主信息!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion((flag.Equals("0") ? "是否下发?" : "是否撤销下发?")) ==
DialogResult.No)
return;
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveD";
ccp.MethodName = "doFurnacePlan";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), flag };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) ;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals(flag.Equals("0") ? "下发成功!" : "撤销成功!"))
{
Query();
}
}
///
/// 托选
///
///
///
private void ultraGridZyD_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGridZyD.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHC"].Value = true;
}
}
}
private int splitterDistance = 0;
int count1 =0;
int count2= 0;
private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
{
if (ultraExpandableGroupBox1.Expanded == false)
{
this.splitContainer1.SplitterDistance =26;
count1 = 26;
}
else
{
if (ultraExpandableGroupBox2.Expanded == false)
{
this.splitContainer1.SplitterDistance = splitContainer1.Size.Height - 26;
}
else
{
this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
}
count1 = splitContainer1.Size.Height - 26;
}
}
private void ultraExpandableGroupBox2_ExpandedStateChanged(object sender, EventArgs e)
{
if (ultraExpandableGroupBox2.Expanded == false)
{
if (count1 == 0) { count1 = splitContainer1.Size.Height - 26; }
this.splitContainer1.SplitterDistance = count1;
}
else
{
if (ultraExpandableGroupBox1.Expanded==false) {
this.splitContainer1.SplitterDistance = 26;
}
else
{
//this.splitContainer1.SplitterDistance = count1;
this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
}
}
}
private void ultraGridZyD_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
QueryMRow(row.Cells["HeatPlanNo"].Text.ToString().Trim());
}
private void QueryMRow(string heatPlanNo)
{
List listSourceM = EntityHelper.GetData
("com.steering.pss.plnsaleord.planStove.FrmPlanStoveD.queryPlanStoveRow", new object[] { heatPlanNo }, ob);
plnZyZgMCEntityBindingSource.DataSource = listSourceM;
foreach (UltraGridRow ugr in ultraGrid1.Rows)
{
//没有实际炉计划,主炉计划变颜色
if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
{
//ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
ugr.Appearance.BackColor = Color.Orange;
}
}
}
private void ultraGrid1_InitializeLayout(object sender,InitializeLayoutEventArgs e)
{
StoveHelper.CustomMergedCellEvaluator merge = new StoveHelper.CustomMergedCellEvaluator("HeatPlanNo");
e.Layout.Bands[0].Columns["HeatPlanNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["HeatPlanNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["JudgeStoveNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["JudgeStoveNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["FlagStoveNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["FlagStoveNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["Memo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["Memo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["StoveNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["StoveNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnInsingleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnInsingleNum"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnInsingleWt"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnInsingleWt"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["ZyBatchId"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["ZyBatchId"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["GxProSeq"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["GxProSeq"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["TotMumM"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["TotMumM"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["totWeightM"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["totWeightM"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["FeedHeatNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["FeedHeatNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["LenGpSingle"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["LenGpSingle"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["Planstatus"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["Planstatus"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutsingleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutsingleNum"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutsingleW"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutsingleW"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["ReducedWt"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["ReducedWt"].MergedCellEvaluator = merge;
}
private void ultraGridZyD_Click(object sender, EventArgs e)
{
activation = 1;
}
private void ultraGrid1_Click(object sender, EventArgs e)
{
activation = 2;
}
private void ultraGridZyD_ClickCell(object sender, ClickCellEventArgs e)
{
activation = 1;
}
private void ultraGrid1_ClickCell(object sender, ClickCellEventArgs e)
{
activation = 2;
}
private void chkLotNo_CheckedChanged(object sender, EventArgs e)
{
this.txtLotNo.Enabled = this.chkLotNo.Checked;
}
private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
{
this.ultraTextEditor1.Enabled = this.ultraTextEditor2.Enabled = this.ultraCheckEditor2.Checked;
}
private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e)
{
if (ultraCheckEditor3.Checked) { ultraTextEditor3.Enabled = true; } else { ultraTextEditor3.Enabled = false; }
}
}
}