diff --git a/HJGL_DS/BLL/API/APIBaseServices.cs b/HJGL_DS/BLL/API/APIBaseServices.cs index 6fcd840..3764a49 100644 --- a/HJGL_DS/BLL/API/APIBaseServices.cs +++ b/HJGL_DS/BLL/API/APIBaseServices.cs @@ -165,7 +165,7 @@ namespace BLL.API if (!string.IsNullOrEmpty(unitStoreId)) { q = (from x in db.Weld_WeldInfo - where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == x.WeldId select y.Amount ?? 0).Sum() - (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == x.WeldId select y.UsingAmount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) + where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == x.WeldId select y.Amount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) orderby x.WeldCode select x).ToList(); } diff --git a/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/ShowPlanWeld.aspx.cs b/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/ShowPlanWeld.aspx.cs index 7a61b87..fe0c406 100644 --- a/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/ShowPlanWeld.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/ShowPlanWeld.aspx.cs @@ -54,7 +54,8 @@ namespace FineUIPro.Web.WeldMat.UsingPlan FROM dbo.Weld_WeldInfo weld LEFT JOIN Weld_WeldType AS weldType ON weldType.WeldTypeId =weld.WeldTypeId WHERE 1 = 1 and (weld.IsLock is null or weld.IsLock=0) -and (select (SUM(ISNULL(stockIn.Amount,0))-SUM(ISNULL(stockIn.UsingAmount,0))) from Weld_StockIn stockIn where UnitStoreId=@UnitStoreId and WeldId=weld.WeldId)>0"; +and (select SUM(ISNULL(stockIn.Amount,0)) from Weld_StockIn stockIn where UnitStoreId=@UnitStoreId and WeldId=weld.WeldId)>0"; + //and (select (SUM(ISNULL(stockIn.Amount,0))-SUM(ISNULL(stockIn.UsingAmount,0))) from Weld_StockIn stockIn where UnitStoreId=@UnitStoreId and WeldId=weld.WeldId)>0"; List listStr = new List(); //listStr.Add(new SqlParameter("@ProjectId", this.ProjectId)); listStr.Add(new SqlParameter("@UnitStoreId", Request.Params["unitStoreId"])); @@ -158,7 +159,17 @@ and (select (SUM(ISNULL(stockIn.Amount,0))-SUM(ISNULL(stockIn.UsingAmount,0))) f protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e) { string itemsString = this.Grid1.SelectedRowID; - + Model.SGGLDB db = Funs.DB; + string unitStoreId = Request.Params["unitStoreId"]; + var q = from x in db.Weld_WeldInfo + where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == itemsString select y.Amount ?? 0).Sum() - (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == itemsString select y.UsingAmount ?? 0).Sum() + (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == itemsString select y.RecycleAmount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) + orderby x.WeldCode + select x; + if (q.Count() == 0) + { + Alert.ShowInTop("所选焊材无库存,请联系仓库保管员!", MessageBoxIcon.Warning); + return; + } PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(itemsString) + ActiveWindow.GetHidePostBackReference()); } @@ -179,13 +190,13 @@ and (select (SUM(ISNULL(stockIn.Amount,0))-SUM(ISNULL(stockIn.UsingAmount,0))) f if (WeldId != null) { var usingMat = from x in Funs.DB.Weld_UsingMat where x.ProjectId == this.ProjectId && x.WeldId == WeldId.ToString() select x; - if (usingMat.Count()>0) + if (usingMat.Count() > 0) { sumUsingAmount = usingMat.Sum(e => e.Amount); } var recycleMat = from x in Funs.DB.Weld_RecycleMat where x.ProjectId == this.ProjectId && x.WeldId == WeldId.ToString() select x; - if (recycleMat.Count()>0) + if (recycleMat.Count() > 0) { sumRecycleAmount = recycleMat.Sum(e => e.RecycleAmount); } diff --git a/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/UsingPlanImport.aspx.cs b/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/UsingPlanImport.aspx.cs index 3758336..d566e7b 100644 --- a/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/UsingPlanImport.aspx.cs +++ b/HJGL_DS/FineUIPro.Web/WeldMat/UsingPlan/UsingPlanImport.aspx.cs @@ -211,7 +211,7 @@ namespace FineUIPro.Web.WeldMat.UsingPlan { Model.SGGLDB db = Funs.DB; var q = from x in db.Weld_WeldInfo - where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == usingPlan.WeldId select y.Amount ?? 0).Sum() - (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == usingPlan.WeldId select y.UsingAmount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) + where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == usingPlan.WeldId select y.Amount ?? 0).Sum() - (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == usingPlan.WeldId select y.UsingAmount ?? 0).Sum() + (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == usingPlan.WeldId select y.RecycleAmount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) orderby x.WeldCode select x; if (q.Count() == 0) diff --git a/HJGL_DS/WebAPI/Controllers/WeldController.cs b/HJGL_DS/WebAPI/Controllers/WeldController.cs index 59b7f78..0188acc 100644 --- a/HJGL_DS/WebAPI/Controllers/WeldController.cs +++ b/HJGL_DS/WebAPI/Controllers/WeldController.cs @@ -84,6 +84,37 @@ namespace WebAPI.Controllers return respone; } + [HttpGet] + public Model.ResponeData isHaveWeld(string welderId, string unitStoreId) + { + Model.ResponeData respone = new ResponeData(); + try + { + Model.SGGLDB db = BLL.Funs.DB; + var q = from x in db.Weld_WeldInfo + where (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == welderId select y.Amount ?? 0).Sum() - (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == welderId select y.UsingAmount ?? 0).Sum() + (from y in db.Weld_StockIn where y.UnitStoreId == unitStoreId && y.WeldId == welderId select y.RecycleAmount ?? 0).Sum() > 0 && (x.IsLock == null || x.IsLock == false) + orderby x.WeldCode + select x; + if (q.Count() == 0) + { + respone.code = 0; + respone.message = "所选焊材无库存,请联系仓库保管员!"; + return respone; + } + else + { + respone.code = 1; + return respone; + } + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } + [HttpPost] public Model.ResponeData addUsingPlan([FromBody] UsingPlanItem usingPlan) { diff --git a/HJGL_DS/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user b/HJGL_DS/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user index c7227c3..ad4ffc2 100644 --- a/HJGL_DS/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/HJGL_DS/WebAPI/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -79,13 +79,13 @@ 09/10/2013 16:29:20 - 07/24/2025 16:36:52 + 07/25/2025 08:51:11 07/03/2024 11:01:05 - 07/24/2025 16:36:52 + 07/25/2025 08:51:11 12/17/2020 21:32:28 @@ -115,10 +115,10 @@ 07/25/2012 11:48:56 - 07/24/2025 16:36:51 + 07/25/2025 08:51:10 - 07/24/2025 16:36:51 + 07/25/2025 08:51:10 02/18/2018 09:44:54 @@ -316,10 +316,10 @@ 02/01/2018 12:20:56 - 07/24/2025 16:36:53 + 07/25/2025 08:51:12 - 07/24/2025 16:36:53 + 07/25/2025 08:51:12 01/23/2014 13:57:34 @@ -445,7 +445,7 @@ 07/03/2024 11:01:07 - 07/24/2025 16:37:05 + 07/25/2025 08:51:20 \ No newline at end of file