From 07c3408a0a2295917c0d0a34b319ea8e83801047 Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 01 十二月 2022 15:47:33 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WebAPI/Controllers/POStockInBillController.cs |  148 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 147 insertions(+), 1 deletions(-)

diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs
index 2d5de67..b0bbedd 100644
--- a/WebAPI/Controllers/POStockInBillController.cs
+++ b/WebAPI/Controllers/POStockInBillController.cs
@@ -697,6 +697,152 @@
                     }
 
                 }
+                //鐢熶骇琛ユ枡鏍¢獙
+                if (HBillType == "1254")
+                {
+                    string[] sArray = sBarCodeNew.Split('@');
+                    string HMaterNumber = "";
+                    HMaterNumber = sArray[0];
+                    Int64 HQty = 0;
+                    HQty = ClsPub.isInt(sArray[4]);
+                    string HBarchNo = "";
+                    HBarchNo = sArray[6];
+
+                    DateTime HSCRQ = ClsPub.isDate(sArray[3]);
+                    DateTime HYXQZ = ClsPub.isDate(sArray[5]);
+
+                    //閲囪喘璁㈠崟鍙�
+                    string HPOOrderBillNo = "";
+                    HPOOrderBillNo = ClsPub.isStrNull(sArray[8]);
+
+
+
+                    Int64 HMaterID = 0;
+
+                    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                    DataSet Dss;
+                    Dss = oCn.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList");
+                    string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]);
+
+                    DataSet Dss1;
+                    Dss1 = oCn.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and  huseorgid = " + HOrgID, "Gy_Material");
+                    HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]);
+                    string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]);
+                    string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]);
+                    Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]);
+
+
+                    HTM = HOrgNumber + HMaterID + HBarchNo;
+
+
+                    DataSet Dss5;
+                    Dss5 = oCn.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill");
+                    if (Dss5.Tables[0].Rows.Count > 0)
+                    {
+
+                    }
+                    else
+                    {
+
+                        string ModName = "85";
+                        var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+                        Int64 HSupID = 0;
+                        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,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " +
+                                           ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
+                                           ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " +
+                                           ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " +
+                                           ") values ("
+                                           + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
+                                           + ",'" + HBarchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString()
+                                           + ", " + 0 + "," + 0 + ",'','',0"
+                                           + ", 0,'',0,0,0,''"
+                                           + ",0,'','','" + HSCRQ.ToShortDateString() + "','" + HYXQZ.ToShortDateString() + "','',getdate()"
+                                           + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1"
+                                           + ",0,0,0"
+                                           + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)");
+
+                    }
+
+                }
+                //閿�鍞嚭搴撴牎楠�
+                if (HBillType == "1205")
+                {
+                    string HMaterNumber = "";
+                    HMaterNumber = sBarCodeNew.Substring(0, 10);
+                    string HSCRQ = "";
+                    HSCRQ = "20" + sBarCodeNew.Substring(10, 6);
+                    Int64 Year = ClsPub.isInt(HSCRQ.Substring(0, 4));
+                    Int64 Month = ClsPub.isInt(HSCRQ.Substring(4, 2));
+                    Int64 Day = ClsPub.isInt(HSCRQ.Substring(6, 2));
+
+                    string HBatchNo = "";
+                    HBatchNo = sBarCodeNew.Substring(16, 11);
+                    SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+
+                    Int64 HMaterID = 0;
+                    DataSet Dss1;
+                    Dss1 = oCN.RunProcReturn(" select HItemID,HName,HModel,HUnitID from Gy_Material where HNumber= '" + HMaterNumber + "' and  huseorgid = " + HOrgID, "Gy_Material");
+                    HMaterID = Pub_Class.ClsPub.isLong(Dss1.Tables[0].Rows[0]["HItemID"]);
+                    string HMaterName = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HName"]);
+                    string HMaterModel = Pub_Class.ClsPub.isStrNull(Dss1.Tables[0].Rows[0]["HModel"]);
+                    Int64 HUnitID = Pub_Class.ClsPub.isInt(Dss1.Tables[0].Rows[0]["HUnitID"]);
+                    DataSet Dss;
+                    Dss = oCN.RunProcReturn(" select HNumber from h_v_CLD_ORGANIZATIONSList where HItemID= " + HOrgID, "h_v_CLD_ORGANIZATIONSList");
+                    string HOrgNumber = Pub_Class.ClsPub.isStrNull(Dss.Tables[0].Rows[0]["HNumber"]);
+                    HTM = HOrgNumber + HMaterID + HBatchNo;
+
+
+                    DateTime HSCRQ1 = ClsPub.isDate(Year + "-" + Month + "-" + Day);
+
+
+                    string HYXQZ = "20" + sBarCodeNew.Substring(27, 6);
+                    Int64 Year1 = ClsPub.isInt(HYXQZ.Substring(0, 4));
+                    Int64 Month1 = ClsPub.isInt(HYXQZ.Substring(4, 2));
+                    Int64 Day1 = ClsPub.isInt(HYXQZ.Substring(6, 2));
+                    DateTime HYXQZ1 = ClsPub.isDate(Year1 + "-" + Month1 + "-" + Day1);
+
+                    Int64 HQty = 0;
+                    HQty = ClsPub.isInt(sBarCodeNew.Substring(33, 3));
+
+                    DataSet Dss5;
+                    Dss5 = oCN.RunProcReturn(" select * from Gy_BarCodeBill where HBarCode= '" + HTM + "'", "Gy_BarCodeBill");
+                    if (Dss5.Tables[0].Rows.Count > 0)
+                    {
+
+                    }
+                    else
+                    {
+
+
+
+                        string ModName = "85";
+                        var HInterID = DBUtility.ClsPub.CreateBillID_Prod(ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+                        Int64 HSupID = 0;
+                        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,HProduceDate,HExpiryDate,HWorkLineName,HBarCodeDate " +
+                                           ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID,HEntryID " +
+                                           ",HGiveAwayFlag,HSeOrderSEQ,HInitSourceEntryID " +
+                                           ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo,HExpirationDateFlag " +
+                                           ") values ("
+                                           + "'" + HTM + "','鎵规鏉$爜'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty.ToString()
+                                           + ",'" + HBatchNo + "'," + HSupID.ToString() + ",0,'" + ClsPub.CurUserName + "',getdate(),0," + HQty.ToString()
+                                           + ", 0,0,'','',0"
+                                           + ", 0,'',0,0,0,''"
+                                           + ",0,'','','" + HSCRQ1.ToShortDateString() + "','" + HYXQZ1.ToShortDateString() + "','',getdate()"
+                                           + ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",''," + HInterID.ToString() + ",1"
+                                           + ",0,0,0"
+                                           + ",'" + HMaterName + "','" + HMaterModel + "','',0,'','',1)");
+
+                    }
+
+                }
                 //objJsonResult.code = "0";
                 //objJsonResult.count = 1;
                 //objJsonResult.Message = DBUtility.ClsPub.sErrInfo;
@@ -2199,7 +2345,7 @@
                 string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);//瀹㈡埛鍚嶇О
                 string sql = string.Empty;
                 if (FCusName.Contains("瀹夌憺"))
-                    sql = $"select HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from  Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'";
+                    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
                     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");

--
Gitblit v1.9.1