| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.ZGMil.Common;
- using Core.StlMes.Client.ZGMil.Entity;
- using Core.StlMes.Client.ZGMil.ResultConrtrol;
- using Core.StlMes.Client.ZGMil.Signature;
- 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.ZGMil.Result
- {
- public partial class FrmMilReSample : FrmBase
- {
- private string departm = "";
- private string plineCode = "";
- private string userName = "";
- private string proPlanId = null;//轧管订单编号
- private string gxPlanNo = null;//工序排产序号
- public FrmMilReSample()
- {
- InitializeComponent();
- this.IsLoadUserView = true;
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Node":
- doNode();
- break;
- case "DoNodeBack":
- doNodeBack();
- break;
- //case "Export":
- // ExportData();
- // break;
- case "Close":
- this.Close();
- break;
- }
- }
- /// <summary>
- /// 结炉回退
- /// </summary>
- private void doNodeBack()
- {
- if (this.dataTable1.Rows.Count > 0 && this.dataTable2.Rows.Count > 0)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- UltraGridRow ugr2 = ultraGrid2.ActiveRow;
- string reSampleSatus = ugr.Cells["RE_GET_SAMPLE_STATUS"].Value.ToString();//复取样完成状态
- string JudgeStoveNo = BaseMethod.getJudgeStoveNo(ugr2.Cells["JUDGE_STOVE_NO"].Value.ToString());
- string LotNo = ugr2.Cells["LOT_NO"].Value.ToString();
- string PlineCode = ugr2.Cells["PLINE_CODE"].Value.ToString();
- string APPLY_FLAG = ugr.Cells["APPLY_FLAG"].Value.ToString(); //送判状态
- if (APPLY_FLAG != "未送判")
- {
- MessageBox.Show("该炉已送判,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (reSampleSatus == "0")
- {
- MessageBox.Show("该炉没有结炉,不可结炉回退,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + JudgeStoveNo + "】结炉回退?") == DialogResult.No)
- {
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmMilReSample.doNodeBack", new object[] { JudgeStoveNo, LotNo, PlineCode, userName, proPlanId, gxPlanNo }, this.ob);
- }
- doQuery();
- }
- /// <summary>
- /// 结炉
- /// </summary>
- private void doNode()
- {
- if (this.dataTable1.Rows.Count > 0 && this.dataTable2.Rows.Count >0)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- UltraGridRow ugr2 = ultraGrid2.ActiveRow;
- string reSampleSatus = ugr.Cells["RE_GET_SAMPLE_STATUS"].Value.ToString();//复取样完成状态
- string JudgeStoveNo = ugr2.Cells["JUDGE_STOVE_NO"].Value.ToString().Substring(0,6);
- string LotNo = ugr2.Cells["LOT_NO"].Value.ToString();
- string PlineCode = ugr2.Cells["PLINE_CODE"].Value.ToString();
- string APPLY_FLAG = ugr.Cells["APPLY_FLAG"].Value.ToString(); //送判状态
- if (APPLY_FLAG != "未送判")
- {
- MessageBox.Show("该炉已送判,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (reSampleSatus == "1")
- {
- MessageBox.Show("该炉已结炉,不可再结炉,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("确认炉号【" + JudgeStoveNo + "】结炉?") == DialogResult.No)
- {
- return;
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.zgmil.coup.FrmMilReSample";
- ccp.MethodName = "doNode";
- ccp.ServerParams = new object[] { JudgeStoveNo, LotNo, PlineCode, userName, proPlanId, gxPlanNo };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("结炉成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
-
- }
-
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
-
- string date = "";
- string endDate = "";
- string JudgeStoveNo = "";
- string LotNo = "";
- string ChkReSample = "0";
- if (chkDate.Checked)
- {
- if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
- {
- MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- return;
- }
- else
- {
- date = cmbDate.Value.ToString();
- endDate = cmbEndDate.Value.ToString();
- }
- }
- if (chkJudgeStoveNo.Checked)
- {
- if (uteJudgeStoveNo.Text.Trim() == "")
- {
- JudgeStoveNo = "";
- }
- else
- {
- JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
- }
- }
- if (chkLotNo.Checked)
- {
- if (uteLotNo.Text.Trim() == "")
- {
- LotNo = "";
- }
- else
- {
- LotNo = uteLotNo.Value.ToString();
- }
- }
- if (chkReSample.Checked)
- {
- ChkReSample = "1";
- }
- WaitingForm2 wf = new WaitingForm2("正在加载,请稍候....");
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmMilReSample.getFrmMilReSample", new Object[] { date, endDate, JudgeStoveNo, LotNo, ChkReSample, getPlineCode() }, this.ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable1, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- foreach(UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (ugr.Cells["APPLY_FLAG"].Value.ToString() == "")
- {
- ugr.Cells["APPLY_FLAG"].Value = "未送判";
- }
- if (ugr.Cells["RE_GET_SAMPLE_STATUS"].Value.ToString() == "1")
- {
- ugr.Appearance.BackColor = Color.YellowGreen;
- }
- }
-
- if (dt.Rows.Count == 0)
- {
- this.dataTable2.Clear();
- }
- wf.Close();
- }
- /// <summary>
- /// 打印
- /// </summary>
- //private void doExport()
- //{
- // string date = "";
- // string endDate = "";
- // string JudgeStoveNo = "";
- // string LotNo = "";
- // string ContractNo = "";
- // if (chkDate.Checked)
- // {
- // if (DataTimeUtil.JudgeTime(DateTime.Parse(cmbDate.Value.ToString()), DateTime.Parse(cmbEndDate.Value.ToString())) == 0)
- // {
- // MessageUtil.ShowTips("您所选择的日期区域不对,请重新选择!");
- // return;
- // }
- // else
- // {
- // date = cmbDate.Value.ToString();
- // endDate = cmbEndDate.Value.ToString();
- // }
- // }
- // if (chkJudgeStoveNo.Checked)
- // {
- // if (uteJudgeStoveNo.Text.Trim() == "")
- // {
- // JudgeStoveNo = "";
- // }
- // else
- // {
- // JudgeStoveNo = uteJudgeStoveNo.Value.ToString();
- // }
- // }
- // if (chkLotNo.Checked)
- // {
- // if (uteLotNo.Text.Trim() == "")
- // {
- // LotNo = "";
- // }
- // else
- // {
- // LotNo = uteLotNo.Value.ToString();
- // }
- // }
- // if (chkReSample.Checked)
- // {
- // if (uteContractNo.Text.Trim() == "")
- // {
- // ContractNo = "";
- // }
- // else
- // {
- // ContractNo = uteContractNo.Value.ToString();
- // }
- // }
- // doQuery();
-
- // string url = "http://172.54.10.42:8080/webroot/decision/view/report?viewlet=RepMilDateStatistics.cpt&__bypagesize__=false&LOT_NO=" + LotNo + "&JUDGE_STOVE_NO=" + JudgeStoveNo + "&DATE=" + date + "&DATE2=" + endDate + "&PLINE_CODE=" + plineCode + "&CONTRACT_NO=" + ContractNo;
- // FrmRepExcel fre = new FrmRepExcel(this.ob, url);
- // //fre.AutoSize = true;
- // fre.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
- // fre.Text = "轧管生产数据统计";
- // fre.ShowDialog();
- //}
- /// <summary>
- /// 查询条件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void chkDate_CheckedChanged(object sender, EventArgs e)
- {
- if (chkDate.Checked) { cmbDate.Enabled = true; } else { cmbDate.Enabled = false; }
- if (chkDate.Checked) { cmbEndDate.Enabled = true; } else { cmbEndDate.Enabled = false; }
- if (chkLotNo.Checked) { uteLotNo.Enabled = true; } else { uteLotNo.Enabled = false; }
- if (chkJudgeStoveNo.Checked) { uteJudgeStoveNo.Enabled = true; } else { uteJudgeStoveNo.Enabled = false; }
- //if (chkReSample.Checked) { uteContractNo.Enabled = true; } else { uteContractNo.Enabled = false; }
- }
- private void FrmMilReSample_Load(object sender, EventArgs e)
- {
- cmbDate.Value = DateTime.Parse(DateTime.Today.ToString());
- NativeMethodNew na = new NativeMethodNew(this.ob);
- userName = UserInfo.GetUserName();
- departm = UserInfo.GetDepartment();
- plineCode = na.GetPCode(departm);//获取 用户 对应的产线
- EntityHelper.ShowGridCaption<PortMilBatchSampleResultEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- DateTime now = DateTime.Now;
- DateTime date = new DateTime(now.Year, now.Month, 1);
- cmbDate.Value = DateTime.Parse(date.ToString("yyyy-MM-dd"));
- cmbEndDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- //cmbEndDate.Value = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd 06:59:59"));
- //cmbDate.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 07:00:00"));
- //TubeRoll.SetComboItemHeight(uteLotNo);
- //TubeRoll.SetComboItemHeight(cmbBz);
- }
- /// <summary>
- /// 导出
- /// </summary>
- private void ExportData()
- {
- GridHelper.ulGridToExcel(ultraGrid1, "轧管生产数据统计");
- }
- /// <summary>
- /// 非250、258、168、460的产线代码都为空
- /// </summary>
- /// <returns></returns>
- private string getPlineCode()
- {
- if (plineCode.Equals("C008") || plineCode.Equals("C009") || plineCode.Equals("C010") || plineCode.Equals("C017"))
- {
- return plineCode;
- }
- else
- {
- return "";
- }
- }
- private void bindingSource1_CurrentChanged(object sender, EventArgs e)
- {
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- queryultraGrid2();
- }
- /// <summary>
- /// 刷新ultraGrid2的数据
- /// </summary>
- private void queryultraGrid2()
- {
- if (this.dataTable1.Rows.Count > 0)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- if (ugr != null)
- {
- string JudgeStoveNo = ugr.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string LotNo = ugr.Cells["LOT_NO"].Value.ToString();
- string PlineCode = ugr.Cells["PLINE_CODE"].Value.ToString();
- proPlanId = ugr.Cells["PRO_PLAN_ID"].Value.ToString();
- gxPlanNo = ugr.Cells["GX_PLAN_NO"].Value.ToString();
- // List<PortMilBatchSampleResultEntity> listSource = EntityHelper.GetData<PortMilBatchSampleResultEntity>(
- //"com.steering.mes.zgmil.coup.FrmMilReSample.getPortMilBatchSampleResult", new object[] { JudgeStoveNo,LotNo, PlineCode }, this.ob);
- // bindingSource1.DataSource = listSource;
- DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmMilReSample.getPortMilBatchSampleResult", new Object[] { JudgeStoveNo, LotNo, getPlineCode(), proPlanId, gxPlanNo }, this.ob);
- GridHelper.CopyDataToDatatable(dt, this.dataTable2, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid2);
- }
- changeColor();
- }
- }
- /// <summary>
- /// 更改剔除样管行颜色
- /// </summary>
- private void changeColor()
- {
- foreach (UltraGridRow ugr in ultraGrid2.Rows )
- {
- if (ugr.Cells["STATUS"].Value.ToString() == "复取样废")
- {
- ugr.Appearance.BackColor = Color.Yellow;
- }
- }
- }
- private void ultraGrid2_ClickCellButton(object sender, CellEventArgs e)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- UltraGridRow ugr2 = ultraGrid2.ActiveRow;
- string reSampleSatus = ugr.Cells["RE_GET_SAMPLE_STATUS"].Value.ToString();//复取样完成状态
- string JudgeStoveNo = ugr2.Cells["JUDGE_STOVE_NO"].Value.ToString();
- string LotNo = ugr2.Cells["LOT_NO"].Value.ToString();
- string PlineCode = ugr2.Cells["PLINE_CODE"].Value.ToString();
- string matNo = ugr2.Cells["MAT_NO"].Value.ToString();//材料号
- string IS_SAMPLE_PIPE = ugr2.Cells["IS_SAMPLE_PIPE"].Value.ToString(); //是否样管
- string STATUS = ugr2.Cells["STATUS"].Value.ToString();//状态,是否废
- string APPLY_FLAG = ugr.Cells["APPLY_FLAG"].Value.ToString(); //送判状态
- string NODE_FUR_FLAG = ugr2.Cells["NODE_FUR_FLAG"].Value.ToString(); //结炉标识(0-未结炉,1-结炉)
- string BATCH_NO = ugr2.Cells["BATCH_NO"].Value.ToString(); //批号
- if (APPLY_FLAG != "未送判")
- {
- MessageBox.Show("该炉已送判,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (NODE_FUR_FLAG == "0")
- {
- MessageBox.Show("该炉未结炉,不能操作复取样!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- //标记样管
- if (e.Cell.Column.Key == "sample1")
- {
- if (reSampleSatus == "1")
- {
- MessageBox.Show("该炉已完成复取样,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (IS_SAMPLE_PIPE == "样管")
- {
- MessageBox.Show("该管已是样管,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmMilReSample.changeSampleState", new object[] { JudgeStoveNo, LotNo, PlineCode, matNo, userName }, this.ob);
- }
- //标记样管回退
- if (e.Cell.Column.Key == "noSample")
- {
- if (reSampleSatus == "1")
- {
- MessageBox.Show("该炉已完成复取样,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (IS_SAMPLE_PIPE == "非样管")
- {
- MessageBox.Show("该管已是非样管,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (STATUS == "复取样废")
- {
- MessageBox.Show("该管已是废管,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmMilReSample.changeSampleStateBack", new object[] { JudgeStoveNo, LotNo, PlineCode, matNo, userName }, this.ob);
- }
- //复取样废
- if (e.Cell.Column.Key == "fei")
- {
- if (reSampleSatus == "1")
- {
- MessageBox.Show("该炉已完成复取样,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (STATUS == "复取样废")
- {
- MessageBox.Show("该管已是废管,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmMilReSample.scrapSample", new object[] { JudgeStoveNo, LotNo, PlineCode, matNo, userName, BATCH_NO }, this.ob);
- }
- //复取样废回退
- if (e.Cell.Column.Key == "noFei")
- {
- if (reSampleSatus == "1")
- {
- MessageBox.Show("该炉已完成复取样,状态不可变,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (STATUS == "正常")
- {
- MessageBox.Show("该管是正常管,请确认!", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmMilReSample.scrapSampleBack", new object[] { JudgeStoveNo, LotNo, PlineCode, matNo, userName, BATCH_NO }, this.ob);
- }
- queryultraGrid2();
- }
- }
- }
|