| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- 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 Core.StlMes.Client.YdmBase;
- using Core.StlMes.Client.YdmPipeManage.Entity;
- using Core.Mes.Client.Comm.Tool;
- using System.Collections;
- using Infragistics.Win.UltraWinGrid;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Control;
- namespace Core.StlMes.Client.YdmPipeManage
- {
- public partial class frmPipeManualIn : FrmBase
- {
- public frmPipeManualIn()
- {
- this.IsLoadUserView = true;
- InitializeComponent();
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- QueryManualIn();
- break;
- case "Add":
- Add();
- break;
- case "Update":
- break;
- case "Delete":
- break;
- case"Export":
- exportDat();
- break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void exportDat()
- {
- GridHelper.ulGridToExcel(ultraGrid2, "钢管起初总汇");
- }
- private void Add()
- {
- if (ultraTabControl1.SelectedTab.Key == "0")
- {
- AddMatZc();
- }else
- {
- updateMat();
- }
- }
-
-
- private void frmPipeManualIn_Load(object sender, EventArgs e)
- {
- dteInStartTime.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM") + "-01" + " 00:00:00");
- //YdmBaseClass.InitComboEditor(cmbBelog, "com.steering.pss.ydm.pipemanage.CorePipeInTemp.getStorageDetail", "STORAGE_NO", this.ob, false);
- EntityHelper.ShowGridCaption<YdmZcInitialEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- EntityHelper.ShowGridCaption<YdmZcInitialEntity>(ultraGrid2.DisplayLayout.Bands[0]);
- this.txtHeatNo.Enabled = false;
- this.txtBatchNo.Enabled = false;
- this.cmbBelog.Enabled = false;
- //this.checkBox1.Visible = false;
- this.ultraTabControl1.Tabs["0"].Visible = false;
- }
- /// <summary>
- /// 查询期初数据
- /// </summary>
- private void QueryManualIn()
- {
-
- string time = dteInStartTime.Value.ToString("yyyyMM");
- string heatNo = "";
- string batchNo = "";
- string storeNo = "";
- string ss = "";
- string supplyUnit = this.CustomInfo;
- ArrayList parm = new ArrayList();
- if(chkHeatNo.Checked)
- {
- heatNo = this.txtHeatNo.Text.Trim();
- }
- if (chkBacthNo.Checked)
- {
- batchNo = this.txtBatchNo.Text.Trim();
- }
- if (chkStoreNo.Checked)
- {
- storeNo = this.cmbBelog.Value.ToString();
- }
- parm.Add(time);
- parm.Add(heatNo);
- parm.Add(batchNo);
- parm.Add(storeNo);
- if (ultraTabControl1.SelectedTab.Key == "0")
- {
- ss = "0";
- List<YdmZcInitialEntity> listSource = EntityHelper.GetData<YdmZcInitialEntity>("com.steering.pss.ydm.pipemanage.FrmPipeManualIn.queryManualIn", new object[] { parm, ss, supplyUnit }, this.ob);
- YdmZcInitialEntitybindingSource.DataSource = listSource;
- }
- if (ultraTabControl1.SelectedTab.Key == "1")
- {
- ss = "1";
- List<YdmZcInitialEntity> listSource = EntityHelper.GetData<YdmZcInitialEntity>("com.steering.pss.ydm.pipemanage.FrmPipeManualIn.queryManualIn", new object[] { parm,ss, supplyUnit }, this.ob);
- bindingSource1.DataSource = listSource;
- }
-
- }
- /// <summary>
- /// 增加库存
- /// </summary>
- private void AddMatZc()
- {
- int m = 0;
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
- {
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请勾选你需要操作的数据!");
- return;
- }
- foreach (UltraGridRow uRow in ultraGrid1.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["judgeStoveNo"].Text.ToString());
- list.Add(uRow.Cells["batchNo"].Value.ToString());
- list.Add(uRow.Cells["batchGroudNo"].Value.ToString());
- list.Add(uRow.Cells["produccode"].Value.ToString());
- list.Add(uRow.Cells["producname"].Value.ToString());
- list.Add(uRow.Cells["STEELCODE"].Value.ToString());
- list.Add(uRow.Cells["STEELNAME"].Value.ToString());
- list.Add(uRow.Cells["specCode"].Value.ToString());
- list.Add(uRow.Cells["specName"].Value.ToString());
- list.Add(uRow.Cells["modelCode"].Value.ToString());
- list.Add(uRow.Cells["modelDesc"].Value.ToString());//10
- list.Add(uRow.Cells["stdCode"].Value.ToString());
- list.Add(uRow.Cells["stdName"].Value.ToString());
- list.Add(uRow.Cells["stdStyle"].Value.ToString());
- list.Add(uRow.Cells["stdStyleDesc"].Value.ToString());
- list.Add(uRow.Cells["DIMATER"].Value.ToString()); //15
- list.Add(uRow.Cells["HEIGHT"].Value.ToString());
- list.Add(uRow.Cells["LEN"].Value.ToString());
- list.Add(uRow.Cells["lenMin"].Value.ToString());
- list.Add(uRow.Cells["lenMax"].Value.ToString());
- list.Add(uRow.Cells["actCount"].Value.ToString());//20
- list.Add(uRow.Cells["actWeight"].Value.ToString());
-
- list.Add(uRow.Cells["actTheoryWeight"].Value.ToString());
- list.Add(uRow.Cells["judgeResultCode"].Value.ToString());
- list.Add(uRow.Cells["judgeResult"].Value.ToString());
- list.Add(uRow.Cells["storageNo"].Value.ToString());
- list.Add(uRow.Cells["storageName"].Value.ToString());
- list.Add(uRow.Cells["locationNo"].Value.ToString());
- list.Add(uRow.Cells["orderNo"].Value.ToString());//28
- list.Add(uRow.Cells["orderSeq"].Value.ToString().PadLeft(3,'0'));
- //if (uRow.Cells["OrderSeqNo"].Value.ToString() == "")
- //{
- // list.Add("001");
- //}
- //else
- //{
- // list.Add(uRow.Cells["OrderSeqNo"].Value.ToString().PadLeft(3,'0'));
- //}
- list.Add(uRow.Cells["OrderSeqNo"].Value.ToString());
- list.Add(uRow.Cells["MEMO"].Value.ToString());
- list.Add(dteInStartTime.Value.ToString("yyyyMM"));
- list.Add(uRow.Cells["GRADECODE"].Value.ToString());
- list.Add(uRow.Cells["GRADENAME"].Value.ToString());
-
- list.Add(uRow.Cells["plineCode"].Value.ToString());
- list.Add(uRow.Cells["plineName"].Value.ToString());
- list.Add(this.UserInfo.GetUserName());//37
- list.Add(uRow.Cells["initialId"].Value.ToString());
- list.Add(this.UserInfo.GetDeptid());
- list.Add(this.UserInfo.GetDepartment());
- list.Add(ClsBaseInfo.GetDepartIdBySectionId(this.UserInfo.GetDeptid(), this.ob));
- list.Add(ClsBaseInfo.GetDepartBySectionId(this.UserInfo.GetDeptid(), this.ob));
- list.Add(uRow.Cells["JUDGEGRADE"].Value.ToString());
- list.Add(uRow.Cells["instockTime"].Value.ToString());
- list.Add(uRow.Cells["belongCode"].Value.ToString());
- list.Add(uRow.Cells["belongName"].Value.ToString());
- parm.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeManualIn";
- ccp.MethodName = "addMatZc";
- ccp.ServerParams = new object[] { parm };
- ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("期初库存维护成功!"))
- {
- QueryManualIn();
- }
- }
- }
- /// <summary>
- /// 修改材料表
- /// </summary>
- private void updateMat()
- {
- int m = 0;
- ArrayList parm = new ArrayList();
- foreach (UltraGridRow row in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(row.Cells["CHK"].Text) == true)
- {
- m++;
- }
- }
- if (m < 1)
- {
- MessageUtil.ShowTips("请勾选你需要操作的数据!");
- return;
- }
- foreach (UltraGridRow uRow in ultraGrid2.Rows)
- {
- if (Convert.ToBoolean(uRow.Cells["CHK"].Text) == true)
- {
- ArrayList list = new ArrayList();
- list.Add(uRow.Cells["judgeStoveNo"].Text.ToString());
- list.Add(uRow.Cells["batchNo"].Value.ToString());
- list.Add(uRow.Cells["batchGroudNo"].Value.ToString());
- list.Add(uRow.Cells["orderNo"].Value.ToString());
- list.Add(uRow.Cells["orderSeq"].Value.ToString().PadLeft(3, '0'));
- list.Add(uRow.Cells["OrderSeqNo"].Value.ToString());
- list.Add(uRow.Cells["initialId"].Value.ToString());
- parm.Add(list);
- }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.pss.ydm.pipemanage.FrmPipeManualIn";
- ccp.MethodName = "updateMat";
- ccp.ServerParams = new object[] { parm };
- ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QueryManualIn();
- //this.checkBox1.Checked = false;
- }
- }
- }
- private void chkHeatNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtHeatNo.Enabled = this.chkHeatNo.Checked;
- }
- private void chkBacthNo_CheckedChanged(object sender, EventArgs e)
- {
- this.txtBatchNo.Enabled = this.chkBacthNo.Checked;
- }
- private void chkStoreNo_CheckedChanged(object sender, EventArgs e)
- {
- this.cmbBelog.Enabled = this.chkStoreNo.Checked;
- }
- /// <summary>
- /// ultraGrid1拖选
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ultraGrid1_AfterSelectChange(object sender, Infragistics.Win.UltraWinGrid.AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid1.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- private void ultraGrid2_AfterSelectChange(object sender, AfterSelectChangeEventArgs e)
- {
- foreach (UltraGridRow uRow in ultraGrid2.Selected.Rows)
- {
- if (uRow.GetType() != typeof(Infragistics.Win.UltraWinGrid.UltraGridGroupByRow))
- {
- uRow.Cells["CHK"].Value = true;
- }
- }
- }
- //private void checkBox1_CheckedChanged(object sender, EventArgs e)
- //{
- // int chkint = 0;
- // if (this.checkBox1.Checked)
- // {
- // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- // {
- // //if (uRow.Cells["CXSTUPP"].Value.ToString().Equals(""))
- // //{
- // chkint += 1;
- // if (chkint > 500) return;
- // uRow.Cells["CHK"].Value = true;
- // //}
- // }
- // }
- // else
- // {
- // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow uRow in ultraGrid2.Rows)
- // {
- // uRow.Cells["CHK"].Value = false;
- // }
- // }
- //}
- }
- }
|