From 7f8ed8cdc49b33178f34c91edf862f831cd30c9c Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 08 二月 2023 09:18:04 +0800
Subject: [PATCH] 供应商物料;根据登录用户获取默认值

---
 WarM/条码打印/Gy_BarCodeBill.cs |  124 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 103 insertions(+), 21 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 6a2c94e..92c9009 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"
@@ -211,6 +211,8 @@
             cmbSourceBillType.Items.Add("閲囪喘璁㈠崟");
             cmbSourceBillType.Items.Add("鏀舵枡閫氱煡鍗�");
             cmbSourceBillType.Items.Add("濮斿璁㈠崟");
+            cmbSourceBillType.Items.Add("宸ュ簭姹囨姤鍗�");
+            cmbSourceBillType.Items.Add("宸ュ簭娴佽浆鍗�");
             cmbSourceBillType.Items.Add("閫�璐ч�氱煡鍗�");
             cmbSourceBillType.Items.Add("鍏朵粬鍏ュ簱鍗�");
             cmbSourceBillType.Items.Add("鐩存帴璋冩嫧鍗�");
@@ -685,7 +687,7 @@
             string HMaterNumber = "";   //鐗╂枡浠g爜
             double HSumQty = 0;         //浜у搧鏁伴噺
             double HMinQty = 0;         //鏈�灏忓寘瑁呮暟
-            int HBQty = 0;              //绠辨暟
+            Int64 HBQty = 0;              //绠辨暟
             double HQty = 0;            //鏁伴噺
             string WeiShu = "";         //灏炬暟
             Int64 LSH = 0;                //娴佹按鍙�
@@ -701,7 +703,7 @@
             string HBarCodeBatchNo = "";       //鏉$爜鎵规鍙�
             string HBarCodeDate = "";         //鏉$爜鏃ユ湡
             int k = 0;
-            int n = 0;                  //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
+            Int64 n = 0;                  //鍚屼竴鎵圭敓鎴愭潯鐮佷腑鐨勭鍑犳潯
             string sTMNumber = "";      //鏉$爜鑷畾涔夊墠缂�
             DataSet Ds;
             //Ds = oCn.RunProcReturn("exec GetLSH '" + ClsPub.GetServerDate(0) + "'", "GetLSH");
@@ -748,7 +750,7 @@
                             sTMNumber = HNumber + sYear + sPeriod + sDay;
                             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]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else if (CampanyName == "椋為緳")
                         {
@@ -763,7 +765,7 @@
                             sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay;
                             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]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                         else  //閫氱敤鏂规硶
                         {
@@ -771,7 +773,7 @@
                             sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
                             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]);
+                            LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         }
                     }
                     else if (cmbHBarCodeType.Text == "鍝佺鏉$爜")
@@ -789,13 +791,22 @@
                     {
                         TM = HOrgNumber + HNumber + HBatchNo;
                     }//鍗氭棩鐗规畩澶勭悊
+                    else if (cmbHBarCodeType.Text == "搴忓垪鐮�")
+                    {
+                        //鏉$爜瑙勫垯锛� GX+鐗╂枡鍐呯爜+骞村勾鏈堟湀鏃ユ棩+5浣嶆祦姘村彿
+                        LSHlen = 5;
+                        //鏉$爜鍓嶇紑 = GX+鐗╂枡鍐呯爜+骞村勾鏈堟湀鏃ユ棩
+                        sTMNumber = "GX" + HNumber + sYear + sPeriod + sDay;
+                        Ds = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+                    }
                     else if(cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佹櫘閫氳鍒�" || cmbHBarCodeType.Text == "浠櫒澶栬喘浠舵潯鐮佸鍣ㄨ鍒�")
                     {
                         //鐗╂枡缂栫爜+鍗曟嵁鏃ユ湡锛圷YMMDD锛�+娴佹按4浣� 
                         sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
                         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]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 4;
                     }
                     else if (cmbHBarCodeType.Text == "浠櫒鎴愬搧鏉$爜瑙勫垯") //鍙﹀澶勭悊浜�
@@ -804,7 +815,7 @@
                         //sTMNumber = HMaterNumber + sYear + sPeriod + sDay;
                         //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]);
+                        //LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                     }
                     else if (cmbHBarCodeType.Text == "璇曞墏鎴愬搧鏉$爜瑙勫垯")
                     {
@@ -812,7 +823,7 @@
                         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]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 6;
                     }
                     else if (cmbHBarCodeType.Text == "鍐呴攢鏈烘潯鐮�")
@@ -822,11 +833,11 @@
                         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 = 5;
-                        if (sTMNumber.Length != 16)
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+                        LSHlen = 4;
+                        if (sTMNumber.Length != 16 && sTMNumber.Length != 15)
                         {
-                            MessageBox.Show("鏉$爜闀垮害涓嶅16浣嶏紝鏄惁鏁版嵁涓嶅叏锛佸埗閫犳湰閮�1浣�:[0] + 鏈哄瀷浠g爜5浣�:[" + HModelName + "] + 骞存湀鏃�5浣�:["+ HBarCodeDate + "] + 鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "]+ 鍘嬬缉鏈�1浣�:["+ HYasuoji + "]+00 ; ");
+                            MessageBox.Show("鏉$爜闀垮害涓嶅15鎴�16浣嶏紝鏄惁鏁版嵁涓嶅叏锛佸埗閫犳湰閮�1浣�:[0] + 鏈哄瀷浠g爜5浣�:[" + HModelName + "] + 骞存湀鏃�4鎴�5浣�:["+ HBarCodeDate + "] + 鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "]+ 鍘嬬缉鏈�1浣�:["+ HYasuoji + "]+00 ; ");
                             return;
                         }
                     }
@@ -837,11 +848,11 @@
                         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 = 5;
-                        if (sTMNumber.Length != 18)
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
+                        LSHlen = 4;
+                        if (sTMNumber.Length != 18 && sTMNumber.Length != 17)
                         {
-                            MessageBox.Show("鏉$爜闀垮害涓嶅18浣嶏紝鏄惁鏁版嵁涓嶅叏锛佺墿鏂欎唬鐮�11浣�:["+ HMaterNumber.Replace(".", "") + "]+骞存湀鏃�5浣�:["+ HBarCodeDate + "]+鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "];");
+                            MessageBox.Show("鏉$爜闀垮害涓嶅17鎴�18浣嶏紝鏄惁鏁版嵁涓嶅叏锛佺墿鏂欎唬鐮�11浣�:["+ HMaterNumber.Replace(".", "") + "]+骞存湀鏃�4鎴�5浣�:["+ HBarCodeDate + "]+鎵规鍙�2浣�:[" + HBarCodeBatchNo  + "];");
                             return;
                         }
                     }
@@ -851,7 +862,7 @@
                         sTMNumber = HICMOBillNo;
                         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]);
+                        LSH = ClsPub.isLong(Ds.Tables[0].Rows[0][0]);
                         LSHlen = 5;
                     }
                     //else if (cmbHBarCodeType.Text == "鎵樼洏鏉$爜")
@@ -864,10 +875,11 @@
                         return;
                     }
 
-                    HBQty = HBQty + ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
+                    HBQty = HBQty + ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value);
                     HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
                     HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
                     n = 0;
+                    int nn = 0;
                     for (int i = k; i < HBQty; i++)
                     {
                         if (HSumQty - HMinQty > 0)
@@ -895,6 +907,11 @@
                             LSH2 = "0" + LSH2;
                         }
                         if (cmbHBarCodeType.Text == "鍞竴鏉$爜")
+                        {
+                            //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
+                            TM = sTMNumber + LSH2;
+                        }
+                        else if (cmbHBarCodeType.Text == "搴忓垪鐮�")
                         {
                             //鏉$爜缂栧彿 = 鏉$爜鍓嶇紑 + 娴佹按鍙�
                             TM = sTMNumber + LSH2;
@@ -984,8 +1001,11 @@
                         grdSub.Rows[i].Cells[HGiveAwayFlag2Col] = oCell;
                         k = k + 1;
                         n = n + 1;
-                        oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
+                        nn = nn + 1;
                     }
+                    //鍚庡彴鎵归噺鎵ц璇彞
+                    oCn.RunProc("exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + nn.ToString() + " ");
                 }
             }
             string HWei = "";      //灏炬暟
@@ -1165,7 +1185,7 @@
             string HMaterNumber = "";   //鐗╂枡浠g爜
             double HSumQty = 0;         //浜у搧鏁伴噺
             double HMinQty = 0;         //鏈�灏忓寘瑁呮暟
-            int HBQty = 0;              //绠辨暟
+            Int64 HBQty = 0;              //绠辨暟
             double HQty = 0;            //鏁伴噺
             string WeiShu = "";         //灏炬暟
             //int LSH = 0;                //娴佹按鍙�
@@ -1216,7 +1236,7 @@
                     //    return;
                     //}
 
-                    HBQty = HBQty + ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
+                    HBQty = HBQty + ClsPub.isLong(grdMain.Rows[j].Cells[HBQtyCol].Value);
                     HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
                     HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
                     n = 0;
@@ -2173,6 +2193,24 @@
                     FillSelectData(oIF_PackageDismantleBillList.oBillSelectColl);
                 }
             }
+            else if (cmbSourceBillType.Text.Trim() == "宸ュ簭娴佽浆鍗�")
+            {
+                string sWhere = " and HOrgID =" + HOrgID.ToString();
+                DAL.Cls_S_IF_ProcessExchangeBillList oIF_ProcessExchangeBillList = new DAL.Cls_S_IF_ProcessExchangeBillList();
+                if (oIF_ProcessExchangeBillList.Refresh(sWhere))  //閫夋嫨鍘熷崟
+                {
+                    FillSelectData(oIF_ProcessExchangeBillList.oBillSelectColl);
+                }
+            }
+            else if (cmbSourceBillType.Text.Trim() == "宸ュ簭姹囨姤鍗�")
+            {
+                string sWhere = " and HOrgID =" + HOrgID.ToString();
+                DAL.Cls_S_IF_ProcessReportBillList oIF_ProcessReportBillList = new DAL.Cls_S_IF_ProcessReportBillList();
+                if (oIF_ProcessReportBillList.Refresh(sWhere))  //閫夋嫨鍘熷崟
+                {
+                    FillSelectData(oIF_ProcessReportBillList.oBillSelectColl);
+                }
+            }
             else
             {
 
@@ -2315,6 +2353,26 @@
                     grdMain.Rows[i].Cells[HTagCol].Value = "*";
                     //寰楀埌淇℃伅
                     Ds = oCn.RunProcReturn("select * from h_v_IF_PackageDismantleList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_PackageDismantleList");
+                    //鍐欏叆淇℃伅
+                    Sub_WriteInForm1(Ds.Tables[0], i);
+                }
+                //宸ュ簭娴佽浆鍗�
+                if (oSelectRow.BillType == "3772")
+                {
+                    grdMain.Rows.Add();
+                    grdMain.Rows[i].Cells[HTagCol].Value = "*";
+                    //寰楀埌淇℃伅
+                    Ds = oCn.RunProcReturn("select * from h_v_IF_ProcessExchangeList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ProcessExchangeList");
+                    //鍐欏叆淇℃伅
+                    Sub_WriteInForm1(Ds.Tables[0], i);
+                }
+                //鐢熶骇姹囨姤鍗�
+                if (oSelectRow.BillType == "3714")
+                {
+                    grdMain.Rows.Add();
+                    grdMain.Rows[i].Cells[HTagCol].Value = "*";
+                    //寰楀埌淇℃伅
+                    Ds = oCn.RunProcReturn("select * from h_v_IF_ProcessReportList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ProcessReportList");
                     //鍐欏叆淇℃伅
                     Sub_WriteInForm1(Ds.Tables[0], i);
                 }
@@ -3113,6 +3171,12 @@
                 grdMain.Rows[row + r].Cells[HMTONoCol].Value = grdMain.Rows[row].Cells[HMTONoCol].Value;
                 grdMain.Rows[row + r].Cells[HInnerBillNoCol].Value = grdMain.Rows[row].Cells[HInnerBillNoCol].Value;
                 grdMain.Rows[row + r].Cells[HMakerCol].Value = grdMain.Rows[row].Cells[HMakerCol].Value;
+                //缃戞牸鎵撳嬀
+                DataGridViewCheckBoxCell oCell = new DataGridViewCheckBoxCell();
+                oCell.ThreeState = false;
+                oCell.Value = grdMain.Rows[row].Cells[HGiveAwayFlagCol].Value;
+                oCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
+                grdMain.Rows[row + r].Cells[HGiveAwayFlagCol] = oCell;
 
             }
             DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
@@ -3422,5 +3486,23 @@
                 MessageBox.Show("鐢熸垚绠辩爜澶辫触锛�" + e1.Message );
             }
         }
+
+        private void cmbSourceBillType_TextChanged(object sender, EventArgs e)
+        {
+            if (cmbSourceBillType.Text == "宸ュ簭娴佽浆鍗�")
+            {
+                cmbHBarCodeType.Items.Clear();
+                cmbHBarCodeType.Items.Add("搴忓垪鐮�");
+                this.cmbHBarCodeType.SelectedIndex = 0;
+            }
+            else
+            {
+                cmbHBarCodeType.Items.Clear();
+                cmbHBarCodeType.Items.Add("鍞竴鏉$爜");
+                cmbHBarCodeType.Items.Add("鍝佺鏉$爜");
+                cmbHBarCodeType.Items.Add("鎵规鏉$爜");
+                this.cmbHBarCodeType.SelectedIndex = 0;
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1