| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 |
- using com.steering.mes.mcp.entity;
- 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.Mcp.Control;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinEditors;
- 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.Mcp.Mch.MchResult
- {
- public partial class FrmMchApply : FrmBase
- {
- UltraComboEditor uceLB = new UltraComboEditor();//材料类别
- UltraComboEditor uceZT= new UltraComboEditor();//材料状态
- UltraComboEditor uceBJ = new UltraComboEditor();//表检结果
- UltraComboEditor uceCF = new UltraComboEditor();//成分结果
- UltraComboEditor uceXN = new UltraComboEditor();//性能结果
- UltraComboEditor uceZHPD = new UltraComboEditor();//综合判定结果
- private string manage = ""; //科室id
- private string manageNmae = ""; //科室名称
- private string departm = "";
- private string plineCode = "";
- public FrmMchApply()
- {
- InitializeComponent();
- }
- //private string plineCode = "";//产线
- private void FrmMchApply_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);//当月最后一天
- this.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00");
- this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59");
- manageNmae = UserInfo.GetDepartment();
- manage = UserInfo.GetDeptid();
- departm = UserInfo.GetDepartment();
- plineCode = YdmBaseClass.GetPCode(departm, this.ob);//获取 用户 对应的产线
- InitBindColumn();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- QuerySinglePlan();
- break;
- case "ApplyDec":
- DoApplyDec();
- break;
- case "UndoApply":
- DoUndoApply();
- break;
- case "ReturnWt":
- DoReturnWt();
- break;
- case "TransferPrint":
- DoTransferPrint();
- break;
- case "CollectedPrint":
- DoCollectedPrint();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void InitBindColumn()
- {
- YdmBaseClass.InitComboEditorWithParm(uceLB, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true,new Object[]{"8014"});
- //YdmBaseClass.InitComboEditorWithParm(uceZT, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "801501" });
- YdmBaseClass.InitComboEditorWithParm(uceBJ, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407406" });
- YdmBaseClass.InitComboEditorWithParm(uceCF, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407401" });
- YdmBaseClass.InitComboEditorWithParm(uceXN, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407402" });
- YdmBaseClass.InitComboEditorWithParm(uceZHPD, "com.steering.mes.mcp.Mch.FrmMchApply.getProductflag", "BASECODE", this.ob, true, new Object[] { "407407" });
- YdmBaseClass.BindColumn(uceLB, "PRODUCT_FLAG", this.Controls, ultraGridMat, 0);
- //YdmBaseClass.BindColumn(uceZT, "MAT_STATUS", this.Controls, ultraGridMat, 0);
- YdmBaseClass.BindColumn(uceBJ, "VRP_FACE_RESULT_CODE", this.Controls, ultraGridMat, 0);
- YdmBaseClass.BindColumn(uceCF, "VRP_CHEM_RESULT_CODE", this.Controls, ultraGridMat, 0);
- YdmBaseClass.BindColumn(uceXN, "VRP_PHY_RESULT_CODE", this.Controls, ultraGridMat, 0);
- YdmBaseClass.BindColumn(uceZHPD, "VRP_JUDGE_RESULT_CODE", this.Controls, ultraGridMat, 0);
- //材料状态
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150101", "材料产出等待");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150102", "材料产出(已判定)");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150103", "材料已编计划");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150104", "材料待处理");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150105", "材料加工");
- //this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150106", "材料为余材");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150201", "材料产出等待(未综合判定)");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150202", "材料产出(已综合判定");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150203", "材料为余材(生产组织产生)");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150204", "材料脱单余材(销售组织脱单)");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150205", "材料缴库余材(销售组织缴库)");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150301", "材料可编提单");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150302", "材料已编提单");
- this.ultraGridMat.DisplayLayout.ValueLists[0].ValueListItems.Add("80150303", "销售出厂");
- }
- /// <summary>
- /// 查询炉计划
- /// </summary>
- private void QuerySinglePlan()
- {
- string value = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
- string startTim = "";
- string endTim = "";
- string jugeNo = "";
-
- 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");
- }
- }
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryLibrary", new object[] { jugeNo, startTim, endTim, plineCode }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dataTable2, true);
- if(dt.Rows.Count>0)
- {
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (value == "0")
- {
- if (Convert.ToInt32(urg.Cells["UNAPPLY_COUNT"].Text) == 0)
- {
- urg.Hidden = true;
- }
- else
- {
- urg.Hidden = false;
- }
- }
- else if (value == "1")
- {
- if (Convert.ToInt32(urg.Cells["APPLY_COUNT"].Text) == 0)
- {
- urg.Hidden = true;
- }
- else
- {
- urg.Hidden = false;
- }
- }
- }
- }
-
- }
- /// <summary>
- /// 查询炉批信息
- /// </summary>
- private void QueryMatZcM(string judgeNo,string batchNo,string groupNo,string value,string plinCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryMatZcM", new object[] { judgeNo, batchNo, groupNo, value, plinCode }, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref dtPipes, true);
-
- }
- /// <summary>
- /// 申请判定
- /// </summary>
- private void DoApplyDec()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- this.ultraGridMat.UpdateData();
- int m = 0;
- int n = 0;
- int z = 0;
- IQueryable<UltraGridRow> checkMagRows = this.ultraGridMat.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要申请判定炉批信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- if (uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "判废" || uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "待处理")
- {
- m = m + 1;
- }
- if (uRow.Cells["VRP_JUGDE_APPLY_CODE"].Text.Trim() != "")
- {
- n = n + 1;
- }
- ArrayList parm1 = new ArrayList();
- parm1.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.ToString());
- parm1.Add(uRow.Cells["BATCH_NO"].Text.ToString());
- parm1.Add(uRow.Cells["BATCH_GROUD_NO"].Text.ToString());
- parm1.Add(this.UserInfo.GetUserName());
- parm1.Add(this.UserInfo.GetUserOrder());
- parm1.Add(this.UserInfo.GetUserGroup());
- parm1.Add(uRow.Cells["PLINE_CODE"].Text.ToString());
- parm1.Add(uRow.Cells["PRODUCT_FLAG"].Value.ToString());
- parm1.Add(manage);
- parm1.Add(manageNmae);
- parm1.Add(row.Cells["ZY_BATCH_ID"].Value.ToString());
- parm1.Add(row.Cells["CRAFT_FILE_NO"].Value.ToString());
- parm1.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString());
- parm.Add(parm1);
- }
- if (m > 0)
- {
- MessageUtil.ShowTips("废品/待处理的炉批组信息,不允许申请判定!");
- return;
- }
- if (n > 0)
- {
- MessageUtil.ShowTips("正在进行判定的炉批组信息,不允许重复申请判定!");
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply";
- ccp.MethodName = "doApplyDec";
- ccp.ServerParams = new object[] { parm, row.Cells["HEAT_PLAN_NO"].Value.ToString() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("申请判定成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- /// <summary>
- /// 撤销申请判定
- /// </summary>
- private void DoUndoApply()
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- this.ultraGridMat.UpdateData();
- IQueryable<UltraGridRow> checkMagRows = this.ultraGridMat.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkMagRows.Count() == 0)
- {
- MessageUtil.ShowTips("请选择需要撤销申请判定炉批信息!");
- return;
- }
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow uRow in checkMagRows)
- {
- //if (uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "判废" || uRow.Cells["VRP_QCM_STAUS"].Text.Trim() == "待处理")
- //{
- // m = m + 1;
- //}
- ArrayList parm1 = new ArrayList();
- parm1.Add(uRow.Cells["JUDGE_STOVE_NO"].Text.ToString());
- parm1.Add(uRow.Cells["BATCH_NO"].Text.ToString());
- parm1.Add(uRow.Cells["BATCH_GROUD_NO"].Text.ToString());
- parm1.Add(this.UserInfo.GetUserName());
- parm1.Add(uRow.Cells["PLINE_CODE"].Text.ToString());
- parm1.Add(uRow.Cells["PRODUCT_FLAG"].Value.ToString());
- parm1.Add(uRow.Cells["VRP_JUGDE_APPLY_CODE"].Value.ToString());
- parm.Add(parm1);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply";
- ccp.MethodName = "DoUndoApply";
- ccp.ServerParams = new object[] { parm, row.Cells["HEAT_PLAN_NO"].Value.ToString() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("撤销申请判定成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- /// <summary>
- /// 回报过磅重量
- /// </summary>
- private void DoReturnWt()
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- //string departMentid = PipeManageClass.GetDepartIdBySectionId(UserInfo.GetDeptid(), ob);
- string departMentid = UserInfo.GetDeptid();
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择需要回报过磅重量的炉计划信息!");
- return;
- }
- //if (uRow.Cells["ProductFlag"].Value.ToString() != "801402")
- //{
- // MessageUtil.ShowTips("只允许成品类回报过磅重量!");
- // return;
- //}
- if (Double.Parse(uRow.Cells["PONDER_GROSS_WT"].Value.ToString()) <= 0)
- {
- MessageUtil.ShowTips("请输入正确的过磅重量!");
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["HEAT_PLAN_NO"].Value.ToString());
- list.Add(uRow.Cells["PONDER_GROSS_WT"].Value.ToString());
- list.Add(uRow.Cells["HEATNO_LAST"].Value.ToString());
- list.Add(uRow.Cells["ZG_BATCH_NO"].Value.ToString());
- list.Add(uRow.Cells["BATCH_GROUD_NO"].Value.ToString());
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.FrmMchApply";
- ccp.MethodName = "doReturnWt";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("回报成功!"))
- {
- QuerySinglePlan();
- }
- }
- }
- /// <summary>
- ///缴库单打印
- /// </summary>
- private void DoTransferPrint()
- {
- this.ultraGrid1.UpdateData();
- string jugeNo = "";
- string batchNo = "";
- string groupNo = "";
- string plinCode = "";
- int count = 0;
- ArrayList list = new ArrayList();
- foreach (UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text.ToString()) == true)
- {
- count += 1;
- jugeNo = uRow.Cells["HEATNO_LAST"].Value.ToString();
- batchNo = uRow.Cells["ZG_BATCH_NO"].Value.ToString();
- groupNo = uRow.Cells["BATCH_GROUD_NO"].Value.ToString();
- plinCode = uRow.Cells["PLINE_CODE"].Value.ToString();
- string departMentid = UserInfo.GetDeptid();
- string userGroup = this.UserInfo.GetUserGroup();
- string userOrder = this.UserInfo.GetUserOrder();
- DataTable ds = ServerHelper.GetData("com.steering.mes.mcp.Mch.FrmMchApply.doQueryApplyCodeNull", new object[] { jugeNo, batchNo, groupNo }, this.ob);
- if (int.Parse(ds.Rows[0][0].ToString()) > 0)
- {
- MessageUtil.ShowTips("有未申请判定的数据,不允许进行缴库单打印!");
- return;
- }
- list.Add(jugeNo);
- }
- }
- if (count == 0)
- {
- MessageUtil.ShowTips("请选择需要打印的炉信息!");
- return;
- }
- string str = string.Join("','", (string[])list.ToArray(typeof(string)));
- string strurl = "";
- if (plinCode.Equals("C021"))//镦粗
- {
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkDcCollected.cpt&PLINE_CODE=" + plinCode + "&HEATNO_LAST=" + str;
- }
- else
- {
- strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkDcCollected.cpt&PLINE_CODE=" + plinCode + "&HEATNO_LAST=" + str;
- }
- FrmRepExcel fre = new FrmRepExcel(this.ob, strurl);
- fre.AutoSize = true;
- fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- fre.WindowState = FormWindowState.Maximized;
- fre.Show();
- }
- /// <summary>
- /// 转移单打印
- /// </summary>
- private void DoCollectedPrint()
- {
- this.ultraGridMat.UpdateData();
- UltraGridRow uRow = this.ultraGridMat.ActiveRow;
- if (uRow == null)
- {
- MessageUtil.ShowTips("请选择需要打印的判定信息!");
- return;
- }
- string userGroup = this.UserInfo.GetUserGroup();
- string userOrder = this.UserInfo.GetUserOrder();
- string userName = this.UserInfo.GetUserName();
- string applyNo = uRow.Cells["VRP_JUGDE_APPLY_CODE"].Text.Trim();
- if (applyNo == "")
- {
- MessageUtil.ShowTips("未申请判定,不允许判定单的打印!");
- }
- string strurl = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepDbkApplyCard.cpt&format=pdf&APPLY_CODE=" + applyNo + "&GROUP=" + userGroup + "&SHIFT=" + userOrder + "&USER_ID=" + userName;
- FrmRepExcel fre = new FrmRepExcel(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 chkJugeHeatNo_CheckedChanged(object sender, EventArgs e)
- {
- if (chkJugeHeatNo.Checked) { txtJugeNo.Enabled = true; } else { txtJugeNo.Enabled = false; }
- if (chkTim.Checked) { StartTime.Enabled = true; EndTime.Enabled = true; } else { StartTime.Enabled = false; EndTime.Enabled = false; }
- }
- /// <summary>
- /// 触发Grid1事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
-
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
-
- QueryMatZcM(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(), uRow.Cells["ZG_BATCH_NO"].Value.ToString(), uRow.Cells["BATCH_GROUD_NO"].Value.ToString(), this.ultraOptionSet1.CheckedItem.DataValue.ToString(), uRow.Cells["PLINE_CODE"].Value.ToString());
- }
- /// <summary>
- /// 触发复选框事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraOptionSet1_ValueChanged(object sender, EventArgs e)
- {
- string value = this.ultraOptionSet1.CheckedItem.DataValue.ToString();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- foreach (UltraGridRow urg in ultraGrid1.Rows)
- {
- if (value == "0")
- {
- if (Convert.ToInt32(urg.Cells["UNAPPLY_COUNT"].Text) == 0)
- {
- urg.Hidden = true;
- }
- else
- {
- urg.Hidden = false;
- }
- }
- else if (value == "1")
- {
- if (Convert.ToInt32(urg.Cells["APPLY_COUNT"].Text) == 0)
- {
- urg.Hidden = true;
- }
- else
- {
- urg.Hidden = false;
- }
- }
- }
-
- QueryMatZcM(uRow.Cells["JUDGE_STOVE_NO"].Value.ToString(), uRow.Cells["ZG_BATCH_NO"].Value.ToString(), uRow.Cells["BATCH_GROUD_NO"].Value.ToString(), this.ultraOptionSet1.CheckedItem.DataValue.ToString(), uRow.Cells["PLINE_CODE"].Value.ToString());
- }
-
- }
- }
|