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.炉计划.Tool;
using Core.StlMes.Client.PlnSaleOrd.窗体;
namespace Core.StlMes.Client.PlnSaleOrd
{
///
/// 镦拔扩排产(CustomInfo 为0 镦拔扩排产查询 1 镦拔扩排产 2 镦拔扩炉计划)
///
public partial class FrmPlnOrderDbkS : FrmBase
{
DataTable dtPlinGroup = null;
///
///产线权限
///
private string[] plinePower = new string[] { "" };
///
/// 订单编号
///
private string _ProPlanId = "";
///
/// 订单排产序号
///
private string _GxPlanNo = "";
///
/// 产线
///
private string _PlineCode = "";
///
/// 颜色
///
private Color _color = new Color();
private string proPlanId = "";
private string gxPlanNo = "";
private ArrayList _EntityList = null;
public FrmPlnOrderDbkS()
{
this.IsLoadUserView = true;
InitializeComponent();
}
private void FrmPlnOrderDbkS_Load(object sender, EventArgs e)
{
if (CustomInfo == null) { CustomInfo = ""; }
if (CustomInfo == "0")
{
splitContainer1.Panel2Collapsed = true;
BaseHelper.setOtherColumnReadOnly(ultraGridDbks, new string[] { "CHC", "PlineCode" });
BaseHelper.setColumnBackColor(ultraGridDbks, new string[] { "PlineCode"});
EntityHelper.setColumnShowOrHidden(ultraGridDbks, new string[] { "PenaltyDesc", "OrderCreateName", "OrderDocumentaryName" }, false);
}
else
{
BaseHelper.ForbidSort(ultraGridDbks);
BaseHelper.setOtherColumnReadOnly(ultraGridDbks, new string[] { "CHC", "PlanTimeB", "RepairType", "PlanUsetime", "PlineCode", "Memo", "PassCode", "ZyBatchId", "Decision" });//"Decision",
BaseHelper.setColumnBackColor(ultraGridDbks, new string[] { "PlineCode", "Memo", "PassCode", "ZyBatchId", "Decision" });
EntityHelper.setColumnShowOrHidden(ultraGridDbks, new string[] { "OrderTeam" }, false);
}
if (CustomInfo != "2")
{
ultraGridDbks.DisplayLayout.Bands[0].Columns["IsOnloadLine"].Hidden = true;
//ultraGridZyReadyE.DisplayLayout.Bands[0].Columns["CHC"].Hidden = true;
}
BaseHelper.setUltraGridColumnMaxInput(ultraGridDbks, new string[] { "WeigthS" });
BaseHelper.InitCellPosition(ultraGridDbks, new string[] {"CountNum", "GxPlanNo", "OrderSeq", "DeliveryNo", "WeigthS", "NumS", "PlanUsetime", "GxProSeq", "PlnDivideId", "Outdiameter", "Wallthick", "Lengthmax", "Lengthmin", "Aimlength",
"OutdiameterIn", "WallthickIn", "LengthmaxIn", "LengthminIn", "Aimoutdiameter", "Aimwallthick", "LenCuthead", "LenCutend" ,"AddWtIn","AddNumIn","MatchWtIn","MatchNumIn", "BatchedWt","BatchedNum","Finishweight","Finishnum","InNumS","InWeightS","FinishWgt","UnfinishWgt","UnfinishNum","MinWgt","RealBatchWt","RealBatchNum","StockNumMononer","StockNumLiku","ExpectWt","ExpectNum"});
BaseHelper.setUltraGridColumnMaxInput(ultraGridDbks, new string[] { "MinWgt" });
BaseHelper.GridColumnSum(ultraGridDbks, new string[] { "WeigthS" });
BaseHelper.GridColumnCount(ultraGridDbks, new string[] { "NumS" });
BaseHelper.InitCellPositionMiddle(ultraGridDbks, new string[] { "IsRepairPln", "Isendgx", "IfMonitorDbk", "IsPlanOk", "IfStoveIssued", "IfZyReady", "IfZyM", "IsOnloadLine" });
BaseHelper.setUltraGridColumnColor(ultraGridDbks, new string[] { "CraftFileNo", "CraftFileLv2G" }, Color.GreenYellow);
plinePower = PlanHelper.InitDropPlinePower("E", comPline, this.ValidDataPurviewIds, this.ob);
PlanHelper.InitRepairType(ultraGridDbks, this);
PlanHelper.InitEditPline("E", "", ultraGridDbks, this);
//BaseHelper.setOtherColumnReadOnly(ultraGridDbks, new string[] { "CHC", "PlanTimeB", "RepairType", "PlanUsetime", "PlineCode", "Memo" });
_color = ultraGridDbks.DisplayLayout.Override.RowSelectorAppearance.BackColor;
InitColorStyle();
EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]);
//炉计划
BaseHelper.setOtherColumnReadOnly(ultraGrid1, new string[] { "CHC", "JudgeStoveNo", "Memo", "OutnumCut" });
BaseHelper.setUltraGridColumnMaxInput(ultraGrid1, new string[] { "RealOutdoubleWt", "RealIndoubleWt", "PlanIndoubleWt" });
BaseHelper.setUltraGridColumnBits(ultraGrid1, new string[] { "RealOutdoubleNum", "RealIndoubleNum", "PlanIndoubleNum" });
BaseHelper.InitCellPosition(ultraGrid1, new string[] { "GxProSeq", "GxPlanNo","OrderSeq", "DeliveryNo", "PlnInsingleNum", "PlnInsingleWt", "PlnIndoubleNum","PlnIndoubleWt","PlnOutsingleNum","PlnOutsingleW" ,"PlnOutdoubleNum","PlnOutdoubleW","OutdiameterIn","WallthickIn","LengthIn","LengthmaxIn",
"LengthminIn","OutnumCut", "Aimoutdiameter","Aimwallthick","AimlengthMax","Aimlength","AimlengthMin","LenCutend","LenCuthead","CraftSeq","RealOutdoubleWt", "RealIndoubleWt", "PlanIndoubleWt","RealOutdoubleNum", "RealIndoubleNum", "PlanIndoubleNum"});
BaseHelper.GridColumnSum(ultraGrid1, new string[] { "RealOutdoubleWt", "RealIndoubleWt", "PlanIndoubleWt" });
BaseHelper.GridColumnCount(ultraGrid1, new string[] { "RealOutdoubleNum", "RealIndoubleNum", "PlanIndoubleNum" });
StoveHelper.ForbidSort(ultraGrid1);
BaseHelper.setColumnBackColor(ultraGrid1, new string[] { "JudgeStoveNo", "Memo", "OutnumCut" });
BaseHelper.SetGroupBySum(ultraGrid1, new string[] { "PlnInsingleWt", "PlnOutsingleW","PlnInsingleNum", "PlnOutsingleNum" }, "HeatPlanNo");
InitTime();
ultraGridDbks.DisplayLayout.Bands[0].Columns["PreInfo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
ultraGridDbks.DisplayLayout.Bands[0].Columns["PreInfo"].CellAppearance.BackColor = Color.GreenYellow;
ultraGridDbks.DisplayLayout.Bands[0].Columns["AfInfo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
ultraGridDbks.DisplayLayout.Bands[0].Columns["AfInfo"].CellAppearance.BackColor = Color.GreenYellow;
UltraComboEditor uceAbc = new UltraComboEditor();
ultraGridDbks.DisplayLayout.Bands[0].Columns["Decision"].EditorComponent = uceAbc;
ultraGridDbks.DisplayLayout.Bands[0].Columns["Decision"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
ValueList vlistSteel = new ValueList(); ;
vlistSteel.ValueListItems.Insert(0, "A", "A");
vlistSteel.ValueListItems.Insert(1, "B", "B");
vlistSteel.ValueListItems.Insert(2, "C", "C");
ultraGridDbks.DisplayLayout.Bands[0].Columns["Decision"].ValueList = vlistSteel;
//查询孔型
DataTable dt1 = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.BaseHelper.queryPassCode", null, ob);
Object[] obj = new Object[] { "", "" };
DataRow dr = dt1.NewRow();
dr.ItemArray = obj;
dt1.Rows.InsertAt(dr, 0);
UltraComboEditor uce = new UltraComboEditor();
this.Controls.Add(uce);
uce.Visible = false;
uce.DropDownListWidth = -1;
uce.DropDownStyle = DropDownStyle.DropDownList;
uce.DataSource = dt1;
uce.DisplayMember = "BASENAME";
uce.ValueMember = "BASECODE";
ultraGridDbks.DisplayLayout.Bands[0].Columns["PassCode"].EditorComponent = uce;
ultraGridDbks.DisplayLayout.Bands[0].Columns["PassCode"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownList;
ClsBaseInfo.SetComboItemHeight(uce);
}
private void InitTime()
{
DateTime now = DateTime.Now;
DateTime d1 = new DateTime(now.Year, now.Month, 1);
DateTime d2 = d1.AddMonths(1).AddSeconds(-1);
txtPlanTimeB1.Value = d1;
txtPlanTimeB2.Value = d2;
txtPlanTimeE1.Value = d1;
txtPlanTimeE2.Value = d2;
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
base.ToolBar_Click(sender, ToolbarKey);
switch (ToolbarKey)
{
case "Query"://查询
Query();
break;
case "Capacity"://产线能力维护
Capacity();
break;
case "AddRepairPlan"://新增检修
AddRepairPlan();
break;
case "DeleteRepairPlan"://删除检修
DeleteRepairPlan();
break;
case "PlineChange"://产线调整
PlineChange();
break;
case "TimeChange"://时间调整
TimeChange();
break;
case "StatusChange"://状态调整
StatusChange();
break;
case "InitData"://耗时初始化
InitData();
break;
case "Spit"://拆分订单
Spit();
break;
case "Merge"://合并订单
Merge();
break;
case "Issued"://确认
Issued("0");
break;
case "CancelIssued"://取消确认
Issued("1");
break;
case "StoveIssued"://下发
StoveIssued();
break;
case "CancelStoveIssued"://取消下发
CancelStoveIssued();
break;
case "OnloadLine"://设置上料行
OnloadLine();
break;
case "StoveSpit"://拆分炉计划
StoveSpit();
break;
case "Decision"://修改判定字头
DoDecision();
break;
case "UpdatePass"://修改孔型
UpdatePass();
break;
case "UpdateBatch"://修改作业批次号
UpdateBatch();
break;
case "Export": //导出
GridHelper.ulGridToExcel(ultraGridDbks, "镦拔扩排产信息");
break;
case "ModifyProcess"://手动获取工艺
DoModifyProcess();
break;
case "AgainProcess"://重新获取工艺
doAgainProcess();
break;
case "SortOrderDbk":
sortOrderDbk();
break;
case "Print":
printData();
break;
case "Notice":
tabNotice();
break;
case "UpdateOrderTeam"://修改是否协同
UpdateOrderTeam();
break;
default:
break;
}
}
private void UpdateOrderTeam()
{
this.ultraGridDbks.UpdateData();
IQueryable checkMagRows = this.ultraGridDbks.Rows.AsQueryable().Where(" CHC = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要操作的数据信息!");
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
PlnOrderDbkSOEntity plnOrderDbksTity = (PlnOrderDbkSOEntity)row.ListObject;
string plnOrderDbksEntity = JSONFormat.Format(plnOrderDbksTity);
parmList.Add(plnOrderDbksEntity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
ccp.MethodName = "UpdateOrderTeam";
ccp.ServerParams = new object[] { parmList, "E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 重新排序订单
///
private void sortOrderDbk()
{
string plineCode = "";
plineCode = comPline.Value == null ? "" : comPline.Value.ToString();
if (plineCode.Equals(""))
{
MessageUtil.ShowTips("请选择产线!");
return;
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.StoveHelper";
ccp.MethodName = "sortOrderDbk";
ccp.ServerParams = new object[] { plineCode };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("重新排序成功!"))
{
Query();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
private void tabNotice()
{
this.ultraGridDbks.UpdateData();
IQueryable checkMagRows = this.ultraGridDbks.Rows.AsQueryable().Where(" CHC = 'True'");
if (checkMagRows.Count() == 0)
{
MessageUtil.ShowTips("请选择需要操作的监制信息!");
return;
}
ArrayList parmList = new ArrayList();
foreach (UltraGridRow row in checkMagRows)
{
PlnOrderDbkSOEntity plnOrderZgsTity = (PlnOrderDbkSOEntity)row.ListObject;
string plnOrderZgsEntity = JSONFormat.Format(plnOrderZgsTity);
parmList.Add(plnOrderZgsEntity);
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
ccp.MethodName = "tabNotice";
ccp.ServerParams = new object[] { parmList, UserInfo.GetUserName(), "E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
if (ccp.ReturnInfo.Equals("标识监制成功!"))
{
Query();
MessageUtil.ShowTips(ccp.ReturnInfo);
}
else
{
MessageUtil.ShowTips(ccp.ReturnInfo);
}
}
}
///
/// 打印检验要点
///
private void printData()
{
UltraGridRow row = ultraGridDbks.ActiveRow;
if (row == null) return;
string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilTestKey2.cpt&PROCESS_CODE=E&ORDER_NO=" + row.Cells["OrderNo"].Value.ToString();
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 chcPline_CheckedChanged(object sender, EventArgs e)
{
if (chcPline.Checked) { comPline.ReadOnly = false; } else { comPline.ReadOnly = true; }
if (chcProPlanId.Checked) { txtProPlanId.ReadOnly = false; } else { txtProPlanId.ReadOnly = true; }
if (chcOrderNo.Checked) { txtOrderNo.ReadOnly = false; } else { txtOrderNo.ReadOnly = true; }
if (chcPlanTimeB.Checked) { txtPlanTimeB1.ReadOnly = false; txtPlanTimeB2.ReadOnly = false; } else { txtPlanTimeB1.ReadOnly = true; txtPlanTimeB2.ReadOnly = true; }
if (chcPlanTimeE.Checked) { txtPlanTimeE1.ReadOnly = false; txtPlanTimeE2.ReadOnly = false; } else { txtPlanTimeE1.ReadOnly = true; txtPlanTimeE2.ReadOnly = true; }
}
///
/// 查询
///
void Query()
{
string plineCode = "";//产线
if (chcPline.Checked && comPline.Value != null) { plineCode = comPline.Value.ToString(); }
if (!CustomInfo.Equals("0") && plineCode.Equals(""))
{
MessageUtil.ShowTips("请选择产线!");
return;
}
WaitingForm2 wf3 = new WaitingForm2("正在刷新,请稍候....");
try
{
this.Cursor = Cursors.WaitCursor;
string[] statusArray = contorlPlanStatus1.statusArr;
string orderNo = "";//合同号
if (chcOrderNo.Checked) { orderNo = txtOrderNo.Text.Trim(); }
string proPlanId = ""; //订单编号
if (chcProPlanId.Checked) { proPlanId = txtProPlanId.Text.Trim(); }
string planTimeB1 = "";
string planTimeB2 = "";
if (chcPlanTimeB.Checked && txtPlanTimeB2.Value != null && txtPlanTimeB1.Value != null)
{
planTimeB1 = DateTime.Parse(txtPlanTimeB1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
planTimeB2 = DateTime.Parse(txtPlanTimeB2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
}
string planTimeE1 = "";
string planTimeE2 = "";
if (chcPlanTimeE.Checked && txtPlanTimeE2.Value != null && txtPlanTimeE1.Value != null)
{
planTimeE1 = DateTime.Parse(txtPlanTimeE1.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
planTimeE2 = DateTime.Parse(txtPlanTimeE2.Value.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
}
string flag = "";//查询下发 的标识
if (CustomInfo.Equals("2")) { flag = "1"; }
List listSource = EntityHelper.GetData
("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryPlanOrderE",
new object[] { plineCode, orderNo, proPlanId, statusArray, plinePower, flag, planTimeB1, planTimeB2, planTimeE1, planTimeE2 }, this.ob);
plnOrderDbkSOEntityBindingSource.DataSource = listSource;
dtPlinGroup = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.queryPlinCodeGroup", null, this.ob);
if (listSource == null || listSource.Count == 0)
{
//plnZyDbkMEntityBindingSource.Clear();
plnZyDbkReadyEntityBindingSource.Clear();
}
foreach (UltraGridRow ugr in ultraGridDbks.Rows)
{
string str = ugr.Cells["PreInfo"].Text.Trim();
if (str != null && str != "")
{
string[] sArray = str.Split(new char[3] { '天', ',', '条' });
//ugr.Cells["TimeDiffer"].Value = sArray[0];
ugr.Cells["BefProLin"].Value = sArray[2];
ugr.Cells["BefProNum"].Value = sArray[3];
}
string strH = ugr.Cells["AfInfo"].Text.Trim();
if (strH != null && strH != "")
{
string[] sArray = strH.Split(new char[3] { '天', ',', '条' });
string plineCodeH = sArray[2];
if (dtPlinGroup.Rows.Count > 0)
{
//for (int i = 0; i < dtPlinGroup.Rows.Count; i++)
//{
string plinGroup = dtPlinGroup.Rows[0]["PLINE_NAME_M"].ToString() + "/" + dtPlinGroup.Rows[0]["PLINE_NAME_C"].ToString();
DataRow[] dr = dtPlinGroup.Select("PLINE_NAME_M='" + ugr.Cells["PlineCode"].Text.ToString() + "' AND PLINE_NAME_C ='" + plineCodeH + "'", "");
if (dr == null || dr.Length == 0) { }
else
{
//DataTable tmp = dr.Table.Clone(); // 复制DataRow的表结构
//if (tmp.Rows.Count > 0)
//{
ugr.Cells["StockGroupName"].Value = dr[0]["STOCK_GROUP_NAME"].ToString();
//}
}
}
}
//ProducHelper.copyLZData(ultraGridDbks,"E",this.ob);
if ((!_ProPlanId.Equals("") && !_GxPlanNo.Equals("")) || _EntityList != null)
//foreach (UltraGridRow ugr in ultraGridDbks.Rows)
//{
if (!_ProPlanId.Equals("") && !_GxPlanNo.Equals(""))
{
if (ugr.Cells["ProPlanId"].Text.Trim().Equals(_ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(_GxPlanNo))
{
ugr.Activate();
break;
}
}
if (_EntityList != null)
{
for (int i = 0; i < _EntityList.Count; i++)
{
PlnOrderDbkSEntity entity = (PlnOrderDbkSEntity)_EntityList[i];
if (ugr.Cells["ProPlanId"].Text.Trim().Equals(entity.ProPlanId) && ugr.Cells["GxPlanNo"].Text.Trim().Equals(entity.GxPlanNo))
{
ugr.Appearance.BackColor = Color.Wheat;
ugr.Activate();
}
}
}
if (ugr.Cells["IsNoticeEp"].Text.Equals("已通知"))
{
ugr.Cells["IsNoticeEp"].Appearance.BackColor = Color.GreenYellow;
ugr.Activate();
}
}
_ProPlanId = "";
_GxPlanNo = "";
_EntityList = null;
if (comPline.Value != null)
{
_PlineCode = comPline.Value.ToString();
}
}
finally
{
wf3.Close();
this.Cursor = Cursors.Default;
}
}
///
/// 拆分
///
void Spit()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.SpitPlanOrder(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
/// 合并
///
void Merge()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.MergePlanOrder(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
/// 时间调整
///
void TimeChange()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.TimeChange(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
///状态调整
///
void StatusChange()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.StatusChange(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
/// 检修计划
///
void AddRepairPlan()
{
if (comPline.Value == null || comPline.Value.ToString().Equals(""))
{
MessageUtil.ShowTips("请选择产线!");
return;
}
FrmJxjh frmJxjh = new FrmJxjh(this.ob, comPline.Value.ToString(), "E");
frmJxjh.ShowDialog();
Query();
}
///
/// 初始化
///
void InitData()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.InitData(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
/// 产线能力维护
///
void Capacity()
{
UltraGridRow ugr = ultraGridDbks.ActiveRow;
if (ugr == null)
{
return;
}
if (ugr.Cells["IsRepairPln"].Text.Equals("Y"))
{
return;
}
FrmBaseMaterialEPl frmBaseMaterialEPl = new FrmBaseMaterialEPl(ugr.Cells["InwlId"].Text, ugr.Cells["OutwlId"].Text, ugr.Cells["PlineCode"].Value.ToString(), this.ob);
frmBaseMaterialEPl.ShowDialog();
}
private void ultraGridDbks_InitializeRow(object sender, InitializeRowEventArgs e)
{
PlanHelper.ControlCellEdit(e.Row);
}
private void ultraGridDbks_MouseDown(object sender, MouseEventArgs e)
{
//查询界面,不能排序
if (CustomInfo.Equals("0"))
{ return; }
try
{ ultraGridDbks.UpdateData(); }
catch (Exception)
{
MessageUtil.ShowWarning("数据异常,请刷新数据!"); return;
}
if (e.Button == MouseButtons.Right)
{
//移动行
ArrayList entityList = ProducHelper.GetChcRows(ultraGridDbks);
if (entityList == null || entityList.Count == 0)
{
return;
}
//定位行
UIElement myUIElement = ultraGridDbks.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; }
PlnOrderDbkSEntity entityD = (PlnOrderDbkSEntity)ugr.ListObject;
bool flag = ProducHelper.SortPlanOrder(entityList, entityD, "E",CustomInfo, this.ob);
if (flag)
{
_EntityList = entityList;
Query();
}
}
}
private void ultraGridDbks_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow ugrAc = ultraGridDbks.ActiveRow;
if (ugrAc == null)
{
return;
}
foreach (UltraGridRow ugr in ultraGridDbks.Rows)
{
if (ugr.Cells["ProPlanId"].Text.Equals(ugrAc.Cells["ProPlanId"].Text))
{
ugr.RowSelectorAppearance.BackColor = Color.LightGreen;
}
else
{
ugr.RowSelectorAppearance.BackColor = _color;
}
if (ugr.Cells["PlanUsetime"].Value == null || ugr.Cells["PlanUsetime"].Value.ToString().Equals("") || Convert.ToDouble(ugr.Cells["PlanUsetime"].Value.ToString()) <= 0)
{
ugr.Cells["PlanUsetime"].Appearance.BackColor = Color.MistyRose;
}
if (ugr.Cells["ExeStatus"].Value.ToString().Equals("生产中"))
{
ugr.Cells["PlanTimeB"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
}
if (ugr.Cells["IsRepairPln"].Text.Equals("Y"))
{
ugr.Cells["PlanUsetime"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
ugr.Cells["RepairType"].Appearance.BackColor = System.Drawing.Color.FromArgb(255, 255, 128);
}
}
proPlanId = ugrAc.Cells["ProPlanId"].Text;
gxPlanNo = ugrAc.Cells["GxPlanNo"].Text;
if (CustomInfo == "1")
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 查询镦拔扩虚拟炉计划
///
///
///
private void QueryZyReadyE(string proPlanId, string gxPlanNo)
{
List listSource = EntityHelper.GetData
("com.steering.pss.plnsaleord.planStove.FrmPlanStoveE.queryPlanStovePlanId", new object[] { proPlanId, gxPlanNo }, this.ob);
plnZyDbkReadyEntityBindingSource.DataSource = listSource;
foreach (UltraGridRow ugr in ultraGrid1.Rows)
{
//没有实际炉计划,主炉计划变颜色
if (ugr.Cells["HeatPlanSqe"].Value.ToString().Equals(""))
{
//ugr.RowSelectorAppearance.BackColor = Color.GreenYellow;
ugr.Appearance.BackColor = Color.Orange;
}
if (!string.IsNullOrEmpty(ugr.Cells["ApplyDesc"].Value.ToString2()))
{
ugr.Appearance.BackColor = Color.Red;
}
}
}
private void ultraGridDbks_CellChange(object sender, CellEventArgs e)
{
try
{
ultraGridDbks.UpdateData();
if (e.Cell.Column.Key.Equals("PlineCode"))
{
IQueryable chcRows = ultraGridDbks.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
if (CustomInfo.Equals("0"))
{
e.Cell.Row.Cells["PlineName"].Value = e.Cell.Text;
}
else
{
if (chcRows != null && chcRows.Count() > 0)
{
foreach (UltraGridRow ugr in chcRows)
{
ugr.Cells["PlineCode"].Value = e.Cell.Value.ToString();
ugr.Cells["PlineName"].Value = e.Cell.Text;
}
}
}
}
}
catch (Exception)
{
}
}
///
/// 产线调整
///
private void PlineChange()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.PlineChange(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
private void ultraGridDbks_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGridDbks.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHC"].Value = true;
}
}
}
///
/// 删除检修计划
///
public void DeleteRepairPlan()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.DeleteRepairPlan(list, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
///
/// 确认(取消)
///
private void Issued(string isFlag)
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
bool flag = ProducHelper.issuedPlanOrder(list, UserInfo.GetUserName(), isFlag, "E", this.ob);
if (flag)
{
_ProPlanId = ((PlnOrderDbkSEntity)list[0]).ProPlanId;
_GxPlanNo = ((PlnOrderDbkSEntity)list[0]).GxPlanNo;
Query();
}
}
private void ultraGridDbks_ClickCellButton(object sender, CellEventArgs e)
{
UltraGridRow row = ultraGridDbks.ActiveRow;
if (e.Cell.Column.Key.Equals("CraftFileNo"))
{
string filePath = row.GetValue("CraftPath");
dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, filePath);
askDown.Show();
}
else if (e.Cell.Column.Key.Equals("CraftFileLv2G"))
{
string craftFileLv2G = row.GetValue("CraftFileLv2G");
dlgOrderAskDown askDown = new dlgOrderAskDown(this.ob, craftFileLv2G);
askDown.Show();
}
else if (e.Cell.Column.Key.Equals("Liku"))
{
if (CustomInfo.Equals("2")) { return; }
string exeStatus = e.Cell.Row.Cells["ExeStatus"].Text.Trim();
if (!exeStatus.Equals("计划") && !exeStatus.Equals("生产中"))
{
MessageUtil.ShowWarning("不是计划、生产中订单,不能利库!");
return;
}
if (e.Cell.Row.Cells["IsRepairPln"].Text.Equals("Y"))
{
MessageUtil.ShowWarning("检修计划,不能利库!");
return;
}
string materialNo = e.Cell.Row.Cells["InwlId"].Text.Trim();//投入物料
string plineCode = e.Cell.Row.Cells["PlineCode"].Text.Trim();//产线
string proPlanId = e.Cell.Row.Cells["ProPlanId"].Text.Trim();//订单编号
string gxPlanNo = e.Cell.Row.Cells["GxPlanNo"].Text.Trim();//排产序号
Core.StlMes.Client.PlnSaleOrd.炉计划.FrmMaterialChoose frmMaterialChoose = new Core.StlMes.Client.PlnSaleOrd.炉计划.FrmMaterialChoose(materialNo, "E", proPlanId, gxPlanNo, UserInfo.GetUserName(), this.ob);
frmMaterialChoose.ShowDialog();
Query();
}
if (e.Cell.Column.Key.Equals("PreInfo"))
{
string proPlanId = row.GetValue("ProPlanId");
string preInfo = row.GetValue("PreInfo");
if (preInfo == null || preInfo.Length == 0) { return; }
FrmPreGxInfo frmPreGxInfo = new FrmPreGxInfo(proPlanId, "E", "Pr", this.ob);
frmPreGxInfo.ShowDialog();
}
if (e.Cell.Column.Key.Equals("AfInfo"))
{
string proPlanId = row.GetValue("ProPlanId");
string afInfo = row.GetValue("AfInfo");
if (afInfo == null || afInfo.Length == 0) { return; }
FrmPreGxInfo frmPreGxInfo = new FrmPreGxInfo(proPlanId, "E", "Af", this.ob);
frmPreGxInfo.ShowDialog();
}
}
///
/// 初始化列状态
///
private void InitColorStyle()
{
ultraGridDbks.DisplayLayout.Bands[0].Columns["Liku"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
ultraGridDbks.DisplayLayout.Bands[0].Columns["PlanTimeB"].Format = "yyyy-MM-dd HH:mm:ss";
ultraGridDbks.DisplayLayout.Bands[0].Columns["PlanTimeB"].MaskInput = "yyyy-mm-dd hh:mm:ss";
ultraGridDbks.DisplayLayout.Bands[0].Columns["PlanTimeB"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DateTime;
ultraGridDbks.DisplayLayout.Bands[0].Columns["CraftFileLv2G"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
ultraGridDbks.DisplayLayout.Bands[0].Columns["CraftFileNo"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.EditButton;
}
///
/// 下发
///
private void StoveIssued()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
if (list == null || list.Count == 0)
{
MessageUtil.ShowWarning("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
string porderstatus = "";//合同状态
foreach (PlnOrderDbkSEntity entity in list)
{
jsonList.Add(JSONFormat.Format(entity));
DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.doQueryPorderstatus", new object[] { entity.OrdLnDlyPk.ToString() }, ob);
if (dt.Rows.Count > 0)
{
porderstatus = dt.Rows[0]["PORDERSTATUS"].ToString();
}
if (porderstatus.Equals("4") || porderstatus.Equals("5"))
{
MessageUtil.ShowTips("该合同已生产完成或关闭,请联系销售!");
return;
}
}
if (MessageUtil.ShowYesNoAndQuestion("是否炉计划下发?") == DialogResult.No)
{
return;
}
string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.stoveIssued", new object[] { jsonList, UserInfo.GetUserName(), "E" }, ob);
if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); }
else
{
MessageUtil.ShowTips(param[1]);
if ((bool.Parse(param[0]))) { Query(); }
}
}
///
/// 取消下发
///
private void CancelStoveIssued()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
if (list == null || list.Count == 0)
{
MessageUtil.ShowWarning("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
foreach (PlnOrderDbkSEntity entity in list)
{
jsonList.Add(JSONFormat.Format(entity));
}
if (MessageUtil.ShowYesNoAndQuestion("是否取消下发?") == DialogResult.No)
{
return;
}
string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.cancelStoveIssued", new object[] { jsonList, UserInfo.GetUserName(), "E" }, ob);
if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); }
else
{
MessageUtil.ShowTips(param[1]);
if ((bool.Parse(param[0]))) { Query(); }
}
}
///
/// 修改判定字头
///
private void DoDecision()
{
ultraGridDbks.UpdateData();
IQueryable chcRows = ultraGridDbks.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
if (chcRows == null || chcRows.Count() == 0)
{
MessageUtil.ShowTips("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
foreach (UltraGridRow ugr in chcRows)
{
ArrayList list = new ArrayList();
if (!ugr.Cells["ExeStatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选择的订单不是计划状态的不能修改!");
return;
}
list.Add(ugr.Cells["ProPlanId"].Text.ToString());
list.Add(ugr.Cells["GxPlanNo"].Text.ToString());
list.Add(ugr.Cells["Decision"].Text.ToString());
jsonList.Add(list);
}
if (MessageUtil.ShowYesNoAndQuestion("是否判定字头修改?") == DialogResult.No)
{
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
ccp.MethodName = "doDecision";
ccp.ServerParams = new object[] { jsonList,"E" };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
}
}
///
/// 修改轧批号
///
private void UpdateBatch()
{
ArrayList messageErr = new ArrayList();
ultraGridDbks.UpdateData();
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
if (list == null || list.Count == 0)
{
MessageUtil.ShowTips("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
foreach (PlnOrderDbkSEntity entity in list)
{
entity.ZyBatchId.ToString();
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.planStove.FrmPlanStoveE";
ccp.MethodName = "updateBatch";
ccp.ServerParams = new object[] { jsonList };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
}
}
///
/// 修改孔型
///
private void UpdatePass()
{
ultraGridDbks.UpdateData();
IQueryable chcRows = ultraGridDbks.Rows.AsQueryable().Where(a => a.GetValue("CHC") == "True");
if (chcRows == null || chcRows.Count() == 0)
{
MessageUtil.ShowTips("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
foreach (UltraGridRow ugr in chcRows)
{
ArrayList list = new ArrayList();
if (!ugr.Cells["ExeStatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选择的订单不是计划状态的不能修改!");
return;
}
string passCode = "";
if (!ugr.Cells["PassCode"].Text.ToString().Equals(""))
{
passCode = ugr.Cells["PassCode"].Value.ToString();
}
list.Add(ugr.Cells["ProPlanId"].Text.ToString());
list.Add(ugr.Cells["GxPlanNo"].Text.ToString());
list.Add(passCode);
list.Add(ugr.Cells["PassCode"].Text.ToString());
jsonList.Add(list);
}
if (MessageUtil.ShowYesNoAndQuestion("是否修改孔型?") == DialogResult.No)
{
return;
}
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.processOrder.base.ProducHelper";
ccp.MethodName = "UpdatePass";
ccp.ServerParams = new object[] { jsonList };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
Query();
}
}
///
/// 订单层重新获取工艺
///
private void DoModifyProcess()
{
ArrayList messageErr = new ArrayList();
ultraGridDbks.UpdateData();
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
if (list == null || list.Count == 0)
{
MessageUtil.ShowTips("请选择订单!");
return;
}
ArrayList jsonList = new ArrayList();
foreach (PlnOrderDbkSEntity 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.planStove.StoveHelper";
ccp.MethodName = "DoModifyProcess";
ccp.ServerParams = new object[] { jsonList, "E" };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("获取成功!"))
{
Query();
}
}
#region 未用到
///
/// 设置上料行
///
private void OnloadLine()
{
ArrayList list = ProducHelper.GetChcRows(ultraGridDbks);
if (list == null || list.Count != 1)
{
MessageUtil.ShowWarning("请选择订单(只能选择一条记录)!");
return;
}
PlnOrderDbkSEntity entity = (PlnOrderDbkSEntity)list[0];
if (entity.IsOnloadLine.Equals("Y"))
{
MessageUtil.ShowWarning("已经是上料行!");
return;
}
if (!entity.IfStoveIssued.Equals("Y"))
{
MessageUtil.ShowWarning("订单未下发!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否设置上料行?") == DialogResult.No)
{
return;
}
string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.setIfOnloadLine", new object[] { JSONFormat.Format(entity), "E" }, ob);
if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); }
else
{
MessageUtil.ShowTips(param[1]);
if ((bool.Parse(param[0]))) { Query(); }
}
}
///
/// 虚拟炉计划拆分
///
private void StoveSpit()
{
UltraGridRow ugr = ultraGridDbks.ActiveRow;
if (ugr == null)
{
return;
}
ultraGrid1.UpdateData();
if (ultraGrid1.Rows.Count <= 1)
{
MessageUtil.ShowWarning("只有唯一的虚拟炉计划,不能拆分!");
return;
}
ArrayList list = ProducHelper.GetChcRows(ultraGrid1);
if (list==null||list.Count == 0)
{
MessageUtil.ShowWarning("请选择要拆分的虚拟炉计划!");
return;
}
if (list.Count == ultraGrid1.Rows.Count)
{
MessageUtil.ShowWarning("不能选择全部的虚拟炉计划!");
return;
}
ArrayList jsonlist = new ArrayList();
foreach (Core.StlMes.Client.PlnSaleOrd.炉计划.Entity.PlnZyDbkReadyEntity entity in list)
{
jsonlist.Add(JSONFormat.Format(entity));
}
if (MessageUtil.ShowYesNoAndQuestion("是否拆分虚拟炉计划?") == DialogResult.No)
{
return;
}
string[] param = PlanHelper.SetData("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.stoveSpit", new object[] { jsonlist,UserInfo.GetUserName(), "E" }, ob);
if (param == null) { MessageUtil.ShowTips("服务端处理失败!"); }
else
{
MessageUtil.ShowTips(param[1]);
if ((bool.Parse(param[0]))) { Query(); }
}
}
#endregion
#region 炉计划层操作
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "Update"://修改判定炉号,备注
doUpdate();
break;
case "Issued"://下发
Issuedlu("0");
break;
case "IssuedU"://撤销
Issuedlu("1");
break;
case "Delete"://删除炉计划
doDelete();
break;
case "DeleteStatr"://删除剩余炉计划
doDeleteStatr();
break;
case "BreakUp"://拆分
doBreakUp();
break;
case "Merge"://合并
doMerge();
break;
case "AgainProcess"://重新获取工艺
doAgainProcess();
break;
case "Print"://打印
doPrint();
break;
case "LuClose"://手动关闭炉计划
doLuClose();
break;
default:
break;
}
}
///
/// 炉计划打印
///
private void doPrint()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
string judgeStoveNo = "";
string plineCode = "";
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (item.Cells["Planstatus"].Text.ToString().Trim().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());
list.Add(list1);
plineCode = item.Cells["PlineCode"].Text.ToString().Trim();
judgeStoveNo += "'" + item.Cells["JudgeStoveNo"].Text.ToString().Trim() + "',";
}
}
if (countM >0)
{
}
else
{
}
//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 Issuedlu(string flag)
{
UltraGridRow ugrAc = ultraGridDbks.ActiveRow;
if (ugrAc == null) return;
string zyBatchId = ugrAc.Cells["ZyBatchId"].Text.ToString().Trim();
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
int countC = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.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("1") && item.Cells["Planstatus"].Text.ToString().Equals("计划"))
{
MessageUtil.ShowTips("选中该炉计划不处于下发状态,不能撤销!");
return;
}
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
//list1.Add(item.Cells["ZyBatchId"].Text.ToString().Trim());
//list1.Add(item.Cells["StoveNo"].Text.ToString().Trim());
list.Add(list1);
}
}
//去重
for (int i = 0; i < list.Count; i++)
{
for (int j = i + 1; j < list.Count; j++)
{
if (list[i].Equals(list[j]))
{
list.RemoveAt(j);
if (i > 0)
{
i--;
}
}
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选炉计划信息!");
return;
}
ArrayList possList = new ArrayList();
IQueryable checkMagRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHC = 'True'");
var posslist = checkMagRows.Select(p => (Core.StlMes.Client.PlnSaleOrd.炉计划.Entity.PlnZyDbkReadyEntity)p.ListObject).ToList();
var grouplist = posslist.GroupBy(p => p.HeatPlanNo);
grouplist.ToList().ForEach(p =>
{
Core.StlMes.Client.PlnSaleOrd.炉计划.Entity.PlnZyDbkReadyEntity tmp = new Core.StlMes.Client.PlnSaleOrd.炉计划.Entity.PlnZyDbkReadyEntity();
tmp.HeatPlanNo = p.First().HeatPlanNo;
//tmp.PlineCode = p.First().PlineCode;
//tmp.ActCount = p.Sum(q => q.ActCount);
possList.Add(JSONFormat.Format(tmp));
});
if (MessageUtil.ShowYesNoAndQuestion((flag.Equals("0") ? "是否下发?" : "是否撤销下发?")) ==
DialogResult.No)
return;
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveE";
ccp.MethodName = "doFurnacePlan";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), flag, proPlanId, gxPlanNo, possList };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals(flag.Equals("0") ? "下发成功!" : "撤销成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 删除炉计划
///
private void doDelete()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
int countC = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.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["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanSqe"].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.FrmPlanStoveE";
ccp.MethodName = "doDeleteLu";
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("删除成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 修改判定炉号,备注
///
private void doUpdate()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
int countC = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.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["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanSqe"].Text.ToString().Trim());
list1.Add(item.Cells["JudgeStoveNo"].Text.ToString().Trim());
list1.Add(item.Cells["Memo"].Text.ToString().Trim());
list1.Add(item.Cells["ZyBatchId"].Text.ToString().Trim());
list1.Add(item.Cells["OutnumCut"].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.FrmPlanStoveE";
ccp.MethodName = "doUpdate";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(),"E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) ;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("修改成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 删除剩余炉计划
///
private void doDeleteStatr()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
int countC = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (item.Cells["Planstatus"].Text.ToString().Equals("计划") || item.Cells["Planstatus"].Text.ToString().Equals("下发"))
{
MessageUtil.ShowTips("选中该炉计划是计划/下发状态,不能删除!");
return;
}
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanSqe"].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.FrmPlanStoveE";
ccp.MethodName = "doDeleteStatr";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(),"E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("删除成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 拆分
///
private void doBreakUp()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
int reaNum = 0;//上料支
int plnNum = 0;//装炉支
if (!item.Cells["RealIndoubleNum"].Text.ToString().Equals(""))
{
reaNum = int.Parse(item.Cells["RealIndoubleNum"].Value.ToString());
}
if (!item.Cells["PlanIndoubleNum"].Text.ToString().Equals(""))
{
plnNum = int.Parse(item.Cells["PlanIndoubleNum"].Value.ToString());
}
if (item.Cells["Planstatus"].Text.ToString().Equals("计划") || item.Cells["Planstatus"].Text.ToString().Equals("下发"))
{
MessageUtil.ShowTips("选中炉计划是计划/下发状态,不能拆分!");
return;
}
if (reaNum == 0)
{
MessageUtil.ShowTips("选中的炉计划无上料支,不能拆分!");
return;
}
if (plnNum - reaNum <= 0)
{
MessageUtil.ShowTips("选中的炉计划已全部上料,不能拆分!");
return;
}
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanSqe"].Text.ToString().Trim());
list.Add(list1);
}
}
if (countM == 0)
{
MessageUtil.ShowTips("请勾选炉计划信息!");
return;
}
if (countM > 1)
{
MessageUtil.ShowWarning("不能一次性拆分多条炉计划!");
return;
}
if (MessageUtil.ShowYesNoAndQuestion("是否拆分?") == DialogResult.No) return;
PlanComm.WaitFromOpen(this.Cursor);
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.pss.plnsaleord.planStove.FrmPlanStoveE";
ccp.MethodName = "doBreakUp";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName(), "E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("拆分成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 合并
///
private void doMerge()
{
}
///
/// 重新获取工艺
///
private void doAgainProcess()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow item in ultraGrid1.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
list1.Add(item.Cells["HeatPlanNo"].Text.ToString().Trim());
list1.Add(item.Cells["HeatPlanSqe"].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.StoveHelper";
ccp.MethodName = "doAgainProcess";
ccp.ServerParams = new object[] { list, proPlanId, gxPlanNo, "E" };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("获取成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
///
/// 托选
///
///
///
private void ultraGrid1_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHC"].Value = true;
}
}
}
private int splitterDistance = 0;
private void ultraExpandableGroupBox1_ExpandedStateChanged(object sender, EventArgs e)
{
if (ultraExpandableGroupBox1.Expanded == false)
{
this.splitContainer1.SplitterDistance = splitContainer1.Size.Height - 26;
}
else
{
this.splitContainer1.SplitterDistance = splitterDistance == 0 ? splitContainer1.Size.Height / 2 : splitterDistance;
}
}
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
StoveHelper.CustomMergedCellEvaluator merge = new StoveHelper.CustomMergedCellEvaluator("HeatPlanNo");
e.Layout.Bands[0].Columns["Memo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["Memo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["FeedHeatNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["FeedHeatNo"].MergedCellEvaluator = merge;
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["StoveNo"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["StoveNo"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnInsingleWt"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnInsingleWt"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutsingleW"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutsingleW"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnIndoubleWt"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnIndoubleWt"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutdoubleW"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutdoubleW"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnInsingleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnInsingleNum"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutsingleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutsingleNum"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnIndoubleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnIndoubleNum"].MergedCellEvaluator = merge;
e.Layout.Bands[0].Columns["PlnOutdoubleNum"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["PlnOutdoubleNum"].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["Planstatus"].MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands[0].Columns["Planstatus"].MergedCellEvaluator = merge;
}
private void ultraGrid1_CellChange(object sender, CellEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
ultraGrid1.UpdateData();
//输入分切
if (e.Cell.Column.Key.Equals("OutnumCut"))
{
if (e.Cell.Row.Cells["OutnumCut"].Text == "")
{
row.Cells["OutnumCut"].Value = "1";
}
else
{
string actLen = e.Cell.Row.Cells["OutnumCut"].Text.ToString();
if (!StringUtil.IsInt(actLen) || actLen == "0")
{
row.Cells["OutnumCut"].Value = "1";
}
}
}
}
///
/// 手动关闭炉计划
///
private void doLuClose()
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
int countM = 0;
ArrayList list = new ArrayList();
string heatPlanNo = "";
foreach (UltraGridRow item in ultraGrid1.Rows)
{
if (Convert.ToBoolean(item.Cells["CHC"].Text) == true)
{
countM++;
ArrayList list1 = new ArrayList();
if (item.Cells["Planstatus"].Text.ToString().Equals("关闭"))
{
MessageUtil.ShowTips("选中该炉计划是关闭状态,不能重复关闭!");
return;
}
if (!heatPlanNo.Equals(item.Cells["HeatPlanNo"].Text.ToString()))
{
heatPlanNo = item.Cells["HeatPlanNo"].Text.ToString().Trim();
list1.Add(item.Cells["HeatPlanNo"].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.FrmPlanStoveE";
ccp.MethodName = "doLuClose";
ccp.ServerParams = new object[] { list, this.UserInfo.GetUserName() };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
PlanComm.WaitFromColse(this.Cursor);
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("关闭成功!"))
{
QueryZyReadyE(proPlanId, gxPlanNo);
}
}
#endregion
private void cmbPro_EditorButtonClick(object sender, EditorButtonEventArgs e)
{
this.ultraGridDbks.UpdateData();
UltraGridRow row = this.ultraGridDbks.ActiveRow;
if (row == null)
{
return;
}
FrmProInformation fp = new FrmProInformation(ob, row.Cells["PrdcrNo"].Text, row.Cells["IndexSeq"].Text, "E");
fp.ShowDialog();
}
}
}