diff --git a/HJGL_DS/BLL/API/APIWeldServices.cs b/HJGL_DS/BLL/API/APIWeldServices.cs index fe51019..d5551e5 100644 --- a/HJGL_DS/BLL/API/APIWeldServices.cs +++ b/HJGL_DS/BLL/API/APIWeldServices.cs @@ -581,18 +581,37 @@ namespace BLL.API { usingMat.StoreMan = user.StoremanId; } - - if (amount == plan.Amount) //全部领取 + BLL.UsingMatService.AddUsingMat(usingMat); + // 修改库存已使用的数量 + BLL.StockInService.UpdateStockInUsingAmount(usingMat.StockInId, usingMat.Amount, usingMat.TwoAmount); + if (amount < plan.Amount) //部分领取 { - BLL.UsingMatService.AddUsingMat(usingMat); - // 修改库存已使用的数量 - BLL.StockInService.UpdateStockInUsingAmount(usingMat.StockInId, usingMat.Amount, usingMat.TwoAmount); + Model.Weld_UsingPlan newPlan = new Weld_UsingPlan(); + newPlan.UnitStoreId = plan.UnitStoreId; + newPlan.WeldId = plan.WeldId; + newPlan.ProjectId = plan.ProjectId; + newPlan.UsePosition = plan.UsePosition; + newPlan.UsingUnit = plan.UsingUnit; + newPlan.STE_ID = plan.STE_ID; + newPlan.STE_Name = plan.STE_Name; + newPlan.Amount = plan.Amount - amount; + newPlan.UsingManOne = plan.UsingManOne; + newPlan.InPutDate = DateTime.Now; + newPlan.OrderDate = plan.OrderDate; + newPlan.OrderTime = plan.OrderTime; + newPlan.TeamGroupId = plan.TeamGroupId; + newPlan.CancelDate = null; + newPlan.IsCancel = plan.IsCancel; + newPlan.CancelResult = plan.CancelResult; + newPlan.IsSubmit = plan.IsSubmit; + newPlan.InPutMan = plan.InPutMan; + newPlan.Type = "1"; + newPlan.IsSteelStru = plan.IsSteelStru; + newPlan.UsingPlanId = SQLHelper.GetNewID(typeof(Model.Weld_UsingPlan)); + BLL.UsingPlanService.AddUsingPlan(newPlan); } - else - { - - } - + respone.code = 1; + respone.message = "领料成功!"; } else { @@ -879,5 +898,41 @@ namespace BLL.API return responeData; } #endregion + + #region 发料异常接口 + /// + /// 发料异常接口 + /// + /// 人员ID + /// 交换类型 + /// + public static Model.ResponeData saveMachineErrlog(string unitStoreId, string errlog) + { + var responeData = new Model.ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + Model.Sys_ErrLogInfo errLogInfo = new Sys_ErrLogInfo(); + errLogInfo.ErrLogId = SQLHelper.GetNewID(); + errLogInfo.ErrType = "WeldMachine"; + errLogInfo.ErrMessage = errlog; + errLogInfo.ErrIP = unitStoreId; + errLogInfo.ErrTime = DateTime.Now; + db.Sys_ErrLogInfo.InsertOnSubmit(errLogInfo); + db.SubmitChanges(); + responeData.code = 1; + responeData.message = "异常保存成功!"; + } + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + ErrLogInfo.WriteLog(ex, "发料异常接口", "WeldController.saveMachineErrlog"); + } + return responeData; + } + #endregion } } diff --git a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user index 80f7761..abef49a 100644 --- a/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user +++ b/HJGL_DS/FineUIPro.Web/FineUIPro.Web.csproj.user @@ -2,7 +2,7 @@ true - Release|Any CPU + Debug|Any CPU diff --git a/HJGL_DS/WebAPI/Controllers/WeldController.cs b/HJGL_DS/WebAPI/Controllers/WeldController.cs index 5560089..6d4ade5 100644 --- a/HJGL_DS/WebAPI/Controllers/WeldController.cs +++ b/HJGL_DS/WebAPI/Controllers/WeldController.cs @@ -379,5 +379,31 @@ namespace WebAPI.Controllers } return respone; } + + [HttpGet] + public Model.ResponeData saveMachineErrlog(string unitStoreCode, string errlog) + { + Model.ResponeData respone = new ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(BLL.Funs.ConnString)) + { + var unitStore = db.Weld_UnitStore.FirstOrDefault(x => x.UnitStoreCode == unitStoreCode); + if (unitStore == null) + { + respone.code = 0; + respone.message = "对应编码的仓库不存在!"; + return respone; + } + return APIWeldServices.saveMachineErrlog(unitStore.UnitStoreId, errlog); + } + } + catch (Exception e) + { + respone.code = 0; + respone.message = e.Message; + } + return respone; + } } } \ No newline at end of file diff --git a/HJGL_DS/WebAPI/WebAPI.csproj.user b/HJGL_DS/WebAPI/WebAPI.csproj.user index 28be9c4..a48b337 100644 --- a/HJGL_DS/WebAPI/WebAPI.csproj.user +++ b/HJGL_DS/WebAPI/WebAPI.csproj.user @@ -1,7 +1,7 @@  - Release|Any CPU + Debug|Any CPU FolderProfile true