using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace MES
|
{
|
public partial class Sc_CheckRequest : Form
|
{
|
public Sc_CheckRequest()
|
{
|
InitializeComponent();
|
}
|
|
public long HInterID;
|
public int IsOk;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
|
private void cmdHCheckMan_Click(object sender, EventArgs e)
|
{
|
DBUtility.Gy_UserSelect oUser = new DBUtility.Gy_UserSelect();
|
oUser.bSingle = true;
|
oUser.ShowDialog();
|
if (oUser.IsOk == 1)
|
{
|
txtHMarker.Text = oUser.sReturn;
|
}
|
else
|
{
|
txtHMarker.Text = "";
|
}
|
}
|
|
private void cmdCancel_Click(object sender, EventArgs e)
|
{
|
IsOk = 2;
|
this.Close();
|
}
|
|
private void cmdOK_Click(object sender, EventArgs e)
|
{
|
IsOk = 1;
|
if (!AllowSave())
|
{
|
return;
|
}
|
Save();
|
this.Close();
|
}
|
|
private void Xs_SellOutDayReportDlg_Activated(object sender, EventArgs e)
|
{
|
}
|
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
IsOk = 0;
|
Show();
|
}
|
|
private void Show()
|
{
|
DataSet oDs = new DataSet();
|
oDs = oCn.RunProcReturn(" Select * From h_v_Sc_ProcessReportList where HMainID=" + HInterID.ToString(), "h_v_Sc_ProcessReportList");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
return;
|
txtHBillNo.Tag = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HMainID"]);
|
txtHBillNo.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["µ¥¾ÝºÅ"]);
|
txtHNumber.Tag = DBUtility.ClsPub.isLong(oDs.Tables[0].Rows[0]["HMaterID"]);
|
txtHNumber.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["ÎïÁÏ´úÂë"]);
|
txtHName.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["ÎïÁÏÃû³Æ"]);
|
txtHModel.Text = DBUtility.ClsPub.isStrNull(oDs.Tables[0].Rows[0]["¹æ¸ñÐͺÅ"]);
|
txtHQty.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["ÊýÁ¿"]).ToString();
|
txtHBadCount.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["²»Á¼ÊýÁ¿"]).ToString();
|
txtHWasterQty.Text = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["±¨·ÏÊý"]).ToString();
|
}
|
|
private bool AllowSave()
|
{
|
if (DBUtility.ClsPub.isLong(txtHBillNo.Tag) == 0)
|
{
|
MessageBox.Show("»ã±¨µ¥ÄÚÂë²»ÕýÈ·£¡");
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(txtHNumber.Tag) == 0)
|
{
|
MessageBox.Show("ÎïÁÏÄÚÂë²»ÕýÈ·£¡");
|
return false;
|
}
|
if (DBUtility.ClsPub.isDoule(txtHQty.Text) == 0)
|
{
|
MessageBox.Show("»ã±¨ÊýÁ¿²»ÄܵÈÓÚ0£¡");
|
return false;
|
}
|
if (DBUtility.ClsPub.isStrNull(txtHMarker.Text.Trim()) == "")
|
{
|
MessageBox.Show("ÇëÑ¡Ôñ¼ìÑéÔ±£¡");
|
return false;
|
}
|
return true;
|
}
|
private void Save()
|
{
|
try
|
{
|
oCn.BeginTran();
|
oCn.RunProc("UpDate Sc_ProcessReportSub set " +
|
" HQty=" + DBUtility.ClsPub.isDoule(txtHQty.Text).ToString() +
|
",HBadCount=" + DBUtility.ClsPub.isDoule(txtHBadCount.Text).ToString() +
|
",HWasterQty=" + DBUtility.ClsPub.isDoule(txtHWasterQty.Text).ToString() +
|
" where HInterID=" + DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString());
|
oCn.RunProc(" Insert into Sc_ProcessReportCheckRequest (HInterID,HMaterID,HQty,HBadCount,HWasterQty,HChecker,HMakeDate) "+
|
" values (" +
|
DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString() + "," + DBUtility.ClsPub.isLong(txtHNumber.Tag).ToString() + "," + DBUtility.ClsPub.isDoule(txtHQty.Text).ToString() +
|
"," + DBUtility.ClsPub.isDoule(txtHBadCount.Text).ToString() + "," + DBUtility.ClsPub.isDoule(txtHWasterQty.Text).ToString() + ",'" + DBUtility.ClsPub.isStrNull(txtHMarker.Text) + "',getdate()" +
|
")");
|
//
|
//ĬÈϱäΪ ÉêÇë¼ìÑé״̬
|
oCn.RunProc("exec h_p_Sc_UpDateProcessReportStatus " + DBUtility.ClsPub.isLong(txtHBillNo.Tag).ToString() + ",15");
|
//
|
MessageBox.Show("±¨¼ìÉêÇë³É¹¦£¡", "Ìáʾ");
|
oCn.Commit();
|
}
|
catch (Exception e)
|
{
|
oCn.RollBack();
|
throw (e);
|
}
|
}
|
|
|
}
|
}
|