| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465 |
- 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.Mch;
- using Core.StlMes.Client.Mcp.Mch.Entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.Mcp.Mch
- {
- public partial class MchSignature : FrmBase
- {
- public MchSignature()
- {
- InitializeComponent();
- }
- private string[] plineCode = null;
- private string fileName = "";//路径
- private void MchSignature_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<HttSignatureEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- plineCode = comm.GetPlineCode(ValidDataPurviewIds, "G",this.CustomInfo, ob);
- comm.InitDropPlinePower("G", txtPline, this.ValidDataPurviewIds,this.CustomInfo, this.ob);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- QuerySinglePlan();
- break;
- //case "DoQueryInList":
- // doQueryInList();
- // break;
- case "DoSave":
- doSave();
- break;
- case "DoUpdate":
- doUpdate();
- break;
- case "CancelSignature":
- cancelSignature();
- break;
- //case "CancelPipe":
- // cancelPipe();
- // break;
- case "Close":
- this.Close();
- break;
- }
- }
- private void QuerySinglePlan()
- {
- List<HttSignatureEntity> listSource = EntityHelper.GetData<HttSignatureEntity>(
- "com.steering.mes.mcp.Mch.MchSignature.doQuery", new object[] { plineCode }, this.ob);
- HttSignatureEntitybindingSource1.DataSource = listSource;
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- ugr.Cells["PlineCode"].Appearance.BackColor = Color.Transparent;
- ugr.Cells["PlineCode"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- ugr.Cells["PlineCode"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- ugr.Cells["ColGroup"].Appearance.BackColor = Color.Transparent;
- ugr.Cells["ColGroup"].Appearance.BackHatchStyle = BackHatchStyle.Default;
- ugr.Cells["ColGroup"].Activation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly;
- }
- }
- private void doSave()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if(checkRows.Count()==0)
- {
- MessageUtil.ShowTips("请勾选要新增的信息");
- return;
- }
- foreach(UltraGridRow row in checkRows)
- {
- HttSignatureEntity hsEntity = (HttSignatureEntity)row.ListObject;
- if(hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if(hsEntity.ColGroup.Equals(""))
- {
- MessageUtil.ShowTips("班组不能为空");
- return;
- }else if(hsEntity.ColGroup.Equals("甲"))
- {
- hsEntity.ColGroup = "1";
- }else if(hsEntity.ColGroup.Equals("乙"))
- {
- hsEntity.ColGroup = "2";
- }else if(hsEntity.ColGroup.Equals("丙"))
- {
- hsEntity.ColGroup = "3";
- }else if(hsEntity.ColGroup.Equals("丁"))
- {
- hsEntity.ColGroup = "4";
- }
- if(hsEntity.UserName.Equals(""))
- {
- MessageUtil.ShowTips("姓名不能为空");
- return;
- }
- if(hsEntity.ProcessNo.Equals(""))
- {
- MessageUtil.ShowTips("工序不能为空");
- return;
- }else if(hsEntity.ProcessNo.Equals("上料"))
- {
- hsEntity.ProcessNo = "0";
- }else if(hsEntity.ProcessNo.Equals("热处理"))
- {
- hsEntity.ProcessNo = "1";
- }else if(hsEntity.ProcessNo.Equals("定径热矫冷矫"))
- {
- hsEntity.ProcessNo = "2";
- }else if(hsEntity.ProcessNo.Equals("表面检验"))
- {
- hsEntity.ProcessNo = "3";
- }else if(hsEntity.ProcessNo.Equals("探伤"))
- {
- hsEntity.ProcessNo = "4";
- }else if(hsEntity.ProcessNo.Equals("下线"))
- {
- hsEntity.ProcessNo = "5";
- }
- //hsEntity.SignRoute = FileHelper.FileToArray(row.Cells["SignRoute"].Text.ToString()).ToString();
- hsEntity.UserId = this.UserInfo.GetUserID();
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.Mch.MchSignature.getSameData", new object[] { hsEntity.PlineCode, hsEntity.ProcessNo, hsEntity.UserName, hsEntity.ColGroup }, ob);
- if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.MchSignature";
- ccp.MethodName = "doSave";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void doUpdate()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选要修改的信息");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- HttSignatureEntity hsEntity = (HttSignatureEntity)row.ListObject;
- if (hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if (hsEntity.ColGroup.Equals(""))
- {
- MessageUtil.ShowTips("班组不能为空");
- return;
- }
- else if (hsEntity.ColGroup.Equals("甲"))
- {
- hsEntity.ColGroup = "1";
- }
- else if (hsEntity.ColGroup.Equals("乙"))
- {
- hsEntity.ColGroup = "2";
- }
- else if (hsEntity.ColGroup.Equals("丙"))
- {
- hsEntity.ColGroup = "3";
- }
- else if (hsEntity.ColGroup.Equals("丁"))
- {
- hsEntity.ColGroup = "4";
- }
- if (hsEntity.UserName.Equals(""))
- {
- MessageUtil.ShowTips("姓名不能为空");
- return;
- }
- if (hsEntity.ProcessNo.Equals(""))
- {
- MessageUtil.ShowTips("工序不能为空");
- return;
- }
- else if (hsEntity.ProcessNo.Equals("上料"))
- {
- hsEntity.ProcessNo = "0";
- }
- else if (hsEntity.ProcessNo.Equals("热处理"))
- {
- hsEntity.ProcessNo = "1";
- }
- else if (hsEntity.ProcessNo.Equals("定径热矫冷矫"))
- {
- hsEntity.ProcessNo = "2";
- }
- else if (hsEntity.ProcessNo.Equals("表面检验"))
- {
- hsEntity.ProcessNo = "3";
- }
- else if (hsEntity.ProcessNo.Equals("探伤"))
- {
- hsEntity.ProcessNo = "4";
- }
- else if (hsEntity.ProcessNo.Equals("下线"))
- {
- hsEntity.ProcessNo = "5";
- }
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
- //DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSignature.getSameData", new object[] { hsEntity.PlineCode, hsEntity.ProcessNo,hsEntity.UserName,hsEntity.ColGroup }, ob);
- //if (dt.Rows.Count > 0) { MessageUtil.ShowTips("已存在数据,不能进行此操作!"); return; }
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.MchSignature";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void cancelSignature()
- {
- this.ultraGrid1.UpdateData();
- ArrayList list = new ArrayList();
- IQueryable<UltraGridRow> checkRows = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'");
- if (checkRows.Count() == 0)
- {
- MessageUtil.ShowTips("请勾选要修改的信息");
- return;
- }
- foreach (UltraGridRow row in checkRows)
- {
- HttSignatureEntity hsEntity = (HttSignatureEntity)row.ListObject;
- if (hsEntity.PlineCode.Equals(""))
- {
- MessageUtil.ShowTips("产线不能为空");
- return;
- }
- if (hsEntity.ColGroup.Equals(""))
- {
- MessageUtil.ShowTips("班组不能为空");
- return;
- }
- else if (hsEntity.ColGroup.Equals("甲"))
- {
- hsEntity.ColGroup = "1";
- }
- else if (hsEntity.ColGroup.Equals("乙"))
- {
- hsEntity.ColGroup = "2";
- }
- else if (hsEntity.ColGroup.Equals("丙"))
- {
- hsEntity.ColGroup = "3";
- }
- else if (hsEntity.ColGroup.Equals("丁"))
- {
- hsEntity.ColGroup = "4";
- }
- if (hsEntity.UserName.Equals(""))
- {
- MessageUtil.ShowTips("姓名不能为空");
- return;
- }
- if (hsEntity.ProcessNo.Equals(""))
- {
- MessageUtil.ShowTips("工序不能为空");
- return;
- }
- else if (hsEntity.ProcessNo.Equals("上料"))
- {
- hsEntity.ProcessNo = "0";
- }
- else if (hsEntity.ProcessNo.Equals("热处理"))
- {
- hsEntity.ProcessNo = "1";
- }
- else if (hsEntity.ProcessNo.Equals("定径热矫冷矫"))
- {
- hsEntity.ProcessNo = "2";
- }
- else if (hsEntity.ProcessNo.Equals("表面检验"))
- {
- hsEntity.ProcessNo = "3";
- }
- else if (hsEntity.ProcessNo.Equals("探伤"))
- {
- hsEntity.ProcessNo = "4";
- }
- else if (hsEntity.ProcessNo.Equals("下线"))
- {
- hsEntity.ProcessNo = "5";
- }
- string httEntity = JSONFormat.Format(hsEntity);
- list.Add(httEntity);
- }
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.MchSignature";
- ccp.MethodName = "doDelete";
- ccp.ServerParams = new object[] { list };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- QuerySinglePlan();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- ///
- /// 上传
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void craftImg_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- UltraGridRow row = ultraGrid1.ActiveRow;
- string askSubItem = row.GetValue("PlineCode");
- string bz = row.GetValue("ColGroup");
- string filePath = "ZGMil/Signature/" + askSubItem + "/" + bz + "/";
- if (e.Button.Key.ToLower().Equals("select"))
- {
- FormFileDown down = new FormFileDown(this.ob, row.Cells["SignRoute"].Text);
- down.CtrlFileDown1.Button3.Visible = false;
- down.ShowDialog();
- }
- if (e.Button.Key.ToLower().Equals("insert"))
- {
- if (askSubItem.Equals("") || bz.Equals(""))
- {
- MessageUtil.ShowTips("没有产线或班组不允许上传!");
- return;
- }
- FormFileDown down = new FormFileDown(this.ob, filePath);
- down.CtrlFileDown1.FilePath = filePath;
- //if (down.CtrlFileDown1.List.Count > 0)
- //{
- // MessageUtil.ShowWarning("只能上传一份文件!");
- // return;
- //}
- List<FileBean> list = new List<FileBean>();
- FileBean bean = new FileBean();
- OpenFileDialog file = new OpenFileDialog();
- file.Multiselect = false;
- DialogResult drStat;
- drStat = file.ShowDialog();
- if (drStat == DialogResult.OK)
- {
- fileName = file.FileName;
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- long s = fs.Length;
- if (s / 1024.0 > 20)
- {
- MessageUtil.ShowTips("图片大于20KB,请重新上传!");
- return;
- }
- string filena = System.IO.Path.GetFileName(fileName);
- DataTable dt = ServerHelper.GetData("com.steering.mes.mcp.heatTreatment.HttSignature.getSameData", new object[] { row.Cells["PlineCode"].Text, row.Cells["ProcessNo"].Text, row.Cells["UserName"].Text, row.Cells["ColGroup"].Text }, ob);
- if (dt.Rows.Count > 0)
- {
- string seturl = dt.Rows[0]["SignRoute"].ToString();
- bool isdelete = Core.Mes.Client.Comm.Server.FileHelper.Delete(seturl);
- //ServerHelper.SetData("com.steering.mes.signature.FrmTubeRollFileManage.updateMinStgnature1", new object[] { filePath + filena, fileName, row.Cells["USER_ID"].Value.ToString() }, ob);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.heatTreatment.HttSignature";
- ccp.MethodName = "updateScoure";
- //ccp.ServerParams = new object[] { filePath + filena, FileHelper.FileToArray(fileName), row.Cells["USER_ID"].Value.ToString() };
- ccp.ServerParams = new object[] { filePath + filena, row.Cells["PlineCode"].Value.ToString() };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode == -1) { MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question); return; }
- }
- bean = new FileBean();
- bean.setFileName(filena);
- bean.setPathName(filePath);
- bean.setFile(FileHelper.FileToArray(fileName));
- list.Add(bean);
- bool isSuccess = Core.Mes.Client.Comm.Server.FileHelper.Upload(list);
- if (isSuccess)
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.mes.mcp.Mch.HttSignature";
- ccp.MethodName = "updateScoure";
- //ccp.ServerParams = new object[] { filePath + filena, FileHelper.FileToArray(fileName), row.Cells["USER_ID"].Value.ToString() };
- ccp.ServerParams = new object[] { filePath + filena, row.Cells["PlineCode"].Value.ToString() };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- MessageBox.Show("上传成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- }
- else
- {
- MessageBox.Show("上传失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Question);
- }
- //ultraGrid1.ActiveCell.Value = filena;
- //ultraGrid1.ActiveRow.Cells["URL"].Value = filePath + filena;
- //ultraGrid1.ActiveRow.Cells["PIR"].Value = fileName;
- }
- }
- }
- }
- }
|