| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- 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 Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using Infragistics.Win;
- using System.Diagnostics;
- namespace Core.LZMes.Client.QCM
- {
- public partial class QCM0211 : FrmBase
- {
- #region 初始变量
- public string specimenNo = "";//取样编号
- public string plineCode = "";//产线
- public string thick = "";//规格
- #endregion
- #region 初始化
- public QCM0211()
- {
- InitializeComponent();
- }
- //初始化的时候加载列
- private void QCM0211_Load(object sender, EventArgs e)
- {
- ValueList v1 = new ValueList();
- v1.ValueListItems.Add("0", "初样");
- v1.ValueListItems.Add("1", "复样");
- v1.ValueListItems.Add("3", "件件取样");
- this.ultraGrid1.DisplayLayout.Bands[0].Columns["SMP_TYPE_CODE"].ValueList = v1.Clone();
- DoQuery();
- }
- #endregion
- #region 功能
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- //this.DoQuery();
- break;
- case "Add":
- //this.DoAdd();
- break;
- }
- }
- #region 查询
- private void DoQuery()
- {
- try
- {
- this.dataSet2.Clear();
- //查询数据库里的数据
- CoreClientParam ccp = new CoreClientParam();
- DataTable datatable = new DataTable();
- ccp.ServerName = "QCM.JHY01.JHY0101.QuerryQltySample";
- ccp.MethodName = "getQltyRZSpecimenNo";
- ccp.SourceDataTable = this.dataSet2.Tables[0];
- ccp.ServerParams = new object[] { specimenNo, plineCode, thick };
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
-
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #region 新增
- private void button2_Click(object sender, EventArgs e)
- {
- this.DoAdd();
- }
- private void DoAdd()
- {
- try
- {
- string SPECIMEN_NO = "";
- string MATERIAL_NO = "";
- string fh = "";
- int num = 0;
- string SMP_TYPE_CODE = "";
- foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
- {
- string specimeNo = "";
- string materialNo = "";
- if (ugr.Cells["check"].Value.ToString().ToLower() == "true")
- {
- specimeNo = ugr.Cells["SPECIMEN_NO"].Value.ToString();
- materialNo = ugr.Cells["OLD_SAMPL_NO"].Value.ToString();
- SMP_TYPE_CODE = ugr.Cells["SMP_TYPE_CODE"].Value.ToString();
- num = num + 1;
- if (num <= 1)
- {
- SPECIMEN_NO = specimeNo;
- MATERIAL_NO = materialNo;
- fh = ",";
- }
- else
- {
- SPECIMEN_NO = SPECIMEN_NO + fh + specimeNo;
- MATERIAL_NO = MATERIAL_NO + fh + materialNo;
- }
- }
- }
- if ("0".Equals(SMP_TYPE_CODE))
- {
- if (num>=2)
- {
- this.alert("人工选样初样只能选一个!");
- return;
- }
- }
- else if ("1".Equals(SMP_TYPE_CODE))
- {
- if (num >= 3)
- {
- this.alert("人工选样复样最多只能选择两个样!");
- return;
- }
- }
- Hashtable ht = new Hashtable();
- ht.Add("SMP_TYPE_CODE", SMP_TYPE_CODE);
- ht.Add("SPECIMEN_NO", SPECIMEN_NO);
- ht.Add("MATERIAL_NO", MATERIAL_NO);
- ht.Add("USERID", this.UserInfo.GetUserID().ToString());
- ht.Add("USERNAME", this.UserInfo.GetUserName().ToString());
- //查询数据库里的数据
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "QCM.JHY01.JHY0102.Send2";
- ccp.MethodName = "SendLimesRZXY";
- ccp.ServerParams = new object[] { ht, specimenNo };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- MessageBox.Show("选样发送成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.None);
- this.Close();
- }
-
- }
- catch (Exception ex)
- {
- System.Diagnostics.Debug.WriteLine(ex.ToString());
- MessageBox.Show("系统出错,请联系管理人员", "警告");
- }
- }
- #endregion
- #endregion
- #region 其它事件
- private void ultraGrid1_AfterHeaderCheckStateChanged(object sender, AfterHeaderCheckStateChangedEventArgs e)
- {
- ultraGrid1.UpdateData();
- }
- private void ultraGrid1_CellChange(object sender, CellEventArgs e)
- {
- ultraGrid1.UpdateData();
- }
- #endregion
-
-
- }
- }
|