using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
using Core.StlMes.Client.PlnSaleOrd.工序排产.entity;
using Core.StlMes.Client.PlnSaleOrd.炉计划.Entity;
using Core.StlMes.Client.PlnSaleOrd.炉计划.Tool;
using CoreFS.CA06;
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 FrmSpitPlanM : FrmBase
{
private string proPlanId = "";
private string gxPlanNo = "";
private OpeBase ob;
private string procesCode = "";
public FrmSpitPlanM(string _proPlanId, string _gxPlanNo, OpeBase _ob, string _procesCode)
{
proPlanId = _proPlanId;
gxPlanNo = _gxPlanNo;
procesCode = _procesCode;
ob = _ob;
InitializeComponent();
}
private string heatPlanNo = "";
///
/// 炉计划ID
///
public string HeatPlanNo
{
get { return heatPlanNo; }
set { heatPlanNo = value; }
}
private string judgeStoveNo = "";
///
/// 上料炉号
///
public string JudgeStoveNo
{
get { return judgeStoveNo; }
set { judgeStoveNo = value; }
}
private double reducedWtKc = 0;
///
/// 折算吨
///
public double ReducedWtKc
{
get { return reducedWtKc; }
set { reducedWtKc = value; }
}
private double reducedWt = 0;
///
/// 折算吨
///
public double ReducedWt
{
get { return reducedWt; }
set { reducedWt = value; }
}
private ArrayList list = null;
public ArrayList List
{
get { return list; }
set { list = value; }
}
private void FrmSpitPlanZgM_Load(object sender, EventArgs e)
{
//订单排产
EntityHelper.ShowGridCaption(ultraGridZyD.DisplayLayout.Bands[0]);
BaseHelper.setUltraGridColumnMaxInput(ultraGridZyD, new string[] {"PlnInsingleWt", "PlnOutsingleW" });
BaseHelper.setUltraGridColumnBits(ultraGridZyD, new string[] { "PlnInsingleNum", "PlnOutsingleNum" });
BaseHelper.InitCellPosition(ultraGridZyD, new string[] { "GxProSeq", "GxPlanNo","OrderNo", "DeliveryNo", "PlnInsingleNum","PlnInsingleWt","PlnOutsingleNum",
"PlnOutsingleW","CraftSeq"});
BaseHelper.GridColumnSum(ultraGridZyD, new string[] { "PlnInsingleWt", "PlnOutsingleW"});
BaseHelper.GridColumnCount(ultraGridZyD, new string[] { "PlnInsingleNum", "PlnOutsingleNum" });
StoveHelper.ForbidSort(ultraGridZyD);
DoQuery();
}
private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
{
switch (e.Tool.Key)
{
case "Query": //刷新
DoQuery();
break;
case "Confirm": // 确认
DoConfirm();
break;
case "Close": // 关闭
this.Close();
break;
default:
break;
}
}
///
/// 查询
///
private void DoQuery()
{
List listSourceM = EntityHelper.GetData
("com.steering.pss.plnsaleord.processOrder.base.ProducHelper.doQueryStarM", new object[] { proPlanId, gxPlanNo, procesCode }, ob);
plnZyMEntityBindingSource.DataSource = listSourceM;
foreach (UltraGridRow urg in ultraGridZyD.Rows)
{
if (!urg.Cells["Planstatus"].Value.ToString().Equals("计划"))
{
urg.Cells["CHC"].Value = true;
}
}
}
///
/// 确认
///
private void DoConfirm()
{
UltraGridRow row = ultraGridZyD.ActiveRow;
if (row == null) return;
int count = 0;
string planstrat="";
foreach (UltraGridRow urg in ultraGridZyD.Rows)
{
ArrayList list1 = new ArrayList();
if (Convert.ToBoolean(urg.Cells["CHC"].Text) == true)
{
count++;
//if (planstrat.Equals(""))
//{
// planstrat = urg.Cells["Planstatus"].Value.ToString();
//}
//if (!planstrat.Equals(urg.Cells["Planstatus"].Value.ToString()))
//{
// MessageUtil.ShowTips("请选择同一状态的炉号!");
// return;
//}
ReducedWt += double.Parse(urg.Cells["PlnOutsingleW"].Value.ToString());
if (JudgeStoveNo.Equals(""))
{
JudgeStoveNo = urg.Cells["JudgeStoveNo"].Value.ToString();
}
else
{
JudgeStoveNo = JudgeStoveNo + "," + urg.Cells["JudgeStoveNo"].Value.ToString();
}
}
else
{
ReducedWtKc += double.Parse(urg.Cells["PlnOutsingleW"].Value.ToString());
if (!urg.Cells["Planstatus"].Value.ToString().Equals("计划") && !urg.Cells["Planstatus"].Value.ToString().Equals("下发"))
{
MessageUtil.ShowTips("炉计划状态不是计划或下发中的必须勾选!");
return;
}
if (HeatPlanNo.Equals(""))
{
HeatPlanNo = urg.Cells["HeatPlanNo"].Value.ToString();
}
else
{
HeatPlanNo = HeatPlanNo + "," + urg.Cells["HeatPlanNo"].Value.ToString();
}
}
}
//if (count == 0)
//{
// MessageUtil.ShowTips("请选择需拆分上料炉号!");
// return;
//}
this.Close();
}
}
}