From 99933ce488d3211f6d5937926f79fd79b67702de Mon Sep 17 00:00:00 2001
From: jingh <jingh@LAPTOP-I53VDLOO>
Date: 星期二, 11 一月 2022 16:42:28 +0800
Subject: [PATCH] 条码生成模块增加组托功能,收料通知单可以选择不同供应商
---
DAL/源单/InterFace源单/Cls_S_IF_POInStockBillList.cs | 2
WarM/条码打印/Gy_BarCodeBill.cs | 227 +++++++++++++++++++++++++++++++++++++++++---------------
2 files changed, 165 insertions(+), 64 deletions(-)
diff --git "a/DAL/\346\272\220\345\215\225/InterFace\346\272\220\345\215\225/Cls_S_IF_POInStockBillList.cs" "b/DAL/\346\272\220\345\215\225/InterFace\346\272\220\345\215\225/Cls_S_IF_POInStockBillList.cs"
index da7e944..fb62b82 100644
--- "a/DAL/\346\272\220\345\215\225/InterFace\346\272\220\345\215\225/Cls_S_IF_POInStockBillList.cs"
+++ "b/DAL/\346\272\220\345\215\225/InterFace\346\272\220\345\215\225/Cls_S_IF_POInStockBillList.cs"
@@ -16,7 +16,7 @@
base.mvarItemKey = "1103";
base.sCondtion = " ";
base.sOrderSql = " order by 鍗曟嵁鍙� desc,hsubid ";
- base.sKeyCol = "渚涘簲鍟�";
+ base.sKeyCol = "HOrgID";
}
}
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 ebc3560..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 = "鏉$爜鐢熸垚";
@@ -911,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;
@@ -1008,6 +1011,7 @@
string HSeOrderBillNo = "";
string HInnerBillNo = "";
bool HGiveAwayFlag = false;
+ Int64 HEntryID = 0;
try
{
oCn.BeginTran();
@@ -1025,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);
@@ -1056,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 ("
@@ -1065,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 + "')");
@@ -1473,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";
@@ -1499,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 = "渚涘簲鍟嗕唬鐮�";
@@ -1585,6 +1591,7 @@
"," + HSeOrderBillNoCol.ToString() +
"," + HBatchNoCol.ToString() +
"," + HCusNumberCol.ToString() +
+ "," + HPackQtyCol.ToString() +
"," + HRemarkCol.ToString();
//璁剧疆鍚堣鍒�
string sTotalCol = HQtyCol.ToString();
@@ -1604,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 = "鏉$爜缂栧彿";
@@ -1662,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;
@@ -2377,6 +2385,7 @@
"," + HMinQtyCol.ToString() +
"," + HAuxPropNumberCol.ToString() +
"," + HBatchNoCol.ToString() +
+ "," + HPackQtyCol.ToString() +
"," + HRemarkCol.ToString();
grdMain.Columns[HBillNoCol].ReadOnly = true;
//璁剧疆鍚堣鍒�
@@ -3213,30 +3222,122 @@
//鐢熸垚澶栫鐮�
private void wxm_Click(object sender, EventArgs e)
{
- //蹇呴』鏉$爜鐢熸垚鎸夐挳鏄伆搴︽墠鍙互鐢熸垚绠辨潯鐮�
- if(bc.Enabled != false)
+ try
{
- MessageBox.Show("璇峰厛鐢熸垚鏉″舰鐮侊紝鍐嶇敓鎴愮鏉$爜");
- return;
- }
- //-------------------鏍规嵁HINTERID鐢熸垚绠辨潯鐮�
+ 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; //澶栫鐮� 鍓嶇紑
- //鐢熸垚鍓嶅垽鏂紝寰幆鐗╂枡缃戞牸锛屽垽鏂� 鏄惁璁剧疆浜嗗悎鐞嗙殑 澶栫鏁伴噺銆� 澶栫鏁伴噺 蹇呴』鏄� 鏈�灏忓寘瑁呮暟鐨� 鍊嶆暟 骞跺繀椤诲ぇ浜�0鍜屽ぇ浜庣瓑浜庢渶灏忓寘瑁呮暟閲忋��
-
-
-
- //浠�0琛岃繘琛屽惊鐜� 鐗╂枡缃戞牸锛岃幏鍙栧绠辨暟閲�
-
- //瀛愬惊鐜� 鏉$爜缃戞牸
-
- //鏍规嵁澶栫鏁伴噺 鎵e噺锛岀洿鍒� 澶栫鏁伴噺鎵e噺瀹岋紝鐢熸垚 澶栫鏉$爜鍜岀粍鎵樺崟
-
-
- //缁撴潫寰幆
-
- //鍒锋柊鎵撳嵃椤电锛�-S 鐨� 铏氭嫙鏉$爜涓嶆樉绀� 锛�
-
-
+ //蹇呴』鏉$爜鐢熸垚鎸夐挳鏄伆搴︽墠鍙互鐢熸垚绠辨潯鐮�
+ 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