From b8a88417bb8a6f5f3b750b7670a87fda25c45296 Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期二, 15 二月 2022 08:36:57 +0800
Subject: [PATCH] nothing
---
WarM/条码打印/Gy_BarCodeBill.cs | 288 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 218 insertions(+), 70 deletions(-)
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index 8a76fc9..c6b008e 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -43,42 +43,43 @@
public const Int16 HQtyCol = 22;
public const Int16 HMinQtyCol = 23;
public const Int16 HBQtyCol = 24;
- public const Int16 HDeptIDCol = 25;
- public const Int16 HDeptNumberCol = 26;
- public const Int16 HDeptNameCol = 27;
- public const Int16 HSourceIDCol = 28;
- public const Int16 HSourceNumberCol = 29;
- public const Int16 HSourceNameCol = 30;
- public const Int16 HDateCol = 31;
- public const Int16 HEndDateCol = 32;
- public const Int16 HSupIDCol = 33;
- public const Int16 HSupNumberCol = 34;
- public const Int16 HSupNameCol = 35;
- public const Int16 HCusIDCol = 36;
- public const Int16 HCusNumberCol = 37;
- public const Int16 HCusNameCol = 38;
- public const Int16 HCusTypeCol = 39;
- public const Int16 HSourceInterIDCol = 40;
- public const Int16 HSourceEntryIDCol = 41;
- public const Int16 HSourceBillNoCol = 42;
- public const Int16 HSourceBillTypeCol = 43;
- public const Int16 HInstructIDCol = 44;
- public const Int16 HInstructNoCol = 45;
- public const Int16 HSeOrderBillIDCol = 46;
- public const Int16 HSeOrderBillNoCol = 47;
- public const Int16 HWhIDCol = 48;
- public const Int16 HWhNumberCol = 49;
- public const Int16 HWhNameCol = 50;
- public const Int16 HSPIDCol = 51;
- public const Int16 HSPNumberCol = 52;
- public const Int16 HSPNameCol = 53;
- public const Int16 HinitQtyCol = 54;
- public const Int16 HRemarkCol = 55;
- public const Int16 HPinfanBarCodeCol = 56;
- public const Int16 HMTONoCol = 57;
- public const Int16 HShowDateCol = 58;
- public const Int16 HInnerBillNoCol = 59;
- public const Int16 HMakerCol = 60;
+ public const Int16 HPackQtyCol = 25;
+ public const Int16 HDeptIDCol = 26;
+ public const Int16 HDeptNumberCol = 27;
+ public const Int16 HDeptNameCol = 28;
+ public const Int16 HSourceIDCol = 29;
+ public const Int16 HSourceNumberCol = 30;
+ public const Int16 HSourceNameCol = 31;
+ public const Int16 HDateCol = 32;
+ public const Int16 HEndDateCol = 33;
+ public const Int16 HSupIDCol = 34;
+ public const Int16 HSupNumberCol = 35;
+ public const Int16 HSupNameCol = 36;
+ public const Int16 HCusIDCol = 37;
+ public const Int16 HCusNumberCol = 38;
+ public const Int16 HCusNameCol = 39;
+ public const Int16 HCusTypeCol = 40;
+ public const Int16 HSourceInterIDCol = 41;
+ public const Int16 HSourceEntryIDCol = 42;
+ public const Int16 HSourceBillNoCol = 43;
+ public const Int16 HSourceBillTypeCol = 44;
+ public const Int16 HInstructIDCol = 45;
+ public const Int16 HInstructNoCol = 46;
+ public const Int16 HSeOrderBillIDCol = 47;
+ public const Int16 HSeOrderBillNoCol = 48;
+ public const Int16 HWhIDCol = 49;
+ public const Int16 HWhNumberCol = 50;
+ public const Int16 HWhNameCol = 51;
+ public const Int16 HSPIDCol = 52;
+ public const Int16 HSPNumberCol = 53;
+ public const Int16 HSPNameCol = 54;
+ public const Int16 HinitQtyCol = 55;
+ public const Int16 HRemarkCol = 56;
+ public const Int16 HPinfanBarCodeCol = 57;
+ public const Int16 HMTONoCol = 58;
+ public const Int16 HShowDateCol = 59;
+ public const Int16 HInnerBillNoCol = 60;
+ public const Int16 HMakerCol = 61;
public Int16 HSelectCol = 0;
public Int16 HSno2Col = 1;
@@ -137,7 +138,8 @@
public Int16 HMTONo2Col = 54;
public Int16 HShowDate2Col = 55;
public Int16 HInnerBillNo2Col = 56;
- public Int16 HMaker2Col = 57;
+ public Int16 HMaker2Col = 57;
+ public Int16 HEntryID2Col = 58;
//
public string ModName = "85";
public string ModCaption = "鏉$爜鐢熸垚";
@@ -266,6 +268,7 @@
{
this.Sub_SaveBill();
Display();
+
}
//閲嶇疆鎸夌航
@@ -688,6 +691,7 @@
string HModelName = ""; //鏈哄瀷
string HICMOBillNo = ""; //婧愬崟鍙�
string HBarCodeBatchNo = ""; //鏉$爜鎵规鍙�
+ string HBarCodeDate = ""; //鏉$爜鏃ユ湡
int k = 0;
int n = 0; //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
string sTMNumber = ""; //鏉$爜鑷畾涔夊墠缂�
@@ -712,14 +716,15 @@
{
sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HEndDateCol].Value);
}
- else if (CompanyName=="澶忓疂鐢靛櫒")// 鏃ユ湡锛氱敓浜ц鍗� 鏉$爜鏃ユ湡
+ else if (CampanyName == "澶忓疂鐢靛櫒")// 鏃ユ湡锛氱敓浜ц鍗� 鏉$爜鏃ユ湡
{
sDate = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HDateCol].Value);
}
HYasuoji= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanCol].Value); //鍘嬬缉鏈轰唬鐮侊紙澶忓疂鐢靛櫒锛�
- HModelName= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterModelCol].Value); //鏈哄瀷锛堝瀹濈數鍣級
+ HModelName= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusTypeCol].Value); //鏈哄瀷锛堝瀹濈數鍣級
HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSourceBillNoCol].Value); //鐢熶骇璁㈠崟鍙凤紙澶忓疂鐢靛櫒锛�
HBarCodeBatchNo= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value); //鏉$爜鎵规鍙凤紙澶忓疂鐢靛櫒锛�
+ HBarCodeDate= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSupNumberCol].Value); //鏉$爜鏃ユ湡锛堝瀹濈數鍣級
//
sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
@@ -795,8 +800,8 @@
}
else if (cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯")
{
- //鐗╂枡缂栫爜+鐢熶骇鎵瑰彿+澶辨晥鏃ユ湡锛圷YMMDD锛�+娴佹按鍙�6浣�-
- sTMNumber = HMaterNumber + HBatchNo + sYear + sPeriod + sDay;
+ //鐗╂枡缂栫爜+鐢熶骇鎵瑰彿+娴佹按鍙�6浣�-
+ sTMNumber = HMaterNumber + HBatchNo ;
Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
//oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
@@ -806,20 +811,31 @@
{
//鍒堕�犳湰閮�1浣嶏紙榛樿1锛�+鏈哄瀷浠g爜5浣嶏紙锛�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛�
//+鏃�2浣�+鏉$爜鎵规鐮�2浣�+鍘嬬缉鏈轰唬鐮�1浣�+00+娴佹按鍙�4浣�+鏍¢獙鐮侊紙榛樿0锛�
- sTMNumber = "1" + HModelName + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo + HYasuoji + "00" ;
+ sTMNumber = "1" + HModelName + HBarCodeDate + HBarCodeBatchNo + HYasuoji + "00" ;
Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
//oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
- LSHlen = 4;
+ LSHlen = 5;
+ if (sTMNumber.Length != 16)
+ {
+ MessageBox.Show("鏉$爜闀垮害涓嶅16浣嶏紝鏄惁鏁版嵁涓嶅叏锛佸埗閫犳湰閮�1浣�:[0] + 鏈哄瀷浠g爜5浣�:[" + HModelName + "] + 骞存湀鏃�5浣�:["+ HBarCodeDate + "] + 鎵规鍙�2浣�:[" + HBarCodeBatchNo + "]+ 鍘嬬缉鏈�1浣�:["+ HYasuoji + "]+00 ; ");
+ return;
+ }
}
else if (cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�")
{
//鐗╂枡浠g爜11浣�+骞�2浣�+鏈�1浣嶏紙A銆丅銆丆浠f浛10鏈堜唤锛�+鏃�2浣�+鎵规2浣�+娴佹按鍙�4浣�
- sTMNumber = HMaterNumber + sYear + Sub_PeriodChange(sPeriod) + sDay + HBarCodeBatchNo ;
+ //sTMNumber = HMaterNumber.Replace(Convert.ToChar("."),Convert.ToChar("")) + HBarCodeDate + HBarCodeBatchNo;
+ sTMNumber = HMaterNumber.Replace( "." , "" ) + HBarCodeDate + HBarCodeBatchNo;
Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
//oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
- LSHlen = 4;
+ LSHlen = 5;
+ if (sTMNumber.Length != 18)
+ {
+ MessageBox.Show("鏉$爜闀垮害涓嶅18浣嶏紝鏄惁鏁版嵁涓嶅叏锛佺墿鏂欎唬鐮�11浣�:["+ HMaterNumber.Replace(".", "") + "]+骞存湀鏃�5浣�:["+ HBarCodeDate + "]+鎵规鍙�2浣�:[" + HBarCodeBatchNo + "];");
+ return;
+ }
}
else if (cmbHBarCodeType.Text == "鍗婃垚鍝佹潯鐮�")
{
@@ -828,7 +844,7 @@
Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿
//oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
- LSHlen = 4;
+ LSHlen = 5;
}
//else if (cmbHBarCodeType.Text == "鎵樼洏鏉$爜")
//{
@@ -879,6 +895,7 @@
|| cmbHBarCodeType.Text == "鍗婃垚鍝佹潯鐮�" || cmbHBarCodeType.Text == "澶栭攢鏈烘潯鐮�")
{
TM = sTMNumber + LSH2;
+
}
else if (cmbHBarCodeType.Text == "鍐呴攢鏈烘潯鐮�")
{
@@ -896,6 +913,7 @@
return;
}
grdSub.Rows[i].Cells[HTMCol].Value = TM;
+ grdSub.Rows[i].Cells[HEntryID2Col].Value = j + 1;
grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value;
grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value;
grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value;
@@ -993,6 +1011,7 @@
string HSeOrderBillNo = "";
string HInnerBillNo = "";
bool HGiveAwayFlag = false;
+ Int64 HEntryID = 0;
try
{
oCn.BeginTran();
@@ -1010,6 +1029,7 @@
}
//
HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value);
+ HEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HEntryID2Col].Value);
HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value);
HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value);
HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value);
@@ -1041,7 +1061,7 @@
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
",HCusID,HCusType,HEndDate,HWorkLineName,HBarCodeDate " +
- ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " +
+ ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
",HGiveAwayFlag " +
",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " +
") values ("
@@ -1050,7 +1070,7 @@
+ ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
+ ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
+ ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + sDate + "'"
- + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString()
+ + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HSeOrderBillNo + "'," + HInterID.ToString() + "," + HEntryID.ToString() + ""
+ ", " + DBUtility.ClsPub.BoolToString(HGiveAwayFlag)
+ ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
@@ -1100,26 +1120,26 @@
}
}
- //鏈堜唤杞寲
- private string Sub_PeriodChange(string sPeriod)
- {
- if(sPeriod=="10")
- {
- return "A";
- }
- else if (sPeriod == "11")
- {
- return "B";
- }
- else if (sPeriod == "12")
- {
- return "C";
- }
- else
- {
- return sPeriod.Substring(2, 1);
- }
- }
+ ////鏈堜唤杞寲
+ //private string Sub_PeriodChange(string sPeriod)
+ //{
+ // if(sPeriod=="10")
+ // {
+ // return "A";
+ // }
+ // else if (sPeriod == "11")
+ // {
+ // return "B";
+ // }
+ // else if (sPeriod == "12")
+ // {
+ // return "C";
+ // }
+ // else
+ // {
+ // return sPeriod.Substring(1, 1);
+ // }
+ //}
//鐢熸垚鏉$爜 鍗氭棩
@@ -1458,7 +1478,7 @@
//
grdMain.RowCount = 0;
grdSub.RowCount = 0;
- grdMain.ColumnCount = 61; //鎬诲垪鏁�
+ grdMain.ColumnCount = 62; //鎬诲垪鏁�
DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
grdMain.Columns[HMainIDCol].HeaderText = "婧愬崟涓籌D";
@@ -1484,6 +1504,7 @@
grdMain.Columns[HGiveAwayFlagCol].HeaderText = "鏄惁璧犲搧";
grdMain.Columns[HQtyCol].HeaderText = "鏁伴噺";
grdMain.Columns[HMinQtyCol].HeaderText = "鏈�灏忓寘瑁呮暟";
+ grdMain.Columns[HPackQtyCol].HeaderText = "澶栫鏁�";
grdMain.Columns[HBQtyCol].HeaderText = "绠辨暟";
grdMain.Columns[HSupIDCol].HeaderText = "渚涘簲鍟咺D";
grdMain.Columns[HSupNumberCol].HeaderText = "渚涘簲鍟嗕唬鐮�";
@@ -1570,6 +1591,7 @@
"," + HSeOrderBillNoCol.ToString() +
"," + HBatchNoCol.ToString() +
"," + HCusNumberCol.ToString() +
+ "," + HPackQtyCol.ToString() +
"," + HRemarkCol.ToString();
//璁剧疆鍚堣鍒�
string sTotalCol = HQtyCol.ToString();
@@ -1589,7 +1611,7 @@
DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol,oSumGrid);
//----------------------------
- grdSub.ColumnCount = 58; //鎬诲垪鏁�
+ grdSub.ColumnCount = 59; //鎬诲垪鏁�
DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name);
grdSub.Columns[HSelectCol].HeaderText = "閫夋嫨";
grdSub.Columns[HTMCol].HeaderText = "鏉$爜缂栧彿";
@@ -1647,6 +1669,7 @@
grdSub.Columns[HShowDate2Col].HeaderText = "鏃ユ湡";
grdSub.Columns[HInnerBillNo2Col].HeaderText = "鍐呴儴閲囪喘璁㈠崟鍙�";
grdSub.Columns[HMaker2Col].HeaderText = "鍒跺崟浜�";
+ grdSub.Columns[HEntryID2Col].HeaderText = "琛屽彿";
//鏍煎紡鍖�
grdSub.Columns[HMaterID2Col].Visible = false;
grdSub.Columns[HModel2Col].Visible = false;
@@ -2311,6 +2334,7 @@
grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["鍗曟嵁鍙�"].ToString();
+ grdMain.Rows[i].Cells[HSourceBillNoCol].Value = oTable.Rows[0]["鍗曟嵁鍙�"].ToString();
grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["鏃ユ湡"].ToString(); //鍗氭棩 鏀舵枡鍗曟嵁鏃ユ湡
grdMain.Rows[i].Cells[HShowDateCol].Value = dtpHDate.Value.ToShortDateString();
@@ -2335,6 +2359,8 @@
grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["瀹㈡埛浠g爜"].ToString();
grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["瀹㈡埛"].ToString();
grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["瀹㈡埛鍨嬪彿"].ToString();
+ grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString();
+ grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["HPinfan"].ToString();
//grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString();
//grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["鐢熶骇绾夸唬鐮�"].ToString();
grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["鐢熶骇绾�"].ToString();
@@ -2359,6 +2385,7 @@
"," + HMinQtyCol.ToString() +
"," + HAuxPropNumberCol.ToString() +
"," + HBatchNoCol.ToString() +
+ "," + HPackQtyCol.ToString() +
"," + HRemarkCol.ToString();
grdMain.Columns[HBillNoCol].ReadOnly = true;
//璁剧疆鍚堣鍒�
@@ -3191,5 +3218,126 @@
Thread.Sleep(1000);
}
}
+
+ //鐢熸垚澶栫鐮�
+ private void wxm_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Int64 iInterID = 0;
+ Int64 dPackQty = 0; //澶栫鏁伴噺
+ Int64 dPackLeftQty = 0; //澶栫鍓╀綑鏁伴噺
+ Int64 dLabelQty = 0; //灏忕鏁伴噺
+ Int64 dQty = 0; //鎬绘暟閲�
+ Int64 dEntryID = 0; //琛屽彿
+ string sPackBarCode = ""; //澶栫鐮�
+ string sBarCode = ""; //鍞竴鐮�
+ Int64 LSH = 0;
+ DataSet Ds;
+ string sYear = DateTime.Today.Year.ToString().Substring(2, 2);
+ string sPeriod = "0" + DateTime.Today.Month.ToString();
+ sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
+ string sDay = "0" + DateTime.Today.Day.ToString();
+ sDay = sDay.Substring(sDay.Length - 2, 2);
+ //
+ string sPackStr = "ZXM" + sYear + sPeriod + sDay; //澶栫鐮� 鍓嶇紑
+
+ //蹇呴』鏉$爜鐢熸垚鎸夐挳鏄伆搴︽墠鍙互鐢熸垚绠辨潯鐮�
+ if (bc.Enabled != false)
+ {
+ MessageBox.Show("璇峰厛鐢熸垚鏉″舰鐮侊紝鍐嶇敓鎴愮鏉$爜");
+ return;
+ }
+ //-------------------鏍规嵁HINTERID鐢熸垚绠辨潯鐮�
+ //鐢熸垚鍓嶅垽鏂紝寰幆鐗╂枡缃戞牸锛屽垽鏂� 鏄惁璁剧疆浜嗗悎鐞嗙殑 澶栫鏁伴噺銆� 澶栫鏁伴噺 蹇呴』鏄� 鏈�灏忓寘瑁呮暟鐨� 鍊嶆暟 骞跺繀椤诲ぇ浜�0鍜屽ぇ浜庣瓑浜庢渶灏忓寘瑁呮暟閲忋��
+ for (int i = 0; i < grdMain.Rows.Count; i++)
+ {
+ if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
+ {
+ if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value) <= 0)
+ {
+ MessageBox.Show("璇峰綍鍏ュ悎鐞嗙殑澶栫鏁伴噺锛岀" + Convert.ToString(i + 1) + "琛�");
+ return;
+ }
+ if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
+ % DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value) != 0
+ || DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value)
+ < DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMinQtyCol].Value))
+ {
+ MessageBox.Show("澶栫鏁伴噺蹇呴』鏄渶灏忓寘瑁呮暟鐨勫�嶆暟锛屼笖澶т簬绛変簬鏈�灏忓寘瑁呮暟锛岀" + Convert.ToString(i + 1) + "琛�");
+ return;
+ }
+ }
+ }
+ //oCn.BeginTran();
+ //浠�0琛岃繘琛屽惊鐜� 鐗╂枡缃戞牸锛岃幏鍙栧绠辨暟閲�
+ for (int i = 0; i < grdMain.Rows.Count; i++)
+ {
+ if (DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
+ {
+ //鑾峰彇鎬绘暟閲忋�佸绠辨暟閲�
+ dPackQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+ dQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HQtyCol].Value);
+ dEntryID = i + 1;
+ dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+ //鐢熸垚涓�涓绠辩爜
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
+ sPackBarCode = sPackStr + LSH.ToString();
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+ //瀛愬惊鐜� 鏉$爜缃戞牸
+ for (int j = 0; j < grdSub.Rows.Count; j++)
+ {
+ if (dEntryID == DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HEntryID2Col].Value))
+ {
+ if (dQty <= 0)
+ {
+ continue;
+ }
+ if (dPackLeftQty > 0) //褰撳墿浣欏绠辨暟閲忓皬浜庣瓑浜�0鏃讹紝閲嶆柊鐢熸垚澶栫鐮�
+ {
+ }
+ else
+ {
+ //鐢熸垚涓�涓绠辩爜
+ Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo"); //鑾峰彇鏈�澶ф祦姘村彿 //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+ LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]) + 1;
+ sPackBarCode = sPackStr + LSH.ToString();
+ oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+ dPackLeftQty = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[HPackQtyCol].Value);
+ }
+ sBarCode = DBUtility.ClsPub.isStrNull(grdSub.Rows[j].Cells[HTMCol].Value); // 鏉$爜
+ dLabelQty = DBUtility.ClsPub.isLong(grdSub.Rows[j].Cells[HQty2Col].Value); // 灏忕鏁伴噺
+ oCn.RunProc("update Gy_BarCodebill set HInnerBillNo= '" + sPackBarCode + "' Where HbarCode='" + sBarCode + "'");
+ dPackLeftQty = dPackLeftQty - dLabelQty;
+ dQty = dQty - dLabelQty;
+ if (dPackLeftQty <= 0)//褰撶鍓╀綑鏁伴噺灏忎簬绛変簬0鏃� 鎵ц 缁勬墭鍗�
+ {
+ //鑾峰彇缁勬墭鍗曞唴鐮�
+ iInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); ;//寰楀埌鏂板崟鍙�;
+ //鏍规嵁澶栫鐮� 鍐欏叆 缁勬墭鍗曚富琛紝缁勬墭鍗曞瓙琛紝SUM锛屽绠辩爜妗f锛孲UM妗f
+ oCn.RunProc("exec h_p_WMS_PackUnionBill_AddNew '" + sPackBarCode + "'," + iInterID.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 涓昏〃锛屽瓙琛� 锛岀鏉$爜妗f
+ oCn.RunProc("exec h_p_WMS_PackUnionBill_SumSubBill " + iInterID.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 SUM琛紝SUM鏉$爜妗f
+ }
+ }
+ else
+ {
+ continue;
+ }
+ }
+ }
+ }
+ wxm.Enabled = false;
+ //oCn.Commit();
+ MessageBox.Show("鐢熸垚绠辩爜瀹屾瘯锛�");
+ //鍒锋柊鏁版嵁
+ Display();
+ }
+ catch(Exception e1)
+ {
+ //oCn.RollBack();
+ MessageBox.Show("鐢熸垚绠辩爜澶辫触锛�" + e1.Message );
+ }
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.1