diff --git a/Admin.Core.Api/Admin.Core.Api.xml b/Admin.Core.Api/Admin.Core.Api.xml index db9e744..543a23c 100644 --- a/Admin.Core.Api/Admin.Core.Api.xml +++ b/Admin.Core.Api/Admin.Core.Api.xml @@ -423,7 +423,7 @@ - + 查询称量重量 diff --git a/Admin.Core.Api/Admin.Core.Model.xml b/Admin.Core.Api/Admin.Core.Model.xml index ef42034..58d43b3 100644 --- a/Admin.Core.Api/Admin.Core.Model.xml +++ b/Admin.Core.Api/Admin.Core.Model.xml @@ -4582,6 +4582,21 @@ 投料整包完整信息 + + + 配方编号 + + + + + 批次号 + + + + + 产品名称 + + 拉缸、泵查询参数 @@ -5251,5 +5266,75 @@ 设置误差 + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + + + + 计划ID + + diff --git a/Admin.Core.Api/Controllers/Business/WarehouseController.cs b/Admin.Core.Api/Controllers/Business/WarehouseController.cs index fd2b1e7..a7d1dee 100644 --- a/Admin.Core.Api/Controllers/Business/WarehouseController.cs +++ b/Admin.Core.Api/Controllers/Business/WarehouseController.cs @@ -100,7 +100,7 @@ namespace Admin.Core.Api.Controllers.Business if (query==null) { return Failed("查询失败!"); - } + } return Success(query); } #endregion @@ -126,19 +126,43 @@ namespace Admin.Core.Api.Controllers.Business return Failed("执行失败!"); } - [HttpGet] - public async Task> DownLoadplanInfo() + [HttpPost] + public async Task> DownLoadplanInfo([FromBody] List MesDownLoadPlanList) { try { - string ss1 = "a82d016e813c4ac3bca0244c519da591"; - string ss2 = "2408090522"; - var ss3 = "D1-813"; - var result = await _hw_WarehouseService.InsertXLPlanInfo(DateTime.Now, ss1, ss2, ss3); - if (result) + int iFlag = 0; + if (MesDownLoadPlanList == null || MesDownLoadPlanList.Count == 0) + { + return Failed("传入参数为空!"); + } + + foreach (var item in MesDownLoadPlanList) + { + + if (item.RecipeID == "") + { + return Failed("传入参数为空!"); + } + var result = await _hw_WarehouseService.InsertXLPlanInfo(DateTime.Now, item.RecipeID, item.Batch, item.ProductName); + if (result) + { + iFlag = iFlag + 1; + } + } + + if (iFlag == MesDownLoadPlanList.Count) { - return Success(result); + return Success(true); } + ////配方名或配方编号 + //string ss1 = "a82d016e813c4ac3bca0244c519da591"; + ////批次号 + //string ss2 = "2408090522"; + ////产品名称 + //var ss3 = "D1-813"; + + } catch (Exception ex) { @@ -174,19 +198,21 @@ namespace Admin.Core.Api.Controllers.Business /// /// [HttpGet] - public async Task> GetWeight(string WeightNo) + public async Task>> GetWeight() { - if (!WeightNo.IsNotEmptyOrNull()) - { - return Failed("传入参数为空!"); - } - var result = await _hw_WarehouseService.RealWeightInfo(WeightNo); - if (result != "") + //if (!WeightNo.IsNotEmptyOrNull()) + //{ + // return Failed("传入参数为空!"); + //} + //var result = await _hw_WarehouseService.RealWeightInfo(WeightNo); + var result = await _hw_WarehouseService.GetPlanWeightInfo(); + if (result != null) { return Success(result,"成功"); } - return Failed("执行失败!"); + return Failed>("执行失败!"); } + #endregion #region 查询反应釜计划 diff --git a/Admin.Core.IRepository/IRepository_New/IXLPlan_weightRepository.cs b/Admin.Core.IRepository/IRepository_New/IXLPlan_weightRepository.cs new file mode 100644 index 0000000..3a4719a --- /dev/null +++ b/Admin.Core.IRepository/IRepository_New/IXLPlan_weightRepository.cs @@ -0,0 +1,17 @@ +using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.IRepository +{ + /// + /// Ixl_planRepository + /// + public interface IXLPlan_weightRepository : IBaseRepository + { + Task> GetPlanWeightList(); + + + } +} \ No newline at end of file diff --git a/Admin.Core.IService/IService_New/IHw_WarehouseServices.cs b/Admin.Core.IService/IService_New/IHw_WarehouseServices.cs index 6039138..b33be7a 100644 --- a/Admin.Core.IService/IService_New/IHw_WarehouseServices.cs +++ b/Admin.Core.IService/IService_New/IHw_WarehouseServices.cs @@ -21,5 +21,7 @@ namespace Admin.Core.IService Task> GetWarehousePlan(string code); Task InsertXLPlanInfo(DateTime planDate, string recipeGUID, string batch, string productName); + + Task> GetPlanWeightInfo(); } } \ No newline at end of file diff --git a/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs b/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs new file mode 100644 index 0000000..aef3dff --- /dev/null +++ b/Admin.Core.Model/ViewModels/MesDownLoadPlanList.cs @@ -0,0 +1,19 @@ +namespace Admin.Core.Model.ViewModels; + +public class MesDownLoadPlanList +{ + /// + /// 配方编号 + /// + public string RecipeID { get; set; } + + /// + /// 批次号 + /// + public string Batch { get; set; } + + /// + /// 产品名称 + /// + public string ProductName { get; set; } +} \ No newline at end of file diff --git a/Admin.Core.Model/ViewModels/XLPlanWeightView.cs b/Admin.Core.Model/ViewModels/XLPlanWeightView.cs new file mode 100644 index 0000000..ab0615b --- /dev/null +++ b/Admin.Core.Model/ViewModels/XLPlanWeightView.cs @@ -0,0 +1,76 @@ +namespace Admin.Core.Model.ViewModels; + +public class XLPlanWeightView +{ + /// + /// 计划ID + /// + public string Batch { get; set; } + + /// + /// 计划ID + /// + public string ProductName { get; set; } + + /// + /// 计划ID + /// + public string Plan_Id { get; set; } + + /// + /// 计划ID + /// + public string Recipe_Name { get; set; } + + /// + /// 计划ID + /// + public string Bin_Code { get; set; } + + /// + /// 计划ID + /// + public string Plan_StateText { get; set; } + + /// + /// 计划ID + /// + public string Plan_Num { get; set; } + + /// + /// 计划ID + /// + public string Real_Num { get; set; } + + /// + /// 计划ID + /// + public string Start_Date { get; set; } + + /// + /// 计划ID + /// + public string End_Date { get; set; } + + + /// + /// 计划ID + /// + public string Total_Weight { get; set; } + + /// + /// 计划ID + /// + public string Total_Error { get; set; } + + + /// + /// 计划ID + /// + public string Plan_TotalWeight { get; set; } + + /// + /// 计划ID + /// + public string Plan_TotalError { get; set; } +} \ No newline at end of file diff --git a/Admin.Core.Repository/Repository_New/XLPlan_weightRepository.cs b/Admin.Core.Repository/Repository_New/XLPlan_weightRepository.cs new file mode 100644 index 0000000..4318033 --- /dev/null +++ b/Admin.Core.Repository/Repository_New/XLPlan_weightRepository.cs @@ -0,0 +1,30 @@ +using Admin.Core.IRepository; +using Admin.Core.Model; +using Admin.Core.Model.ViewModels; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Admin.Core.Repository +{ + /// + /// LR_weighRepository + /// + public class XLPlan_weightRepository : BaseRepository, IXLPlan_weightRepository + { + public XLPlan_weightRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + + } + public async Task> GetPlanWeightList() + { + string sql = @" select t.Batch,t.ProductName,t.Plan_Id,t.Recipe_Name,o.Bin_Code,t.Plan_StateText,t.Plan_Num,t.Real_Num,t.Start_Date,t.End_Date,t.Total_Weight,t.Total_Error,p.Total_Weight Plan_TotalWeight ,p.Total_Error Plan_TotalError from (select p.Batch,p.ProductName, p.Plan_Id,p.Recipe_ID,p.Recipe_Name,p.Version,p.Plan_StateText,p.Plan_Num,p.Real_Num,p.Start_Date,p.Weight_Man,r.Total_Weight,Total_Error,case when IsRetransmission=0 then '是' when IsRetransmission=1 then '否' when IsRetransmission is null then '否' end as IsRetransmission,(CASE WHEN p.End_Date IS NULL THEN GETDATE() ELSE p.End_Date END) End_Date from xl_plan p left join xl_recipe r on p.Recipe_ID=r.ID) t left join ( select t1.Plan_ID,t2.Bin_Code from LR_weigh t1 left join dbo.Pmt_Bin t2 on t1.Bin_Serial = t2.Bin_Serial) o on t.Plan_Id = o.Plan_ID left join ( select ID,Dosing_Id,Plan_Id, Real_Num,SUM(Total_Weight) as Total_Weight,SUM(Total_Error) as Total_Error from LR_plan group by ID,Dosing_Id,Plan_Id, Real_Num,Total_Weight,Total_Error ) p on t.Plan_Id=p.Plan_Id WHERE 1=1 and Plan_StateText = '已完成' and Recipe_Name != '产前检测'"; + + var r = await Db.Ado.SqlQueryAsync(sql); + if (r != null) { return r; } + else + { + return null; + } + } + } +} \ No newline at end of file diff --git a/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs b/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs index 3d6dac0..6915a25 100644 --- a/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs +++ b/Admin.Core.Service/Service_New/Hw_WarehouseServices.cs @@ -31,11 +31,12 @@ namespace Admin.Core.Service private readonly ILR_weighRepository _lrWeighRepository; private readonly Ixl_planRepository _planRepository;//小料计划 + private readonly IXLPlan_weightRepository _XLPlan_weightRepository; public Hw_WarehouseServices(IBaseRepository dal, IHw_WarehouseRepository wareHouse, IHw_WareHouse_SubRepository wareHouse_Sub, IHw_FeedReportRepository feed, IHw_BarrelRepository barrel, Ixl_materialRepository materialRepository, - Ixl_recipeRepository recipeRepository, ILR_weighRepository lrWeighRepository, Ixl_planRepository planRepository) + Ixl_recipeRepository recipeRepository, ILR_weighRepository lrWeighRepository, Ixl_planRepository planRepository, IXLPlan_weightRepository IXLPlan_weightRepository, IXLPlan_weightRepository xLPlan_weightRepository) { this._dal = dal; base.BaseDal = dal; @@ -47,6 +48,7 @@ namespace Admin.Core.Service _recipeRepository = recipeRepository; _lrWeighRepository = lrWeighRepository; _planRepository = planRepository; + _XLPlan_weightRepository = xLPlan_weightRepository; } #region 扫描桶二维码,获取绑定的小料配方物料 @@ -222,6 +224,12 @@ namespace Admin.Core.Service int shiftID = 1; //根据配方编号查询 var recipe = await _recipeRepository.FirstAsync(d => d.Recipe_Verify == 1 && d.ID == recipeGUID); + if (recipe == null) + { + recipe.ID = recipeGUID; + recipe.Recipe_Name = recipeGUID; + recipe.Version = "1"; + } int rtPlanSNum = GetNextSerialNumAsync(); //xl_plan序号 //int lrPlanSNum = GetNextSerialNumFromLRPlan(planDate); //LR_Plan序号 @@ -232,7 +240,6 @@ namespace Admin.Core.Service Equip_Code = "01", Dosing_Id = 0, Plan_Id = planID, - Batch = batch, ProductName= productName, Plan_Serial = rtPlanSNum, @@ -247,11 +254,11 @@ namespace Admin.Core.Service Plan_Num = 1, Real_Num = 0, Duration_Time = 0, - Start_Date = DateTime.Now.ToString("yyyy-mm-dd hh:MM:ss"), Plan_State = 5, Plan_StateText = "未启动", Plan_Date = DateTime.Now.ToString("yyyy-mm-dd"), IF_FLAG = 1, + }; var result = await _planRepository.Add(xl_plan); if (result == 1) @@ -412,6 +419,23 @@ namespace Admin.Core.Service } } + public async Task> GetPlanWeightInfo() + { + try + { + List XLPlanWeightView = await _XLPlan_weightRepository.GetPlanWeightList(); + if (XLPlanWeightView != null) + { + return XLPlanWeightView; + } + return XLPlanWeightView; + } + catch (Exception ex) + { + return null; + } + } + /// /// 投料口开/投料口关