You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
222 lines
9.6 KiB
222 lines
9.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
using System.Drawing;
|
|
using ICSSoft.Base.Report.Filter;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSIQCspectAdd : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
private string sqltxt = "";
|
|
private string sqlconn = "";
|
|
private DataTable dataSource = null;
|
|
#region 构造函数
|
|
|
|
public FormICSIQCspectAdd()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 过滤
|
|
private string tempTableName = "";
|
|
#endregion
|
|
#endregion
|
|
#region 刷新
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
if (sqlconn == null || sqlconn == "")
|
|
{
|
|
return;
|
|
}
|
|
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
|
|
filter.OldTempTableName = tempTableName;
|
|
//tempTableName = filter.NewTempTableName;
|
|
//DataTable data = DBHelper.ExecuteDataset(AppConfig.FrameConnectString, CommandType.Text, "select * from " + tempTableName).Tables[0];
|
|
dataSource = DBHelper.ExecuteDataset(sqlconn, CommandType.Text, sqltxt).Tables[0];
|
|
grdDetail.DataSource = dataSource;
|
|
grvDetail.BestFitColumns();
|
|
rptPage.RecordNum = dataSource.Rows.Count;
|
|
rptPage.PageIndex = 1;
|
|
rptPage.ReLoad();
|
|
_wait.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
_wait.Close();
|
|
}
|
|
}
|
|
|
|
#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
|
|
|
|
private void save_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private void txtLOTNO_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
if (txtLOTNO.Text == "")
|
|
{
|
|
txtMUSER1.Text = "";
|
|
txtMUSERName1.Text = "";
|
|
txtINVCode.Text = "";
|
|
txtINVNAME.Text = "";
|
|
txtOPNAME.Text = "";
|
|
txtINVCode.Text = "";
|
|
txtSEQ.Text = "";
|
|
txtMOSEQ.Text = "";
|
|
|
|
}
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = @"select distinct a.ID as [ID], a.LOTNO as [产品跟踪单号],a.MUSER as [员工条码],a.MUSERName as [员工姓名],a.ITEMCODE as [存货编码],b.INVNAME as [存货姓名],b.INVTYPE as [规格型号],
|
|
e.OPCode as OPCODE,c.OPDESC as [上道工序名称],
|
|
a.SEQ as [条码数量],a.MOSEQ as [工单数量],f.CKGROUPDNAME as CKGROUPDNAME,e.CKGROUPCode as CKGROUPCODE,e.SetValueMax as SetValueMax,e.SetValueMin as SetValueMin
|
|
from ICSLOTONWIP a
|
|
left join ICSOQCCKLIST e on a.ITEMCODE=e.INVCode
|
|
left join ICSINVENTORY b on a.ITEMCODE=b.INVCODE
|
|
left join ICSOP c on a.OPCODE=c.OPCODE
|
|
left join ICSOQCCKGROUP f on f.CKGROUP=e.CKGROUPCode
|
|
where 1=1 ORDER BY a.ITEMCODE";
|
|
//sql = string.Format(sql, LotNO, OPCode, txtPOCode.Text.ToString());
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
FormDataRefer reForm = new FormDataRefer();
|
|
// reForm.FormTitle = "产品跟踪单号信息";
|
|
DataTable menuData = data;
|
|
reForm.DataSource = menuData;
|
|
reForm.MSelectFlag = false;
|
|
reForm.RowIndexWidth = 35;
|
|
reForm.HideCols.Add("ID");
|
|
reForm.FormWidth = 500;
|
|
reForm.FormHeight = 500;
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtLOTNO.Text = dr["产品跟踪单号"].ToString();
|
|
txtMUSER1.Text = dr["员工条码"].ToString();
|
|
txtMUSERName1.Text = dr["员工姓名"].ToString();
|
|
txtINVCode.Text = dr["存货编码"].ToString();
|
|
txtINVNAME.Text = dr["存货姓名"].ToString();
|
|
txtINVTYPE.Text = dr["规格型号"].ToString();
|
|
txtOPNAME.Text = dr["上道工序名称"].ToString();
|
|
txtSEQ.Text = dr["条码数量"].ToString();
|
|
txtMOSEQ.Text = dr["工单数量"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
#region 合格判定
|
|
private void repositoryItemButtonEdit4_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//DataRow df = CheckStatus("合格");
|
|
UpdateStatus(grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), "合格", grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString());
|
|
|
|
btnRefresh_Click(null, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void UpdateStatus(string DispatchCode, string DispatchRow, string Class, string Send, string Sale)
|
|
{
|
|
#region
|
|
//grvDetail.SetRowCellValue(num, CreateUser, AppConfig.UserName);
|
|
//grvDetail.SetRowCellValue(num, CreateTime, AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("yyyy-MM-dd HH:mm:ss"));
|
|
//修改行状态
|
|
#endregion
|
|
string sql = @"UPDATE ICSSODispatch SET Class = '{2}',Send='{3}',Sale='{4}' WHERE DispatchCode = '{0}' AND DispatchRow = '{1}' ";
|
|
sql = string.Format(sql, DispatchCode, DispatchRow, Class, AppConfig.UserName, AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss").ToString("yyyy-MM-dd HH:mm:ss"));
|
|
DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql);
|
|
#region
|
|
//修改头状态
|
|
// sql = @"select * from ICSINVReceiptDetail
|
|
// where ReceiptNO='{0}' and IQCStatus='{1}'";
|
|
// sql = string.Format(sql, RcvNo,"待检");
|
|
// DataTable dt=DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql).Tables[0];
|
|
// if (dt == null || dt.Rows.Count == 0)
|
|
// {
|
|
// sql = @"update ICSINVReceipt set RECSTATUS='{1}',MUSERName='{2}',MTIME='{3}'
|
|
// where ReceiptNO='{0}'";
|
|
// sql = string.Format(sql, RcvNo, "已检",AppConfig.UserName,AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss"));
|
|
// DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql);
|
|
// }
|
|
|
|
//修改子状态
|
|
// sql = @"select * from ICSITEMLot
|
|
// where TransNO='{0}' and EATTRIBUTE5=''";
|
|
// sql = string.Format(sql, RcvNo);
|
|
// DataTable dt1 = DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql).Tables[0];
|
|
// if (dt1 == null || dt1.Rows.Count == 0)
|
|
// {
|
|
// sql = @"update ICSITEMLot set EATTRIBUTE5='{1}',MUSERName='{2}',MTIME='{3}'
|
|
// where TransNO='{0}'";
|
|
// sql = string.Format(sql, RcvNo, "已检", AppConfig.UserName, AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss"));
|
|
// DBHelper.ExecuteDataset(AppConfig.GetDataBaseConnectStringByKey("[DB.SYS]"), CommandType.Text, sql);
|
|
// }
|
|
#endregion
|
|
//btnRefresh_Click(null, null);
|
|
}
|
|
|
|
#region 不合格判定
|
|
private void repositoryItemButtonEdit5_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
//DataRow df = CheckStatus("不合格");
|
|
UpdateStatus(grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), "不合格", grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString(), grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, txtLOTNO.Text).ToString());
|
|
btnRefresh_Click(null, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
private void groupBox2_Enter(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|