更新代码

main
SoulStar 1 month ago
parent 8e16a72a7e
commit 0537ee5434

@ -405,7 +405,12 @@
称重服务类
</summary>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.#ctor(Admin.Core.IService.IHw_WarehouseServices,Admin.Core.IService.ISys.ISysUserService,Admin.Core.IService.IService_New.IHw_BarrelServices,Admin.Core.IService.ILR_weighServices)">
<member name="F:Admin.Core.Api.Controllers.Business.WarehouseController._binFeedingReportServices">
<summary>
料仓投料验证服务类
</summary>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.#ctor(Admin.Core.IService.IHw_WarehouseServices,Admin.Core.IService.ISys.ISysUserService,Admin.Core.IService.IService_New.IHw_BarrelServices,Admin.Core.IService.ILR_weighServices,Admin.Core.IService.IBinFeedingReportServices)">
<summary>
构造方法
</summary>
@ -470,7 +475,7 @@
<summary>
根据罐号查询称量列表
</summary>
<param name="barrelID"></param>
<param name="barrelBarcode"></param>
<returns></returns>
</member>
<member name="T:Admin.Core.Api.SeedController">

@ -4619,6 +4619,81 @@
产品名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.BinId">
<summary>
物料所属料仓
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Material_Code">
<summary>
物料编码二维码
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.MaterialName">
<summary>
物料名称
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.MaterialType">
<summary>
物料类型:整包、尾料、溶剂
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.SetWeight">
<summary>
重量
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.SetError">
<summary>
误差值
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Difference">
<summary>
工装区分,相同值代表在一个料桶中
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Fixed">
<summary>
是否有固含 1为有0没有
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.FixedRatio">
<summary>
固含率
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.PumpCode">
<summary>
泵条码
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Weighbridge">
<summary>
地磅
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Recipe">
<summary>
配方号
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.Tare">
<summary>
皮重
</summary>
</member>
<member name="P:Admin.Core.Model.ViewModels.MesDownLoadPlanList.MainId">
<summary>
反应釜编号
</summary>
</member>
<member name="T:Admin.Core.Model.ViewModels.PlanView">
<summary>
拉缸、泵查询参数

@ -18,6 +18,7 @@ using NPOI.SS.Formula.Functions;
using TouchSocket.Core;
using System.Numerics;
using Admin.Core.IService.IService_New;
using Admin.Core.Model.Model_New;
namespace Admin.Core.Api.Controllers.Business
{
@ -51,6 +52,11 @@ namespace Admin.Core.Api.Controllers.Business
/// </summary>
private readonly ILR_weighServices _lr_weighService;
/// <summary>
/// 料仓投料验证服务类
/// </summary>
private readonly IBinFeedingReportServices _binFeedingReportServices;
#region 构造方法
/// <summary>
/// 构造方法
@ -59,12 +65,13 @@ namespace Admin.Core.Api.Controllers.Business
/// <param name="sysUserService"></param>
/// <param name="hwBarrelService"></param>
/// <param name="lrweighService"></param>
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService, IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService) : base(sysUserService)
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService, IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService, IBinFeedingReportServices binFeedingReportServices) : base(sysUserService)
{
_sysUserService = sysUserService;
_hw_WarehouseService = hw_WarehouseServices;
_hw_BarrelService = hwBarrelService;
_lr_weighService = lrweighService;
_binFeedingReportServices = binFeedingReportServices;
}
#endregion
@ -162,30 +169,30 @@ namespace Admin.Core.Api.Controllers.Business
if (result1.Contains("成功"))
{
if (result2.Contains("成功"))
{
if (result3.Contains("成功"))
{
return Success(true);
{
if (result2.Contains("成功"))
{
if (result3.Contains("成功"))
{
return Success(true);
}
else
{
return Failed<bool>(result3 + "执行失败!");
else
{
return Failed<bool>(result3 + "执行失败!");
}
}
else
{
return Failed<bool>(result2 + "执行失败!");
}
}
else
{
return Failed<bool>(result1 + "执行失败!");
else
{
return Failed<bool>(result2 + "执行失败!");
}
}
else
{
return Failed<bool>(result1 + "执行失败!");
}
////配方名或配方编号
////配方名或配方编号
//string ss1 = "a82d016e813c4ac3bca0244c519da591";
////批次号
//string ss2 = "2408090522";
@ -198,7 +205,7 @@ namespace Admin.Core.Api.Controllers.Business
{
return Failed<bool>(ex.Message + "执行失败!");
}
return Failed<bool>("执行失败!");
return Failed<bool>("执行失败!");
}
@ -270,27 +277,39 @@ namespace Admin.Core.Api.Controllers.Business
/// <summary>
/// 根据罐号查询称量列表
/// </summary>
/// <param name="barrelID"></param>
/// <param name="barrelBarcode"></param>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<List<LR_weigh>>> GetWeightInfoByBarrelID(string barrelBarcode)
public async Task<MessageModel<List<LR_weigh_BatchCode>>> GetWeightInfoByBarrelID(string barrelBarcode)
{
if (!barrelBarcode.IsNotEmptyOrNull())
{
return Failed<List<LR_weigh>>("传入参数为空!");
return Failed<List<LR_weigh_BatchCode>>("传入参数为空!");
}
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
string planID = _hw_BarrelService.GetPlanIdByBarrelID(barrelBarcode.Trim());
if (string.IsNullOrEmpty(planID))
{
return Failed<List<LR_weigh>>("查询不到罐号对应的计划ID!");
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号对应的计划ID!");
}
if (planID == "-1")
{
return Failed<List<LR_weigh_BatchCode>>("查询不到罐号!");
}
List<LR_weigh> wlist = _lr_weighService.GetRecentWeightList(planID);
List<LR_weigh_BatchCode> list = new List<LR_weigh_BatchCode>();
foreach (LR_weigh weigh in wlist)
{
LR_weigh_BatchCode record = new LR_weigh_BatchCode();
record.WeightData = weigh;
record.BatchCode = _binFeedingReportServices.GetBatchNumberByMaterialAndBinID(weigh.Material_ID, weigh.Bin_Serial ?? -1);
list.Add(record);
}
List<LR_weigh> list = _lr_weighService.GetRecentWeightList(planID);
if (list != null)
{
return Success(list);
}
return Failed<List<LR_weigh>>("执行失败!");
return Failed<List<LR_weigh_BatchCode>>("执行失败!");
}
}

@ -61,7 +61,7 @@ namespace Admin.Core.Api.PLTBusiness
//执行任务
//log.Info($"{DateTime.Now}");
if (_tokenExpirationTime == 0)
if (_tokenExpirationTime <= 0)
{
if (await GetToken())
{
@ -122,7 +122,7 @@ namespace Admin.Core.Api.PLTBusiness
{
{"pageIndex", 200},
{"pageSize", 0},
{"orgCode", "Mesnac"},
{"orgCode", "01"},
};
try
{
@ -174,7 +174,7 @@ namespace Admin.Core.Api.PLTBusiness
{
{"pageIndex", 200},
{"pageSize", 0},
{"orgCode", "Mesnac"},
{"orgCode", "01"},
};
try
{
@ -222,9 +222,9 @@ namespace Admin.Core.Api.PLTBusiness
{
Dictionary<string, string> _tokenDictionary = new Dictionary<string, string>()
{
{"authCode", "QT_XXX"},
{"appid", "q7cloud_XXX"},
{"secret", "f434eab8b9652524dc719e33f4ff255a45570XXX"}
{"authCode", "QT_U9C"},
{"appid", "q7cloud_e68b20"},
{"secret", "f5137d6b53968fcbb95948f00cfce81bd8400ffa"}
};
try

@ -38,7 +38,7 @@ namespace Admin.Core.Api.PLTBusiness
foreach (var mesMaterial in list)
{
// Step 3: 在B表中查询是否存在相同ID的记录
var material = await _xl_materialService.SelectXlMaterialById(mesMaterial.id.ToString());
xl_material material = await _xl_materialService.SelectXlMaterialById(mesMaterial.id.ToString());
if (material == null)
{

@ -8,5 +8,6 @@ namespace Admin.Core.IService
/// </summary>
public interface IBinFeedingReportServices :IBaseServices<BinFeedingReport>
{
string GetBatchNumberByMaterialAndBinID(string materialID, int binID);
}
}

@ -9,96 +9,96 @@ namespace Admin.Core.Model
///<summary>
///
///</summary>
[SugarTable( "BinFeedingReport", "admin_sqlite")]
[SugarTable("Hw_BinTypeErrorPreventionReport", "admin_sqlite")]
public class BinFeedingReport
{
public BinFeedingReport()
{
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey=true,IsIdentity=true)]
public int ID { get; set; }
/// <summary>
/// Desc:料仓主键
/// Default:
/// Nullable:True
/// </summary>
public int? BinID { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:True
/// </summary>
public string Bin_Name { get; set; }
/// <summary>
/// Desc:条码
/// Default:
/// Nullable:True
/// </summary>
public string Bin_Code { get; set; }
/// <summary>
/// Desc:批次
/// Default:
/// Nullable:True
/// </summary>
public string Batch { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:True
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// Desc:物料ID
/// Default:
/// Nullable:True
/// </summary>
public string MaterialID { get; set; }
/// <summary>
/// Desc:物料名称
/// Default:
/// Nullable:True
/// </summary>
public string MaterialName { get; set; }
/// <summary>
/// Desc:条码
/// Default:
/// Nullable:True
/// </summary>
public string Material_Code { get; set; }
/// <summary>
/// Desc:存货编码
/// Default:
/// Nullable:True
/// </summary>
public string Material_InventoryCode { get; set; }
/// <summary>
/// Desc:批次号
/// Default:
/// Nullable:True
/// </summary>
public string Material_BatchNumber { get; set; }
/// <summary>
/// Desc:流水号
/// Default:
/// Nullable:True
/// </summary>
public string Material_SerialCode { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// Desc:完整二维码
/// Default:
/// Nullable:True
/// </summary>
public string BarCodeStr { get; set; }
public BinFeedingReport()
{
}
/// <summary>
/// Desc:
/// Default:
/// Nullable:False
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public int ID { get; set; }
/// <summary>
/// Desc:料仓主键
/// Default:
/// Nullable:True
/// </summary>
public int? BinID { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:True
/// </summary>
public string Bin_Name { get; set; }
/// <summary>
/// Desc:条码
/// Default:
/// Nullable:True
/// </summary>
public string Bin_Code { get; set; }
/// <summary>
/// Desc:批次
/// Default:
/// Nullable:True
/// </summary>
public string Batch { get; set; }
/// <summary>
/// Desc:名称
/// Default:
/// Nullable:True
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// Desc:物料ID
/// Default:
/// Nullable:True
/// </summary>
public string MaterialID { get; set; }
/// <summary>
/// Desc:物料名称
/// Default:
/// Nullable:True
/// </summary>
public string MaterialName { get; set; }
/// <summary>
/// Desc:条码
/// Default:
/// Nullable:True
/// </summary>
public string Material_Code { get; set; }
/// <summary>
/// Desc:存货编码
/// Default:
/// Nullable:True
/// </summary>
public string Material_InventoryCode { get; set; }
/// <summary>
/// Desc:批次号
/// Default:
/// Nullable:True
/// </summary>
public string Material_BatchNumber { get; set; }
/// <summary>
/// Desc:流水号
/// Default:
/// Nullable:True
/// </summary>
public string Material_SerialCode { get; set; }
/// <summary>
/// Desc:创建时间
/// Default:
/// Nullable:True
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// Desc:完整二维码
/// Default:
/// Nullable:True
/// </summary>
public string BarCodeStr { get; set; }
}
}

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Admin.Core.Model.Model_New
{
public class LR_weigh_BatchCode
{
public LR_weigh WeightData { get; set; }
public string BatchCode { get; set; }
}
}

@ -17,23 +17,79 @@ public class MesDownLoadPlanList
/// </summary>
public string ProductName { get; set; }
/// <summary>
/// 物料所属料仓
/// </summary>
public string BinId { get; set; }
/// <summary>
/// 物料编码二维码
/// </summary>
public string Material_Code { get; set; }
/// <summary>
/// 物料名称
/// </summary>
public string MaterialName { get; set; }
/// <summary>
/// 物料类型:整包、尾料、溶剂
/// </summary>
public string MaterialType { get; set; }
/// <summary>
/// 重量
/// </summary>
public string SetWeight { get; set; }
/// <summary>
/// 误差值
/// </summary>
public string SetError { get; set; }
/// <summary>
/// 工装区分,相同值代表在一个料桶中
/// </summary>
public string Difference { get; set; }
/// <summary>
/// 是否有固含 1为有0没有
/// </summary>
public string Fixed { get; set; }
/// <summary>
/// 固含率
/// </summary>
public string FixedRatio { get; set; }
/// <summary>
/// 泵条码
/// </summary>
public string PumpCode { get; set; }
/// <summary>
/// 地磅
/// </summary>
public string Weighbridge { get; set; }
/// <summary>
/// 配方号
/// </summary>
public string Recipe { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 皮重
/// </summary>
public string Tare { get; set; }
/// <summary>
/// 反应釜编号
/// </summary>
public string MainId { get; set; }

@ -2,6 +2,11 @@
using Admin.Core.Service;
using Admin.Core.IService;
using Admin.Core.Model;
using System.Linq;
using System.Collections.Generic;
using System;
using log4net.Repository.Hierarchy;
using Serilog;
namespace Admin.Core.Service
{
@ -13,5 +18,25 @@ namespace Admin.Core.Service
this._dal = dal;
base.BaseDal = dal;
}
/// <summary>
/// 获取批次号
/// </summary>
/// <param name="materialID"></param>
/// <param name="binID"></param>
/// <returns></returns>
public string GetBatchNumberByMaterialAndBinID(string materialID, int binID)
{
try
{
BinFeedingReport record = _dal.Query(x => x.MaterialID == materialID && x.BinID == binID).OrderBy(x => x.CreateTime).LastOrDefault();
return record != null ? record.Material_BatchNumber : string.Empty;
}
catch(Exception ex)
{
Log.Error($"获取批次号发生错误:{ex.Message}");
return string.Empty;
}
}
}
}

@ -2,6 +2,7 @@
using Admin.Core.IService;
using Admin.Core.IService.IService_New;
using Admin.Core.Model;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
@ -24,12 +25,13 @@ namespace Admin.Core.Service.Service_New
{
try
{
string planId = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().PlanId.ToString();
string planId = _dal.Query(x => x.BarCode == barrelBarcode).FirstOrDefault().PlanId;
return planId;
}
catch
catch(Exception ex)
{
throw;
Log.Error($"获取计划ID错误{ex}");
return "-1";
}
}
}

@ -284,7 +284,7 @@ namespace Admin.Core.Service
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
sb.MainId = int.Parse(a.MainId);
sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.MaterialID = a.Material_Code;
@ -492,7 +492,7 @@ namespace Admin.Core.Service
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
sb.MainId = int.Parse(a.MainId);
sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.MaterialID = a.Material_Code;
@ -685,7 +685,7 @@ namespace Admin.Core.Service
list.ForEach((a) =>
{
Hw_WareHouse_Sub sb = new Hw_WareHouse_Sub();
sb.MainId = int.Parse(a.MainId);
sb.MainId = int.TryParse(a.MainId, out int value) ? value : throw new Exception("MainID格式错误请传入int类型的反应釜编号");
sb.PId = a.PId;
sb.ProductName = a.ProductName;
sb.BinId = a.BinId == "" || a.BinId == null ? 0 : int.Parse(a.BinId);
@ -763,7 +763,7 @@ namespace Admin.Core.Service
throw new Exception("未查询到对应料仓!");
}
var binInfo = await _binRepository.FirstAsync(d => d.Bin_Serial == sub.BinId && d.Material_ID == obj.ID);
Pmt_Bin binInfo = await _binRepository.FirstAsync(d => d.Bin_Serial == sub.BinId && d.Material_ID == obj.ID);
if (binInfo == null)
{
throw new Exception("未查询到对应料仓!");
@ -1175,7 +1175,7 @@ namespace Admin.Core.Service
}
var s7 = PlcConnect.Instance;
var result = s7.Write(name, short.Parse(state.ToString()));//反应釜点位
log.Error($"反应釜开启点位状态:{result.IsSuccess},返回信息:{result.Message}");
log.Info($"反应釜开启点位状态:{result.IsSuccess},返回信息:{result.Message}");
if (result.IsSuccess)
{
return result.IsSuccess;

Loading…
Cancel
Save