From fa3c3fd56c34f3a047c77896d366fcdb9a88f988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E9=B9=8F?= Date: Sat, 17 May 2025 17:53:38 +0800 Subject: [PATCH] 1 --- .../ICSManufactureService.cs | 75 +++++-------------- .../ICSSoft.DataProject/ICSPurchaseService.cs | 9 ++- .../ICSSoft.DataProject/ICSSubmitService.cs | 2 +- .../Controllers/WMSBarCoreController.cs | 2 +- 4 files changed, 24 insertions(+), 64 deletions(-) diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs index ade9a3c..8a95a96 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSManufactureService.cs @@ -1042,25 +1042,25 @@ b.IssueCode+a.MUSER+ISNULL(b.SourceCode,'')+ISNULL(c.DepCode,'') AS Costre,a.Fro RAISERROR('" + language.GetNameByCode("WMSAPIInfo114") + @"',16,1); END - UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)-'{2}' - FROM ICSInventoryLot a - INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint - INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint - INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint - {3} - WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='{4}' + -- UPDATE e SET IssueQuantity=ISNULL(IssueQuantity,0)-'{2}' + -- FROM ICSInventoryLot a + -- INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint + -- INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint + -- INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint + -- {3} + -- WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='{4}' {5} - IF EXISTS(SELECT a.LotNo FROM ICSInventoryLot a - INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint - INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint - INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint - {3} - WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='{4}' AND e.IssueQuantity<0) - BEGIN - RAISERROR('" + language.GetNameByCode("WMSAPIInfo192") + @"',16,1); - END"; + -- IF EXISTS(SELECT a.LotNo FROM ICSInventoryLot a + -- INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint + -- INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint + -- INNER JOIN ICSMOApplyNeg d ON c.ApplyNegCode=d.ApplyNegCode AND c.WorkPoint=d.WorkPoint + -- {3} + -- WHERE a.LotNo='{0}' AND a.WorkPoint='{1}' AND d.Type='{4}' AND e.IssueQuantity<0) + -- BEGIN + -- RAISERROR('" + language.GetNameByCode("WMSAPIInfo192") + @"',16,1); + -- END"; sql = string.Format(sql, LotNo, WorkPoint, Quantity, table, type, sqlMOIssueDocNegativeIssueDH, quantitySql); #endregion @@ -1315,47 +1315,7 @@ SELECT y.DepCode+a.ToWarehouseCode+y.MOCode+a.MUSER AS Costre,y.DepCode,a.ToWare } else if (TransType == TransTypeEnum.MOIssueDocNegativeApply.GetDescription()) { - if (DBHelper.IsPNU9()) - { - sql = @"select LotNo,WorkPoint,InvCode,ToWarehouseCode,MUSER,Quantity -INTO #NewTempERP -from ICSWareHouseLotInfoLog -WHERE Identification='{0}' AND ERPUpload='0' AND ISNULL(LogID, '')='' - -select LotNo,WorkPoint,InvCode,ToWarehouseCode,MUSER,Quantity,LogID -INTO #NewDouTempERP -from ICSWareHouseLotInfoLog -WHERE Identification='{0}' AND ERPUpload='0' AND ISNULL(LogID, '')<>'' - -SELECT a.ToWarehouseCode+z.ApplyNegCode+a.MUSER AS Costre,'' AS DepCode,a.ToWarehouseCode AS WarehouseCode,z.ApplyNegCode,a.MUSER,ROW_NUMBER() OVER (ORDER BY a.ToWarehouseCode,z.ApplyNegCode,c.id,a.InvCode) AS Sequence, - a.InvCode,SUM(a.Quantity) AS Quantity,0 AS Amount,c.id AS SourceDetailID,con.Enable AS UpdateTodoQuantity,conStock.Enable AS UpdateStock - ,a.WorkPoint,ISNULL(ext.ProjectCode, '') AS ProjectCode,CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode,ISNULL(ext.Version, '') AS Version,ISNULL(ext.Brand, '') AS Brand, - ISNULL(ext.cFree1, '') AS cFree1,ISNULL(ext.cFree2, '') AS cFree2,ISNULL(ext.cFree3, '') AS cFree3,ISNULL(ext.cFree4, '') AS cFree4,ISNULL(ext.cFree5, '') AS cFree5,ISNULL(ext.cFree6, '') AS cFree6,ISNULL(ext.cFree7, '') AS cFree7,ISNULL(ext.cFree8, '') AS cFree8,ISNULL(ext.cFree9, '') AS cFree9,ISNULL(ext.cFree10, '') AS cFree10 - INTO #TempERP - FROM #NewTempERP a - INNER JOIN ICSInventoryLot lot ON a.LotNo=lot.LotNo AND a.WorkPoint=lot.WorkPoint - INNER JOIN ICSExtension ext ON lot.ExtensionID=ext.ID AND lot.WorkPoint=ext.WorkPoint - INNER JOIN ICSInventory inv ON a.InvCode=inv.InvCode AND a.WorkPoint=inv.WorkPoint - LEFT JOIN ICSInventoryBatchEnable invBat ON a.InvCode=invBat.InvCode AND a.ToWarehouseCode=invBat.WHCode AND a.WorkPoint=invBat.WorkPoint - INNER JOIN ICSInventoryLotDetail b ON a.LotNo=b.LotNo AND a.WorkPoint=b.WorkPoint - INNER JOIN ICSMOApplyNegDetail c ON b.TransCode=c.ApplyNegCode AND b.TransSequence=c.Sequence AND b.WorkPoint=c.WorkPoint - INNER JOIN ICSMOApplyNeg z ON c.ApplyNegCode=z.ApplyNegCode AND c.WorkPoint=z.WorkPoint - INNER JOIN ICSConfiguration con ON con.Code='Stock001' AND a.WorkPoint=con.WorkPoint -INNER JOIN ICSConfiguration conStock ON conStock.Code='UpdateStock002' AND a.WorkPoint=conStock.WorkPoint - GROUP BY a.ToWarehouseCode,z.ApplyNegCode,a.MUSER,a.InvCode,c.id,con.Enable,conStock.Enable - ,a.WorkPoint,ISNULL(ext.ProjectCode, ''),CASE WHEN (invBat.BatchEnable IS NULL AND ISNULL(inv.BatchEnable, '0')='1') OR ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END,ISNULL(ext.Version, ''),ISNULL(ext.Brand, ''), - ISNULL(ext.cFree1, ''),ISNULL(ext.cFree2, ''),ISNULL(ext.cFree3, ''),ISNULL(ext.cFree4, ''),ISNULL(ext.cFree5, ''),ISNULL(ext.cFree6, ''),ISNULL(ext.cFree7, ''),ISNULL(ext.cFree8, ''),ISNULL(ext.cFree9, ''),ISNULL(ext.cFree10, '') - - SELECT DISTINCT Costre,WorkPoint,DepCode,WarehouseCode AS WHCode,'领料申请单' AS SourceType,ApplyNegCode AS SourceCode,MUSER AS [User],SYSDATETIME() AS MTime,UpdateTodoQuantity,UpdateStock FROM #TempERP - SELECT Costre,Sequence,InvCode,Quantity,Amount,SourceDetailID,ProjectCode,BatchCode,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10 ,WarehouseCode AS WHCode FROM #TempERP - - DROP TABLE #TempERP - DROP TABLE #NewTempERP - DROP TABLE #NewDouTempERP"; - } - else - { - sql = @"select LotNo,WorkPoint,InvCode,ToWarehouseCode,MUSER,Quantity + sql = @"select LotNo,WorkPoint,InvCode,ToWarehouseCode,MUSER,Quantity INTO #NewTempERP from ICSWareHouseLotInfoLog WHERE Identification='{0}' AND ERPUpload='0' AND ISNULL(LogID, '')='' @@ -1408,7 +1368,6 @@ INNER JOIN ICSConfiguration conStock ON conStock.Code='UpdateStock002' AND a.Wor DROP TABLE #TempERP DROP TABLE #NewTempERP DROP TABLE #NewDouTempERP"; - } } //根据材料出库单查询上游单据,根据上游单据生成红字材料出库 diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs index 390cebd..6cdc62d 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSPurchaseService.cs @@ -2086,7 +2086,7 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in { #region ERP string sql = ""; - sql = @"SELECT a.VenCode+a.DepCode+a.MUSER AS Costre,a.VenCode,a.DepCode,y.POID AS POCode,a.MUSER,a.MTIME, + sql = @"SELECT a.VenCode+a.DepCode+a.MUSER+y.POID AS Costre,a.VenCode,a.DepCode,y.POID AS POCode,a.MUSER,GETDATE() AS MTIME, a.Sequence,a.InvCode,a.Quantity,CASE invBat.AmountEnable WHEN '1' THEN a.Amount ELSE '0' END AS Amount,ISNULL(a.UnitPrice,0) AS UnitPrice,a.Currency,a.PODetailID ,a.WorkPoint,ISNULL(ext.ProjectCode, '') AS ProjectCode,CASE WHEN ISNULL(invBat.BatchEnable, '0')='1' THEN ISNULL(ext.BatchCode, '') ELSE '' END AS BatchCode,ISNULL(ext.Version, '') AS Version,ISNULL(ext.Brand, '') AS Brand, ISNULL(ext.cFree1, '') AS cFree1,ISNULL(ext.cFree2, '') AS cFree2,ISNULL(ext.cFree3, '') AS cFree3,ISNULL(ext.cFree4, '') AS cFree4,ISNULL(ext.cFree5, '') AS cFree5,ISNULL(ext.cFree6, '') AS cFree6,ISNULL(ext.cFree7, '') AS cFree7,ISNULL(ext.cFree8, '') AS cFree8,ISNULL(ext.cFree9, '') AS cFree9,ISNULL(ext.cFree10, '') AS cFree10 @@ -2103,7 +2103,7 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in SELECT DISTINCT Costre,WorkPoint,VenCode,DepCode ,CASE (SELECT Enable FROM ICSConfiguration WHERE Code='POCodeDisplayed' AND WorkPoint='{1}') WHEN 0 THEN '' ELSE POCode END AS POCode - ,MUSER AS [User],SYSDATETIME() AS MTime FROM #TempERP + ,MUSER AS [User],MTime FROM #TempERP SELECT Costre,Sequence,InvCode,Quantity,Amount,UnitPrice,Currency,POCode,PODetailID,ProjectCode,BatchCode,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10 FROM #TempERP @@ -2126,14 +2126,14 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in foreach (var item in res) { JObject jo = (JObject)item; - JArray resdetail = (JArray)JsonConvert.DeserializeObject(jo["ArrivalVouchSRet"].ToString()); + JArray resdetail = (JArray)JsonConvert.DeserializeObject(jo["details"].ToString()); foreach (var detail in resdetail) { JObject det = (JObject)detail; string ERPupdate = @"update ICSDeliveryNotice set DNCode='{0}',Sequence='{1}',DNID='{2}',DNDetailID='{3}' where PODetailID='{4}' AND DNType='1' AND DNCode='{5}' and Sequence='{6}'"; - ERPupdate = string.Format(ERPupdate, jo["DNCode"], det["Sequence"], jo["ID"], det["DetailID"], det["PODetailID"], DNCode, det["Sequence"].ToString().Substring(0, det["Sequence"].ToString().Length - 1)); + ERPupdate = string.Format(ERPupdate, jo["DNCode"], det["Sequence"], jo["ID"], det["DetailID"], det["PODetailID"], DNCode, det["WMSSequence"]); if (!DBHelper.ExecuteNonQuery(ERPupdate, cmd)) { @@ -2146,6 +2146,7 @@ IF EXISTS(SELECT b.id FROM ICSPurchaseReceive b where rcvcode in { log.Debug(ex.ToString()); log.Debug(resultStr); + throw ex; } } else diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs index 33a6a1b..b6bd9e0 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.DataProject/ICSSubmitService.cs @@ -10673,7 +10673,7 @@ BEGIN { throw new Exception(LanguageHelper.GetNameSingle("WMSAPIInfo003"));//"单据类型不存在!" } - + var groupedDetails = item.detail.GroupBy(p => new { p.TransCode, p.TransSequence}).ToList(); foreach (var itemInfo in item.detail) { diff --git a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs index 8eb6804..d180876 100644 --- a/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs +++ b/ICSSoft.WMS.WebAPI/ICSSoft.WMS.WebAPI/Controllers/WMSBarCoreController.cs @@ -6569,7 +6569,7 @@ namespace ICSSoft.WebAPI.Controllers [Route("api/YSDeliveryNotice/Create")] public HttpResponseMessage YSDeliveryNoticeCreate([FromBody] object JsonData) { - log.Info("采购到货传入值" + JsonData); + log.Info("自购料到货传入值" + JsonData); try { List model = new List();