| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368 |
- 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 Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Tool;
- using Infragistics.Win.UltraWinEditors;
- using System.Text.RegularExpressions;
- using com.steering.mes.fprecall;
- namespace Core.StlMes.Client.MilCount
- {
- public partial class FrmFPRecall : FrmBase
- {
- public FrmFPRecall()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "doQuery":
- doQuery();
- break;
- case "doModify":
- Update();
- break;
- case "DoTB":
- DoTB();
- break;
- // break;
- //case "doResume":
- // this.doDeleteOrResume(false);
- // break;
- //case "Close":
- // this.Close();
- //break;
- }
- }
- private void doQuery()
- {
- string titleName = "";
- if (ultraCheckEditor2.Checked)
- {
- titleName = txt_lh.Text.Trim();
- DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.corefprecall.getLineList", new Object[] { titleName}, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- }
- else
- {
- DataTable dt = ServerHelper.GetData("com.steering.mes.fprecall.corefprecall.getLineList_all", null, this.ob);
- GridHelper.CopyDataToDatatable(ref dt, ref this.dataTable1, true);
- }
- DataTable dt1 = ServerHelper.GetData("com.steering.mes.fprecall.corefprecall.getFPJY", null, this.ob);
- GridHelper.CopyDataToDatatable(ref dt1, ref this.dataTable2, true);
- GridHelper.RefreshAndAutoSize(this.ultraGrid1);
- GridHelper.RefreshAndAutoSize(this.ultraGrid2);
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
- {
- if (row.Cells["管判定支"].Value.ToString() == row.Cells["管计划总支"].Value.ToString() && row.Cells["管计划总支"].Value.ToString() != "")
- {
- row.Appearance.BackColor = Color.Bisque;
- }
- if (row.Cells["成品计划支"].Value.ToString() == row.Cells["管判定支"].Value.ToString())
- {
- row.Appearance.BackColor = Color.GreenYellow;
- }
- }
-
- //不同颜色区分是否有效数据
- //Infragistics.Win.UltraWinGrid.UltraGridRow row = null;
- //for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- //{
- // row = ultraGrid2.Rows[i];
- // if (!row.Cells["VALIDFLAG"].Value.ToString().Equals("1"))
- // {
- // row.Appearance.ForeColor = Color.Red;
- // }
- // else
- // {
- // row.Appearance.ForeColor = Color.Black;
- // }
- //}
- //列自适应
- //GridHelper.RefreshAndAutoSizeExceptRows(ultraGrid2, new UltraGridColumn[] {
- // ultraGrid2.DisplayLayout.Bands[0].Columns["MEMO"]
- //});
- }
- String ID = "";
- String PZzhi = "";
- String PZdun = "";
- String GPzhi = "";
- String GPdun = "";
- String Length = "";
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow row = ultraGrid1.ActiveRow;
- if (row != null)
- {
- //STEELCODE,STEELNAME,STEELSTYLE
- ID = row.Cells["标识ID"].Value.ToString();
- txt_lcode.Text = row.Cells["上料炉号"].Value.ToString();
- Length = "";
- PZzhi = row.Cells["上料合计单倍尺支"].Value.ToString();
- PZdun = row.Cells["上料合计单倍尺吨"].Value.ToString();
- GPzhi = row.Cells["成品计划支"].Value.ToString();
- GPdun = row.Cells["成品计划吨"].Value.ToString();
- }
- }
- private void initJGDropDown(UltraComboEditor uce, string MethodId, string memberValue)
- {
- //初始化编辑区域下拉框
- DataTable dt = ServerHelper.GetData(MethodId, null, this.ob);
- if (dt != null && dt.Rows.Count > 0)
- {
- uce.DataSource = dt;
- uce.ValueMember = memberValue;
- }
- }
- private void FrmFPRecall_Load(object sender, EventArgs e)
- {
- InitCombo();
- txt_fz.Enabled = false;
- }
- private void InitCombo()
- {
- initJGDropDown(cmbGXType, "com.steering.mes.fprecall.corefprecall.getGXType", "GX_Detail");
- initJGDropDown(cmbleixing, "com.steering.mes.fprecall.corefprecall.getLeiXing", "FP_Detail");
- initJGDropDown(com_gx, "com.steering.mes.fprecall.corefprecall.getGX", "GXMC");
-
- }
- private void Update()
- {
- string para = @"^(\d+(\.\d+)?)|(\-1)$";//正则式
- Regex reg = new Regex(para);
- if (reg.IsMatch(txt_fd.Text) && reg.IsMatch(txt_fz.Text))
- {
- if (MessageUtil.ShowYesNoAndQuestion("是否确认修改?") == DialogResult.No)
- {
- return;
- }
- ArrayList list = new ArrayList();
- list.Add(ID.Trim());//cmbGradeType.Value
- list.Add(cmbleixing.Value);
- list.Add(txt_fz.Text.Trim());
- list.Add(txt_fd.Text.Trim());
- list.Add("");
- list.Add(com_gx.Value);
- list.Add(cmbGXType.Value);
- list.Add(ultraGrid1.ActiveRow.Cells["产出炉号"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["轧批号"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["外径"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["壁厚"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["上料炉号"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["计划年月"].Value.ToString());
- list.Add(ultraGrid1.ActiveRow.Cells["合同号"].Value.ToString());
- ArrayList list2 = new ArrayList();
- //cmbGradeType.Value
- list2.Add(ID.Trim());
- list2.Add(ultraGrid1.ActiveRow.Cells["轧批号"].Value.ToString());
- list2.Add(ultraGrid1.ActiveRow.Cells["产出炉号"].Value.ToString());
- if (cmbGXType.Value.ToString() == "穿孔前")
- {
- list2.Add(txt_fz.Text.Trim());
- list2.Add(txt_fd.Text.Trim());
- list2.Add("0");
- list2.Add("0");
- }
- else
- {
- list2.Add("0");
- list2.Add("0");
- list2.Add(txt_fz.Text.Trim());
- list2.Add(txt_fd.Text.Trim());
- }
- list2.Add(ultraGrid1.ActiveRow.Cells["计划年月"].Value.ToString());
- list2.Add(ultraGrid1.ActiveRow.Cells["上料炉号"].Value.ToString());
- list2.Add("20");
- ArrayList list3 = new ArrayList();
- //cmbGradeType.Value
- list3.Add(cmbGXType.Value.ToString());
- list3.Add(txt_fz.Text.Trim());
- list3.Add(txt_fd.Text.Trim());
- list3.Add(ID.Trim());
- ServerHelper.SetData("com.steering.mes.fprecall.corefprecall.update", new object[] { list, list2, list3 }, ob);
- MessageUtil.ShowTips("修改成功!");
- doQuery();
- }
- else
- {
- MessageBox.Show("请输入数字!");
- return;
- }
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- if (ultraCheckEditor2.Checked)
- {
- txt_lh.ReadOnly = false;
- }
- else
- {
- txt_lh.ReadOnly = true;
- }
- }
- private void txt_fd_KeyPress(object sender, KeyPressEventArgs e)
- {
-
- //if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8)
- //{
- // e.Handled = true;
- //}
- //else
- //{
- // MessageBox.Show("请输入数字!");
- //}
- }
- private void cmbGXType_ValueChanged(object sender, EventArgs e)
- {
- txt_fz.Enabled = true;
- txt_fz.Text = "";
- txt_fd.Text = "";
- }
- private void txt_fz_TextChanged(object sender, EventArgs e)
- {
- if (txt_fz.Text == "")
- {
- txt_fz.Text = "0";
- }
-
- if (cmbGXType.SelectedItem.DataValue.Equals("穿孔前"))
- {
- decimal dun = Int16.Parse(txt_fz.Text) * (decimal.Parse(PZdun) / Int16.Parse(PZzhi));
- dun = Math.Round(dun, 3);
- txt_fd.Text = dun.ToString();
- }
- else
- {
- decimal dun = Int16.Parse(txt_fz.Text) * (decimal.Parse(GPdun) / Int16.Parse(GPzhi));
- dun = Math.Round(dun, 3);
- txt_fd.Text = dun.ToString();
- }
- }
- private void DoTB()
- {
- ArrayList list = new ArrayList();
- FPPlan TB = new FPPlan();
- DateTime date_x = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
- String year_x = date_x.Year.ToString(); ;//date_x.Splite("-")[0].ToString();;
- String month_x = date_x.ToString("MM");
- String fin_date = year_x + month_x;
- if (chk_TB.Checked)
- {
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Value))
- {
- TB.Gkx = "";
- TB.GPZ = row.Cells["品种"].Value.ToString();
- TB.GSteelGrade = row.Cells["钢种"].Value.ToString();
- TB.GSteelLevel = row.Cells["钢级"].Value.ToString();
- TB.LlDept = row.Cells["产线"].Value.ToString();
- TB.PDM = row.Cells["坯断面"].Value.ToString();
- TB.PLGPUnit = row.Cells["坯计划总支"].Value.ToString();
- TB.PLKind = row.Cells["坯料品种"].Value.ToString();
- TB.PSteelGrade = row.Cells["钢种"].Value.ToString();
- TB.PSteelLevel = row.Cells["钢级"].Value.ToString();
- TB.JZNY = fin_date;
- TB.SLGPWeight = row.Cells["坯计划总吨"].Value.ToString();
- TB.TARGET = row.Cells["目标"].Value.ToString();
- TB.WAIJING = row.Cells["外径"].Value.ToString();
- TB.BIHOU = row.Cells["壁厚"].Value.ToString();
- TB.CPUnit = row.Cells["管判定支"].Value.ToString();
- TB.CPWeight = row.Cells["管判定吨"].Value.ToString();
- TB.GPLode = row.Cells["上料炉号"].Value.ToString();
- TB.ZGLode = row.Cells["产出炉号"].Value.ToString();
- list.Add(TB);
- }
- }
-
-
- }
- else
- {
- //foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in ultraGrid1.Rows)
- //{
- // if (row.Cells["管判定支"].Value.ToString() == row.Cells["管计划总支"].Value.ToString() && row.Cells["管计划总支"].Value.ToString() != "")
- // {
- // TB.Gkx = "";
- // TB.GPZ = row.Cells["品种"].Value.ToString();
- // TB.GSteelGrade = row.Cells["钢种"].Value.ToString();
- // TB.GSteelLevel = row.Cells["钢级"].Value.ToString();
- // TB.LlDept = row.Cells["产线"].Value.ToString();
- // TB.PDM = row.Cells["坯断面"].Value.ToString();
- // TB.PLGPUnit = row.Cells["坯计划总支"].Value.ToString();
- // TB.PLKind = row.Cells["坯料品种"].Value.ToString();
- // TB.PSteelGrade = row.Cells["钢种"].Value.ToString();
- // TB.PSteelLevel = row.Cells["钢级"].Value.ToString();
- // TB.JZNY = fin_date;
- // TB.SLGPWeight = row.Cells["坯计划总吨"].Value.ToString();
- // TB.TARGET = row.Cells["目标"].Value.ToString();
- // TB.WAIJING = row.Cells["外径"].Value.ToString();
- // TB.BIHOU = row.Cells["壁厚"].Value.ToString();
- // TB.CPUnit = row.Cells["管判定支"].Value.ToString();
- // TB.CPWeight = row.Cells["管判定吨"].Value.ToString();
- // TB.GPLode = row.Cells["上料炉号"].Value.ToString();
- // TB.ZGLode = row.Cells["产出炉号"].Value.ToString();
- // list.Add(TB);
- // }
- //}
- }
-
- ServerHelper.SetData("com.steering.mes.fprecall.corefprecall.tb", new object[] { list }, ob);
- MessageUtil.ShowTips("提交成功!");
- doQuery();
- }
-
-
-
-
-
-
- }
- }
|