|
|
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using System.Data.SqlClient; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraGrid.Views.BandedGrid; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid; using System.IO; using System.Threading; using ICSSoft.Base.Language.Tool; using ICSSoft.Base.Config.AppConfig; using ICSSoft.Base.UserControl.MessageControl; using ICSSoft.Base.Config.DBHelper; using ICSSoft.Base.Report.Filter; using ICSSoft.Base.UserControl.FormControl; using ICSSoft.Base.Report.GridReport; using ICSSoft.Base.ReferForm.AppReferForm; using ICSSoft.Frame.Data.BLL; using System.Collections; using ICSSoft.Frame.Data.Entity; using ICSSoft.Frame.Common;
namespace ICSSoft.Frame.APP { public partial class FormICSLLAGV : DevExpress.XtraEditors.XtraForm { //ZHCSoft.AntiwearValveExpanded.Forms.UserControlAdds.UserControlLL UserControlLL;
//ZHCSoft.AntiwearValveExpanded.Forms.UserControlAdds.UserControlLLNew UserControlLLNew;
public DataTable dt;
private string WGCode = ""; //外观
private string CCCode = ""; //尺寸
private string LHCode = ""; //理化
public int GXOrWW = 0; private string CKType = "工序检验";
public string ItemCode = string.Empty; public string LotNo = string.Empty; public string OPCode = string.Empty; public string MOCode = string.Empty; public string MOPLANQTY = string.Empty; public string INVDESC = string.Empty;
public string ItemCode_ = string.Empty; public string LotNo_ = string.Empty; public string OPCode_ = string.Empty;
public string MOCode_ = string.Empty; public string MOPLANQTY_ = string.Empty; public string INVDESC_ = string.Empty; public string LOTQTY_ = string.Empty;
#region 构造函数
//public FormICSLL()
//{
// InitializeComponent();
// this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
// this.WindowState = FormWindowState.Maximized;
// GetJianYan();
//}
#endregion
#region 获取 外观,尺寸,理化 编号
private void GetJianYan() { string sql = @"
select Enumvalue,EnumText from Sys_EnumValues where EnumKey='005' and EnumText='外观检验' select Enumvalue,EnumText from Sys_EnumValues where EnumKey='005' and EnumText='尺寸检验' select Enumvalue,EnumText from Sys_EnumValues where EnumKey='005' and EnumText='理化检验' ";
DataSet ds = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql); if (ds != null && ds.Tables.Count == 3) { if (ds.Tables[0].Rows.Count > 0) { WGCode = ds.Tables[0].Rows[0]["Enumvalue"].ToString(); } else { MessageBox.Show("自定义档案:质量一级分类中未维护外观检验,请先维护"); } if (ds.Tables[1].Rows.Count > 0) { CCCode = ds.Tables[1].Rows[0]["Enumvalue"].ToString(); } else { MessageBox.Show("自定义档案:质量一级分类中未维护尺寸检验,请先维护"); } if (ds.Tables[2].Rows.Count > 0) { LHCode = ds.Tables[2].Rows[0]["Enumvalue"].ToString(); } else { MessageBox.Show("自定义档案:质量一级分类中未维护理化检验,请先维护"); } } else { MessageBox.Show("自定义档案:质量一级分类中未维护外观检验,尺寸检验,理化检验,请先维护。"); }
} #endregion
//public FormICSLL(ZHCSoft.AntiwearValveExpanded.Forms.UserControlAdds.UserControlLL userControlLL)
public FormICSLLAGV(int IsWW) { InitializeComponent(); this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); this.WindowState = FormWindowState.Maximized; this.ActiveControl = this.txtLotNo; //GetJianYan();
//UserControlLL = userControlLL;
cboStatus.Items.Add("已检测"); cboStatus.Items.Add("未检测"); cboStatus.Items.Add("所有"); cboStatus.SelectedIndex =1; //SearchSource(IsWW);
GXOrWW = IsWW; //ItemCode = ItemCode_; LotNo = LotNo_; OPCode = OPCode_;
//MOCode = MOCode_; MOPLANQTY = MOPLANQTY_; INVDESC = INVDESC_;
btnSearch_Click(null, null);
foreach (GridColumn column in grvDetail.Columns) { if (column.Name != colisSelect.Name && column.Name != colDown.Name && column.Name != colSend.Name) column.OptionsColumn.AllowEdit = false; } } //public FormICSLL(ZHCSoft.AntiwearValveExpanded.Forms.UserControlAdds.UserControlLLNew userControlLLNew)
public FormICSLLAGV() { InitializeComponent(); this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); this.WindowState = FormWindowState.Maximized; this.ActiveControl = this.txtLotNo; //GetJianYan();
//txtFW.Checked = true;
cboStatus.Items.Add("已检测"); cboStatus.Items.Add("未检测"); cboStatus.Items.Add("所有"); cboStatus.SelectedIndex =1; btnSearch_Click(null, null); this.grvDetail.BestFitColumns();
foreach (GridColumn column in grvDetail.Columns) { if (column.Name != colisSelect.Name&& column.Name != colDown.Name&& column.Name != colSend.Name) column.OptionsColumn.AllowEdit = false; } }
//--LEFT JOIN ICSMO2User rr ON 备注栏位1是委外,备注栏位0是自制,
private DataTable SearchSource(string whereStr) { string sql = @"SELECT DISTINCT
CAST ( 0 AS BIT ) AS isSelect,--e.ID, a.MOCODE,a.MOSEQ,a.LOTNO,a.LOTQTY,c.MOPLANQTY,a.ITEMCODE,b.INVNAME INVDESC,b.INVSTD,a.UserCodeEnd,a.MTIME,a.EQPCODE,f.EQPDESC,a.OPCODE,d.OPDESC, e.ckusercode as 检验人员编码,E.MTIME AS 检验时间, CASE WHEN e.CKResult = '1' THEN '合格' WHEN e.CKResult = '0' THEN '不合格' ELSE '未检测' END AS Result, CASE WHEN ISNULL( e.CKResult , '' ) = '' THEN '未检测' ELSE '已检测' END AS [Status] FROM ICSLOTONWIP a LEFT JOIN ICSINVENTORY b ON a.ITEMCODE=b.INVCODE LEFT JOIN ICSMO c ON a.MOCODE=c.MOCODE AND a.MOSEQ=c.MOSEQ LEFT JOIN ICSOP d ON a.OPCODE=d.OPCODE LEFT JOIN ICSQualityCKDATA e ON e.LOTNO=a.LOTNO AND e.OPCode=a.OPCODE LEFT JOIN ICSEquipment f ON a.EQPCODE=f.EQPCode LEFT JOIN ICSMO2User rr ON rr.LOTNO=a.LOTNO AND rr.OPCODE=a.OPCODE WHERE a.WorkPoint='{0}' AND b.WorkPoint='{0}' AND c.WorkPoint='{0}' AND d.WorkPoint='{0}' AND a.ACTIONRESULT='COLLECT_END' and a.EATTRIBUTE1 is null and not exists(select id from ICSNCRDoc where LOTNO=A.LOTNO AND OPCODE=A.OPCODE AND NGQTY>0 AND ERRORTYPE='自检') and c.mostatus<>'关闭' {1} ORDER BY a.LOTNO,a.MOSEQ ";
sql = string.Format(sql, AppConfig.WorkPointCode, whereStr); dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0]; //txtCount.Text = dt.Rows.Count.ToString();
//DataRow[] drsChecked = dt.Select("Status='已检测'");
//txtChecked.Text = drsChecked.Length.ToString();
//DataRow[] drsUnChecked = dt.Select("Status='未检测'");
//txtUnchecked.Text = drsUnChecked.Length.ToString();
//DataRow[] drstDisqualification = dt.Select("Result='不合格'");
//txtdisqualification.Text = drstDisqualification.Length.ToString();
return dt; }
private DataTable SearchSourceWW(string whereStr) { //ICSLOTONWIP 还要加上这张表串联20120712
string sql = @"SELECT DISTINCT
CAST (0 AS BIT) AS isSelect,--e.ID, rr.MOCODE, ff.LOTQTY, a.UserCodeEnd,a.MTIME, rr.MOSEQ, rr.LOTNO, c.MOPLANQTY, c.ITEMCODE, b.INVName INVDESC, b.INVSTD, rr.OPCODE, d.OPDESC, e.ckusercode as 检验人员编码,E.MTIME AS 检验时间, CASE WHEN e.CKResult = '1' THEN '合格' WHEN e.CKResult = '0' THEN '不合格' ELSE '未检测' END AS Result, CASE WHEN ISNULL(e.CKResult, '') = '' THEN '未检测' ELSE '已检测' END AS [Status] FROM ICSLOTONWIP a left join icsmo2user rr on rr.lotno=a.lotno and a.opcode=rr.opcode LEFT JOIN ICSITEMLot ff ON rr.LOTNO=ff.LotNO LEFT JOIN ICSMO c ON rr.MOCODE = c.MOCODE AND rr.MOSEQ = c.MOSEQ LEFT JOIN ICSINVENTORY b ON c.ITEMCODE = b.INVCODE LEFT JOIN ICSOP d ON rr.OPCODE = d.OPCODE LEFT JOIN ICSQualityCKDATA e ON e.LOTNO = rr.LOTNO AND e.OPCode = rr.OPCODE WHERE rr.WorkPoint='{0}' AND b.WorkPoint='{0}' AND c.WorkPoint='{0}' AND d.WorkPoint='{0}' AND rr.EATTRIBUTE1 = '1' and a.actionresult='COLLECT_END' and a.EATTRIBUTE1 is null {1} and c.mostatus<>'关闭' ORDER BY rr.LOTNO,rr.MOSEQ ";
sql = string.Format(sql, AppConfig.WorkPointCode, whereStr); dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
return dt; }
#region 移动窗体
private const int WM_NCHITTEST = 0x84; private const int HTCLIENT = 0x1; private const int HTCAPTION = 0x2; //首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
//系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
//假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
//同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
//重写窗体,使窗体可以不通过自带标题栏实现移动
protected override void WndProc(ref Message m) {
//当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
//当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
//这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
//注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
switch (m.Msg) { case WM_NCHITTEST: base.WndProc(ref m); if ((int)m.Result == HTCLIENT) m.Result = (IntPtr)HTCAPTION; return; } //拦截双击标题栏、移动窗体的系统消息
if (m.Msg != 0xA3) { base.WndProc(ref m); }
} #endregion
#region SystemOptition
/// <summary>
/// 操作权限
/// </summary>
/// <returns></returns>
public DataTable RightOfExute() { DataTable rData = new DataTable(); rData.Columns.Add("BtnName"); rData.Columns.Add("ActionName"); //查看权限(必须有)
DataRow seeRow = rData.NewRow(); seeRow["BtnName"] = "see"; seeRow["ActionName"] = "查看"; rData.Rows.Add(seeRow);
List<Control> ControlList = new List<Control>();
//ControlList.Add(btnDelLable);
foreach (Control ctr in ControlList) {
if (ctr.GetType() == typeof(SimpleButton)) { DataRow dr = rData.NewRow(); dr["BtnName"] = ctr.Name; dr["ActionName"] = ctr.Text; rData.Rows.Add(dr); } }
rData.AcceptChanges(); return rData; } /// <summary>
/// 数据权限
/// </summary>
/// <returns></returns>
public DataTable RightOfData() { DataTable rData = new DataTable(); rData.Columns.Add("BodyName"); rData.Columns.Add("ControlName"); rData.Columns.Add("ControlCaption");
rData.AcceptChanges(); return rData; } #endregion
#region 退出
private void btnClose_Click(object sender, EventArgs e) { AppConfig.CloseFormShow(this.Text); this.Close(); }
private void btnExit_Click(object sender, EventArgs e) { AppConfig.CloseFormShow(this.Text); this.Close(); } #endregion
#region 列表
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e) { if (e.Info.IsRowIndicator && e.RowHandle >= 0) e.Info.DisplayText = (e.RowHandle + 1).ToString(); } #endregion
#region 双击选择
private void grvDetail_DoubleClick(object sender, EventArgs e) { if (grvDetail.FocusedRowHandle < 0) { return; } //UserControlLL.LotNo = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colLOTNO).ToString();
//UserControlLL.participant = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colparticipant).ToString();
//UserControlLLNew.LotNo = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colLOTNO).ToString();
string __LotNo = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colLOTNO).ToString(); string __OPCode = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colOPCODE).ToString(); string __ItemCode = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colITEMCODE).ToString();
string __MOCode = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOCode).ToString(); string __MOPLANQTY = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colMOPLANQTY).ToString(); string __INVDESC = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colINVDESC).ToString();
string __LOTQTY = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colLOTQTY).ToString();
ItemCode_ = __ItemCode; LotNo_ = __LotNo; OPCode_ = __OPCode; INVDESC_ = __INVDESC; MOCode_ = __MOCode; MOPLANQTY_ = __MOPLANQTY; LOTQTY_ = __LOTQTY;
this.Close(); //FormICSIPQC form = new FormICSIPQC(ItemCode, LotNo, OPCode);
//form.ShowDialog();
}
//质检 即双击
//private void but_ZhiJIan_Click(object sender, EventArgs e)
//{
//int SelectIndex = -1;
//int Selectcount = 0;
//for (int i = 0; i < grvDetail.RowCount; i++)
//{
// string isselect = grvDetail.GetRowCellValue(i, colisSelect).ToString();
// if (isselect == "True")
// {
// SelectIndex = i;
// Selectcount++;
// }
//}
//if (Selectcount == 1)
//{
// //UserControlLLNew.LotNo = grvDetail.GetRowCellValue(SelectIndex, colLOTNO).ToString();
// this.Close();
//}
//else
//{
// MessageBox.Show("有且只能选择一行进行质检");
//}
//}
#endregion
#region 行背景色
private void grvDetail_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e) { if (e.RowHandle < 0) return; string result = grvDetail.GetRowCellValue(e.RowHandle, colResult).ToString(); if (result.Equals("合格")) { e.Appearance.BackColor = Color.Green; } if (result.Equals("不合格")) { e.Appearance.BackColor = Color.Red; } string status = grvDetail.GetRowCellValue(e.RowHandle, colState).ToString(); //string remainingTime = grvDetail.GetRowCellValue(e.RowHandle, colremainingTime).ToString();
//if (status == "未检测" && remainingTime == "00:00")
if (status == "未检测") { if (cboStatus.SelectedIndex == 1) { if (e.RowHandle % 2 == 0) e.Appearance.BackColor = Color.White; else e.Appearance.BackColor = Color.FromArgb(235, 248, 255); } else { e.Appearance.BackColor = Color.FromArgb(235, 248, 255); } } } #endregion
private void btnSearch_Click(object sender, EventArgs e) { string whereStr = ""; //if (GXOrWW == 0)
//{
// whereStr += " AND (a.SHIFTTYPECODE= '' or a.SHIFTTYPECODE is null) ";
//}
//else
//{
// whereStr += " AND a.SHIFTTYPECODE= 'WW' ";
//}
if (GXOrWW == 0) { whereStr += " AND (a.SHIFTTYPECODE= '' or a.SHIFTTYPECODE is null) AND rr.EATTRIBUTE1='0' "; } else { //whereStr += " AND a.SHIFTTYPECODE= 'WW' AND rr.EATTRIBUTE1='1' ";
whereStr += " AND rr.EATTRIBUTE1='1' "; }
if (!string.IsNullOrWhiteSpace(txtMOCode.Text.Trim())) { if (GXOrWW == 0) { whereStr += " AND a.MOCODE LIKE '%" + txtMOCode.Text.Trim() + "%' "; //whereStr1 = " AND LOTNO LIKE '%" + txtMOCode.Text.Trim() + "%' ";
} else { whereStr += " AND rr.MOCODE LIKE '%" + txtMOCode.Text.Trim() + "%' "; } }
if (txtFW.Checked) { whereStr += " AND a.mtime BETWEEN " + "'" + Convert.ToDateTime(txtDateBegin.Text).ToString("yyyy-MM-dd") + "'" + " AND " + "'" + Convert.ToDateTime(txtDateEnd.Text).ToString("yyyy-MM-dd") + "'"; } if (!string.IsNullOrEmpty(txtOPName.Text.Trim())){
whereStr += " AND d.OPDESC LIKE '%" + txtOPName.Text.Trim() + "%' "; } if (!string.IsNullOrEmpty(txtItemName.Text.Trim())) {
whereStr += " AND b.INVName LIKE '%" + txtItemName.Text.Trim() + "%' "; }
if (GXOrWW == 0) { if (!string.IsNullOrWhiteSpace(this.txtLotNo.Text.Trim())) { whereStr += " AND a.LOTNO LIKE '%" + txtLotNo.Text.Trim() + "%' "; } } else { if (!string.IsNullOrWhiteSpace(this.txtLotNo.Text.Trim())) { whereStr += " AND rr.LOTNO LIKE '%" + txtLotNo.Text.Trim() + "%' "; } }
if (!string.IsNullOrWhiteSpace(txtItemCode.Text.Trim())) { if (GXOrWW == 0) { whereStr += " AND a.ITEMCODE LIKE '%" + txtItemCode.Text.Trim() + "%' "; //whereStr1 += " AND ItemName LIKE '%" + txtItemCode.Text.Trim() + "%' ";
} else { whereStr += " AND c.ITEMCODE LIKE '%" + txtItemCode.Text.Trim() + "%' "; } } if (!string.IsNullOrWhiteSpace(this.txtOPCode.Text.Trim())) { if (GXOrWW == 0) { whereStr += " AND a.OPCODE LIKE '%" + txtOPCode.Text.Trim() + "%' "; //whereStr1 += " AND ItemName LIKE '%" + txtItemCode.Text.Trim() + "%' ";
} else { whereStr += " AND rr.OPCODE LIKE '%" + txtOPCode.Text.Trim() + "%' "; } } if (!string.IsNullOrWhiteSpace(cboStatus.Text.Trim())) { switch (cboStatus.Text.Trim()) { case "所有": break; case "未检测": whereStr += " AND ISNULL( e.CKResult , '' ) = '' "; break; case "已检测": whereStr += " AND ISNULL( e.CKResult , '' )<>'' "; break; } }
if (GXOrWW == 1) { grdDetail.DataSource = SearchSourceWW(whereStr); } else { grdDetail.DataSource = SearchSource(whereStr); } grvDetail.BestFitColumns();
//grvDetail.BestFitColumns();
//grdDetail.MainView.PopulateColumns();
//grdDetail.RefreshDataSource();
//grdDetail.Refresh();
//grvDetail.RefreshData();
//DataView dv1 = dt.Copy().DefaultView;
//dv1.RowFilter = whereStr1.Substring(whereStr1.IndexOf("AND") + 3);
//DataTable dt1 = dv1.ToTable().Copy();
//string docNo = "";
//int count = 0;
//int checkCount = 0;
//int unCheckCount = 0;
//int sisqualificationCount = 0;
//foreach (DataRow dr in dt1.Rows)
//{
// if (docNo != dr["LOTNO"].ToString())
// {
// count++;
// docNo = dr["LOTNO"].ToString();
// if (dr["Result"].ToString() == "不合格")
// {
// sisqualificationCount++;
// }
// if (dr["Status"].ToString() == "已检测")
// {
// checkCount++;
// }
// else if (dr["Status"].ToString() == "未检测")
// {
// unCheckCount++;
// }
// }
//}
//txtCount.Text = count.ToString();
//txtChecked.Text = checkCount.ToString();
//txtUnchecked.Text = unCheckCount.ToString();
//txtdisqualification.Text = sisqualificationCount.ToString();
}
#region 页面加载
private void FormICSLL_Load(object sender, EventArgs e) { //colWGQty.Caption = "外观抽\r\n检数量";
//colCCQty.Caption = "尺寸抽\r\n检数量";
//colLHQty.Caption = "理化抽\r\n检数量";
//colWGRequireQty.Caption = "外观抽\r\n检数量";
//colCCRequireQty.Caption = "尺寸抽\r\n检数量";
//colLHRequireQty.Caption = "理化抽\r\n检数量";
} #endregion
private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { //try
//{
// DevExpress.XtraGrid.Views.Grid.GridView view = ((DevExpress.XtraGrid.Views.Grid.GridView)(grdDetail.MainView));
// int rowhandle = view.FocusedRowHandle;
// DataRow dr = view.GetDataRow(rowhandle);
// if (dr["LOTNO"].ToString() == "")
// {
// ICSBaseSimpleCode.AppshowMessageBox("批次条码不能为空!");
// return;
// }
// List<ICSQualityCKDATA> codeList = new List<ICSQualityCKDATA>();
// ICSQualityCKDATA ckData = new ICSQualityCKDATA();
// ckData.LOTNO = dr["LOTNO"].ToString();
// codeList.Add(ckData);
// ICSQualityCKDATABLL.AddThrough(codeList, AppConfig.AppConnectString);
// ICSBaseSimpleCode.AppshowMessageBox(0, "放行成功!");
// btnSearch_Click(null, null);
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.Message);
//}
}
private void cboStatus_SelectedValueChanged(object sender, EventArgs e) { if (cboStatus.Text == "已检测") { // grvDetail.Columns["isSelect"].Visible = false;
grvDetail.Columns["isSelect"].Visible = true;//modify on 20190722
} if (cboStatus.Text == "未检测") { grvDetail.Columns["isSelect"].Visible = true;
} //dt = SearchSource();
//btnSearch_Click(null, null);
}
#region 批量放行
//private void btnOK_Click(object sender, EventArgs e)
//{
// try
// {
// List<string> ht = new List<string>();
// List<string> UnCKLotno = new List<string>();
// List<string> UnCKRCV = new List<string>();
// List<string> IsCKedCK = new List<string>();
// List<ICSQualityCKDATA> codeList = new List<ICSQualityCKDATA>();
// List<WMSICSINSPECTIONModel> InsList = new List<WMSICSINSPECTIONModel>();
// List<ICSLLDisposeInFoAgain> modelList = new List<ICSLLDisposeInFoAgain>();
// for (int i = 0; i < grvDetail.RowCount; i++)
// {
// if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True")
// {
// //string docNo = grvDetail.GetRowCellValue(i, colRcvDocNo).ToString();
// string lotno = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); ;
// string MOCode = grvDetail.GetRowCellValue(i, colMOCode).ToString(); ;
// //string IsCanCK = grvDetail.GetRowCellValue(i, colIsCanCK).ToString();
// //string WGCK = grvDetail.GetRowCellValue(i, colIsCKWG).ToString();
// //string CCCK = grvDetail.GetRowCellValue(i, colIsCKCC).ToString();
// //string LHCK = grvDetail.GetRowCellValue(i, colIsCKLH).ToString();
// //if (IsCanCK != "OK")
// //{
// //if (!UnCKRCV.Contains(docNo))
// //{
// // UnCKRCV.Add(docNo);
// //}
// //}
// //else if (WGCK == "N" || CCCK == "N" || LHCK == "N")
// //{
// // if (!UnCKLotno.Contains(lotno))
// // {
// // UnCKLotno.Add(lotno);
// // }
// //}
// //else
// //{
// //bool IsCK = ICSQualityCKDATABLL.IsLLCKByLotNo(lotno);
// //if (IsCK)
// //{
// // IsCKedCK.Add(lotno);
// //}
// //else
// //{
// ICSQualityCKDATA ckData = new ICSQualityCKDATA();
// ckData.LOTNO = lotno;
// ckData.MOCODE = MOCode;
// if (!string.IsNullOrWhiteSpace(grvDetail.GetRowCellValue(i, colOPCODE).ToString()))
// {
// ckData.OPCode = grvDetail.GetRowCellValue(i, colOPCODE).ToString();
// }
// codeList.Add(ckData);
// //string lineNo = grvDetail.GetRowCellValue(i, colRcvLineNo).ToString();
// //if (ht.Contains(docNo + "_" + lineNo))
// //{
// // ht.Add(docNo + "_" + lineNo);
// //}
// ICSLLDisposeInFoAgain model = new ICSLLDisposeInFoAgain();
// //物料条码
// model.LOTNO = lotno;
// //物料编码
// model.ItemCode = grvDetail.GetRowCellValue(i, colITEMCODE).ToString();
// //物料名称
// model.ItemName = grvDetail.GetRowCellValue(i, colINVDESC).ToString();
// //条码数量
// model.BarCodeQty = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString());
// //处理数量
// model.DisposeInQty = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString());
// //采购订单号
// //model.DocNo = grvDetail.GetRowCellValue(i, colPoDocNo).ToString();
// model.MUSER = AppConfig.UserId;
// model.MUSERName = AppConfig.UserName;
// model.MTIME = DateTime.Now;
// model.WorkPoint = AppConfig.WorkPointCode;
// model.EATTRIBUTE1 = "制程";
// modelList.Add(model);
// WMSICSINSPECTIONModel ins = new WMSICSINSPECTIONModel();
// ins.LotNO = lotno;
// ins.INVCODE = grvDetail.GetRowCellValue(i, colITEMCODE).ToString();
// ins.VENDORITEMCODE = grvDetail.GetRowCellValue(i, colITEMCODE).ToString();
// ins.LOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString());
// ins.YLOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString());
// //ins.TransNO = grvDetail.GetRowCellValue(i, colPOCode).ToString();
// //ins.TransLine = grvDetail.GetRowCellValue(i, colPoLineNo).ToString();
// ins.TYPE = "采购入库";
// InsList.Add(ins);
// //}
// //}
// }
// }
// //if (codeList.Count == 0 && UnCKRCV.Count == 0 && UnCKLotno.Count == 0 && IsCKedCK.Count == 0)
// if (codeList.Count == 0)
// {
// ICSBaseSimpleCode.AppshowMessageBox("请选择需要放行的批次条码!");
// return;
// }
// //提示
// string Mess = "";
// if (UnCKRCV.Count != 0)
// {
// Mess += "以下到货单未达到抽检比例,不能放行:" + string.Join(",", UnCKRCV.ToArray()) + Environment.NewLine;
// }
// if (UnCKLotno.Count != 0)
// {
// Mess += "以下批次质检不合格,不能放行,只能判退:" + string.Join(",", UnCKLotno.ToArray()) + Environment.NewLine;
// }
// if (IsCKedCK.Count != 0)
// {
// Mess += "以下批次已放行/判退,不能再次放行:" + string.Join(",", IsCKedCK.ToArray()) + Environment.NewLine;
// }
// if (Mess != "")
// {
// ICSBaseSimpleCode.AppshowMessageBox(Mess);
// }
// if (codeList.Count != 0)
// {
// ICSQualityCKDATABLL.AddThrough(codeList, AppConfig.AppConnectString);
// //待定,需要看无锡自控代码
// //等于来料日志,放行日志
// ICSLLDisposeInFoBLL.LLDisposeAgainEditByLOTNO(modelList, AppConfig.AppConnectString);
// //SRM用到的,可以注释
// //ICSQualityCKDATABLL.InsertICSINSPECTION(InsList);
// ICSBaseSimpleCode.AppshowMessageBox(0, "放行成功!");
// }
// //判断是否全部检查完毕
// foreach (string str in ht)
// {
// string docNo = str.Split('_')[0];
// string lineNo = str.Split('_')[1];
// if (ICSQualityCKDATABLL.ISAllCheck(docNo, lineNo, AppConfig.AppConnectString))
// {
// DataTable dt1 = GetNGCKData(docNo, lineNo);
// string ItemCode = dt1.Rows[0]["RcvLineItemMasterCode"].ToString();
// string ItemName = dt1.Rows[0]["RcvLineItemMasterName"].ToString();
// string ProjectCode = dt1.Rows[0]["RcvLineProjectCode"].ToString();
// string LotFurnace = dt1.Rows[0]["RcvLineInvLotFurnace"].ToString();
// decimal QTY = Convert.ToDecimal(dt1.Rows[0]["BarCodeQty"].ToString());
// if (dt1 != null && dt1.Rows.Count > 0)
// {
// string strResult = "";
// foreach (DataRow dr in dt1.Rows)
// {
// strResult += dr["LotNo"].ToString() + ":";
// if (dr["Type"].ToString() == WGCode)
// {
// strResult += "外观检验项:" + dr["CKITEMDESC"].ToString() + "不良 检测值为" + dr["CKValue"].ToString() + "\r\n";
// }
// else if (dr["Type"].ToString() == CCCode)
// {
// strResult += "尺寸检验项:" + dr["CKITEMCODE"].ToString() + " " + dr["CKITEMDESC"].ToString() + "不良,系统要求最小值" + dr["SetValueMin"].ToString()
// + "最大值" + dr["SetValueMax"].ToString() + "检测值为" + dr["CKValue"].ToString() + "\r\n";
// }
// else if (dr["Type"].ToString() == LHCode)
// {
// strResult += "理化检验项:" + dr["CKITEMCODE"].ToString() + " " + dr["CKITEMDESC"].ToString() + "不良,系统要求最小值" + dr["SetValueMin"].ToString()
// + "最大值" + dr["SetValueMax"].ToString() + "检测值为" + dr["CKValue"].ToString() + "\r\n";
// }
// }
// //SendNCR(strResult, docNo + "_" + lineNo, ItemCode, ItemName, ProjectCode, QTY);
// }
// DBHelper.ExecuteNonQuery(AppConfig.AppConnectString, CommandType.Text, " Update WM_RCVShip set RcvDocStatus = '10' where [RcvDocNo] = '" + docNo + "' And RcvLineNo = " + lineNo);
// }
// }
// btnSearch_Click(null, null);
// }
// catch (Exception ex)
// {
// MessageBox.Show(ex.Message);
// }
//}
#region 批量放行
private void btnOK_Click(object sender, EventArgs e) { DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在处理...请稍等..."); try { List<string> codeList = new List<string>(); List<string> moList = new List<string>(); List<string> opList = new List<string>(); String complete_Status = ""; List<string> opaddList = new List<string>(); List<ICSQualityCKDATA> dataList = new List<ICSQualityCKDATA>(); List<ICSQualityCKDATA> dataList1 = new List<ICSQualityCKDATA>(); for (int i = 0; i < grvDetail.RowCount; i++) { if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True") {
ICSQualityCKDATA ckData = new ICSQualityCKDATA(); ckData.LOTNO = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); ckData.MOCODE = grvDetail.GetRowCellValue(i, colMOCode).ToString(); ckData.OPCode = grvDetail.GetRowCellValue(i, colOPCODE).ToString(); //ckData.ID = grvDetail.GetRowCellValue(i, colID).ToString();
string sql = "select max(opseq) as opseq from icsitemroute2oplot a where lotno='"+ckData.LOTNO+ "' and opseq<(select opseq from icsitemroute2oplot b where b.lotno='" + ckData.LOTNO + "' and b.opcode='"+ckData.OPCode+"' )"; DataTable lastop = DBHelper.ExecuteDataset(AppConfig.AppConnectString,CommandType.Text,sql).Tables[0];
if (lastop.Rows.Count > 0 && !string.IsNullOrEmpty(lastop.Rows[0]["opseq"].ToString())) { bool isOK = CheckIsOK(Convert.ToInt32(lastop.Rows[0]["opseq"])); if (!isOK) { _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox("上道工序未检验或检验结果不合格,不能判定!"); return; }
}
dataList.Add(ckData);
if (GXOrWW == 0) { #region 20210709下道工序开工,上道工序质量检验就不能判退或者放行,提示下道工序已开工
string sqlCheck = @"SELECT b.OPSEQ FROM
ICSITEMROUTE2OPLot b LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.lotno=a.lotno WHERE a.LOTNO='" + ckData.LOTNO + "' and b.OPCODE='" + ckData.OPCode + "' ORDER BY OPSEQ";
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlCheck).Tables[0]; if (data != null && data.Rows.Count > 0) { int _OPSEQ = 0; string OPSEQ = data.Rows[0][0].ToString(); // if (!string.IsNullOrWhiteSpace(OPSEQ))
// {
// _OPSEQ = Int32.Parse(OPSEQ) + 10;
// }
// string sqlDownOP = @"SELECT a.ACTIONRESULT,b.OPCODE,b.OPSEQ FROM
// ICSROUTE2OP b
// LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.ROUTECODE=a.RouteCode
// WHERE a.LOTNO='" + ckData.LOTNO + "' AND b.OPSEQ='" + _OPSEQ + "' ORDER BY OPSEQ";
string sqlDownOP = @"SELECT a.ACTIONRESULT,b.OPCODE,b.OPSEQ FROM
ICSITEMROUTE2OPLot b LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.lotno=a.lotno WHERE a.LOTNO='" + ckData.LOTNO + "' AND b.OPSEQ>'" + OPSEQ + "' ORDER BY OPSEQ";
DataTable _data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlDownOP).Tables[0]; if (_data != null && _data.Rows.Count > 0) { _wait.Close(); MessageBox.Show("下道工序已开工,不能执行放行,请核对!"); return; } } else { _wait.Close(); MessageBox.Show("当前工序没开工工序,不能执行放行,请核对!"); return; } #endregion
}
string Status = grvDetail.GetRowCellValue(i, colState).ToString(); if (Status == "已检测") { _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox("当前批次:" + ckData.LOTNO + ",工单:" + ckData.MOCODE + ",工序:" + ckData.OPCode + "已经检测,不能继续放行!"); return; }
codeList.Add(grvDetail.GetRowCellValue(i, colLOTNO).ToString()); moList.Add(grvDetail.GetRowCellValue(i, colMOCode).ToString()); opList.Add(grvDetail.GetRowCellValue(i, colOPCODE).ToString()); String opadd = ""; for (int j = 0; j < grvDetail.RowCount; j++) { if (grvDetail.GetRowCellValue(i, colLOTNO).ToString() == grvDetail.GetRowCellValue(j, colLOTNO).ToString() && grvDetail.GetRowCellValue(i, colOPCODE).ToString() != grvDetail.GetRowCellValue(j, colOPCODE).ToString()) { if (opadd == "") { opadd += "" + grvDetail.GetRowCellValue(j, colOPCODE).ToString(); } else { opadd += "," + grvDetail.GetRowCellValue(j, colOPCODE).ToString(); } } } opaddList.Add(opadd); bool status = LotComplete_New(grvDetail.GetRowCellValue(i, colLOTNO).ToString(), grvDetail.GetRowCellValue(i, colOPCODE).ToString(), grvDetail.GetRowCellValue(i, colMOCode).ToString());
#region 20210818
string sqlCheckICSLOTONWIP = @"SELECT COUNT(*) FROM ICSLOTONWIP WHERE LOTNO='" + ckData.LOTNO + "' AND OPCODE='" + ckData.OPCode + "' and ACTIONRESULT='COLLECT_END' "; DataTable dtCheckICSLOTONWIP = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sqlCheckICSLOTONWIP).Tables[0]; if (dtCheckICSLOTONWIP != null && dtCheckICSLOTONWIP.Rows.Count > 0) { if (dtCheckICSLOTONWIP.Rows[0][0].ToString() == "0") { _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox("当前批次:" + ckData.LOTNO + ",工单:" + ckData.MOCODE + ",工序:" + ckData.OPCode + ",ICSLOTONWIP表中没有完工记录,请核对!"); return; } } else { _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox("当前批次:" + ckData.LOTNO + ",工单:" + ckData.MOCODE + ",工序:" + ckData.OPCode + ",ICSLOTONWIP表中没有完工记录,请核对!"); return; } #endregion
} } if (codeList.Count == 0) { _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox("请选择需要放行的批次条码!"); return; }
//CKDATA_WX(codeList, moList, opList, opaddList);//20191114
ICSQualityCKDATABLL.AddThroughOP(dataList, AppConfig.AppConnectString, GXOrWW);
//判断是否最后一道工序
//ICSQualityCKDATABLL.AddThroughZC(dataList1, AppConfig.AppConnectString);
if (complete_Status != "") { ICSBaseSimpleCode.AppshowMessageBox(0, complete_Status); } _wait.Close(); ICSBaseSimpleCode.AppshowMessageBox(0, "放行成功!");
#region AGV调用
StringBuilder errores = new StringBuilder(""); foreach (var ckdata in dataList) { if (ICSAGVBLL.IsCanToAGV(ckdata.LOTNO, ckdata.OPCode, "AGV是否开启", AppConfig.AppConnectString, AppConfig.WorkPointCode)) { try {
ICSAGVTASKLOG Log = new ICSAGVTASKLOG(); Log.ID = AppConfig.GetGuid(); Log.Lotno = ckdata.LOTNO; Log.Opcode = ckdata.OPCode; bool Islastop = ICSAGVBLL.IsLastOP(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); bool NextOpIsWW = ICSAGVBLL.NextOPisWW(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); bool NextOpIsWG = ICSAGVBLL.NextOPisWG(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); string Area = ""; string CArea = ""; //需要注意连续委外逻辑,当前工序和下道工序为连续委外,当前工序不触发AGV
if (!(NextOpIsWW && GXOrWW == 1 && NextOpIsWG)) {
if (Islastop) { FormICSAGVAreaChoose Choose = new FormICSAGVAreaChoose(); Choose.ShowDialog(); Area = ICSAGVBLL.GetAreaCode("00088", "4", AppConfig.AppConnectString, AppConfig.WorkPointCode); CArea = Choose.AreaCode; if (string.IsNullOrEmpty(CArea)) continue; Log.TaskType = "成品检合格"; } else if (NextOpIsWW) { Area = ICSAGVBLL.GetAreaCode("00088", "6", AppConfig.AppConnectString, AppConfig.WorkPointCode); Log.TaskType = "质检合格下工序委外"; } else { Area = ICSAGVBLL.GetAreaCode("00088", "2", AppConfig.AppConnectString, AppConfig.WorkPointCode); Log.TaskType = "质检合格"; }
string BeginArea = Area.Split('@')[0].Split(':')[0]; string EndArea = ""; if (Islastop) EndArea = CArea; else EndArea = Area.Split('@')[1].Split(':')[0]; AgvAreaToAreaModel Model = new AgvAreaToAreaModel(); Model.trackingNumber = ckdata.LOTNO; Model.area = EndArea; Log.Area = BeginArea; Log.EndArea = EndArea; Log.Mtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Log.MuserName = AppConfig.UserName; ICSAGVBLL.AgvAreaToArea(Model, Log, AppConfig.AppConnectString, AppConfig.WorkPointCode); } }
catch (Exception ex) { errores.Append("AGV任务异常:" + ex.Message + "已跳过\r\n"); continue; } } } if (!string.IsNullOrEmpty(errores.ToString())) { ICSBaseSimpleCode.AppshowMessageBox(errores.ToString()); } #endregion
btnSearch_Click(null, null); txtLotNo.Focus(); txtLotNo.SelectAll(); } catch (Exception ex) { _wait.Close(); MessageBox.Show(ex.Message); } } #endregion
#endregion
private bool CheckIsOK(int OPSEQ) { bool isfalse = false; string _OQCSql = @"SELECT DISTINCT ACTION,CC.RESULT FROM ICSLOTONWIP bb WITH (nolock)
LEFT JOIN ICSLOTONWIPCHECK CC ON BB.ID=CC.ONWIPID INNER JOIN ICSITEMROUTE2OPLot a WITH (nolock) ON bb.lotno=a.lotno and bb.opcode=a.opcode WHERE bb.LotNo='" + txtLotNo.Text + "' AND a.OPSEQ='" + OPSEQ + "' AND ISNULL(CC.RESULT,'')<>'合格'";
DataTable _OQCdt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, _OQCSql).Tables[0];
if (_OQCdt != null && _OQCdt.Rows.Count > 0) { isfalse = false; } else { isfalse = true; } return isfalse; }
//
//已经放行的还能判退吗???
//自控的判退,放行是没有工序管控的,只到批次,现在是否需要工序纬度
private void btnReturn_Click_bak(object sender, EventArgs e) { string id = ""; List<string> editList = new List<string>(); for (int i = 0; i < grvDetail.RowCount; i++) { //if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True") { //id = grvDetail.GetRowCellValue(i, colID).ToString();
string lotno = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); editList.Add(lotno); } } if (editList.Count == 0) { MessageBox.Show("请选择数据"); return; }
if (string.IsNullOrEmpty(this.txtReturn.Text.Trim())) { MessageBox.Show("请填写判退原因"); return; }
string strResult = ""; try { List<string> codeList = new List<string>(); List<ICSQualityCKDATA> modelList = new List<ICSQualityCKDATA>();
List<string> UnCKRCV = new List<string>(); List<string> IsCKedCK = new List<string>(); List<WMSICSINSPECTIONModel> InsList = new List<WMSICSINSPECTIONModel>(); string docNo = ""; string docLine = ""; decimal QTY = 0; string itemcode = ""; string Luhao = ""; bool IsFirst = true; for (int i = 0; i < grvDetail.RowCount; i++) { if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True") { ICSQualityCKDATA model = new ICSQualityCKDATA();
//string IsCanCK = grvDetail.GetRowCellValue(i, colIsCanCK).ToString();
string lotno = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); model.LOTNO = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); model.OPCode = grvDetail.GetRowCellValue(i, colOPCODE).ToString(); model.MOCODE = grvDetail.GetRowCellValue(i, colMOCode).ToString(); model.SEQ = Int32.Parse(grvDetail.GetRowCellValue(i, colMOSEQ).ToString()); model.CKResult = "0"; docNo = model.MOCODE; docLine = model.SEQ.ToString(); itemcode = grvDetail.GetRowCellValue(i, colITEMCODE).ToString(); QTY = Decimal.Parse(grvDetail.GetRowCellValue(i, colLOTQTY).ToString()); modelList.Add(model); //if (IsCanCK != "OK")
//{
//if (!UnCKRCV.Contains(docNo))
//{
// UnCKRCV.Add(docNo);
//}
//}
//else
//{
bool Isck = ICSQualityCKDATABLL.IsLLCKByLotNo(lotno); if (Isck) { IsCKedCK.Add(lotno); } else { codeList.Add(lotno); QTY += Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString()); strResult += grvDetail.GetRowCellValue(i, colLOTNO).ToString() + ",";
WMSICSINSPECTIONModel ins = new WMSICSINSPECTIONModel(); ins.LotNO = lotno; ins.INVCODE = grvDetail.GetRowCellValue(i, colITEMCODE).ToString(); ins.VENDORITEMCODE = grvDetail.GetRowCellValue(i, colITEMCODE).ToString(); ins.LOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString()); ins.NLOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString()); ins.BadCause = this.txtReturn.Text.Trim(); //ins.TransNO = grvDetail.GetRowCellValue(i, colPOCode).ToString();
//ins.TransLine = grvDetail.GetRowCellValue(i, colPoLineNo).ToString();
ins.TYPE = "采购入库";
InsList.Add(ins); //}
} //判断是否有相同的炉号,报检单号,料号,行号
if (IsFirst) { IsFirst = false; //docNo = grvDetail.GetRowCellValue(i, colRcvDocNo).ToString();
itemcode = grvDetail.GetRowCellValue(i, colITEMCODE).ToString(); //Luhao = grvDetail.GetRowCellValue(i, colRcvLineInvLotFurnace).ToString();
//docLine = grvDetail.GetRowCellValue(i, colRcvLineNo).ToString();
} else { //if (docNo != grvDetail.GetRowCellValue(i, colRcvDocNo).ToString() ||
// itemcode != grvDetail.GetRowCellValue(i, colItemCode).ToString() ||
// Luhao != grvDetail.GetRowCellValue(i, colRcvLineInvLotFurnace).ToString() ||
// docLine != grvDetail.GetRowCellValue(i, colRcvLineNo).ToString())
if (itemcode != grvDetail.GetRowCellValue(i, colITEMCODE).ToString()) { ICSBaseSimpleCode.AppshowMessageBox("请选择相同料号,报检单号,行号,炉号的批次条码!"); return; } } }
}
if (codeList.Count == 0 && UnCKRCV.Count == 0 && IsCKedCK.Count == 0) { ICSBaseSimpleCode.AppshowMessageBox("请选择需要判退的批次条码!"); return; } string mess = ""; //if (UnCKRCV.Count != 0)
//{
// mess += "以下到货单未达到抽检比例,不能放行:" + string.Join(",", UnCKRCV.ToArray());
//}colIsSendNCR
if (IsCKedCK.Count != 0) { mess += "以下批次已经放行或判退,不能判退:" + string.Join(",", IsCKedCK.ToArray()); } if (!string.IsNullOrEmpty(mess)) { ICSBaseSimpleCode.AppshowMessageBox(mess); } if (codeList.Count != 0) { ICSQualityCKDATABLL.AddReturn(modelList, AppConfig.AppConnectString, this.txtReturn.Text.Trim()); //SRM用的,可以注释
//ICSQualityCKDATABLL.InsertICSINSPECTION(InsList);
//这里需要
SendNCR(codeList, this.txtReturn.Text.Trim(), docNo, docLine, QTY, Luhao, itemcode);
ICSBaseSimpleCode.AppshowMessageBox(0, "判退成功!");
btnSearch_Click(null, null); } this.txtReturn.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void btnReturn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.txtReturn.Text.Trim())) { MessageBox.Show("请填写判退原因"); return; } string strResult = ""; try { List<ICSQualityCKDATA> ckList = new List<ICSQualityCKDATA>();//工序检验
List<string> codeList = new List<string>();
string MOCODE = ""; decimal QTY = 0; string itemcode = "";
String OPCODE = "";
bool IsFirst = true; for (int i = 0; i < grvDetail.RowCount; i++) { ICSQualityCKDATA item = new ICSQualityCKDATA();//工序检验
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True") { string lot = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); string opcode = grvDetail.GetRowCellValue(i, colOPCODE).ToString(); string mocode = grvDetail.GetRowCellValue(i, colMOCode).ToString(); //string ID = grvDetail.GetRowCellValue(i, colID).ToString();
string sql = "select max(opseq) as opseq from icsitemroute2oplot a where lotno='" + lot + "' and opseq<(select opseq from icsitemroute2oplot b where b.lotno='" + lot + "' and b.opcode='" + opcode + "' )"; DataTable lastop = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
if (lastop.Rows.Count > 0&&!string.IsNullOrEmpty(lastop.Rows[0]["opseq"].ToString())) {
bool isOK = CheckIsOK(Convert.ToInt32(lastop.Rows[0]["opseq"])); if (!isOK) { ICSBaseSimpleCode.AppshowMessageBox("上道工序未检验或检验结果不合格,不能判定!"); return; }
}
string Status = grvDetail.GetRowCellValue(i, colState).ToString(); if (Status == "已检测") { ICSBaseSimpleCode.AppshowMessageBox("当前批次:" + lot + ",工单:" + mocode + ",工序:" + opcode + "已经检测,不能继续判退!"); return; }
item.LOTNO = lot; item.OPCode = opcode; item.MOCODE = mocode; item.CKResult = "0"; //item.ID = ID;
if (!ckList.Contains(item)) { ckList.Add(item); } if (!codeList.Contains(lot)) { strResult += lot + ","; codeList.Add(lot); } QTY += Convert.ToDecimal(grvDetail.GetRowCellValue(i, colLOTQTY).ToString());
if (string.IsNullOrEmpty(itemcode)) { itemcode = grvDetail.GetRowCellValue(i, colITEMCODE).ToString(); }
//判断是否有相同的 工单
if (IsFirst) { IsFirst = false; MOCODE = mocode; OPCODE = opcode; } else { if (MOCODE != mocode) { ICSBaseSimpleCode.AppshowMessageBox("请选择相同工单号的批次条码!"); return; }
if (OPCODE != opcode) { ICSBaseSimpleCode.AppshowMessageBox("请选择相同工序的批次条码!"); return; } }
if (GXOrWW == 0) { #region 20210709下道工序开工,上道工序质量检验就不能判退或者放行,提示下道工序已开工
string sqlCheck = @"SELECT b.OPSEQ FROM
ICSITEMROUTE2OPLot b LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.lotno=a.lotno WHERE a.LOTNO='" + lot + "' and b.OPCODE='" + opcode + "' ORDER BY OPSEQ";
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlCheck).Tables[0]; if (data != null && data.Rows.Count > 0) { int _OPSEQ = 0; string OPSEQ = data.Rows[0][0].ToString(); //if (!string.IsNullOrWhiteSpace(OPSEQ))
//{
// _OPSEQ = Int32.Parse(OPSEQ) + 10;
//}
// string sqlDownOP = @"SELECT a.ACTIONRESULT,b.OPCODE,b.OPSEQ FROM
// ICSROUTE2OP b
// LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.ROUTECODE=a.RouteCode
// WHERE a.LOTNO='" + lot + "' AND b.OPSEQ='" + _OPSEQ + "' ORDER BY OPSEQ";
string sqlDownOP = @"SELECT b.OPSEQ FROM
ICSITEMROUTE2OPLot b LEFT JOIN ICSLOTONWIP a ON b.OPCODE=a.OPCODE AND b.lotno=a.lotno WHERE a.LOTNO='" + lot + "' AND b.OPSEQ>'" + OPSEQ + "' ORDER BY OPSEQ";
DataTable _data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sqlDownOP).Tables[0]; if (_data != null && _data.Rows.Count > 0) { MessageBox.Show("下道工序已开工,不能执行判退,请核对!"); return; } } else { MessageBox.Show("当前工序没开工工序,不能执行判退,请核对!"); return; } #endregion
} }
}
if (codeList.Count == 0) { ICSBaseSimpleCode.AppshowMessageBox("请选择需要判退的批次条码!"); return; } strResult=strResult.Trim(','); ICSQualityCKDATABLL.AddCK_GXJY(ckList, AppConfig.AppConnectString, this.txtReturn.Text.Trim(), GXOrWW); SendNCR(codeList, strResult + this.txtReturn.Text.Trim(), QTY, itemcode, MOCODE, OPCODE);
ICSBaseSimpleCode.AppshowMessageBox(0, "判退成功!");
#region AGV调用
StringBuilder errores = new StringBuilder(""); foreach (var ckdata in ckList) { if (ICSAGVBLL.IsCanToAGV(ckdata.LOTNO, ckdata.OPCode, "AGV是否开启", AppConfig.AppConnectString, AppConfig.WorkPointCode)) { try {
ICSAGVTASKLOG Log = new ICSAGVTASKLOG(); Log.ID = AppConfig.GetGuid(); Log.Lotno = ckdata.LOTNO; Log.Opcode = ckdata.OPCode; bool Islastop = ICSAGVBLL.IsLastOP(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); bool NextOpIsWW = ICSAGVBLL.NextOPisWW(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); bool NextOpIsWG = ICSAGVBLL.NextOPisWG(Log.Lotno, Log.Opcode, AppConfig.AppConnectString, AppConfig.WorkPointCode); string Area = ""; if (!(NextOpIsWW && GXOrWW == 1 && NextOpIsWG)) { Area = ICSAGVBLL.GetAreaCode("00088", "3", AppConfig.AppConnectString, AppConfig.WorkPointCode); Log.TaskType = "质检不合格"; string BeginArea = Area.Split('@')[0].Split(':')[0]; string EndArea = Area.Split('@')[1].Split(':')[0]; AgvAreaToAreaModel Model = new AgvAreaToAreaModel(); Model.trackingNumber = ckdata.LOTNO; Model.area = EndArea; Log.Area = BeginArea; Log.EndArea = EndArea; Log.Mtime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Log.MuserName = AppConfig.UserName; ICSAGVBLL.AgvAreaToArea(Model, Log, AppConfig.AppConnectString, AppConfig.WorkPointCode); } }
catch (Exception ex) { errores.Append("AGV任务异常:" + ex.Message + "已跳过\r\n"); continue; } } } if (!string.IsNullOrEmpty(errores.ToString())) { ICSBaseSimpleCode.AppshowMessageBox(errores.ToString()); }
#endregion
this.txtReturn.Text = "";
btnSearch_Click(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
#region 提交时选择工序对前面所有工序自动开工完工
public bool LotComplete_New(string LotNo, string OPCODE, String MoCode) { //查询此条码正在进行工序--当前工序
string seqSql = string.Format(@"SELECT f.CollectStatus
FROM ICSLOTSIMULATION f WHERE f.LOTNO='{0}' and f.OPCODE='{1}' ", LotNo, OPCODE);
DataTable seqDt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, seqSql).Tables[0];
//BatchStartServer.BatchStartClient StartClientResult = new BatchStartServer.BatchStartClient();
//BatchStartServer.OperationResult _StartResult = new BatchStartServer.OperationResult();
//BatchEndServer.BatchEndClient EndClientResult = new BatchEndServer.BatchEndClient();
//BatchEndServer.OperationResult _EndResult = new BatchEndServer.OperationResult();
if (seqDt != null && seqDt.Rows.Count > 0) {
if (seqDt.Rows[0]["CollectStatus"].ToString() == "COLLECT_BEGIN")//此条码当前工序已开工,需自动完工
{ //ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.FormICSOQCOPCKDATAUIModel[] ICSOQCOPCKDATAArray = new BatchEndServer.FormICSOQCOPCKDATAUIModel[0];
//ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[] ICSOQCOPCKDATA = new ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[0];
//_EndResult = EndClientResult.GetBatchEnd_Message(true, ICSOQCOPCKDATAArray, ICSOQCOPCKDATA, LotNo, MoCode, OPCODE, "admin", AppConfig.WorkPointCode);
//if (!_EndResult.IsSuccess)
//{
// ICSBaseSimpleCode.AppshowMessageBox(LotNo + "完工失败! " + _EndResult.MESSAGE);
// return false;
//}
} else if (seqDt.Rows[0]["CollectStatus"].ToString() == "")//自动开工完工
{ //自动开工
//_StartResult = StartClientResult.GetBatchStart_Message(LotNo, MoCode, OPCODE, "admin", AppConfig.WorkPointCode);
//if (_StartResult.IsSuccess)//自动开工成功
//{
// ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.FormICSOQCOPCKDATAUIModel[] ICSOQCOPCKDATAArray = new BatchEndServer.FormICSOQCOPCKDATAUIModel[0];
// ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[] ICSOQCOPCKDATA = new ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[0];
// _EndResult = EndClientResult.GetBatchEnd_Message(true, ICSOQCOPCKDATAArray, ICSOQCOPCKDATA, LotNo, MoCode, OPCODE, "admin", AppConfig.WorkPointCode);
// if (!_EndResult.IsSuccess)
// {
// ICSBaseSimpleCode.AppshowMessageBox(LotNo + ":完工失败! " + _EndResult.MESSAGE);
// return false;
// }
//}
//else
//{
// ICSBaseSimpleCode.AppshowMessageBox(LotNo + "开工失败!" + _StartResult.MESSAGE);
// return false;
//}
} } else { //ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.FormICSOQCOPCKDATAUIModel[] ICSOQCOPCKDATAArray = new BatchEndServer.FormICSOQCOPCKDATAUIModel[0];
//ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[] ICSOQCOPCKDATA = new ZHCSoft.AntiwearValveExpanded.Forms.BatchEndServer.ICSECG2EC[0];
//_EndResult = EndClientResult.GetBatchEnd_Message(true, ICSOQCOPCKDATAArray, ICSOQCOPCKDATA, LotNo, MoCode, OPCODE, "admin", AppConfig.WorkPointCode);
//if (!_EndResult.IsSuccess)
//{
// ICSBaseSimpleCode.AppshowMessageBox(LotNo + "完工失败! " + _EndResult.MESSAGE);
// return false;
//}
}
return true;
} #endregion
#region 20210602
private void SendNCR(List<string> codeList, string strResult, string DocNo, string DocLine, decimal QTY, string luhao, string itemcode) { try { string codeStr = ""; foreach (string str in codeList) { codeStr += str + ","; } codeStr = codeStr.TrimEnd(','); string NewCartonNo = "NCR" + AppConfig.GetSeverDateTime("yyyy-MM-dd").ToString("yyyyMMdd"); NewCartonNo = GetSerialCode(AppConfig.FrameConnectString, "ICSNCRDoc", "SecDocNO", NewCartonNo, 3); ICSSecDocType secDocType = ICSSecDocTypeBLL.select("QC_Collect", AppConfig.FrameConnectString);
//获取对应的接收人和抄送人
ICSSecDocTypeStep docTypeStep = ICSSecDocTypeStepBLL.selectStepBySeq(secDocType.guid, "1", AppConfig.FrameConnectString); string ToUserList = ""; //ToUserList = ICSNCRDocBLL.QualityEngineer(UserControlLLNew.GetUserCode, AppConfig.AppConnectString);
ToUserList = ICSNCRDocBLL.QualityEngineer("", AppConfig.AppConnectString);
if (string.IsNullOrEmpty(ToUserList)) { ToUserList = ICSNCRDocBLL.QualityEngineer("来料", AppConfig.AppConnectString); }
string CCUserList = ICSNCRDocBLL.QualityEngineer("经理", AppConfig.AppConnectString);
ICSNCRDoc SecDoc = new ICSNCRDoc(); SecDoc.SecDocNO = NewCartonNo; SecDoc.SecDocType = secDocType.guid; SecDoc.SecDocStatus = "已发送"; SecDoc.SecDocSeq = 1; //SecDoc.SecDocCreateUser = UserControlLLNew.GetUserCode;
//SecDoc.SecDocCreateUserName = UserControlLLNew.GetUserName;
SecDoc.SecDocCreateUser = AppConfig.UserCode; SecDoc.SecDocCreateUserName = AppConfig.UserName; SecDoc.SecDocCreateTime = AppConfig.GetSeverDateTime(""); SecDoc.ErrorType = "来料"; SecDoc.EQPCode = ""; SecDoc.ItemCode = itemcode; SecDoc.ProjectCode = ""; SecDoc.TimeLimit = "1"; SecDoc.ContentDesc = strResult; SecDoc.EATTRIBUTE1 = codeStr; SecDoc.ToUserList = ToUserList; SecDoc.CCUserList = CCUserList; SecDoc.LOTNO = DocNo; SecDoc.OPCode = DocLine; SecDoc.SecDocOKTime = Convert.ToDateTime("1990-01-01"); SecDoc.Qty = QTY; SecDoc.SrcDocInfo = codeStr; SecDoc.Furnace = luhao;
ICSNCRDocDoDetail SecDocDoDetail = new ICSNCRDocDoDetail();
SecDocDoDetail.DepCode = docTypeStep.DocTypeTo;
ICSNCRDoc NCR = new ICSNCRDoc(); NCR = null;//modify on 20200418
if (NCR == null) { ICSNCRDocBLL.CreateNCR(SecDoc, AppConfig.AppConnectString); } else { MessageBox.Show(codeStr + "已产生NCR单号:" + NCR.SecDocNO + ",不能新增NCR单"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SendNCR(string strResult, string RcvDocNo, string ItemCode, string ItemName, string ProjectCode, decimal QTY) { try { string NewCartonNo = "NCR" + AppConfig.GetSeverDateTime("yyyy-MM-dd").ToString("yyyyMMdd"); NewCartonNo = GetSerialCode(AppConfig.FrameConnectString, "ICSNCRDoc", "SecDocNO", NewCartonNo, 3);
ICSSecDocType secDocType = ICSSecDocTypeBLL.select("QC_Collect", AppConfig.FrameConnectString);
//获取对应的接收人和抄送人
ICSSecDocTypeStep docTypeStep = ICSSecDocTypeStepBLL.selectStepBySeq(secDocType.guid, "1", AppConfig.FrameConnectString); string ToUserList = ""; ToUserList = ICSNCRDocBLL.QualityEngineer(AppConfig.UserCode, AppConfig.AppConnectString); if (string.IsNullOrEmpty(ToUserList)) { ToUserList = ICSNCRDocBLL.QualityEngineer("来料", AppConfig.AppConnectString); } string CCUserList = ICSNCRDocBLL.QualityEngineer("经理", AppConfig.AppConnectString);
ICSNCRDoc SecDoc = new ICSNCRDoc(); SecDoc.SecDocNO = NewCartonNo; SecDoc.SecDocType = secDocType.guid; SecDoc.SecDocStatus = "已发送"; SecDoc.SecDocSeq = 1; SecDoc.SecDocCreateUser = AppConfig.UserCode; SecDoc.SecDocCreateUserName = AppConfig.UserName; SecDoc.SecDocCreateTime = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss"); SecDoc.ErrorType = "来料"; SecDoc.EQPCode = ""; SecDoc.ItemCode = ItemCode; SecDoc.ProjectCode = ProjectCode; SecDoc.TimeLimit = "1"; SecDoc.ContentDesc = strResult;
SecDoc.ToUserList = ToUserList; SecDoc.CCUserList = CCUserList; SecDoc.LOTNO = RcvDocNo.Split('_')[0]; SecDoc.OPCode = RcvDocNo.Split('_')[1]; SecDoc.SecDocOKTime = Convert.ToDateTime("1990-01-01"); SecDoc.SrcDocInfo = RcvDocNo.Split('_')[0]; SecDoc.Qty = QTY;
ICSNCRDoc NCR = new ICSNCRDoc();
NCR = null;//modify on 20200418
if (NCR == null) { ICSNCRDocBLL.CreateNCR(SecDoc, AppConfig.AppConnectString); } else { MessageBox.Show(RcvDocNo.Split('_')[0] + "已产生NCR单号:" + NCR.SecDocNO + ",不能新增NCR单"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SendNCR(List<string> codeList, string strResult, decimal QTY, string itemcode, string mocode, string OPCODE) {//
try { string codeStr = ""; foreach (string str in codeList) { codeStr += str + ","; } codeStr = codeStr.TrimEnd(','); string NewCartonNo = "NCR" + AppConfig.GetSeverDateTime("yyyy-MM-dd").ToString("yyyyMMdd"); NewCartonNo = GetSerialCode(AppConfig.FrameConnectString, "ICSNCRDoc", "SecDocNO", NewCartonNo, 3);
ICSSecDocType secDocType = ICSSecDocTypeBLL.select("QC_Collect", AppConfig.FrameConnectString);
#region 20210816
//获取对应的接收人和抄送人
//ICSSecDocTypeStep docTypeStep = ICSSecDocTypeStepBLL.selectStepBySeq(secDocType.guid, "1", AppConfig.FrameConnectString);
//string ToUserList = "";
//ToUserList = ICSNCRDocBLL.QualityEngineer(CKType, AppConfig.AppConnectString);
#endregion
//string CCUserList = ICSNCRDocBLL.QualityEngineer("经理", AppConfig.AppConnectString);
//string sql = @"SELECT a.ProjectCode FROM ICSMO a WHERE a.MOCODE='{0}'";
//sql = string.Format(sql, mocode);
//DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
string ProjectCode = ""; //if (dt != null && dt.Rows.Count > 0)
//{
// ProjectCode = dt.Rows[0]["ProjectCode"].ToString();
//}
ICSNCRDoc SecDoc = new ICSNCRDoc(); SecDoc.SecDocNO = NewCartonNo; SecDoc.SecDocType = secDocType.guid; SecDoc.SecDocStatus = "已发送"; SecDoc.SecDocSeq = 1; SecDoc.SecDocCreateUser = AppConfig.UserCode; SecDoc.SecDocCreateUserName = AppConfig.UserName; SecDoc.SecDocCreateTime = AppConfig.GetSeverDateTime(""); //SecDoc.ErrorType = CKType;
SecDoc.ErrorType = "工序检验";//modify on 20201202 NCRtype修改
SecDoc.EQPCode = ""; SecDoc.ItemCode = itemcode; SecDoc.ProjectCode = ProjectCode; SecDoc.TimeLimit = "1"; SecDoc.ContentDesc = strResult; SecDoc.EATTRIBUTE2 = CKType;
//SecDoc.ToUserList = ToUserList;
//SecDoc.CCUserList = CCUserList;
//SecDoc.ToUserList = ToUserList;
//SecDoc.CCUserList = CCUserList;
SecDoc.LOTNO = ""; SecDoc.OPCode = OPCODE; SecDoc.SecDocOKTime = Convert.ToDateTime("1990-01-01"); SecDoc.Qty = QTY; SecDoc.SrcDocInfo = codeStr;
ICSNCRDoc NCR = new ICSNCRDoc(); // NCR = ICSNCRDocBLL.selectBySrcDocInfo(codeStr, AppConfig.AppConnectString);
NCR = null;//modify on 20200418
if (NCR == null) { ICSNCRDocBLL.CreateNCR(SecDoc, AppConfig.AppConnectString); } else { MessageBox.Show(codeStr + "已产生NCR单号:" + NCR.SecDocNO + ",不能新增NCR单"); }
} catch (Exception ex) { throw new Exception(ex.Message); } }
#endregion
private DataTable GetNGCKData(string RcvDocNo, string LineNo) { string sql = @"select a.RcvDocNo,a.RcvLineNo,a.RcvLineItemMasterCode,a.RcvLineItemMasterName, a.RcvLineProjectCode,
a.RcvLineInvLotFurnace, C.LotNo, e.CKITEMCODE,e.CKITEMDESC,SetValueMax,SetValueMin,d.[CKValue] ,b.BarCodeQty from [dbo].[WM_RCVShip] a inner join [dbo].[WM_BarCode] b on a.[guid] = b.Srcguid And b.SrcType = 'WM_RCVShip' inner join ( select * from (select ROW_NUMBER()over(partition by LOTNO order by mtime desc) rowId,* from ICSQualityCKDATA ck where type='来料' ) as AuctionRecords where rowId=1) c on b.BarCodeNo = c.LotNo And c.CKResult = '0' inner join [dbo].[ICSQualityCKDATADetail] d on d.DataID = c.ID And d.[CKResult] = '0' And [DECKResult] = '0' inner join [dbo].[ICSQualityCKItem] e on d.CKItemID = e.ID where a.[RcvDocNo] = '" + RcvDocNo + "' And a.[RcvLineNo]='" + LineNo + "' order by a.RcvDocNo,a.RcvLineNo";
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
return dt; }
private void btnSelectAll_Click(object sender, EventArgs e) { if (ICSBaseSimpleCode.AppshowMessageBoxRepose("确定全选吗?") != DialogResult.OK) return; grvDetail.PostEditor(); this.Validate(); for (int i = 0; i < grvDetail.RowCount; i++) { grvDetail.SetRowCellValue(i, colisSelect, true); } }
private void btnUnSelectAll_Click(object sender, EventArgs e) { grvDetail.PostEditor(); this.Validate(); for (int i = 0; i < grvDetail.RowCount; i++) { grvDetail.SetRowCellValue(i, colisSelect, false); } }
private void btnDisposeIn_Click(object sender, EventArgs e) { //FormICSLLDispose add = new FormICSLLDispose();
//add.ShowDialog();
}
private void grvDetail_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { int hand = e.RowHandle; if (hand < 0) return; DataRow dr = this.grvDetail.GetDataRow(hand); if (dr == null) return; if (grvDetail.FocusedColumn.FieldName == "SecDocNO") { string userCode = AppConfig.UserCode;
string DocNo = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colSecDocNO).ToString();
if (!string.IsNullOrWhiteSpace(DocNo)) {
if (!string.IsNullOrWhiteSpace(DocNo)) { List<string> list = new List<string>(DocNo.Split(',')); //FormICSNCR ff = new FormICSNCR(list, 0);
//ff.Show();
} } } }
private void repositoryItemHyperLinkEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) {
}
private void timer1_Tick(object sender, EventArgs e) { //btnSearch_Click(null, null);
}
private void simpleBut_Min_Click(object sender, EventArgs e) { this.WindowState = FormWindowState.Minimized; this.FormBorderStyle = FormBorderStyle.Sizable; }
private void FormICSLL_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.FormBorderStyle = FormBorderStyle.Sizable; } else { this.FormBorderStyle = FormBorderStyle.None; } }
/// <summary>
/// 获取单据号
/// </summary>
/// <param name="tbName"></param>
/// <param name="colName"></param>
/// <param name="Pre"></param>
/// <param name="numLen"></param>
/// <returns></returns>
public static string GetSerialCode(string connectString, string tbName, string colName, string Pre, int numLen) { string sql = "EXEC Addins_GetSerialCode '{0}','{1}','{2}','{3}',{4}"; sql = string.Format(sql, new object[] { "",tbName, colName, Pre, numLen }); return DBHelper.ExecuteScalar(connectString, CommandType.Text, sql).ToString(); }
private void grdDetail_Click(object sender, EventArgs e) {
}
private void txtLotNo_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { btnSearch_Click(null, null); }
}
/// <summary>
/// 撤销功能:防止误判 1.委外检验无法撤销,判退无法撤销,下到工序已开工无法撤销
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e) {
try { if (GXOrWW == 1) throw new Exception("委外检验无法撤销!");
List<ICSQualityCKDATA> codeList = new List<ICSQualityCKDATA>(); for (int i = 0; i < grvDetail.RowCount; i++) { if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "True") { string Lotno = grvDetail.GetRowCellValue(i, colLOTNO).ToString(); string opcode = grvDetail.GetRowCellValue(i, colOPCODE).ToString(); string opcodeSimu = GetSimuOp(Lotno); if (grvDetail.GetRowCellValue(i, colResult).ToString() == "不合格") throw new Exception("条码:" + Lotno + ",工序:" + opcode + " 已判退无法撤销!"); if (grvDetail.GetRowCellValue(i, colResult).ToString() == "未检测") throw new Exception("条码:" + Lotno + ",工序:" + opcode + " 未检测无法撤销!");
if (opcode != opcodeSimu) { throw new Exception("条码:" + Lotno + "当前在制工序:" + opcodeSimu + "已开工,工序:" + opcode + "无法回撤!"); } ICSQualityCKDATA ckdata = new ICSQualityCKDATA(); ckdata.LOTNO = Lotno; ckdata.OPCode = opcode; codeList.Add(ckdata);
}
} if (codeList.Count == 0) { ICSBaseSimpleCode.AppshowMessageBox("请选择需要撤回判定的批次条码!"); return; } ICSQualityCKDATABLL.BackThroughOP(codeList, AppConfig.AppConnectString); ICSBaseSimpleCode.AppshowMessageBox("撤回成功!"); btnSearch_Click(null, null); } catch (Exception EX) { ICSBaseSimpleCode.AppshowMessageBox(EX.Message); }
}
public string GetSimuOp(string Lotno) { string sql = "select Opcode from icslotsimulation where lotno='{0}'"; sql = string.Format(sql, Lotno); return DBHelper.ExecuteDataset(AppConfig.AppConnectString,CommandType.Text,sql).Tables[0].Rows[0]["Opcode"].ToString(); } } }
|