From 4286ee5823987af404e167a7c4aeacbe7def3c36 Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 27 七月 2022 10:19:37 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API into master

---
 WarM/条码打印/Sc_ICMOToBarCode.cs |  122 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 106 insertions(+), 16 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 225d43b..258363c 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"
@@ -41,6 +41,7 @@
         public Int64 HInterID_TTM = 0;
         public string HBillNo_TTM = "";
         ClsCN SubCn = new ClsCN();
+        Pub_Class.ClsGridViewSum oSumGrid = new Pub_Class.ClsGridViewSum();
         //
         private void initGrid()
         {
@@ -216,6 +217,7 @@
         {
             //
             //frmCondition = new frmBillQueryCondition_New();
+            oSumGrid.ogrdMain = grdMain;
             this.Text = ModCaption;
             //lblCaption.Text = ModCaption;
             initGrid();
@@ -787,13 +789,49 @@
                 string WeiShu = "";         //灏炬暟
                 int LSHlen = 6;             //娴佹按鍙烽暱搴�
                 string TM = "";             //鏉$爜
+                string sPackBarCode = "";
+                //HDate = dtpHBeginDate.Value.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);
 
-                HDate = dtpHBeginDate.Value.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);
+                    HDate = dtpHBeginDate.Value.ToShortDateString();
+                    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.isInt(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.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
+                    sPackBarCode = sPackStr + TTM_LSH.ToString() + "+" ;
+                    oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+                    }
 
                 //=============鏍规嵁鐣岄潰涓婂凡缁忓垎閰嶇殑鏁版嵁杩涜鏉$爜鐢熸垚鍜屾墦鍗般��
                 //鑾峰彇鏈鐢熸垚鐨� 涓诲唴鐮� 
@@ -807,13 +845,13 @@
                 //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.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
-                string sPackBarCode = sPackStr + TTM_LSH.ToString();
-                oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
+                //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.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
+                //string sPackBarCode = sPackStr + TTM_LSH.ToString();
+                //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
 
 
                 //MessageBox.Show("11");
@@ -947,7 +985,7 @@
                 }
                 //2.寰幆缁撴潫鍚庯紝鏍规嵁 鏈鐢熸垚鐨� 涓诲唴鐮侊紝浠庡悗鍙版暟鎹簱鑾峰彇 鏉$爜鍒楄〃锛岀敓鎴� 缁勬墭鍗� 鍜� 鎵樻潯鐮侊紝 鐩存帴璋冪敤瀛樺偍杩囩▼ 
                  //鏍规嵁澶栫鐮� 鍐欏叆 缁勬墭鍗曚富琛紝缁勬墭鍗曞瓙琛紝SUM锛屽绠辩爜妗f锛孲UM妗f
-                oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + HInterID_TTM.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 涓昏〃锛屽瓙琛� 锛岀鏉$爜妗f 
+                oCn.RunProc("exec  h_p_WMS_PackUnionBill_AddNew  '" + sPackBarCode + "'," + HInterID_TTM.ToString() + ",'" + DBUtility.ClsPub.CurUserName + "','" + HDate + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 涓昏〃锛屽瓙琛� 锛岀鏉$爜妗f 
                 oCn.RunProc("exec  h_p_WMS_PackUnionBill_SumSubBill  " + HInterID_TTM.ToString() + ",'" + sPackBarCode + "','3783','" + DBUtility.ClsPub.CurUserName + "'," + HInterID.ToString()); //鏍规嵁绠辨潯鐮侊紝鍐欏叆 SUM琛紝SUM鏉$爜妗f
 
 
@@ -1053,6 +1091,7 @@
 
             bool flag = this.txtHZXQty.Text.Trim() != "";
             double num;
+            double HICMOQty = 0;
             if (flag)
             {
                 num = Pub_Class.ClsPub.isDoule(this.txtHZXQty.Text);
@@ -1070,6 +1109,17 @@
             {
                 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)
                     {
@@ -1312,9 +1362,49 @@
                 }
                 if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
                 {
-                    //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
-                    TM = HTMNumber + LSH2;
+                    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.isInt(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.isInt(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.isInt(Ds.Tables[0].Rows[0][0]);
                 }
+                //if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+                //{
+                //    //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+                //    TM = HTMNumber + LSH2;
+                //}
                 if (TM.Trim() == "")
                 {
                     MessageBox.Show("鏉″舰鐮佷笉鑳戒负绌猴紝涓嶈兘鐢熸垚鏉$爜锛�");

--
Gitblit v1.9.1