修改称量信息上传接口;新增计划下发接口

dep_wangsr
CaesarBao 5 months ago
parent 403efae2aa
commit 4f66f0d671

@ -423,7 +423,7 @@
<param name="state"></param>
<returns></returns>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.GetWeight(System.String)">
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.GetWeight">
<summary>
查询称量重量
</summary>

@ -4582,6 +4582,21 @@
投料整包完整信息
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.RecipeID">
<summary>
配方编号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Batch">
<summary>
批次号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.ProductName">
<summary>
产品名称
</summary>
</member>
<member name="T:Admin.Core.Model.ViewModels.PlanView">
<summary>
拉缸、泵查询参数
@ -5251,5 +5266,75 @@
设置误差
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Batch">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.ProductName">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Plan_Id">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Recipe_Name">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Bin_Code">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Plan_StateText">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Plan_Num">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Real_Num">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Start_Date">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.End_Date">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Total_Weight">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Total_Error">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Plan_TotalWeight">
<summary>
计划ID
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.XLPlanWeightView.Plan_TotalError">
<summary>
计划ID
</summary>
</member>
</members>
</doc>

@ -126,19 +126,43 @@ namespace Admin.Core.Api.Controllers.Business
return Failed<bool>("执行失败!");
}
[HttpGet]
public async Task<MessageModel<bool>> DownLoadplanInfo()
[HttpPost]
public async Task<MessageModel<bool>> DownLoadplanInfo([FromBody] List<MesDownLoadPlanList> 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<bool>("传入参数为空!");
}
foreach (var item in MesDownLoadPlanList)
{
if (item.RecipeID == "")
{
return Failed<bool>("传入参数为空!");
}
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
/// <param name="WeightNo"></param>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<string>> GetWeight(string WeightNo)
public async Task<MessageModel<List<XLPlanWeightView>>> GetWeight()
{
if (!WeightNo.IsNotEmptyOrNull())
{
return Failed<string>("传入参数为空!");
}
var result = await _hw_WarehouseService.RealWeightInfo(WeightNo);
if (result != "")
//if (!WeightNo.IsNotEmptyOrNull())
//{
// return Failed<string>("传入参数为空!");
//}
//var result = await _hw_WarehouseService.RealWeightInfo(WeightNo);
var result = await _hw_WarehouseService.GetPlanWeightInfo();
if (result != null)
{
return Success(result,"成功");
}
return Failed<string>("执行失败!");
return Failed<List<XLPlanWeightView>>("执行失败!");
}
#endregion
#region 查询反应釜计划

@ -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
{
/// <summary>
/// Ixl_planRepository
/// </summary>
public interface IXLPlan_weightRepository : IBaseRepository<XLPlanWeightView>
{
Task<List<XLPlanWeightView>> GetPlanWeightList();
}
}

@ -21,5 +21,7 @@ namespace Admin.Core.IService
Task<List<string>> GetWarehousePlan(string code);
Task<bool> InsertXLPlanInfo(DateTime planDate, string recipeGUID, string batch, string productName);
Task<List<XLPlanWeightView>> GetPlanWeightInfo();
}
}

@ -0,0 +1,19 @@
namespace Admin.Core.Model.ViewModels;
public class MesDownLoadPlanList
{
/// <summary>
/// 配方编号
/// </summary>
public string RecipeID { get; set; }
/// <summary>
/// 批次号
/// </summary>
public string Batch { get; set; }
/// <summary>
/// 产品名称
/// </summary>
public string ProductName { get; set; }
}

@ -0,0 +1,76 @@
namespace Admin.Core.Model.ViewModels;
public class XLPlanWeightView
{
/// <summary>
/// 计划ID
/// </summary>
public string Batch { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Plan_Id { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Recipe_Name { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Bin_Code { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Plan_StateText { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Plan_Num { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Real_Num { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Start_Date { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string End_Date { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Total_Weight { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Total_Error { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Plan_TotalWeight { get; set; }
/// <summary>
/// 计划ID
/// </summary>
public string Plan_TotalError { get; set; }
}

@ -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
{
/// <summary>
/// LR_weighRepository
/// </summary>
public class XLPlan_weightRepository : BaseRepository<XLPlanWeightView>, IXLPlan_weightRepository
{
public XLPlan_weightRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public async Task<List<XLPlanWeightView>> 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<XLPlanWeightView>(sql);
if (r != null) { return r; }
else
{
return null;
}
}
}
}

@ -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<Hw_Warehouse> 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<List<XLPlanWeightView>> GetPlanWeightInfo()
{
try
{
List<XLPlanWeightView> XLPlanWeightView = await _XLPlan_weightRepository.GetPlanWeightList();
if (XLPlanWeightView != null)
{
return XLPlanWeightView;
}
return XLPlanWeightView;
}
catch (Exception ex)
{
return null;
}
}
/// <summary>
/// 投料口开/投料口关

Loading…
Cancel
Save