From 195b4a9f4ce855f550070ba90b9f3c57471e1d5b Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期三, 04 九月 2024 18:10:18 +0800
Subject: [PATCH] 物料添加单个流转卡数量,批量生成流转卡优化,到货确认模块添加添康科技客户

---
 WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs |   17 ++++++--
 WebAPI/Models/ClsGy_Material_Model.cs                       |    2 +
 DAL/车间管理/ClsSc_ProcessExchangeBill.cs                       |   35 +++++++++++++++--
 Model/车间管理/ClsSc_ProcessExchangeBillSub_BatchSplit.cs       |    3 +
 WebAPI/Controllers/POStockInBillController.cs               |    4 +
 WebAPI/DLL/ClsGy_Material_Ctl.cs                            |    3 +
 6 files changed, 54 insertions(+), 10 deletions(-)

diff --git "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs" "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
index cfebe96..0bc28d5 100644
--- "a/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
+++ "b/DAL/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBill.cs"
@@ -342,7 +342,11 @@
             try
             {
                 //寰楀埌mainid
-                omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (omodel.HInterID == 0 || omodel.HInterID.ToString() == null || omodel.HInterID.ToString() == "undefined")
+                {
+                    omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
+                }
+               
                 //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
 
                 //淇濆瓨鍓嶆帶鍒�=========================================
@@ -496,12 +500,34 @@
                 {
                     if (oSystemParameter.omodel.Sc_ProcessExchangeBill_AutoBarCode == "Y") //绯荤粺鍙傛暟  宸ュ簭娴佽浆鍗′繚瀛樻椂鑷姩鍚屾鏉$爜淇℃伅鑷虫潯鐮佹。妗�
                     {
-                        oCn.RunProc("insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
+                        Int64 HBarCodeInterID =  DBUtility.ClsPub.CreateBillID_Prod("85", ref DBUtility.ClsPub.sExeReturnInfo);
+
+                        if (oSystemParameter.omodel.WMS_CampanyName == "娣诲悍绉戞妧")
+                        {
+                            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,HGiveAwayFlag" +
+                            ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID,HGiveAwayFlag" +
+                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
+                            ") values ("
+                            + "'" + omodel.HBillNo + "','鍞竴鏉$爜'," + omodel.HMaterID.ToString() + "," + omodel.HUnitID.ToString() + "," + omodel.HQty.ToString()
+                            + ",'" + omodel.HBatchNo + "'," + omodel.HSupID.ToString() + ",0,'" + omodel.HMaker + "',getdate(),0," + omodel.HQty.ToString()
+                            + ", " + omodel.HICMOInterID.ToString() + "," + omodel.HICMOEntryID + ",'" + omodel.HICMOBillNo + "','3710',''"
+                            + ",1,1,0,0,0,'宸ュ簭娴佽浆鍗′繚瀛樿嚜鍔ㄥ悓姝�'"
+                            + ",0,'',getdate(),'',getdate()"
+                            + ", " + omodel.HPRDORGID + "," + omodel.HPRDORGID + ",''," + HBarCodeInterID + ",1,0"
+                            + ",'','','',0,'','')");
+                        }
+                        else
+                        {
+                            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,HEntryID,HGiveAwayFlag" +
                             ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo" +
                             ") values ("
                             + "'" + omodel.HBillNo + "','鍞竴鏉$爜'," + omodel.HMaterID.ToString() + "," + omodel.HUnitID.ToString() + "," + omodel.HQty.ToString()
@@ -509,8 +535,9 @@
                             + ", " + omodel.HInterID.ToString() + ",1,'" + omodel.HBillNo + "','3772',''"
                             + ",1,1,0,0,0,'宸ュ簭娴佽浆鍗′繚瀛樿嚜鍔ㄥ悓姝�'"
                             + ",0,'',getdate(),'',getdate()"
-                            + ", " + omodel.HPRDORGID + "," + omodel.HPRDORGID + ",'',0,0"
+                            + ", " + omodel.HPRDORGID + "," + omodel.HPRDORGID + ",''," + HBarCodeInterID + ",1,0"
                             + ",'','','',0,'','')");
+                        }                        
                     }
                 }
                 else
diff --git "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillSub_BatchSplit.cs" "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillSub_BatchSplit.cs"
index 547ada3..af1f432 100644
--- "a/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillSub_BatchSplit.cs"
+++ "b/Model/\350\275\246\351\227\264\347\256\241\347\220\206/ClsSc_ProcessExchangeBillSub_BatchSplit.cs"
@@ -16,6 +16,9 @@
         public double HProQty;//流转卡数量
         public Int64 HRoutingInterID;//工艺路线内码
         public DateTime HDate;//流转卡日期
+        public Int64 HInterID;//流转卡内码
+        public string HBillNo;//流转卡号
+        public string HBatchNo;//批次
     }
 }
 
diff --git a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
index 5cdf611..28e33cc 100644
--- a/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
+++ b/WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -1065,7 +1065,7 @@
 
                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                 string sql = string.Format(@"exec h_p_Sc_GetProcessExchangeBillSubTech ");
-                ds = oCN.RunProcReturn(sql +  HInterID, "h_p_Sc_GetProcessExchangeBillSubTech");
+                ds = oCN.RunProcReturn(sql + " '" +  HInterID + "'", "h_p_Sc_GetProcessExchangeBillSubTech");
 
                 //娣诲姞鍒楀悕
                 foreach (DataColumn col in ds.Tables[0].Columns)
@@ -2083,18 +2083,24 @@
 
                 DateTime dt = DateTime.Now;
                 string sql = "";
+                Int64 HInterID = 0;
                 string HBillNo = "";
                 Int64 HICMOInterID = 0;
                 Int64 HICMOEntryID = 0;
                 string HICMOBillNo = "";
                 double HQty = 0;
+                double HProQty = 0;
+                
                 foreach (Model.ClsSc_ProcessExchangeBillSub_BatchSplit oItemSub in ls)
                 {
-                    HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("3772", ref DBUtility.ClsPub.sExeReturnInfo, true); 
+                    //HBillNo = DBUtility.ClsPub.CreateBillCode_Prod("3772", ref DBUtility.ClsPub.sExeReturnInfo, true); 
+                    HInterID = oItemSub.HInterID;
+                    HBillNo = oItemSub.HBillNo;
                     HICMOInterID = oItemSub.HICMOInterID;
                     HICMOEntryID = oItemSub.HICMOEntryID;
                     HICMOBillNo = oItemSub.HICMOBillNo;
                     HQty = oItemSub.HQty;
+                    HProQty = oItemSub.HProQty;
 
                     sql = "select * from h_v_Sc_ProcessExchangeBill_BatchSplit where hmainid = " + oItemSub.HICMOInterID + " and hentryid = " 
                          + oItemSub.HICMOEntryID;
@@ -2102,6 +2108,7 @@
                     //涓昏〃璧嬪��
                     if (ds.Tables[0].Rows.Count > 0 && ds != null)
                     {
+                        oBill.omodel.HInterID = HInterID;
                         oBill.omodel.HBillNo = HBillNo;
                         oBill.omodel.HBillSubType = "3772";
                         oBill.omodel.HMainSourceBillSubType = "3710";
@@ -2112,7 +2119,7 @@
                         oBill.omodel.HYear = DBUtility.ClsPub.isLong(oItemSub.HDate.Year);
                         oBill.omodel.HPeriod = DBUtility.ClsPub.isLong(oItemSub.HDate.Month);
                         oBill.omodel.HRemark = "";
-                        oBill.omodel.HBatchNo = "";
+                        oBill.omodel.HBatchNo = oItemSub.HBatchNo;
                         oBill.omodel.HMainMaterID = 0;
                         oBill.omodel.HKeyMaterID = 0;
                         oBill.omodel.HNo = 0;
@@ -2205,7 +2212,7 @@
                         oBill.omodel.HRemark_New = "";
                         oBill.omodel.HWeight_New = 0;
                         oBill.omodel.HPlanOrderProcNo = ds.Tables[0].Rows[0]["HPlanOrderProcNo"].ToString();
-                        oBill.omodel.HMouldNum = "0";
+                        oBill.omodel.HMouldNum = "0";                        
                     }   
                     //瀛愯〃璧嬪��
                     for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
@@ -2239,7 +2246,7 @@
                         oItemSubs.HWorkerID = 0;
                         oItemSubs.HWorkerNumber = "";
                         oItemSubs.HSourceID = 0;
-                        oItemSubs.HQty = HQty;
+                        oItemSubs.HQty = HProQty;
                         oItemSubs.HTimeUnit = "";
                         oItemSubs.HPlanWorkTimes = 0;
                         oItemSubs.HPlanBeginDate = Convert.ToDateTime(dt.ToShortDateString().ToString());
diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs
index 8c671f1..9dcce14 100644
--- a/WebAPI/Controllers/POStockInBillController.cs
+++ b/WebAPI/Controllers/POStockInBillController.cs
@@ -5335,9 +5335,11 @@
                 string sql = string.Empty;
                 if (FCusName.Contains("瀹夌憺"))
                     sql = $"select top 1 HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from  Gy_BarCodeBill where HSourceInterID =(select distinct HSourceInterID from Cg_POInStockBillSub where HInterID ={HInterID}) and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'";
+                else if(FCusName.Contains("娣诲悍绉戞妧"))
+                    sql = $"select top 1 HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID,HMaterID,HBatchNo,HProduceDate,HExpiryDate from  Gy_BarCodeBill where HSourceInterID = {HInterID} and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'";
                 else
                     sql = $"select HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from  Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode.Split('#')[0]}' and HQty = {HBarcode.Split('#')[1]}";
-                DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList");
+                DataSet ds = oCn.RunProcReturn(sql, "Gy_BarCodeBill");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";
diff --git a/WebAPI/DLL/ClsGy_Material_Ctl.cs b/WebAPI/DLL/ClsGy_Material_Ctl.cs
index 6a98db4..66d96de 100644
--- a/WebAPI/DLL/ClsGy_Material_Ctl.cs
+++ b/WebAPI/DLL/ClsGy_Material_Ctl.cs
@@ -29,6 +29,7 @@
                     ",HSTDLABORPREPARETIME,HSTDMACHINEPREPARETIME,HWidth,HWeight,HColorRemark,HQCSchemeID_Fst,HQCSchemeID_Proc,HQCSchemeID_Patrol" +
                     ",HMaterRuleType,HColorNo,HPieceMaxQty,HCommonUseFlag,HAvgStockPrice,HFootPrice,HTaxCost,HNoTaxCost,HOnceRightRate" +
                     ",HHeight_M,HInches_M,HAl1Long_M,HDensity_M,HTela_M,HUnderTela_M,HSizing_M,HQtyDec,HPriceDec,HMoneyDec,HTaxRate,HProfitRate" +
+                    ",HLotcardQty" +
                     ") " +
                     " Values('" + oModel.HNumber + "','" + oModel.HName + "','" + oModel.HHelpCode + "','" + oModel.HShortNumber + "'," + oModel.HParentID.ToString() +
                     ", " + oModel.HLevel.ToString() + "," + Convert.ToString(oModel.HEndFlag ? 1 : 0) + "," + Convert.ToString(oModel.HStopflag ? 1 : 0) + ",'" + oModel.HRemark + "'" +
@@ -51,6 +52,7 @@
                        "," + oModel.HMoneyDec +
                        "," + oModel.HTaxRate +
                        "," + oModel.HProfitRate +
+                       "," + oModel.HLotcardQty +
                        ")", ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼涓婄骇涓洪潪鏈骇浠g爜
                 oCn.RunProc("Update " + MvarItemKey + " set HEndflag=0 where HItemID=" + oModel.HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -219,6 +221,7 @@
                     ",HMoneyDec=" + oModel.HMoneyDec.ToString() +
                     ",HTaxRate=" + oModel.HTaxRate.ToString() +
                     ",HProfitRate=" + oModel.HProfitRate.ToString() +
+                    ",HLotcardQty=" + oModel.HLotcardQty.ToString() +
                     " Where HItemID=" + sItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                 //淇敼瀛愰」鐩唬鐮�
                 oCn.RunProc("exec h_p_Gy_UpdateNumber '" + MvarItemKey + "','" + oModel.HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
diff --git a/WebAPI/Models/ClsGy_Material_Model.cs b/WebAPI/Models/ClsGy_Material_Model.cs
index 810ded1..d404f2c 100644
--- a/WebAPI/Models/ClsGy_Material_Model.cs
+++ b/WebAPI/Models/ClsGy_Material_Model.cs
@@ -105,5 +105,7 @@
 
         public double HProfitRate; // 榛樿鍒╂鼎鐜囷紙榛樿0锛�
         public int HProjectBillMainID; //椤圭洰鍙�
+
+        public double HLotcardQty; //鍗曚釜娴佽浆鍗℃暟閲�
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1