using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CoreFS.CA06;
using System.Collections;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Tool;
using Core.Mes.Client.Comm.Control;
using Infragistics.Win.UltraWinGrid;
using Core.Mes.Client.Comm.Format;
using Infragistics.Win.UltraWinEditors;
using Infragistics.Win;
using com.steering.mes.mcp.entity;
using Core.StlMes.Client.Mcp.Control;
namespace Core.StlMes.Client.Mcp.Treatment
{
public partial class FrmHttInOnlineStore : FrmBase
{
public FrmHttInOnlineStore()
{
InitializeComponent();
}
private string SlGx = "";//交库工序
private string plineCode = "";
private string departm = ""; //部门
private string SlGxname = "";//交库名称
private string stono = ""; //仓库代码
private string deparNo = ""; //部门ID
private string manage = ""; //科室id
private string manageNmae = ""; //科室名称
private string dingwei = "";
private void FrmInOnlineStore_Load(object sender, EventArgs e)
{
DateTime now = DateTime.Now;
DateTime dt1 = new DateTime(now.Year, now.Month, 1);//当月第一天
DateTime dt2 = dt1.AddMonths(1).AddDays(-1);//当月最后一天
StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
StartTime1.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
EndTime1.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
//去向
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.WarehousePermissions.getWarehousePermissionsStore", null, this.ob);//如果是“”里面添加的是条件
cmbStorage.DataSource = dt;
cmbStorage.DisplayMember = "STORAGE_NAME";
cmbStorage.ValueMember = "STORAGE_NO";
YdmBaseClass.SetComboItemHeight(cmbStorage);
manageNmae = UserInfo.GetDepartment();
plineCode = YdmBaseClass.GetPCode(manageNmae, this.ob);//获取 用户 对应的产线
//获取工序
DataTable dt3 = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryGX", new object[] { "600211" }, this.ob);
if (dt3.Rows.Count > 0)
{
SlGx = dt3.Rows[0]["BASECODE"].ToString();
SlGxname = dt3.Rows[0]["BASENAME"].ToString();
}
manage = UserInfo.GetDeptid();
deparNo = Core.StlMes.Client.Mcp.Control.ClsBaseInfo.GetDepartIdBySectionId(manage, ob);
stono = YdmBaseClass.GetStorage1(manage, deparNo, "800304", "800202", this.ob);//获取对应的仓库代码
}
///
/// 重写基类方法
///
///
///
public override void ToolBar_Click(object sender, string ToolbarKey)
{
switch (ToolbarKey)
{
case "DoQuery":
QuerySinglePlan();
break;
case "DoQueryInList":
DoQueryInList();
break;
case "cancelInList":
cancelInList();
break;
case "DoSave":
DoSave();
break;
case "DoBeside":
doBeside();
break;
case "cancelDoBeside":
cancelDoBeside();
break;
case "Close":
this.Close();
break;
}
}
///
/// 打印入库单
///
//private void printPipe()
//{
// this.ultraGrid7.UpdateData();
// string jugeAppleCode = "";
// IQueryable checkRows = this.ultraGrid7.Rows.AsQueryable().Where(a=>a.GetValue("CHK") == "True");
// if(checkRows.Count() == 0)
// {
// MessageUtil.ShowTips("请选择需要打印的判定数据信息!");
// return;
// }
// foreach (UltraGridRow uRow in checkRows)
// {
// jugeAppleCode = uRow.Cells["JugdeApplyCode"].Value.ToString();
// }
// if (jugeAppleCode == "")
// {
// MessageUtil.ShowTips("未申请判定,不允许打印缴库单!");
// return;
// }
// int jugeAppleM = checkRows.GroupBy(a => a.GetValue("JugdeApplyCode")).Count();
// if (jugeAppleM > 1)
// {
// MessageUtil.ShowTips("只有同一申请单号的信息才允许同时打印!");
// return;
// }
// string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilGodownEntryYM.cpt&format=pdf&JUGDE_APPLY_CODE=" + jugeAppleCode;
// FrmExcel fre = new FrmExcel(this.ob, strurl);
// fre.AutoSize = true;
// fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
// fre.WindowState = FormWindowState.Maximized;
// fre.Show();
//}
///
/// 结炉回退
///
private void cancelDoBeside()
{
UltraGridRow uRow = this.ultraGrid1.ActiveRow;
if (uRow == null)
{
MessageUtil.ShowTips("无数据!");
return;
}
string heatNo = uRow.Cells["HEAT_PLAN_NO"].Value.ToString();
ArrayList list = new ArrayList();
list.Add(heatNo);
list.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
list.Add(uRow.Cells["BATCH_NO"].Value.ToString());
list.Add(uRow.Cells["PRO_PLAN_ID"].Value.ToString());
list.Add(uRow.Cells["GX_PLAN_NO"].Value.ToString());
if (MessageUtil.ShowYesNoAndQuestion("是否撤销结炉?") == DialogResult.No)
{
return;
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore";
ccp.MethodName = "undoBeside";
ccp.ServerParams = new object[] { list, SlGx, plineCode };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("撤销结炉成功!"))
{
QuerySinglePlan();
}
}
}
///
/// 交库结炉(验证进程表数据与入库数据一致性(合格))
///
private void doBeside()
{
UltraGridRow uRow = this.ultraGrid1.ActiveRow;
if (uRow == null)
{
MessageUtil.ShowTips("无数据!");
return;
}
string heatNo = uRow.Cells["HEAT_PLAN_NO"].Value.ToString();
if (MessageUtil.ShowYesNoAndQuestion("是否结炉?") == DialogResult.No)
{
return;
}
CoreClientParam ccp = new CoreClientParam();
ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore";
ccp.MethodName = "doBeside";
ccp.ServerParams = new object[] { heatNo, SlGx, plineCode, uRow.Cells["PRO_PLAN_ID"].Value.ToString(), uRow.Cells["GX_PLAN_NO"].Value.ToString() };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("结炉成功!"))
{
QuerySinglePlan();
}
}
}
///
/// 交库
///
private void DoSave()
{
string strInbound = "800701";//入库类型(产出入库)
string strInMemo = "";
string matStart = "";//材料状态
string isSamp = "";//是否样管
UltraGridRow uRow = ultraGrid1.ActiveRow;
if (uRow == null) return;
UltraGridRow uRow3 = ultraGrid3.ActiveRow;
if (uRow3 == null) return;
//int addCount = 0;
ArrayList list = new ArrayList();
DataTable dtMemo = PipeManageClass.getComTypeInfo(strInbound, ob);
if (dtMemo.Rows.Count >= 1)
{
strInMemo = dtMemo.Rows[0]["MEMO"].ToString();
}
if (uRow3.Cells["MAT_STATUS"].Value.ToString().Equals("剔除"))
{
matStart = "10";
isSamp = "0";
}
else if (uRow3.Cells["MAT_STATUS"].Value.ToString().Equals("合格"))
{
matStart = "00";
isSamp = "0";
}
else
{
matStart = "00";
isSamp = "1";
}
if (cmbBc.Text.ToString() == "" || cmbBc.Text.ToString()==null)
{
MessageUtil.ShowTips("班次不能为空!");
return;
}
if (cmbBz.Text.ToString() == "" || cmbBz.Text.ToString() == null)
{
MessageUtil.ShowTips("班组不能为空!");
return;
}
if (name.Text.ToString() == "" || name.Text.ToString() == null)
{
MessageUtil.ShowTips("操作人不能为空!");
return;
}
//foreach (UltraGridRow uRow1 in ultraGrid2.Rows)
//{
// if (Convert.ToBoolean(uRow1.Cells["CHK"].Text) == true)
// {
// addCount += 1;
//产量差
if (uRow.Cells["CLC_NUM"].Value.ToString() != "0")
{
MessageUtil.ShowTips("您选择的计划产量不平!");
return;
}
if (cmbStorage.Text.ToString().Equals(""))
{
MessageUtil.ShowTips("去向不能为空!");
return;
}
UltraGridRow uRow1 = ultraGrid2.ActiveRow;
if (uRow1 == null) { MessageUtil.ShowTips("炉批信息无数据"); return; }
if (uRow1.Cells["EDI_COUNT"].Value.ToString().Equals("0"))
{
MessageUtil.ShowTips("可入库支数不能为零!");
return;
}
if (uRow1.Cells["EDI_WT"].Value.ToString().Equals("0"))
{
MessageUtil.ShowTips("可入库重量不能为零!");
return;
}
ArrayList pram = new ArrayList();
pram.Add(uRow.Cells["HEAT_PLAN_NO"].Text.ToString());
pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.ToString());
pram.Add(uRow.Cells["BATCH_NO"].Text.ToString());
pram.Add(uRow.Cells["PLAN_JG_NUM"].Value.ToString());
pram.Add(uRow.Cells["PLAN_JG_WEIGHT"].Value.ToString());
pram.Add(uRow1.Cells["EDI_COUNT"].Value.ToString());
pram.Add(uRow.Cells["SJ_WEIGHT"].Value.ToString());
pram.Add(uRow.Cells["FAIL_CUT_NUM"].Value.ToString());
pram.Add(uRow.Cells["FAIL_CUT_WEIGHT"].Value.ToString());
pram.Add(this.UserInfo.GetUserName());
pram.Add(this.UserInfo.GetUserOrder());
pram.Add(this.UserInfo.GetUserGroup());
pram.Add(strInbound);
pram.Add(strInMemo);
pram.Add(manage);//所属单位
pram.Add(manageNmae);//所属单位名称
pram.Add(stono);//仓库
pram.Add(matStart);
pram.Add(isSamp);
pram.Add(cmbStorage.Value.ToString());//去向
pram.Add(cmbStorage.Text.ToString());//去向
pram.Add(uRow1.Cells["ACT_COUNT"].Value.ToString());
pram.Add(uRow.Cells["BATCH_GROUD_NO"].Text.ToString());
pram.Add(uRow1.Cells["EDI_WT"].Value.ToString());
pram.Add(cmbBc.Value.ToString());
pram.Add(cmbBz.Value.ToString());
pram.Add(name.Text.ToString());
//list.Add(pram);
// }
//}
//if (addCount == 0) { MessageUtil.ShowTips("请选择要交库炉批信息!"); return; }
if (MessageUtil.ShowYesNoAndQuestion("是否确认交库?") == DialogResult.No)
{
return;
}
CoreClientParam ccp = new CoreClientParam();
try
{
this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
if (Constant.WaitingForm == null)
{
Constant.WaitingForm = new WaitingForm();
}
Constant.WaitingForm.ShowToUser = true;
Constant.WaitingForm.Show();
Constant.WaitingForm.Update();
ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore";
ccp.MethodName = "addLibraryResult";
ccp.ServerParams = new object[] { pram, uRow.Cells["HEAT_PLAN_NO"].Text.ToString(), SlGx, SlGxname, plineCode };
ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
if (ccp.ReturnCode != -1)
{
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("交库成功!"))
{
dingwei = uRow.Cells["HEAT_PLAN_NO"].Value.ToString();
QuerySinglePlan();
}
}
}
///
/// 撤销交库
///
private void cancelInList()
{
ultraGridIn.UpdateData();
UltraGridRow urg = ultraGridIn.ActiveRow;
if (urg == null) { MessageUtil.ShowTips("无交库信息!"); return; }
int addCount = 0;
ArrayList list = new ArrayList();
foreach (UltraGridRow uRow in ultraGridIn.Rows)
{
if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
{
addCount += 1;
ArrayList pram = new ArrayList();
pram.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString());
pram.Add(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString());
pram.Add(uRow.Cells["BATCH_NO"].Value.ToString());
pram.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
pram.Add(uRow.Cells["QCM_STAUS"].Value.ToString());
pram.Add(uRow.Cells["ACT_COUNT"].Value.ToString());
pram.Add(uRow.Cells["ACT_WEIGHT"].Value.ToString());
pram.Add(this.UserInfo.GetUserName());
pram.Add(uRow.Cells["INSTOCK_DOC"].Value.ToString());
pram.Add(uRow.Cells["PRODUCT_FLAG"].Value.ToString());
list.Add(pram);
}
}
if (addCount == 0) { MessageUtil.ShowTips("请选择要撤销的交库信息!"); return; }
if (MessageUtil.ShowYesNoAndQuestion("是否撤销交库信息?") == DialogResult.No)
{
return;
}
CoreClientParam ccp = new CoreClientParam();
try
{
this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
if (Constant.WaitingForm == null)
{
Constant.WaitingForm = new WaitingForm();
}
Constant.WaitingForm.ShowToUser = true;
Constant.WaitingForm.Show();
Constant.WaitingForm.Update();
ccp.ServerName = "com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore";
ccp.MethodName = "deleteLibraryResult";
ccp.ServerParams = new object[] { list, SlGx, urg.Cells["JUDGE_STOVE_NO"].Value.ToString(), urg.Cells["BATCH_NO"].Value.ToString(), plineCode };
ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
catch (Exception ex)
{
this.Cursor = Cursors.Default;
Constant.WaitingForm.ShowToUser = false;
Constant.WaitingForm.Close();
Constant.WaitingForm = null;
}
if (ccp.ReturnCode == -1) return;
MessageUtil.ShowTips(ccp.ReturnInfo);
if (ccp.ReturnInfo.Equals("撤销交库成功!"))
{
DoQueryInList();
}
}
///
/// 查询入库实绩
///
private void DoQueryInList()
{
string startTim = "";
string endTim = "";
string jugeNo = "";
if (this.chkHeatNo1.Checked && this.txtHeatNo1.Text.Trim() != "")
{
jugeNo = this.txtHeatNo1.Text.Trim();
}
if (chkTim1.Checked)
{
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("选择的前面时间不能大于后面的时间!");
return;
}
else
{
startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
}
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQueryLibrary", new object[] { plineCode, startTim, endTim, jugeNo }, this.ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable6, true);
}
///
/// 查询炉顺序
///
private void QuerySinglePlan()
{
string startTim = "";
string endTim = "";
string jugeNo = "";
string lotNo = "";
if (this.chkJugeHeatNo.Checked && this.txtJugeNo.Text.Trim() != "")
{
jugeNo = this.txtJugeNo.Text.Trim();
}
if (chkTim.Checked)
{
if (DateTime.Parse(StartTime.Value.ToString()) > DateTime.Parse(EndTime.Value.ToString()))
{
MessageUtil.ShowTips("选择时间区间错误,请重新选择!");
return;
}
else
{
startTim = this.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
endTim = this.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
}
if (this.chkLotNo.Checked && this.txtLotNo.Text.Trim() != "")
{
lotNo = this.txtLotNo.Text.Trim();
}
HttPlan plan = new HttPlan();
plan.JudgeStoveNo = jugeNo;//炉号
plan.HeatPlanNo = lotNo;//炉批计划
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQuerymch", new object[] { plan, plineCode, startTim, endTim, ultraOptionSet2.CheckedItem.DataValue.ToString() }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
if (dt.Rows.Count <= 0)
{
DataTable dt1 = new DataTable();
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable8, true);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable7, true);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
}
foreach (UltraGridRow urg in ultraGrid1.Rows)
{
if (urg.Cells["BESIDE_STATUS"].Text.Equals("交库结炉"))
{
urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray;
}
}
if (dt.Rows.Count > 0)
{
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_NO"].Value.ToString() == dingwei)
{
UltraGridRow row = ultraGrid1.Rows[i];
row.Activate();
}
}
}
dingwei = "";
}
private void ultraGrid3_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
{
foreach (UltraGridRow uRow in ultraGrid3.Selected.Rows)
{
if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
{
uRow.Cells["CHK"].Value = true;
}
}
}
//查询炉批信息里的内容
private void ultraGrid3_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow row = ultraGrid3.ActiveRow;
if (row != null)
{
string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
string matstatus = row.Cells["MAT_STATUS"].Value.ToString();
string pipe = row.Cells["IS_SAMPLE_PIPE"].Value.ToString();
if (matstatus == "合格")
{
matstatus = "00";
pipe = "0";
}
else if (matstatus == "剔除")
{
matstatus = "10";
pipe = "0";
}
else if (matstatus == "样管")
{
matstatus = "00";
pipe = "1";
}
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQueryformat", new object[] { heatNo, matstatus, pipe }, ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable8, true);
}
}
UltraComboEditor bacthNo = new UltraComboEditor();
UltraComboEditor flawStaus = new UltraComboEditor();
UltraComboEditor testingStaus = new UltraComboEditor();
private void ultraGrid2_CellChange(object sender, CellEventArgs e)
{
UltraGridRow row=ultraGrid2.ActiveRow;
this.ultraGrid2.UpdateData();
UltraGridRow row1 = ultraGrid3.ActiveRow;
string heatNo = row1.Cells["HEAT_PLAN_NO"].Value.ToString();
string matstatus = row1.Cells["MAT_STATUS"].Value.ToString();
string pipe = row1.Cells["IS_SAMPLE_PIPE"].Value.ToString();
if (matstatus == "合格")
{
matstatus = "00";
pipe = "0";
}
else if (matstatus == "剔除")
{
matstatus = "10";
pipe = "0";
}
else if (matstatus == "样管")
{
matstatus = "00";
pipe = "1";
}
if (e.Cell.Column.Key == "EDI_COUNT")
{
if (e.Cell.Row.Cells["EDI_COUNT"].Value == null)
{
e.Cell.Row.Cells["EDI_COUNT"].Value = "0";
}
else
{
ultraGrid2.UpdateData();
string actCount = e.Cell.Row.Cells["EDI_COUNT"].Value.ToString();
if (!StringUtil.IsInt(actCount) || actCount == "0")
{
e.Cell.Row.Cells["EDI_COUNT"].Value = "0";
e.Cell.Row.Cells["EDI_WT"].Value = "0";
}
else
{
int count=int.Parse(row.Cells["ACT_COUNT"].Value.ToString())-int.Parse(row.Cells["LINT_COUNT"].Value.ToString());
if (count < int.Parse(e.Cell.Row.Cells["EDI_COUNT"].Value.ToString()))
{
MessageUtil.ShowTips("可入库支数不能大于总支数与已入库支数之差");
e.Cell.Row.Cells["EDI_COUNT"].Value = count.ToString();
return;
}
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQueryWt", new object[] { heatNo, matstatus, pipe, e.Cell.Row.Cells["EDI_COUNT"].Value }, ob);
if (dt.Rows.Count == 0)
{
e.Cell.Row.Cells["EDI_WT"].Value = "0";
}
else
{
e.Cell.Row.Cells["EDI_WT"].Value = dt.Rows[0]["ACT_WEIGHT"].ToString();
}
}
}
}
if (e.Cell.Column.Key == "EDI_WT")
{
if (e.Cell.Row.Cells["EDI_WT"].Value == null)
{
e.Cell.Row.Cells["EDI_WT"].Value = "0";
}
else
{
ultraGrid2.UpdateData();
string actWt = e.Cell.Row.Cells["EDI_WT"].Value.ToString();
if (!StringUtil.IsFloat(actWt) || actWt == "0")
{
e.Cell.Row.Cells["EDI_WT"].Value = "0";
}
else
{
double wt = double.Parse(row.Cells["ACT_WEIGHT"].Value.ToString()) - double.Parse(row.Cells["LINT_WT"].Value.ToString());
if (wt < double.Parse(e.Cell.Row.Cells["EDI_WT"].Value.ToString()))
{
MessageUtil.ShowTips("可入库重量不能大于总重量与已入库重量之差");
e.Cell.Row.Cells["EDI_WT"].Value = wt.ToString("f3");
return;
}
}
}
}
//if (e.Cell.Column.Key == "CHK")
//{
// if (Convert.ToBoolean(e.Cell.Value))
// {
// for (int i = 0; i < e.Cell.Row.Cells.Count; i++)
// {
// e.Cell.Row.Cells[i].Activation = Activation.AllowEdit;
// }
// }
//}
}
private void FrmInOnlineStore_Shown(object sender, EventArgs e)
{
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMat"))
{
toolMenu.Toolbars[0].Tools["DoQueryMat"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMatB"))
{
toolMenu.Toolbars[0].Tools["DoQueryMatB"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryInList"))
{
toolMenu.Toolbars[0].Tools["DoQueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelInList"))
{
toolMenu.Toolbars[0].Tools["cancelInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoDecision"))
{
toolMenu.Toolbars[0].Tools["DoDecision"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelDoDecision"))
{
toolMenu.Toolbars[0].Tools["cancelDoDecision"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Print"))
{
toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("insertProssWt"))
{
toolMenu.Toolbars[0].Tools["insertProssWt"].InstanceProps.Visible = DefaultableBoolean.False;
}
}
private void ultraTabControl1_SelectedTabChanged(object sender, Infragistics.Win.UltraWinTabControl.SelectedTabChangedEventArgs e)
{
if (toolMenu == null) return;
if (ultraTabControl1.SelectedTab.Key == "1")
{
if (toolMenu.Toolbars[0].Tools.Exists("DoQuery"))
{
toolMenu.Toolbars[0].Tools["DoQuery"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoSave"))
{
toolMenu.Toolbars[0].Tools["DoSave"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMat"))
{
toolMenu.Toolbars[0].Tools["DoQueryMat"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMatB"))
{
toolMenu.Toolbars[0].Tools["DoQueryMatB"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryInList"))
{
toolMenu.Toolbars[0].Tools["DoQueryInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelInList"))
{
toolMenu.Toolbars[0].Tools["cancelInList"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoDecision"))
{
toolMenu.Toolbars[0].Tools["DoDecision"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoBeside"))
{
toolMenu.Toolbars[0].Tools["DoBeside"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelDoBeside"))
{
toolMenu.Toolbars[0].Tools["cancelDoBeside"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelDoDecision"))
{
toolMenu.Toolbars[0].Tools["cancelDoDecision"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("Print"))
{
toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("insertProssWt"))
{
toolMenu.Toolbars[0].Tools["insertProssWt"].InstanceProps.Visible = DefaultableBoolean.False;
}
}
else if (ultraTabControl1.SelectedTab.Key == "2")
{
if (toolMenu.Toolbars[0].Tools.Exists("DoQuery"))
{
toolMenu.Toolbars[0].Tools["DoQuery"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoSave"))
{
toolMenu.Toolbars[0].Tools["DoSave"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMat"))
{
toolMenu.Toolbars[0].Tools["DoQueryMat"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryMatB"))
{
toolMenu.Toolbars[0].Tools["DoQueryMatB"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoQueryInList"))
{
toolMenu.Toolbars[0].Tools["DoQueryInList"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelInList"))
{
toolMenu.Toolbars[0].Tools["cancelInList"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoDecision"))
{
toolMenu.Toolbars[0].Tools["DoDecision"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("DoBeside"))
{
toolMenu.Toolbars[0].Tools["DoBeside"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelDoBeside"))
{
toolMenu.Toolbars[0].Tools["cancelDoBeside"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("cancelDoDecision"))
{
toolMenu.Toolbars[0].Tools["cancelDoDecision"].InstanceProps.Visible = DefaultableBoolean.True;
}
if (toolMenu.Toolbars[0].Tools.Exists("Print"))
{
toolMenu.Toolbars[0].Tools["Print"].InstanceProps.Visible = DefaultableBoolean.False;
}
if (toolMenu.Toolbars[0].Tools.Exists("insertProssWt"))
{
toolMenu.Toolbars[0].Tools["insertProssWt"].InstanceProps.Visible = DefaultableBoolean.False;
}
}
}
private void chkTim_CheckedChanged(object sender, EventArgs e)
{
this.StartTime.Enabled = this.EndTime.Enabled = this.chkTim.Checked;
}
private void chkJugeHeatNo_CheckedChanged(object sender, EventArgs e)
{
this.txtJugeNo.Enabled = this.chkJugeHeatNo.Checked;
}
private void chkLotNo_CheckedChanged(object sender, EventArgs e)
{
this.txtLotNo.Enabled = this.chkLotNo.Checked;
}
private void chkTim1_CheckedChanged(object sender, EventArgs e)
{
this.StartTime1.Enabled = this.EndTime1.Enabled = this.chkTim1.Checked;
}
private void chkHeatNo1_CheckedChanged(object sender, EventArgs e)
{
this.txtHeatNo1.Enabled = this.chkHeatNo1.Checked;
}
private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
string heatNo = row.Cells["HEAT_PLAN_NO"].Value.ToString();
string judge = row.Cells["JUDGE_STOVE_NO"].Value.ToString();
string batch = row.Cells["BATCH_NO"].Value.ToString();
string groupNo = row.Cells["BATCH_GROUD_NO"].Value.ToString();
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQuerySingleJug", new object[] { heatNo, judge, batch, groupNo }, ob);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable7, true);
QueryPortVrp(heatNo);
foreach (UltraGridRow urg in ultraGrid3.Rows)
{
if (urg.Cells["MAT_STATUS"].Text.Equals("剔除"))
{
urg.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
}
}
}
//查询管号队列
private void QueryPortVrp(string planNo)
{
//查询管号队列
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryDbkPortVrphot", new object[] { planNo }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable3, true);
foreach (UltraGridRow urg in ultraGrid6.Rows)
{
if (urg.Cells["MAT_STATUS"].Text.Equals("剔除"))
{
urg.Cells["MAT_STATUS"].Appearance.ForeColor = Color.Red;
}
}
}
private void craftImg_EditorButtonClick(object sender, EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
string craftPath = YdmBaseClass.getQueryCraftNoRCL(row.Cells["CRAFT_FILE_NO"].Text.ToString(), row.Cells["CRAFT_SEQ"].Text.ToString(), ob);
if (e.Button.Key.ToLower().Equals("select"))
{
FormFileDown down = new FormFileDown(ob, craftPath);
down.CtrlFileDown1.Button3.Visible = false;
down.ShowDialog();
}
}
private void cmbBz_ValueChanged(object sender, EventArgs e)
{
//获取产线名称
string plinename = "";
DataTable dtc = ServerHelper.GetData("com.steering.mes.mcp.common.PlanService.getQueryplinename", new object[] { plineCode }, this.ob);
if (dtc.Rows.Count > 0)
{
plinename = dtc.Rows[0]["PLINE_NAME"].ToString();
}
//获取操作人
string banCi = "";
if (cmbBz.Value == "1")
{
banCi = "甲";
}
else if (cmbBz.Value == "2")
{
banCi = "乙";
}
else if (cmbBz.Value == "3")
{
banCi = "丙";
}
else if (cmbBz.Value == "4")
{
banCi = "丁";
}
DataTable dtt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMcpLoading.getPerson", new object[] { banCi, plinename }, this.ob);//如果是“”里面添加的是条件
name.DataSource = dtt;
name.DisplayMember = "NAME";
// name.ValueMember = "ID";
YdmBaseClass.SetComboItemHeight(name);
}
private void OfflineNum_EditorButtonClick(object sender, EditorButtonEventArgs e)
{
UltraGridRow row = ultraGrid1.ActiveRow;
if (row == null) return;
UltraGridRow uRow3 = ultraGrid3.ActiveRow;
if (uRow3 == null) return;
UltraGridRow urg = ultraGrid2.ActiveRow;
if (urg == null) return;
string matStart = "";//材料状态
string isSamp = "";//是否样管
if (uRow3.Cells["MAT_STATUS"].Value.ToString().Equals("剔除"))
{
matStart = "10";
isSamp = "0";
}
else if (uRow3.Cells["MAT_STATUS"].Value.ToString().Equals("合格"))
{
matStart = "00";
isSamp = "0";
}
else
{
matStart = "00";
isSamp = "1";
}
string batchgroudno = row.Cells["BATCH_GROUD_NO"].Text.ToString();
string outnumcut = row.Cells["OUTNUM_CUT"].Text.ToString();
string heno = row.Cells["HEAT_PLAN_NO"].Text.ToString();
string linenum = urg.Cells["EDI_COUNT"].Text.ToString();
string plineName = row.Cells["PLINE_NAME"].Text.ToString();
DataTable dt1 = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.getQueryExpandResultStuts", new object[] { heno, row.Cells["PLINE_CODE"].Text.ToString() }, this.ob);
if (dt1.Rows.Count > 0)
{
if (dt1.Rows[0]["INSTORE_FLAG"].ToString() == "1")
{
MessageUtil.ShowTips("该工序已经结炉,不允许录入离线数!");
return;
}
}
if(linenum==null||linenum=="")
{
linenum = "0";
}
UltraGridRow row3 = ultraGrid6.ActiveRow;
if (row3 == null) return;
HttScrapNumOnline matfrm = new HttScrapNumOnline(heno, SlGx, SlGxname, batchgroudno, outnumcut, stono, plineCode, linenum, plineName,matStart,isSamp, this.ob);
matfrm.ShowDialog();
this.ultraGrid1.UpdateData();
QuerySinglePlan();
}
private void ultraGrid5_AfterRowActivate(object sender, EventArgs e)
{
UltraGridRow urgs = ultraGrid5.ActiveRow;
string heastno = urgs.Cells["HEAT_PLAN_NO"].Value.ToString();
DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.FrmHttInOnlineStore.doQuerySingleJugStove", new object[] { heastno }, this.ob);
GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
if (dt.Rows.Count <= 0)
{
DataTable dt1 = new DataTable();
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable8, true);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable7, true);
GridHelper.CopyDataToDatatable(ref dt1, ref dataTable1, true);
}
foreach (UltraGridRow urg in ultraGrid1.Rows)
{
if (urg.Cells["PLANSTATUS"].Text.Equals("生产中"))
{
urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Green;
}
if (urg.Cells["PLANSTATUS"].Text.Equals("生产完成"))
{
urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
}
if (urg.Cells["PLANSTATUS"].Text.Equals("关闭"))
{
urg.Cells["PLANSTATUS"].Appearance.BackColor = Color.Red;
}
if (urg.Cells["BESIDE_STATUS"].Text.Equals("交库结炉"))
{
urg.Cells["BESIDE_STATUS"].Appearance.BackColor = Color.LightGray;
}
}
if (dt.Rows.Count > 0)
{
for (int i = 0; i < ultraGrid1.Rows.Count; i++)
{
if (ultraGrid1.Rows[i].Cells["HEAT_PLAN_NO"].Value.ToString() == dingwei)
{
UltraGridRow row = ultraGrid1.Rows[i];
row.Activate();
}
}
}
dingwei = "";
}
}
}