From c070720d960fd2acc02bfe8bbd5a97351a400b04 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 25 七月 2023 11:09:02 +0800
Subject: [PATCH] 异常工时申请单 及列表
---
WarM/条码打印/Sc_ICMOToBarCode.cs | 1813 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 1,677 insertions(+), 136 deletions(-)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
index 4d1622c..f90e6ff 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
@@ -28,57 +28,135 @@
public const string ModRightNameCheck = ModRightName + "_Check";
public const string ModRightNameClose = ModRightName + "_Close";
public const string ModRightNameDelete = ModRightName + "_Delete";
+ public DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
+ SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
//DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
//public Gy_ICBomBill oFrm;
public int selectRow = 0;
public int selectRow2 = 0;
public string sDlgWhere = ""; //澶栫獥浣撻�掑叆
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+ public Int64 HInterID = 0;
+ public const string ModName1 = "3783";
+ public Int64 HInterID_TTM = 0;
+ public string HBillNo_TTM = "";
+ ClsCN SubCn = new ClsCN();
+ Pub_Class.ClsGridViewSum oSumGrid = new Pub_Class.ClsGridViewSum();
//
private void initGrid()
{
- DBUtility.Xt_BaseBillFun.initGridList(grdMain,this.Name);
+ DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name);
}
//
private void Display()
{
- ClsCN SubCn = new ClsCN();
DataSet DSet;
string sSql = "";
+ string sFastSQL = "";
+ //鐢熶骇璁㈠崟鍙�
+ //if (txtHICMOBillNo.Text.Trim() != "")
+ //{
+ // sFastSQL = sFastSQL + " and HICMOBillNo like '%" + txtHICMOBillNo.Text + "%'";
+ //}
+ string HICMOBillNo = "";
+ HICMOBillNo = txtHICMOBillNo.Text.Trim().ToString();
+ //閿�鍞鍗曞彿
+ string HSeOrderBillNo = "";
+ HICMOBillNo = txtHSeOrderBillNo.Text.Trim().ToString();
+ //鐗╂枡
+ //if (txtHMaterID.Text.Trim() != "")
+ //{
+ // sFastSQL = sFastSQL + " and HMaterName like '%" + txtHMaterID.Text + "%'";
+ //}
+ string HMaterName = "";
+ HMaterName = txtHMaterID.Text.Trim().ToString(); //鐗╂枡浠g爜
+ //鏈哄彴
+ //if (txtHSourceID.Text.Trim() != "")
+ //{
+ // sFastSQL = sFastSQL + " and HSourceName like '%" + txtHSourceID.Text + "%'";
+ //}
+ string HSourceName = "";
+ HSourceName = txtHSourceID.Text.Trim().ToString();
+ //鑱屽憳
+ string HEmpName = "";
+ HEmpName = txtHEmpID.Text.Trim().ToString();
+ //鍒ゆ柇寮�濮嬫棩鏈�
+ //if (dtpHBeginDate.Checked)
+ //{
+ // sFastSQL = sFastSQL + " and 鏃ユ湡>='" + dtpHBeginDate.Value.ToShortDateString() + "'";
+ //}
+ string HBeginDate = "";
+ HBeginDate = dtpHBeginDate.Value.ToShortDateString();
+
+ //鍒ゆ柇缁撴潫鏃ユ湡
+ //if (dtpHEndDate.Checked)
+ //{
+ // sFastSQL = sFastSQL + " and 鏃ユ湡<='" + dtpHEndDate.Value.ToShortDateString() + "'";
+ //}
+ //string HEndDate = "";
+ //HEndDate = dtpHEndDate.Value.ToShortDateString();
+ //if (sFastSQL.Trim() == "")
+ //{
+ // MessageBox.Show("娌℃湁杈撳叆鏉′欢!");
+ // return;
+ //}
+
//杩囨护鏉′欢
- if (frmCondition.SqlStr.Trim().Length == 0)
- return;
- sSql = "Select * from " + ViewName + " Where 1=1 " + sDlgWhere + " order by HICMOBillNo asc";
+
//
- DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
+ DSet = SubCn.RunProcReturn("exec h_p_KSTMSC '" + HSeOrderBillNo + "' ,'" + HICMOBillNo + "' , '" + HMaterName + "' , '" + HSourceName + "' ,'" + HEmpName + "' ,'" + HBeginDate + "'", "h_p_KSTMSC", ref DBUtility.ClsPub.sExeReturnInfo);
//鐢熸垚棣栬鏍囬
if (DSet == null)
+ //if (DSet == null|| DSet.Tables[0].Rows.Count == 0)
{
MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo);
return;
}
- //
- grdMain.DataSource = DSet.Tables[0].DefaultView;
- //鏍囧噯瑁呯
- for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+ else
{
- txtHMiniQty.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("HMiniQty")].Value);
+ grdMain.DataSource = DSet.Tables[0].DefaultView;
+ //鎶婂綋鍓嶅崟鎹甀D 瀛樺埌涓�涓寜閽噷闈� 鍒锋柊鏃舵瘡娆″瓨涓�閬�
+ if (DSet.Tables[0].Rows.Count > 0)
+ {
+ txtHMaterID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells["HInterID"].Value);
+ txtHMiniQty.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鏍囧噯瑁呯"].Value);
+ //txtHMaterID.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鐗╂枡缂栫爜"].Value);
+ txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["瑙勬牸鍨嬪彿"].Value);
+ txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鐗╂枡鍚嶇О"].Value);
+ }
+ else
+ {
+
+ }
}
+ //
+
+
+ //鏍囧噯瑁呯
+ //for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+ //{
+ // txtHMiniQty.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[Fun_GetCol("HMiniQty")].Value);
+ // if (txtHMiniQty.Text.Trim() != "")
+ // {
+ // txtHMiniQty.Enabled = false;
+ // }
+ //}
//鍐荤粨
- int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
- string s = frmCondition.cmbHComplete.Text;
- DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s,FrCol);
+ //int FrCol = DBUtility.ClsPub.isLong(frmCondition.txtFrozenCol.Text);
+ //string s = frmCondition.cmbHComplete.Text;
+ //DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s,FrCol);
//鐢荤嚎
GraphLine();
-
-
+
+
//
}
//
private void timer1_Tick(object sender, EventArgs e)
{
- timer1.Enabled=false;
+ timer1.Enabled = false;
initGrid();
Display();
}
@@ -132,14 +210,54 @@
{
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
}
+
+ private Int32 Fun_GetColList(string sCol)
+ {
+ return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
+ }
//
private void Sc_ICMOToBarCode_Load(object sender, EventArgs e)
{
//
- frmCondition = new frmBillQueryCondition_New();
+ //frmCondition = new frmBillQueryCondition_New();
+ oSumGrid.ogrdMain = grdMain;
this.Text = ModCaption;
//lblCaption.Text = ModCaption;
initGrid();
+ cmbHBarCodeType.SelectedIndex = 0;
+ dtpHBeginDate.Value = DateTime.Today;
+ string HUserName = "";
+ HUserName = ClsPub.isStrNull(DBUtility.ClsPub.CurUserName);
+ Int64 HUserID = 0;
+ HUserID = ClsPub.isLong(DBUtility.ClsPub.CurUserID);
+
+ DataSet DSet;
+
+ DSet = oCn.RunProcReturn("Select HEmpID from gy_czygl Where czymc='" + HUserName + "'", "gy_czygl", ref DBUtility.ClsPub.sExeReturnInfo);
+
+ if (DSet == null)
+ //if (DSet == null|| DSet.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ else
+ {
+ //grdMain.DataSource = DSet.Tables[0].DefaultView;
+ //鎶婂綋鍓嶅崟鎹甀D 瀛樺埌涓�涓寜閽噷闈� 鍒锋柊鏃舵瘡娆″瓨涓�閬�
+ if (DSet.Tables[0].Rows.Count > 0)
+ {
+
+
+ txtHEmpID.Tag = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HEmpID"]);
+ }
+ else
+ {
+
+ }
+ }
+
+
}
private void grdMain_DblClick(object sender, EventArgs e)
@@ -149,21 +267,21 @@
private void cx_Click(object sender, EventArgs e)
{
- frmCondition = new frmBillQueryCondition_New();
- SetCondition(frmCondition, ViewName, this.Name);
- frmCondition.ShowDialog();
- if (frmCondition.Tag.ToString() == "OK")
- {
- Display();
- }
+ //frmCondition = new frmBillQueryCondition_New();
+ //SetCondition(frmCondition, ViewName, this.Name);
+ //frmCondition.ShowDialog();
+ //if (frmCondition.Tag.ToString() == "OK")
+ //{
+ // Display();
+ //}
}
- public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name)
- {
- frmCondition.Tag = "";
- frmCondition.ViewName = ViewName;
- frmCondition.ModName = Name;
- }
+ //public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name)
+ //{
+ // frmCondition.Tag = "";
+ // frmCondition.ViewName = ViewName;
+ // frmCondition.ModName = Name;
+ //}
private void xz_Click(object sender, EventArgs e)
{
@@ -179,7 +297,7 @@
//鍒犻櫎
private void Sub_DeleteBill()
{
- // //缂栬緫鏉冮檺
+ // //缂栬緫鏉冮檺
if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
{
return;
@@ -257,17 +375,17 @@
private void timer2_Tick(object sender, EventArgs e)
{
- timer2.Enabled = false;
- frmCondition = new frmBillQueryCondition_New();
- SetCondition(frmCondition, ViewName, this.Name);
- frmCondition.ShowDialog();
- if (frmCondition.Tag.ToString() == "OK")
- {
- timer1.Enabled = true;
- }
+ //timer2.Enabled = false;
+ //frmCondition = new frmBillQueryCondition_New();
+ //SetCondition(frmCondition, ViewName, this.Name);
+ //frmCondition.ShowDialog();
+ //if (frmCondition.Tag.ToString() == "OK")
+ //{
+ // timer1.Enabled = true;
+ //}
}
-
+
private void bclk_Click(object sender, EventArgs e)
{
@@ -282,11 +400,11 @@
//
private void GraphLine()
{
- int MainIDCol = Fun_GetCol("hmainid");
- int SubIDCol = Fun_GetCol("hsubid");
- string s = frmCondition.cmbHComplete.Text;
- long n=0;
- DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s,ref n);
+ //int MainIDCol = Fun_GetCol("hmainid");
+ //int SubIDCol = Fun_GetCol("hsubid");
+ //string s = frmCondition.cmbHComplete.Text;
+ //long n=0;
+ //DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s,ref n);
//鏄剧ず
//lbldj.Text = "鏌ヨ鍑� " + n.ToString() + " 寮犲崟鎹�";
//lbljl.Text = "鍏辨湁 " + grdMain.RowCount.ToString() + " 鏉¤褰�";
@@ -301,7 +419,7 @@
private void Sub_CheckBill()
{
//瀹℃牳鏉冮檺
- if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,DBUtility.ClsPub.CurUserName))
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
{
return;
}
@@ -312,7 +430,7 @@
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
if (lngBillKey == 0)
return;
- DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
+ DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
//鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
{
@@ -343,7 +461,7 @@
private void Sub_AbandonCheck()
{
//瀹℃牳鏉冮檺
- if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,DBUtility.ClsPub.CurUserName))
+ if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
{
return;
}
@@ -354,7 +472,7 @@
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
if (lngBillKey == 0)
return;
- DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
+ DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
//鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
{
@@ -416,14 +534,14 @@
private void Sub_SetReport(string sOpenTmp)
{
//鍒ゆ柇琛屾暟
- for (int i = 0; i < grdMain.Rows.Count; i++)
- {
- grdMain.Rows[i].Cells[0].Value = "";
- }
- for (int i = 0; i < grdMain.SelectedRows.Count; i++)
- {
- grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[0].Value = "*";
- }
+ //for (int i = 0; i < grdList.Rows.Count; i++)
+ //{
+ // grdList.Rows[i].Cells[0].Value = "";
+ //}
+ //for (int i = 0; i < grdList.SelectedRows.Count; i++)
+ //{
+ // grdList.Rows[grdMain.SelectedRows[i].Index].Cells[0].Value = "*";
+ //}
//
Report = new GridppReport();
Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf"); //here .
@@ -463,7 +581,7 @@
try
{
DataTable ds = new DataTable();
- BLL.Utility.FillRecordToReport_Sel(Report, grdMain, ds, Fun_GetCol("閫夋嫨"));
+ BLL.Utility.FillRecordToReport_Sel(Report, grdList, ds, Fun_GetCol("閫夋嫨"));
}
catch (Exception e)
{
@@ -635,98 +753,1521 @@
}
}
- private void zf_Click(object sender, EventArgs e)
- {
- //Sub_AbandonCheck();
- if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
- {
- return;
- }
- if (grdMain.CurrentRow == null)
- return;
- DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
- if (MessageBox.Show("纭畾瑕佷綔搴熸墍閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- {
- return;
- }
- for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
- {
- if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0)
- {
- if (!oBar.Cancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)))
- {
- MessageBox.Show("浣滃簾澶辫触锛�", "鎻愮ず");
- return;
- }
- }
- }
- MessageBox.Show("浣滃簾鎴愬姛锛�", "鎻愮ず");
- }
-
- private void fzf_Click(object sender, EventArgs e)
- {
- //this.Sub_CheckBill();
- if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
- {
- return;
- }
- if (grdMain.CurrentRow == null)
- return;
- DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
- if (MessageBox.Show("纭畾瑕佸弽浣滃簾鎵�閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
- {
- return;
- }
- for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
- {
- if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0)
- {
- if (!oBar.UnCancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)))
- {
- MessageBox.Show("鍙嶄綔搴熷け璐ワ紒", "鎻愮ず");
- return;
- }
- }
- }
- MessageBox.Show("鍙嶄綔搴熸垚鍔燂紒", "鎻愮ず");
- }
-
private void cmdHSaveBill_Click(object sender, EventArgs e)
{
- string sFastSQL = "";
- //鐢熶骇璁㈠崟鍙�
- if (txtHICMOBillNo.Text.Trim() != "")
+ Display();
+ }
+
+ string TTM = ""; //鎵樻潯鐮�
+ string HTTMNumber = "";
+ string HICMOBillNo = ""; //鐢熶骇璁㈠崟鍙�
+ int TLSH = 0;
+ string TLSH2 = "";
+ string HOrgNumber = "";
+
+
+
+ //=======鐢熸垚 鍞竴鐮� 鍜� 鎵樻潯鐮� 銆佺粍鎵樺崟
+ private void Sub_SaveBarCode()//鍒嗛厤鏃� 瑕佽�冭檻 璁㈠崟鍓╀綑鏁伴噺宸茬粡鏄� 璐熸暟鐨勬儏鍐�
+ {
+ try
{
- sFastSQL = sFastSQL + " and HICMOBillNo like '%" + txtHICMOBillNo.Text + "%'";
+ string HMaterNumber = "";
+ string HBatchNo = "";
+ string HDate = "";
+ string HYear = "";
+ string HPeriod = "";
+ string HDay = "";
+ string HTMNumber = "";
+ string HOrgNumber = "";
+ DataSet Ds;
+ Int64 LSH = 0; //娴佹按鍙�
+ string LSH2 = ""; //娴佹按鍙疯浆鎹㈡垚瀛楃
+
+
+ double HZXQty = 0; //瑁呯鏁伴噺
+ double HDDQty = 0; //璁㈠崟鏁伴噺
+ double HBQty = 0; //绠辨暟
+ int k = 0;
+ int n = 0; //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
+ string WeiShu = ""; //灏炬暟
+ int LSHlen = 6; //娴佹按鍙烽暱搴�
+ string TM = ""; //鏉$爜
+ string sPackBarCode = "";
+ string HPrdDate = "";
+ string HBC = "";
+ string HDate1 = "";
+ DataSet Ds99;
+
+ //绠卞彿
+ string HXH = "";
+ //绠卞彿娴佹按鍙�
+ Int64 LSH3 = 0; //娴佹按鍙�
+ string LSH4 = ""; //娴佹按鍙疯浆鎹㈡垚瀛楃
+ //鏈哄彴
+ string HJT = "";
+
+ HDate = DateTime.Now.ToString();
+
+ //鍒ゆ柇褰撳墠鏃堕棿鏄惁鍦ㄥ伐浣滄椂闂存鍐�
+ string _strWorkingDayAM = "07:30";//宸ヤ綔鏃堕棿涓婂崍08:30
+ string _strWorkingDayPM = "19:30";
+ string _strWorkingDayTM = "00:00";
+ string _strWorkingDaySM = "23:59";
+ TimeSpan dspWorkingDayAM = DateTime.Parse(_strWorkingDayAM).TimeOfDay;
+ TimeSpan dspWorkingDayPM = DateTime.Parse(_strWorkingDayPM).TimeOfDay;
+ TimeSpan dspWorkingDayTM = DateTime.Parse(_strWorkingDayTM).TimeOfDay;
+ TimeSpan dspWorkingDaySM = DateTime.Parse(_strWorkingDaySM).TimeOfDay;
+
+ //string time1 = "2017-2-17 8:10:00";
+ DateTime t1 = Convert.ToDateTime(HDate);
+
+ TimeSpan dspNow = t1.TimeOfDay;
+ HDate1 = Convert.ToDateTime(HDate).ToShortDateString();
+ //1.姝e父涓婄彮鏃堕棿 灏辨槸鐧界彮 濡傛灉涓嶆槸绀兼嫓澶� 灏卞線鍓嶆彁鍓嶄竴澶�
+ if (dspNow > dspWorkingDayAM && dspNow < dspWorkingDayPM)
+ {
+ HBC = "鐧界彮";
+
+ DataSet DSet2 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate1.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DSet2 == null || DSet2.Tables[0].Rows.Count == 0)
+ {
+ HPrdDate = HDate;
+ }
+ else
+ {
+ HPrdDate = DBUtility.ClsPub.isStrNull(DSet2.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
+ }
+ }
+ //2.澶т簬19锛�30 灏忎簬24锛�00 澶滅彮
+ if (dspNow > dspWorkingDayPM && dspNow < dspWorkingDaySM)
+ {
+ HBC = "澶滅彮";
+ DataSet DSet2 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate1.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DSet2 == null || DSet2.Tables[0].Rows.Count == 0)
+ {
+ HPrdDate = HDate;
+ }
+ else
+ {
+ HPrdDate = DBUtility.ClsPub.isStrNull(DSet2.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
+ }
+ }
+ //3.澶т簬00锛�00 灏忎簬7锛�30 鐧界彮 鍏堝噺涓�澶� 鍐嶅垽鏂噺浜嗕竴澶╃殑鏃ユ湡鏄笉鏄巶浼戞棩鏈�
+ if (dspNow > dspWorkingDayTM && dspNow < dspWorkingDayAM)
+ {
+ HBC = "澶滅彮";
+ HDate = DBUtility.ClsPub.isStrNull(DBUtility.ClsPub.isDate(HDate).AddDays(-1));
+ HDate = DBUtility.ClsPub.isDate(HDate).ToShortDateString();
+ DataSet DSet2 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DSet2 == null || DSet2.Tables[0].Rows.Count == 0)
+ {
+ HPrdDate = HDate;
+ }
+ else
+ {
+ HPrdDate = DBUtility.ClsPub.isStrNull(DSet2.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
+ }
+ }
+ HYear = ClsPub.isDate(HPrdDate).Year.ToString().Substring(2, 2);
+ HPeriod = "0" + ClsPub.isDate(HPrdDate).Month.ToString();
+ HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ HDay = "0" + ClsPub.isDate(HPrdDate).Day.ToString();
+ HDay = HDay.Substring(HDay.Length - 2, 2);
+ long HTMaterID = 0;
+ HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
+ string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //澶栫鐮� 鍓嶇紑
+
+
+ //鑾峰彇澶勭悊杩囩殑鏃ユ湡璺熶粖澶╁樊鍑犲ぉ 鐒跺悗鍔犲嚑涓�+鍙�
+ TimeSpan HCY = Convert.ToDateTime(HPrdDate) - Convert.ToDateTime(DateTime.Now.ToString());
+ int a = 1;
+ while (a <= HCY.Days) //褰揳 灏忎簬 宸紓澶╂暟 寰幆鍔犱笂 + 鍙�
+ {
+ HPrdDate = HPrdDate + "+";
+ a = a + 1;
+ }
+ DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ Int64 TTM_LSH = ClsPub.isLong(DsTM.Tables[0].Rows[0][0]) + 1;
+
+
+ sPackBarCode = sPackStr + TTM_LSH.ToString();
+ //DataSet DSet3 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate1.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+ //if (DSet3 == null || DSet3.Tables[0].Rows.Count == 0)
+ //{
+ // sPackBarCode = sPackStr + TTM_LSH.ToString() ;
+ //}
+ //else
+ //{
+ // sPackBarCode = sPackStr + TTM_LSH.ToString() + "+";
+ //}
+
+
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+
+
+ //DataSet DSet1 = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+
+
+ // //鐢熸垚棣栬鏍囬
+ // if (DSet1 == null || DSet1.Tables[0].Rows.Count == 0)
+ // {
+
+ // HDate = DateTime.Now.ToShortDateString();
+ // HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ // HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ // HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ // HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ // HDay = HDay.Substring(HDay.Length - 2, 2);
+ // long HTMaterID = 0;
+ // HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
+ // string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //澶栫鐮� 鍓嶇紑
+ // DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ // Int64 TTM_LSH = ClsPub.isLong(DsTM.Tables[0].Rows[0][0]) + 1;
+ // sPackBarCode = sPackStr + TTM_LSH.ToString();
+ // oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+ // }
+
+ // else
+ // {
+
+ // HDate = DBUtility.ClsPub.isStrNull(DSet1.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
+
+
+ // HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ // HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ // HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ // HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ // HDay = HDay.Substring(HDay.Length - 2, 2);
+ // long HTMaterID = 0;
+ // HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
+ // string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //澶栫鐮� 鍓嶇紑
+ // DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ // Int64 TTM_LSH = ClsPub.isLong(DsTM.Tables[0].Rows[0][0]) + 1;
+ // sPackBarCode = sPackStr + TTM_LSH.ToString() + "+" ;
+ // oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+ // }
+
+ //=============鏍规嵁鐣岄潰涓婂凡缁忓垎閰嶇殑鏁版嵁杩涜鏉$爜鐢熸垚鍜屾墦鍗般��
+ //鑾峰彇鏈鐢熸垚鐨� 涓诲唴鐮�
+ Int64 HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+ HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+ Int64 HInterID_TTM = DBUtility.ClsPub.CreateBillID_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo); //缁勬墭鍗曞唴鐮�
+ string HBillNo_TTM = DBUtility.ClsPub.CreateBillCode_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo, true);//缁勬墭鍗曞崟鍙�
+
+ //0 寮�鍚簨鍔�
+ oCn.BeginTran();
+ //00 鍏堢敓鎴� 鍞竴鐨� 鎵樻潯鐮�
+
+ //鐢熸垚涓�涓绠辩爜
+ //long HTMaterID = 0;
+ //HTMaterID = ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HMaterID")].Value);
+ //string sPackStr = "ZXM" + HYear + HPeriod + HDay + HTMaterID; //澶栫鐮� 鍓嶇紑
+ //DataSet DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ //Int64 TTM_LSH = ClsPub.isLong(DsTM.Tables[0].Rows[0][0]) + 1;
+ //string sPackBarCode = sPackStr + TTM_LSH.ToString();
+ //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+
+
+ //MessageBox.Show("11");
+ oCn.RunProc("insert into Sc_PackUnionBillMain (HYear,HPeriod,HBillType,HInterID,HDate" +
+ ",HBillNo,HBillStatus,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight" +
+ ",HPWeight,HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo " +
+ ") values ("
+ + HYear + "," + HPeriod + ",'3783'," + HInterID_TTM + ",'" + HDate + "'"
+ + ", '" + sPackBarCode.ToString() + "',1,'','" + sPackBarCode.ToString() + "',0,0,0"
+ + ",0,1,0,0,0,0,'','')");
+ //MessageBox.Show("12");
+
+ //1.寰幆缃戞牸锛屾牴鎹� 鏈鏁伴噺 鍒� 鐢熸垚 鍞竴鐮�
+
+ for (int j = 0; j < grdMain.Rows.Count; j++)
+ {
+ if (DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鏈鏁伴噺")].Value) > 0)
+ {
+ HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
+ HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+
+ HOrgNumber = ClsPub.HOrgNumber;
+
+
+ //绠卞彿鐢熸垚瑙勫垯 鏃ユ湡 + 鏈哄彴 + 鐝 + 鐗╂枡 鍙鑾峰彇鏈�澶х殑娴佹按鍙�
+ HJT = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("璁惧")].Value);
+ HXH = HYear + HPeriod + HDay + HBC + HJT + HMaterNumber;
+ Ds99 = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HXH + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH3 = ClsPub.isLong(Ds99.Tables[0].Rows[0][0]) + 1;
+ LSH4 = LSH3.ToString();
+
+
+
+ //HBQty = HBQty + ClsPub.isLong(txtHBQty.Text);
+ HZXQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鏈鏁伴噺")].Value);
+ HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鏁伴噺")].Value);
+ HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+
+ HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ n = 0;
+ LSH2 = LSH.ToString();
+ while (LSH2.Length < LSHlen) //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+ {
+ LSH2 = "0" + LSH2;
+ }
+ //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+ TM = HTMNumber + LSH2;
+ if (TM.Trim() == "")
+ {
+ MessageBox.Show("鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�");
+ return;
+ }
+ string HWei = ""; //灏炬暟
+ string HBarCode = "";
+ string HBarCodeType = "";
+ Int64 HMaterID1 = 0;
+ Int64 HAuxPropID = 0;
+ Int64 HUnitID = 0;
+ double HQty2 = 0;
+ string HBatchNo2 = "";
+ Int64 HSupID = 0;
+ Int64 HGroupID = 0;
+ int HPrintQty = 0;
+ Int64 HSourceInterID = 0;
+ Int64 HSourceEntryID = 0;
+ string HSourceBillNo = "";
+ string HSourceBillType = "";
+ Int64 HBarcodeNo = 0; //鎵樺彿
+ Int64 HBarcodeQtys = 0; //鎬绘墭鏁�
+ Int64 HDeptID = 0;
+ Int64 HWhID = 0;
+ Int64 HSPID = 0;
+ string HRemark = "";
+ string HMaterName = "";
+ string HMaterModel = "";
+ string HPinfan = "";
+ string HMTONo = "";
+ Int64 HCusID = 0;
+ string HCusType = "";
+ DateTime HEndDate;
+ string HWorkLineName = "";
+ string HSeOrderBillNo = "";
+ string HInnerBillNo = "";
+ Int64 HSourceID = 0;
+ //姣涢噸
+ Double HMZQty = 0;
+ HMZQty = HZXQty * ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鍏嬮噸")].Value)/1000;
+
+ HWei = WeiShu;
+ HBarCode = TM;
+ HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+ HMaterID1 = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HMaterID")].Value);
+ HAuxPropID = 0;
+ HUnitID = 0;
+ HQty2 = HZXQty;
+ HBatchNo2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+ HSourceInterID = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HSourceInterID")].Value);
+ HSourceEntryID = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HSourceEntryID")].Value);
+ HSourceBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+ HSourceBillType = "3710";
+ HBarcodeQtys = 0;
+ HBarcodeNo = 0;
+ HSupID = 0;
+ HDeptID = 0;
+ HWhID = 0;
+ HSPID = 0;
+ HRemark = "";
+ HMaterName = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+ HMaterModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+ HPinfan = "";
+ HMTONo = "";
+ HCusID = 0;
+ HCusType = "";
+ HEndDate = ClsPub.isDate(grdMain.Rows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
+ HWorkLineName = "";
+ HSeOrderBillNo = "";
+ HInnerBillNo = sPackBarCode;
+ HSourceID = ClsPub.isLong(txtHSourceID.Tag);
+ oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty,HMaterialMQty" +
+ ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+ ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HSourceID,HInterID " +
+ ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HPrdDate,HBC,HXH,HInnerBillNo " +
+ ") values ("
+ + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() + ", " + HMZQty.ToString()
+ + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+ + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+ + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+ + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + HDate + "'"
+ + ", " + ClsPub.HOrgID.ToString() + "," + ClsPub.HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HSourceID.ToString() + "," + HInterID.ToString()
+ + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HPrdDate + "','" + HBC + "','" + LSH4 + "','" + HInnerBillNo + "')");
+
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HTMNumber + "'");
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HXH + "'");
+ DisplayTM();
+ }
+ }
+ //2.寰幆缁撴潫鍚庯紝鏍规嵁 鏈鐢熸垚鐨� 涓诲唴鐮侊紝浠庡悗鍙版暟鎹簱鑾峰彇 鏉$爜鍒楄〃锛岀敓鎴� 缁勬墭鍗� 鍜� 鎵樻潯鐮侊紝 鐩存帴璋冪敤瀛樺偍杩囩▼
+ //鏍规嵁澶栫鐮� 鍐欏叆 缁勬墭鍗曚富琛紝缁勬墭鍗曞瓙琛紝SUM锛屽绠辩爜妗f锛孲UM妗f
+ oCn.RunProc("exec h_p_WMS_PackUnionBill_AddNew_test '" + sPackBarCode + "'," + HInterID_TTM.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 涓昏〃锛屽瓙琛� 锛岀鏉$爜妗f
+ oCn.RunProc("exec h_p_WMS_PackUnionBill_SumSubBill " + HInterID_TTM.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 SUM琛紝SUM鏉$爜妗f
+
+
+
+
+ sPackBarCode = "";
+ DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList_CS_Test Where HInterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 = '鎵樼洏鏉$爜'", "h_v_IF_BarCodeBillList_CS_Test", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ //
+ grdList.DataSource = DSet.Tables[0].DefaultView;
+ txtHZXQty.Text = "";
+ //鍐荤粨
+ int FrCol = 0;
+ string s = "鏄�";
+ DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol);
+ oCn.Commit();
+ //DisplayTM();
+ MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+
+
+
+
+
+
+
+
+ //0缁撴潫浜嬪姟
+
+ //
+ //Display();
+
+
}
- //鐗╂枡
- if (txtHMaterID.Text.Trim() != "")
+ catch (Exception e )
{
- sFastSQL = sFastSQL + " and HMaterID like '%" + txtHMaterID.Text + "%'";
+ //鍥炴粴浜嬪姟
+
+ MessageBox.Show("鐢熸垚鏉$爜澶辫触锛�" + e.Message);
+ Display();
}
- //鏈哄彴
- if (txtHSourceID.Text.Trim() != "")
+ }
+
+ private void button4_Click(object sender, EventArgs e)
+ {
+
+ ////鏍规嵁鏈鏁伴噺 鏉� 鍒嗛厤鍒� 姣忎釜鐢熶骇璁㈠崟涓婏紙鍒嗛厤鏃� 瑕佽�冭檻 璁㈠崟鍓╀綑鏁伴噺宸茬粡鏄� 璐熸暟鐨勬儏鍐碉級
+ ////濡傛灉鏈夋爣鍑嗚绠辨暟閲� 鍏堥粯璁ゅ彇鏍囧噯瑁呯鏁伴噺 娌℃湁鍐嶅彇鎵嬭緭鐨勬湰绠辨暟閲�
+ ////1.鍒ゆ柇鏈鏁伴噺 蹇呴』澶т簬0
+ //double HZXQty = 0;//鏁寸鏁伴噺
+ //if (txtHZXQty.Text.Trim() != "")
+ //{
+ // HZXQty = ClsPub.isDoule(txtHZXQty.Text);
+ //}
+ //else
+ //{
+ // HZXQty = ClsPub.isDoule(txtHMiniQty.Text);
+ //}
+ //if (HZXQty <= 0)
+ //{
+ // MessageBox.Show("璇疯緭鍏ユ暣绠辨暟閲忥紒");
+ // return;
+ //}
+ ////2.鍒锋柊缃戞牸
+ ////Display();
+ ////3.鎶婃暣绠辨暟閲� 鍒嗛厤鍒� 缃戞牸涓嬮潰鐨勬瘡涓�涓� 鐢熶骇璁㈠崟涓婂幓銆� 寰幆缃戞牸
+ //for(int i =0;i<grdMain.Rows.Count;i++)
+ //{
+ // if (HZXQty > 0)
+ // {
+ // if (HZXQty > DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value))
+ // {
+ // HZXQty = HZXQty - DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+
+ // //MessageBox.Show("璇风偣鍑昏秴棰濈敓浜ф寜閽敓鎴愭潯鐮侊紒");
+ // //return;
+ // }
+ // else if (HZXQty == 0)
+ // {
+ // return;
+ // }
+ // else
+ // {
+ // grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = HZXQty;
+ // //
+
+ // //HZXQty = HZXQty - DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // //grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // }
+ // }
+ // else
+ // {
+ // break;
+ // }
+ //}
+ //Sub_SaveBarCode();
+ ////
+
+
+
+ //bool flag = this.txtHZXQty.Text.Trim() != "";
+ //double num;
+ //double HICMOQty = 0;
+ //if (flag)
+ //{
+ // num = Pub_Class.ClsPub.isDoule(this.txtHZXQty.Text);
+ //}
+ //else
+ //{
+ // num = Pub_Class.ClsPub.isDoule(this.txtHMiniQty.Text);
+ //}
+ //bool flag2 = num <= 0.0;
+ //if (flag2)
+ //{
+ // MessageBox.Show("璇疯緭鍏ユ暣绠辨暟閲忥紒");
+ //}
+ //else
+ //{
+ // for (int i = 0; i < this.grdMain.Rows.Count; i++)
+ // {
+ // for (int i1 = 0; i1 < this.grdMain.Rows.Count; i1++)
+ // {
+
+ // HICMOQty += Pub_Class.ClsPub.isDoule(this.grdMain.Rows[i1].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // }
+ // if (HICMOQty < num)
+ // {
+ // MessageBox.Show("璇风偣鍑昏秴棰濈敓浜ф寜閽敓鎴愭潯鐮侊紒");
+ // break;
+ // }
+
+ // bool flag3 = num > 0.0;
+ // if (!flag3)
+ // {
+ // break;
+ // }
+ // bool flag4 = num > Pub_Class.ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // if (!flag4)
+ // {
+ // this.grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = num;
+ // break;
+ // }
+ // num -= Pub_Class.ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // this.grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = Pub_Class.ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ // }
+ // this.Sub_SaveBarCode();
+
+ bool flag = this.txtHZXQty.Text.Trim() != "";
+ double HICMOQty = 0.0;
+ bool flag5 = flag;
+ double num;
+ if (flag5)
{
- sFastSQL = sFastSQL + " and HSourceID like '%" + txtHSourceID.Text + "%'";
+ num = ClsPub.isDoule(this.txtHZXQty.Text);
}
- //鍒ゆ柇寮�濮嬫棩鏈�
- if (dtpHBeginDate.Checked)
+ else
{
- sFastSQL = sFastSQL + " and 鏃ユ湡>='" + dtpHBeginDate.Value.ToShortDateString() + "'";
+ num = ClsPub.isDoule(this.txtHMiniQty.Text);
}
- //鍒ゆ柇缁撴潫鏃ユ湡
- if (dtpHEndDate.Checked)
+ bool flag2 = num <= 0.0;
+ bool flag6 = flag2;
+ if (flag6)
{
- sFastSQL = sFastSQL + " and 鏃ユ湡<='" + dtpHEndDate.Value.ToShortDateString() + "'";
+ MessageBox.Show("璇疯緭鍏ユ暣绠辨暟閲忥紒");
}
- if (sFastSQL.Trim() == "")
+ else
{
- MessageBox.Show("娌℃湁杈撳叆鏉′欢!");
+ for (int i = 0; i < this.grdMain.Rows.Count; i++)
+ {
+ for (int i2 = 0; i2 < this.grdMain.Rows.Count; i2++)
+ {
+ HICMOQty += ClsPub.isDoule(this.grdMain.Rows[i2].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ }
+ bool flag7 = HICMOQty < num;
+ if (flag7)
+ {
+ MessageBox.Show("璇风偣鍑昏秴棰濈敓浜ф寜閽敓鎴愭潯鐮侊紒");
+ break;
+ }
+ bool flag3 = num > 0.0;
+ bool flag8 = !flag3;
+ if (flag8)
+ {
+ break;
+ }
+ bool flag4 = num > ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ bool flag9 = !flag4;
+ if (flag9)
+ {
+ this.grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = num;
+ break;
+ }
+ num -= ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ this.grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = ClsPub.isDoule(this.grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ }
+ this.Sub_SaveBarCode();
+ }
+ }
+
+ private void Sub_SaveBill()
+ {
+ HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+ string HMaterNumber = "";
+ string HBatchNo = "";
+ string HDate = "";
+ string HYear = "";
+ string HPeriod = "";
+ string HDay = "";
+ string HTMNumber = "";
+ string HOrgNumber = "";
+ DataSet Ds;
+ Int64 LSH = 0; //娴佹按鍙�
+ string LSH2 = ""; //娴佹按鍙疯浆鎹㈡垚瀛楃
+ double HZXQty = 0; //瑁呯鏁伴噺
+ double HDDQty = 0; //璁㈠崟鏁伴噺
+ double HBQty = 0; //绠辨暟
+ int k = 0;
+ int n = 0; //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
+ string WeiShu = ""; //灏炬暟
+ int LSHlen = 6; //娴佹按鍙烽暱搴�
+ string TM = ""; //鏉$爜
+ for (int j = 0; j < grdMain.Rows.Count; j++)
+ {
+ HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
+ HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+ HDate = DateTime.Now.ToShortDateString();
+ HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ HDay = HDay.Substring(HDay.Length - 2, 2);
+ HOrgNumber = ClsPub.HOrgNumber;
+
+
+ //HBQty = HBQty + ClsPub.isLong(txtHBQty.Text);
+ HZXQty = ClsPub.isDoule(txtHZXQty.Text);
+ HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+
+
+ if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+ {
+ HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ }
+ else if (cmbHBarCodeType.Text == "鎵规鏉$爜")
+ {
+ TM = HOrgNumber + HMaterNumber + HBatchNo;
+ }
+ n = 0;
+
+ LSH2 = LSH.ToString();
+ while (LSH2.Length < LSHlen) //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+ {
+ LSH2 = "0" + LSH2;
+ }
+ if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+ {
+ //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+ TM = HTMNumber + LSH2;
+ }
+ if (TM.Trim() == "")
+ {
+ MessageBox.Show("鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�");
+ return;
+ }
+ string HWei = ""; //灏炬暟
+ string HBarCode = "";
+ string HBarCodeType = "";
+ Int64 HMaterID1 = 0;
+ Int64 HAuxPropID = 0;
+ Int64 HUnitID = 0;
+ double HQty2 = 0;
+ string HBatchNo2 = "";
+ Int64 HSupID = 0;
+ Int64 HGroupID = 0;
+ int HPrintQty = 0;
+ Int64 HSourceInterID = 0;
+ Int64 HSourceEntryID = 0;
+ string HSourceBillNo = "";
+ string HSourceBillType = "";
+ Int64 HBarcodeNo = 0; //鎵樺彿
+ Int64 HBarcodeQtys = 0; //鎬绘墭鏁�
+ Int64 HDeptID = 0;
+ Int64 HWhID = 0;
+ Int64 HSPID = 0;
+ string HRemark = "";
+ string HMaterName = "";
+ string HMaterModel = "";
+ string HPinfan = "";
+ string HMTONo = "";
+ Int64 HCusID = 0;
+ string HCusType = "";
+ DateTime HEndDate;
+ string HWorkLineName = "";
+ string HSeOrderBillNo = "";
+ string HInnerBillNo = "";
+ try
+ {
+ oCn.BeginTran();
+ HWei = WeiShu;
+ HBarCode = TM;
+ HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+ HMaterID1 = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HMaterID")].Value);
+ HAuxPropID = 0;
+ HUnitID = 0;
+ HQty2 = HZXQty;
+ HBatchNo2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+ HSourceInterID = 0;
+ HSourceEntryID = 0;
+ HSourceBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+ HSourceBillType = "3710";
+ HBarcodeQtys = 0;
+ HBarcodeNo = 0;
+ HSupID = 0;
+ HDeptID = 0;
+ HWhID = 0;
+ HSPID = 0;
+ HRemark = "";
+ HMaterName = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+ HMaterModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+ HPinfan = "";
+ HMTONo = "";
+ HCusID = 0;
+ HCusType = "";
+ HEndDate = ClsPub.isDate(grdMain.Rows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
+ HWorkLineName = "";
+ HSeOrderBillNo = "";
+ HInnerBillNo = "";
+ oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+ ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+ ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+ ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+ ") values ("
+ + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
+ + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+ + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+ + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+ + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + HDate + "'"
+ + ", " + ClsPub.HOrgID.ToString() + "," + ClsPub.HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
+ + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
+ oCn.Commit();
+ MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+ //grdSub.RowCount = 0;
+ DisplayTM();
+ }
+
+ catch (Exception e1)
+ {
+ oCn.RollBack();
+ MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e1.Message);
+ }
+ }
+ }
+
+
+
+ private void Sub_SaveBill_TTM()
+ {
+ HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+ HInterID_TTM = DBUtility.ClsPub.CreateBillID_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo);
+ HBillNo_TTM = DBUtility.ClsPub.CreateBillCode_Prod(ModName1, ref DBUtility.ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
+ string HMaterNumber = "";
+ string HBatchNo = "";
+ string HDate = "";
+ string HYear = "";
+ string HPeriod = "";
+ string HDay = "";
+ string HTMNumber = "";
+ string HOrgNumber = "";
+ DataSet Ds;
+ Int64 LSH = 0; //娴佹按鍙�
+ string LSH2 = ""; //娴佹按鍙疯浆鎹㈡垚瀛楃
+ double HZXQty = 0; //瑁呯鏁伴噺
+ double HDDQty = 0; //璁㈠崟鏁伴噺
+ double HBQty = 0; //绠辨暟
+ int k = 0;
+ int n = 0; //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
+ string WeiShu = ""; //灏炬暟
+ int LSHlen = 6; //娴佹按鍙烽暱搴�
+ string TM = ""; //鏉$爜
+ for (int j = 0; j < grdMain.Rows.Count; j++)
+ {
+ HMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
+ HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+ HDate = DateTime.Now.ToShortDateString();
+ HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ HDay = HDay.Substring(HDay.Length - 2, 2);
+ HOrgNumber = ClsPub.HOrgNumber;
+
+
+ //HBQty = HBQty + ClsPub.isLong(txtHBQty.Text);
+ HZXQty = ClsPub.isDoule(txtHZXQty.Text);
+ HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+ HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+
+ if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+ {
+ HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ }
+ else if (cmbHBarCodeType.Text == "鎵规鏉$爜")
+ {
+ TM = HOrgNumber + HMaterNumber + HBatchNo;
+ }
+
+
+ n = 0;
+
+ LSH2 = LSH.ToString();
+ while (LSH2.Length < LSHlen) //濡傛灉娴佹按鍙峰皬浜�6浣嶆暟鍓嶉潰琛�0
+ {
+ LSH2 = "0" + LSH2;
+ }
+ if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+ {
+ HDate = DateTime.Now.ToShortDateString();
+ DataSet DSet = oCn.RunProcReturn("select * from Gy_FactoryDayOff Where HFactoryDayOffDate='" + HDate.ToString() + "'", "Gy_FactoryDayOff", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null || DSet.Tables[0].Rows.Count == 0)
+ {
+ HDate = DateTime.Now.ToShortDateString();
+ HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ HDay = HDay.Substring(HDay.Length - 2, 2);
+ HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ TM = HTMNumber + LSH2;
+ }
+ else
+ {
+ HDate = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HNoFactoryDayOffDate"]);
+ HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ HDay = HDay.Substring(HDay.Length - 2, 2);
+ HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ TM = HTMNumber + LSH2 + "+";
+ }
+ //HYear = ClsPub.isDate(HDate).Year.ToString().Substring(2, 2);
+ //HPeriod = "0" + ClsPub.isDate(HDate).Month.ToString();
+ //HPeriod = HPeriod.Substring(HPeriod.Length - 2, 2);
+ //HDay = "0" + ClsPub.isDate(HDate).Day.ToString();
+ //HDay = HDay.Substring(HDay.Length - 2, 2);
+ //HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
+ //Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + HTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
+ //LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+ }
+ //if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+ //{
+ // //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+ // TM = HTMNumber + LSH2;
+ //}
+ if (TM.Trim() == "")
+ {
+ MessageBox.Show("鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�");
+ return;
+ }
+ string HWei = ""; //灏炬暟
+ string HBarCode = "";
+ string HBarCodeType = "";
+ Int64 HMaterID1 = 0;
+ Int64 HAuxPropID = 0;
+ Int64 HUnitID = 0;
+ double HQty2 = 0;
+ string HBatchNo2 = "";
+ Int64 HSupID = 0;
+ Int64 HGroupID = 0;
+ int HPrintQty = 0;
+ Int64 HSourceInterID = 0;
+ Int64 HSourceEntryID = 0;
+ string HSourceBillNo = "";
+ string HSourceBillType = "";
+ Int64 HBarcodeNo = 0; //鎵樺彿
+ Int64 HBarcodeQtys = 0; //鎬绘墭鏁�
+ Int64 HDeptID = 0;
+ Int64 HWhID = 0;
+ Int64 HSPID = 0;
+ string HRemark = "";
+ string HMaterName = "";
+ string HMaterModel = "";
+ string HPinfan = "";
+ string HMTONo = "";
+ Int64 HCusID = 0;
+ string HCusType = "";
+ DateTime HEndDate;
+ string HWorkLineName = "";
+ string HSeOrderBillNo = "";
+ string HInnerBillNo = "";
+ try
+ {
+ oCn.BeginTran();
+ HWei = WeiShu;
+ HBarCode = TM;
+ HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
+ HMaterID1 = ClsPub.isLong(grdMain.Rows[j].Cells[Fun_GetCol("HMaterID")].Value);
+ HAuxPropID = 0;
+ HUnitID = 0;
+ HQty2 = HZXQty;
+ HBatchNo2 = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鎵规")].Value);
+ HSourceInterID = 0;
+ HSourceEntryID = 0;
+ HSourceBillNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
+ HSourceBillType = "3710";
+ HBarcodeQtys = 0;
+ HBarcodeNo = 0;
+ HSupID = 0;
+ HDeptID = 0;
+ HWhID = 0;
+ HSPID = 0;
+ HRemark = "";
+ HMaterName = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+ HMaterModel = ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+ HPinfan = "";
+ HMTONo = "";
+ HCusID = 0;
+ HCusType = "";
+ HEndDate = ClsPub.isDate(grdMain.Rows[j].Cells[Fun_GetCol("鏃ユ湡")].Value);
+ HWorkLineName = "";
+ HSeOrderBillNo = "";
+ HInnerBillNo = "";
+ oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+ ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
+ ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
+ ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
+ ",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
+ ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+ ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
+ ") values ("
+ + "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
+ + ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
+ + ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+ + ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+ + ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + HDate + "'"
+ + ", " + ClsPub.HOrgID.ToString() + "," + ClsPub.HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
+ + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
+ oCn.RunProc("insert into Sc_PackUnionBillSub (HInterID,HEntryID,HSourceInterID,HSourceEntryID,HSourceBillNo" +
+ ",HSourceBillType,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID" +
+ ",HWorkerID,HScanDate,HBarCode,HBarCode_Pack,HStatus,HICMOEntryID " +
+ ") values ("
+ + HInterID_TTM + "," + j + ",0,0,''"
+ + ",'3710'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() + ",0,0,0"
+ + ", 0,getdate(),'" + HBarCode + "','" + TTM + "',0,0)");
+
+ DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HInterID=" + HInterID.ToString() + " and HBarCode like '%ZXM&' order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ //
+ grdList.DataSource = DSet.Tables[0].DefaultView;
+
+ oCn.Commit();
+ MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
+ //grdSub.RowCount = 0;
+ //DisplayTM();
+
+ }
+ catch (Exception e1)
+ {
+ oCn.RollBack();
+ MessageBox.Show("鏉$爜鐢熸垚澶辫触锛�" + e1.Message);
+ }
+ }
+ }
+
+
+
+ private void DisplayTM()
+ {
+ //HInterID = DBUtility.ClsPub.isLong(txtHMaterID.Tag);
+ DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList_test Where HinterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 = '鎵樼洏鏉$爜' order by HItemID", "h_v_IF_BarCodeBillList_test", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
return;
}
- sDlgWhere = sFastSQL;
- Display();
- sDlgWhere = "";
+ //
+ grdList.DataSource = DSet.Tables[0].DefaultView;
+ //鍐荤粨
+ int FrCol = 0;
+ string s = "鏄�";
+ DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol);
+ //鐢荤嚎
+ //GraphLine();
+ //
+ }
+
+ //private void button5_Click(object sender, EventArgs e)
+ //{
+ // //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+ // for (int j = 0; j < grdMain.SelectedRows.Count; j++)
+ // {
+ // if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("HBarCode")].Value) == "")
+ // {
+ // MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
+ // return;
+ // }
+
+ // //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+ // if (ReportPrintBegin())
+ // {
+ // return;
+ // }
+
+ // //閫夋嫨鎵撳嵃妯℃澘
+ // BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+ // oFrm.sBillName = ModName;
+ // oFrm.sBillModel = ModCaption;
+ // oFrm.ShowDialog();
+ // if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+ // {
+ // Sub_SetReport(oFrm.sOpenTmp);
+ // Report.PrintPreview(false);
+ // Thread.Sleep(1000);
+ // }
+ // }
+ //}
+
+
+ //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+ //private bool ReportPrintBegin()
+ //{
+ // string sRelQty = "";
+
+ // if (oBar.Set_BPrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[j].Cells[Fun_GetCol("HBarCode")].Value), ref sRelQty))
+ // {
+ // MessageBox.Show("鏉$爜宸茬粡鎵撳嵃杩囷紝涓嶅彲閲嶅鎵撳嵃锛�");
+ // return true;
+ // }
+ // else
+ // {
+ // return false;
+ // }
+ //}
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
+ //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+ string sBarCode = "";
+ string sRelQty = "";
+ for (int i = 0; i < grdSub.SelectedRows.Count; i++)
+ {
+ sBarCode = sBarCode + "," + DBUtility.ClsPub.isStrNull(grdSub.Rows[grdSub.SelectedRows[i].Index].Cells[Fun_GetCol("HBarcode")].Value);
+ }
+ //if (oBar.Set_BPrintQty(sBarCode.Substring(1), ref sRelQty))
+ //{
+ // MessageBox.Show(sRelQty);
+ // return;
+ //}
+
+ //閫夋嫨鎵撳嵃妯℃澘
+ BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+ //DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
+ oFrm.sBillName = ModName;
+ oFrm.sBillModel = ModCaption;
+ oFrm.ShowDialog();
+ if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+ {
+ Sub_SetReport(oFrm.sOpenTmp);
+ Report.Print(false);
+ //oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.Rows[CurRows].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
+ Thread.Sleep(1000);
+ }
+
+ //鎵归噺鏇存柊鏉$爜鎵撳嵃娆℃暟
+ oBar.Set_EPrintQty(sBarCode.Substring(1));
+ }
+
+ private void cmdHSaveBill1_Click(object sender, EventArgs e)
+ {
+ Display1();
+ }
+
+ private void Display1()
+ {
+ ClsCN SubCn = new ClsCN();
+ DataSet DSet;
+ string sSql = "";
+ string sFastSQL = "";
+ //鐢熶骇璁㈠崟鍙�
+ //if (txtHICMOBillNo.Text.Trim() != "")
+ //{
+ // sFastSQL = sFastSQL + " and HICMOBillNo like '%" + txtHICMOBillNo.Text + "%'";
+ //}
+ string HICMOBillNo = "";
+ HICMOBillNo = txtHICMOBillNo1.Text.Trim().ToString();
+ //鐗╂枡
+ //if (txtHMaterID.Text.Trim() != "")
+ //{
+ // sFastSQL = sFastSQL + " and HMaterName like '%" + txtHMaterID.Text + "%'";
+ //}
+ string HMaterName = "";
+ HMaterName = txtHMaterID1.Text.Trim().ToString();
+ //鍒ゆ柇寮�濮嬫棩鏈�
+ //if (dtpHBeginDate.Checked)
+ //{
+ // sFastSQL = sFastSQL + " and 鏃ユ湡>='" + dtpHBeginDate.Value.ToShortDateString() + "'";
+ //}
+ string HBeginDate = "";
+ HBeginDate = dtpHBeginDate1.Value.ToShortDateString();
+
+ //鍒ゆ柇缁撴潫鏃ユ湡
+ //if (dtpHEndDate.Checked)
+ //{
+ // sFastSQL = sFastSQL + " and 鏃ユ湡<='" + dtpHEndDate.Value.ToShortDateString() + "'";
+ //}
+ string HEndDate = "";
+ HEndDate = dtpHEndDate1.Value.ToShortDateString();
+ //if (sFastSQL.Trim() == "")
+ //{
+ // MessageBox.Show("娌℃湁杈撳叆鏉′欢!");
+ // return;
+ //}
+
+ //杩囨护鏉′欢
+
+ //
+ DSet = SubCn.RunProcReturn("exec h_p_KSTMCX '" + HICMOBillNo + "' , '" + HMaterName + "' ,'" + HBeginDate + "', '" + HEndDate + "'", "h_p_KSTMCX", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ //
+ grdSub.DataSource = DSet.Tables[0].DefaultView;
+ //鍐荤粨
+ //int FrCol = DBUtility.ClsPub.isLong(frmCondition.txtFrozenCol.Text);
+ //string s = frmCondition.cmbHComplete.Text;
+ //DBUtility.Xt_BaseBillFun.DisplayGrid(grdSub, this.Name, s, FrCol);
+ //鐢荤嚎
+ GraphLine();
+
+
+ //
+ }
+
+ private void cmdHSourceID_Click(object sender, EventArgs e)
+ {
+ Int64 HEmpID = 0;
+ HEmpID = Convert.ToInt64(txtHEmpID.Tag);
+
+
+ //MessageBox.Show(ClsPub.isStrNull(HEmpID));
+ //string HEmpName = "";
+ //HEmpName = ClsPub.isStrNull(txtHEmpID.Text);
+
+ DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();
+ if (HEmpID != 0)
+ {
+ if (oSource.GetInfoByID_AoBang(HEmpID))
+ {
+ this.txtHSourceID.Text = oSource.oModel.HName;
+ this.txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
+ //
+ Display();
+ }
+ else
+ {
+ this.txtHSourceID.Text = "";
+ }
+ }
+ else
+ {
+
+ if (oSource.RefreshView())
+ {
+ this.txtHSourceID.Text = oSource.oModel.HName;
+ this.txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
+ //
+ Display();
+ }
+ else
+ {
+ this.txtHSourceID.Text = "";
+ }
+ }
+ //if (oSource.RefreshView())
+ //{
+ // this.txtHSourceID.Text = oSource.oModel.HName;
+ // this.txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
+ // //
+ // Display();
+ //}
+
+ //DAL.ClsGy_WorkCenter_View oWork = new DAL.ClsGy_WorkCenter_View();
+ //if (oWork.RefreshView())
+ //{
+ // this.txtHSourceID.Text = oWork.oModel.HName;
+ // this.txtHSourceID.Tag = oWork.oModel.HItemID.ToString();
+ // //
+ // Display();
+ // //
+ //}
+ //else
+ //{
+ // this.txtHSourceID.Text = "";
+ //}
+ }
+
+ private void cmdHEmpID_Click(object sender, EventArgs e)
+ {
+ DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View();
+ if (oEmp.RefreshView())
+ {
+ this.txtHEmpID.Text = oEmp.oModel.HName;
+ this.txtHEmpID.Tag = oEmp.oModel.HItemID.ToString();
+ }
+ else
+ {
+ this.txtHEmpID.Text = "";
+ }
+ }
+
+ private void cmdHMaterID_Click(object sender, EventArgs e)
+ {
+ DAL.ClsGy_Material_View oMater = new DAL.ClsGy_Material_View();
+ if (oMater.RefreshView())
+ {
+ this.txtHMaterID.Text = oMater.oModel.HName;
+ this.txtHMaterID.Tag = oMater.oModel.HItemID.ToString();
+ }
+ else
+ {
+ this.txtHMaterID.Text = "";
+ }
+ }
+
+ private void cmdHMaterID1_Click(object sender, EventArgs e)
+ {
+ DAL.ClsGy_Material_View oMater = new DAL.ClsGy_Material_View();
+ if (oMater.RefreshView())
+ {
+ this.txtHMaterID1.Text = oMater.oModel.HName;
+ this.txtHMaterID1.Tag = oMater.oModel.HItemID.ToString();
+ }
+ else
+ {
+ this.txtHMaterID1.Text = "";
+ }
+ }
+
+ private void txtHMiniQty_TextChanged(object sender, EventArgs e)
+ {
+ //double HMiniQty = 0;
+ //double HBQty = 0;
+ //HMiniQty = DBUtility.ClsPub.isDoule(txtHMiniQty.Text.Trim());
+ //HBQty =
+
+
+ }
+
+ private void txtHBQty_TextChanged(object sender, EventArgs e)
+ {
+ double HICMOQty = 0;
+ double HMiniQty = 0;
+ double HBQty = 0;
+
+
+
+
+ for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+ {
+ txtHZXQty.Text = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+ }
+ HICMOQty = DBUtility.ClsPub.isDoule(txtHZXQty.Text.Trim());
+ HMiniQty = DBUtility.ClsPub.isDoule(txtHMiniQty.Text.Trim());
+ if (HMiniQty == 0)
+ {
+ HBQty = 0;
+ }
+ else
+ {
+ HBQty = HICMOQty / HMiniQty;
+ }
+ HBQty = Math.Ceiling(HBQty);
+ txtHBQty.Text = DBUtility.ClsPub.isStrNull(HBQty);
+ }
+
+ private void button5_Click(object sender, EventArgs e)
+ {
+ //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+ for (int i = 0; i < grdList.SelectedRows.Count; i++)
+ {
+ if (DBUtility.ClsPub.isStrNull(grdList.SelectedRows[i].Cells[Fun_GetColList("鏉$爜缂栧彿")].Value) == "")
+ {
+ MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
+ return;
+ }
+ }
+
+ //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+ if (ReportPrintBegin())
+ {
+ return;
+ }
+
+ //閫夋嫨鎵撳嵃妯℃澘
+ BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+ oFrm.sBillName = ModName;
+ oFrm.sBillModel = ModCaption;
+ oFrm.ShowDialog();
+ if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+ {
+ Sub_SetReport(oFrm.sOpenTmp);
+ Report.PrintPreview(false);
+ Thread.Sleep(1000);
+ }
+ }
+
+ private bool ReportPrintBegin()
+ {
+ string sRelQty = "";
+
+ if (oBar.Set_BPrintQty(DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetColList("鏉$爜缂栧彿")].Value), ref sRelQty))
+ {
+ MessageBox.Show("鏉$爜宸茬粡鎵撳嵃杩囷紝涓嶅彲閲嶅鎵撳嵃锛�");
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ private void button6_Click(object sender, EventArgs e)
+ {
+ //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+ if (DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetColList("鏉$爜缂栧彿")].Value) == "")
+ {
+ MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
+ return;
+ }
+
+ //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+ if (ReportPrintBegin())
+ {
+ return;
+ }
+
+ //閫夋嫨鎵撳嵃妯℃澘
+ BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+ oFrm.sBillName = ModName;
+ oFrm.sBillModel = ModCaption;
+ oFrm.ShowDialog();
+ if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+ {
+ Sub_SetReport(oFrm.sOpenTmp);
+ Report.PrintPreview(false);
+ Thread.Sleep(1000);
+ }
+ }
+
+ private void cz_Click(object sender, EventArgs e)
+ {
+ txtHBQty.Text = "";
+ txtHEmpID.Text = "";
+ txtHICMOBillNo.Text = "";
+ txtHICMOBillNo1.Text = "";
+ txtHZXQty.Text = "";
+ txtHMaterID.Text = "";
+ txtHMaterID1.Text = "";
+ txtHMiniQty.Text = "";
+ txtHSourceID.Text = "";
+ cmbHBarCodeType.Items.Clear();
+ grdList.DataSource = null;
+ grdSub.DataSource = null;
+ grdMain.DataSource = null;
+ txtHEmpID.Tag = 0;
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ //鑾峰彇缃戞牸绗竴琛孒InterID鐨勫��
+ Int64 HInterID = 0;
+ HInterID = DBUtility.ClsPub.isLong(txtHMaterID.Tag);
+ DataSet DSBefore;
+ DSBefore = SubCn.RunProcReturn("exec h_p_PreviousMater "+ HInterID, "h_p_PreviousMater", ref DBUtility.ClsPub.sExeReturnInfo);
+ grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+ //if (DSBefore.Tables[0].Rows.Count > 0)
+ //{
+ // txtHMaterID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells["HInterID"].Value);
+ //}
+ //else
+ //{
+
+ //}
+ if (DSBefore == null || DSBefore.Tables[0].Rows.Count == 0)
+ //if (DSet == null|| DSet.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("娌℃湁涓婁竴涓墿鏂�,濡傛灉闇�瑕佽鎵炬満淇紒" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ else
+ {
+ grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+ txtHMaterID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells["HInterID"].Value);
+ txtHMiniQty.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鏍囧噯瑁呯"].Value);
+ txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["瑙勬牸鍨嬪彿"].Value);
+ txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鐗╂枡鍚嶇О"].Value);
+ }
+
+
+
+ }
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ //鏍规嵁
+ Int64 HInterID = 0;
+ //HInterID = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+ HInterID = DBUtility.ClsPub.isLong(txtHMaterID.Tag);
+ DataSet DSBefore;
+ DSBefore = SubCn.RunProcReturn("exec h_p_NextMater " + HInterID, "h_p_NextMater", ref DBUtility.ClsPub.sExeReturnInfo);
+ if (DSBefore == null || DSBefore.Tables[0].Rows.Count == 0)
+ //if (DSet == null|| DSet.Tables[0].Rows.Count == 0)
+ {
+ MessageBox.Show("娌℃湁涓嬩竴涓墿鏂�,濡傛灉闇�瑕佽鎵炬満淇紒" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ else
+ {
+ grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+ txtHMaterID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells["HInterID"].Value);
+ txtHMiniQty.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鏍囧噯瑁呯"].Value);
+ txtHMaterModel.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["瑙勬牸鍨嬪彿"].Value);
+ txtHMaterName.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["鐗╂枡鍚嶇О"].Value);
+ }
+ //txtHMaterID.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["HInterID"].Value);
+ }
+
+ //瓒呴鎵撳嵃
+ private void button7_Click(object sender, EventArgs e)
+ {
+ //鏍规嵁鏈鏁伴噺 鏉� 鍒嗛厤鍒� 姣忎釜鐢熶骇璁㈠崟涓婏紝骞朵笖鍏佽瓒呰繃璁㈠崟鏁伴噺 锛堝垎閰嶆椂 瑕佽�冭檻 璁㈠崟鍓╀綑鏁伴噺宸茬粡鏄� 璐熸暟鐨勬儏鍐碉級
+ //1.鍒ゆ柇鏈鏁伴噺 蹇呴』澶т簬0
+ double HZXQty = 0;//鏁寸鏁伴噺
+ HZXQty = ClsPub.isDoule(txtHZXQty.Text);
+ if (HZXQty <= 0)
+ {
+ MessageBox.Show("璇疯緭鍏ユ暣绠辨暟閲忥紒");
+ return;
+ }
+ //2.鍒锋柊缃戞牸
+ //Display();
+ //3.寰幆缃戞牸锛岀疮璁″叏閮ㄥ墿浣欐暟閲忥紝鍒ゆ柇鏄惁 鍓╀綑鏁伴噺 灏忎簬 鏈鏁伴噺锛涘鏋� 澶т簬鍒欐姤閿� 閫�鍑恒��
+ double sumLeftQty = 0;
+ for (int i = 0; i < grdMain.Rows.Count; i++)
+ {
+ if ( DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value)>0)
+ {
+ sumLeftQty = sumLeftQty + DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ }
+ else
+ {
+ }
+ }
+ if(sumLeftQty>= HZXQty )
+ {
+ MessageBox.Show("鍓╀綑鏁伴噺澶т簬鏈鏁伴噺锛屼笉鑳借秴棰濇墦鍗帮紝璇风敤鏅�氭墦鍗板姛鑳姐��");
+ return;
+ }
+ //4.鎶婃暣绠辨暟閲� 鍒嗛厤鍒� 缃戞牸涓嬮潰鐨勬瘡涓�涓� 鐢熶骇璁㈠崟涓婂幓銆� 寰幆缃戞牸
+ for (int i = 0; i < grdMain.Rows.Count; i++)
+ {
+ if (HZXQty > DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value))
+ {
+ if (i == grdMain.Rows.Count - 1)
+ {
+ grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = HZXQty;
+ }
+ else
+ {
+ HZXQty = HZXQty - DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells["鐢熶骇璁㈠崟鏁伴噺"].Value);
+ }
+ }
+ else
+ {
+ //grdMain.Rows[i].Cells["鏈鏁伴噺"].Value = HZXQty;
+ break;
+ }
+ }
+ Sub_SaveBarCode();
+ //
+ }
+
+ private void cmdESOP_Click(object sender, EventArgs e)
+ {
+ Sc_MESNowWorkBill_Fast oSc_MESNowWorkBill_Fast = new Sc_MESNowWorkBill_Fast();
+ oSc_MESNowWorkBill_Fast.txtHICMOBillNo.Text = "";
+ oSc_MESNowWorkBill_Fast.txtHMaterID.Text =txtHMaterID.Text;
+ oSc_MESNowWorkBill_Fast.txtHName.Text = ClsPub.isStrNull(grdMain.Rows[0].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
+ oSc_MESNowWorkBill_Fast.txtHModel.Text = ClsPub.isStrNull(grdMain.Rows[0].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
+ oSc_MESNowWorkBill_Fast.Show();
+
+ }
+
+ private void txtHBarCode_KeyDown(object sender, KeyEventArgs e)
+ {
+ if(e.KeyCode==Keys.Enter)
+ {
+ //
+ //鑾峰彇绗竴琛屾潯褰㈢爜杩涜鎵撳嵃
+ DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList_CS Where 鏉$爜缂栧彿='"+ txtHBarCode.Text +"' and 鏉$爜绫诲瀷 = '鎵樼洏鏉$爜'", "h_v_IF_BarCodeBillList_CS", ref DBUtility.ClsPub.sExeReturnInfo);
+ //鐢熸垚棣栬鏍囬
+ if (DSet == null)
+ {
+ MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+ return;
+ }
+ //
+ grdList.DataSource = DSet.Tables[0].DefaultView;
+ //鍐荤粨
+ int FrCol = 0;
+ string s = "鏄�";
+ DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol);
+ //
+ //鍒ゆ柇鏄惁宸茬粡鐢熸垚鏉$爜
+ if (DBUtility.ClsPub.isStrNull(grdList.Rows[0].Cells[Fun_GetColList("鏉$爜缂栧彿")].Value) == "")
+ {
+ MessageBox.Show("鏉$爜鏈敓鎴愶紝璇峰厛鐢熸垚鏉$爜鍚庡啀棰勮锛�");
+ return;
+ }
+ //閫夋嫨鎵撳嵃妯℃澘
+ Sub_SetReport("娉ㄥ鐗╂枡鏍囩");
+ Report.Print(false);
+ Thread.Sleep(1000);
+ }
+ }
+
+ private void label14_Click(object sender, EventArgs e)
+ {
+
}
}
}
\ No newline at end of file
--
Gitblit v1.9.1