dep_wangsr
liulb@mesnac.com 1 year ago
parent c15b174660
commit 0f649ed106

@ -271,7 +271,7 @@
</member>
<member name="T:Admin.Core.Api.xl_materialController">
<summary>
小料料仓类型差错
小料料仓类型差错
</summary>
</member>
<member name="F:Admin.Core.Api.xl_materialController._xl_materialService">
@ -389,11 +389,12 @@
<param name="code">桶条码</param>
<returns></returns>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.GetByCode(System.String)">
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.GetByCode(System.String,System.String)">
<summary>
根据条码查询投料釜设置的物料
</summary>
<param name="code">投料釜条码</param>
<param name="planId">计划Id</param>
<returns></returns>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.ExecPlcState(Admin.Core.Model.ViewModels.KettleView)">
@ -403,6 +404,12 @@
<param name="view">json 对象</param>
<returns></returns>
</member>
<member name="M:Admin.Core.Api.Controllers.Business.WarehouseController.GetWarehousePlan(System.String)">
<summary>
查询反应釜计划
</summary>
<returns></returns>
</member>
<member name="T:Admin.Core.Api.SeedController">
<summary>
Controller代码生成

@ -362,6 +362,11 @@
Nullable:True
</summary>
</member>
<member name="P:Admin.Core.Model.Hw_BinAlarm.TypeName">
<summary>
类型
</summary>
</member>
<member name="T:Admin.Core.Model.Hw_BinTypeErrorPreventionReport">
<summary>

@ -15,7 +15,7 @@ using log4net;
namespace Admin.Core.Api
{
/// <summary>
/// 小料料仓类型差错
/// 小料料仓类型差错
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
@ -206,6 +206,7 @@ namespace Admin.Core.Api
/// </summary>
/// <returns></returns>
[HttpGet]
[Obsolete("废弃")]
public async Task<MessageModel<List<AllXlPlanView>>> GetXlPlanInfo()
{
MessageModel<List<AllXlPlanView>> message=new MessageModel<List<AllXlPlanView>>();

@ -36,7 +36,7 @@ namespace Admin.Core.Api
{
_sysUserService = sysUserService;
this._solventServices = solventServices;
}
}
#endregion
#region 拉缸验证物料
@ -44,16 +44,16 @@ namespace Admin.Core.Api
/// 根据拉缸条码查询物料
/// </summary>
/// <param name="code">缸条码</param>
/// <param name="weighbridge">地磅名称1号地磅|2号地磅</param>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<WaitePlanView>> GetByCylinderInfo(string code)
public async Task<MessageModel<WaitePlanView>> GetByCylinderInfo(string code,string weighbridge)
{
string weighbridge = "1号地磅";
if (!code.IsNotEmptyOrNull())
{
return Failed<WaitePlanView>("传入参数为空!");
}
var query = await _solventServices.GetByCylinderCode(code.Trim(),weighbridge);
var query = await _solventServices.GetByCylinderCode(code.Trim(),weighbridge.Trim());
if (query == null)
{
return Failed<WaitePlanView>("查询失败!");
@ -142,6 +142,7 @@ namespace Admin.Core.Api
/// </summary>
/// <returns></returns>
[HttpGet]
[Obsolete("废弃")]
public async Task<MessageModel<List<SolventPlanView>>> GetSolventPlanInfo()
{
MessageModel<List<SolventPlanView>> message = new MessageModel<List<SolventPlanView>>();

@ -32,7 +32,6 @@ namespace Admin.Core.Api.Controllers.Business
//25kg物料重量
#endregion
/// <summary>
/// 投料仓服务
/// </summary>
@ -49,23 +48,6 @@ namespace Admin.Core.Api.Controllers.Business
_hw_WarehouseService = hw_WarehouseServices;
}
#region 获取反应釜所有计划号
///// <summary>
///// 获取反应釜所有计划号
///// </summary>
///// <returns></returns>
//[HttpGet]
//public async Task<MessageModel<List<string>>> GetAllPlan()
//{
// var query = await _hw_WarehouseService.GetPlan();
// if (query == null)
// {
// return Failed<List<string>>("未查询到计划号!");
// }
// return Success(query);
//}
#endregion
#region 扫描料桶条码 获取桶绑定物料信息
/// <summary>
/// 扫描料桶条码 获取桶绑定物料信息
@ -93,16 +75,21 @@ namespace Admin.Core.Api.Controllers.Business
/// 根据条码查询投料釜设置的物料
/// </summary>
/// <param name="code">投料釜条码</param>
/// <param name="planId">计划Id</param>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<WarehouseView>> GetByCode(string code)
public async Task<MessageModel<WarehouseView>> GetByCode(string code,string planId)
{
if (!code.IsNotEmptyOrNull())
{
return Failed<WarehouseView>("传入参数为空!");
return Failed<WarehouseView>("传入物料编码参数为空!");
}
if (!planId.IsNotEmptyOrNull())
{
return Failed<WarehouseView>("传入计划ID参数为空");
}
var query = await _hw_WarehouseService.QueryByCode(code.Trim());
var query = await _hw_WarehouseService.QueryByCode(code.Trim(), planId);
if (query==null)
{
@ -134,5 +121,29 @@ namespace Admin.Core.Api.Controllers.Business
}
#endregion
#region 查询反应釜计划
/// <summary>
/// 查询反应釜计划
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<MessageModel<List<string>>> GetWarehousePlan(string code)
{
MessageModel<List<string>> messageModel = new MessageModel<List<string>>();
List<string> list = await _hw_WarehouseService.GetWarehousePlan(code);
if (list == null)
{
messageModel.success = false;
messageModel.msg = "未查询到数据";
return messageModel;
}
messageModel.success = true;
messageModel.data = list;
return Success(list);
}
#endregion
}
}

@ -82,7 +82,7 @@
"Enabled": true,
"HitRate": 50,
//"Connection": "Server=127.0.0.1;Port=5432;User Id=postgres;Password=postgres;Database=Admin.Core;",
"Connection": "Data Source=localhost;Initial Catalog=cwss_xl;User ID=sa;Password=haiwei@123;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
"Connection": "Data Source=localhost;Initial Catalog=cwss_xl;User ID=sa;Password=sa;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"Connection": "Data Source=.;Initial Catalog=RCEP_Market;User ID=sa;Password=Password01!;Integrated Security=false;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//"Connection": "db/hw.db",

@ -15,7 +15,7 @@ namespace Admin.Core.Extensions
public static class QuartzJobMildd
{
private static readonly ILog log = LogManager.GetLogger(typeof(QuartzJobMildd));
public static void UseQuartzJobMildd(this IApplicationBuilder app, ISysTasksQzService tasksQzService, ISchedulerCenter schedulerCenter)
public static async Task UseQuartzJobMildd(this IApplicationBuilder app, ISysTasksQzService tasksQzService, ISchedulerCenter schedulerCenter)
{
if (app == null) throw new ArgumentNullException(nameof(app));
@ -24,7 +24,7 @@ namespace Admin.Core.Extensions
if (Appsettings.app("Middleware", "QuartzNetJob", "Enabled").ObjToBool())
{
//**注意在此处查询《wpf异步查询不到改为同步》**
var allQzServices = tasksQzService.Query(x => x.DelFlag == false);
var allQzServices =await tasksQzService.QueryAsync(x => x.DelFlag == false);
foreach (var item in allQzServices)
{
if ((bool)item.IsStart)

@ -12,10 +12,9 @@ namespace Admin.Core.IService
/// </summary>
public interface IHw_WarehouseServices : IBaseServices<Hw_Warehouse>
{
Task<WarehouseView> QueryByCode(string code);
Task<WarehouseView> QueryByCode(string code,string planId);
Task<bool> UpdatePlcState(KettleView view);
Task<BarrelView> GetXlInfo(string code);
Task<List<string>> GetPlan();
Task<List<string>> GetWarehousePlan(string code);
}
}

@ -126,6 +126,14 @@ namespace Admin.Core.Model.ViewModels
/// <summary>
/// 地磅名称
/// </summary>
public string Weighbridge { get; set; }
public string Weighbridge { get; set; }
/// <summary>
/// 是否有固含
/// </summary>
public bool IsRate { get; set; }
/// <summary>
/// 固含率
/// </summary>
public double Rate { get; set; }
}
}

@ -103,5 +103,9 @@ namespace Admin.Core.Model.ViewModels
/// 待执行物料是否执行过
/// </summary>
public string MaterialPlan { get; set; }
/// <summary>
/// 是否有固含 1:有0:无
/// </summary>
public int IsRate { get; set; }
}
}

@ -98,6 +98,13 @@ namespace Admin.Core.PlcServer
/// <returns></returns>
bool WriteFloat(string address, float value);
/// <summary>
/// 写入double
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
/// <returns></returns>
bool Writedouble(string address, double value);
/// <summary>
/// 心跳使用——喂狗
/// </summary>
/// <param name="address"></param>

@ -429,6 +429,39 @@ namespace Admin.Core.PlcServer
}
#endregion
#region 写入double
/// <summary>
/// 写入byte
/// </summary>
/// <param name="address"></param>
/// <param name="bytes"></param>
/// <returns></returns>
public bool Writedouble(string address, double value)
{
bool iflag = false;
try
{
OperateResult write = siemensS7Net.Write(address, value);
if (write.IsSuccess)
{
iflag = true;
}
else
{
iflag = false;
}
}
catch (Exception ex)
{
log.Error("WriteByte方法异常" + ex.ToString());
iflag = false;
}
return iflag;
}
#endregion
#region 心跳使用——喂狗
@ -437,7 +470,7 @@ namespace Admin.Core.PlcServer
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public async Task<bool> Read(string address)
public async Task<bool> Read(string address)
{
try
{

@ -18,9 +18,9 @@ namespace Admin.Core.Repository
public async Task<List<WaitePlanView>> GetWaiteMaterial(string planId)
{
string sql = @"select w.Weight_Id MID,p.Plan_Id,p.Plan_Num,p.Real_Num,p.Plan_Serial,p.Plan_State,p.Plan_Date,p.Plan_StateText,r.ID as RecipeID,r.Recipe_Serial,r.Recipe_Name,r.Version,r.Recipe_Verify,r.Total_Weight,r.Total_Error,m.ID as MaterialID,m.Material_name,m.Material_code,w.Set_Weight,w.Set_Error,
hw.Plan_ID MaterialPlan from RT_plan p left join Pmt_recipe r on p.Recipe_ID=r.ID left join Pmt_weigh w on r.ID=w.Recipe_ID
hw.Plan_ID MaterialPlan,ISNULL(r.IsRate,0) as IsRate from RT_plan p left join Pmt_recipe r on p.Recipe_ID=r.ID left join Pmt_weigh w on r.ID=w.Recipe_ID
left join Pmt_material m on w.Material_ID=m.ID
left join Hw_weigh hw on hw.Material_ID=m.ID and p.Real_Num=hw.Dosing_ID where p.Plan_State=3 and p.Plan_Id=@Plan_Id ORDER BY w.Weight_Id";
left join Hw_weigh hw on hw.Material_ID=m.ID and p.Real_Num=hw.Dosing_ID where p.Plan_State=3 ORDER BY w.Weight_Id";
SugarParameter[] parameters = new SugarParameter[]
{

@ -21,6 +21,7 @@ namespace Admin.Core.Service
private readonly IHw_BarrelRepository _barrel;
private readonly Ixl_materialRepository _materialRepository;
private readonly Ixl_recipeRepository _recipeRepository;
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)
{
this._dal = dal;
@ -73,15 +74,14 @@ namespace Admin.Core.Service
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public async Task<WarehouseView> QueryByCode(string code)
public async Task<WarehouseView> QueryByCode(string code, string planId)
{
try
{
var list = await _wareHouse.QueryAsync();
if (list == null) return null;
Hw_Warehouse wh = list.FirstOrDefault(d => d.BarCode == code);
Hw_Warehouse wh = await _wareHouse.FirstAsync(d => d.BarCode == code);
if (wh == null) return null;
var sub = await _wareHouse_Sub.QueryAsync(d => d.MainId == wh.ID);
var sub = await _wareHouse_Sub.QueryAsync(d => d.MainId == wh.ID&& d.PId== planId);
if (sub == null) return null;
WarehouseView warehouseView = new WarehouseView()
{
@ -101,8 +101,6 @@ namespace Admin.Core.Service
return null;
}
}
#endregion
#region 更新PLC状态
@ -271,22 +269,15 @@ namespace Admin.Core.Service
/// 获取所有计划号
/// </summary>
/// <returns></returns>
public async Task<List<string>> GetPlan()
public async Task<List<string>> GetWarehousePlan(string code)
{
List<string> strList = new List<string>();
List<Hw_Warehouse> list = await _wareHouse.QueryAsync();
if (list.Count == 0) return null;
list.ForEach(d => {
if (!string.IsNullOrEmpty(d.PlanId))
{
strList.Add(d.PlanId);
}
});
return strList;
Hw_Warehouse wh = await _wareHouse.FirstAsync(d=>d.BarCode== code);
if (wh==null) return null;
var list = await _wareHouse_Sub.QueryAsync(d=>d.MainId== wh.ID);
var planList = (from d in list
select d.PId).Distinct();
return planList.ToList();
}
#endregion
}
}

@ -57,6 +57,7 @@ namespace Admin.Core.Service
if (view.Weighbridge == "1号地磅")
{
bool matCode = plcList.plc.WriteInt16("DB110.DBW400.0", "1");//执行启动
bool writeDouble = plcList.plc.Writedouble("DB110.DBW401.0", view.Rate);//传入固率
if (matCode)
{
Hw_SolventErrorPreventionReport report = new Hw_SolventErrorPreventionReport()
@ -327,39 +328,26 @@ namespace Admin.Core.Service
/// 拉缸查询
/// </summary>
/// <param name="code"></param>
/// <param name="weighbridge"></param>
/// <returns></returns>
public async Task<WaitePlanView> GetByCylinderCode(string code, string weighbridge)
{
try
{
var list = await _planRepository.GetDownLoadPlan(code, weighbridge);
if (list.Count == 0) return null;
var plan = list.FirstOrDefault();
var hwWeighList = await _hwWeighRepository.GetWaiteMaterial(plan.Plan_Id);
if (hwWeighList == null) return null;
var plcList = PlcHelper.siemensList.SingleOrDefault(d => d.EquipName.Equals("溶剂PLC"));
if (plcList.plc.IsConnected)
{
var list = await _planRepository.GetDownLoadPlan(code, weighbridge);
if (list.Count == 0) return null;
var plan = list.FirstOrDefault();
var hwWeighList = await _hwWeighRepository.GetWaiteMaterial(plan.Plan_Id);
if (hwWeighList == null) return null;
if (plcList.plc.IsConnected)
int endStatus = plcList.plc.ReadInt16("DB110.DBW6.0");//完成信号
if (endStatus == 1)
{
int endStatus = plcList.plc.ReadInt16("DB110.DBW6.0");//完成信号
if (endStatus == 1)
{
int planNum = plcList.plc.ReadInt16("DB110.DBW2.0");//执行批次
if (plan.Plan_Num > plan.Real_Num)
{
var rtPlanList = await _planRepository.QueryAsync(d => d.Plan_State == 3);
var rtPlan = rtPlanList.FirstOrDefault(d => d.Plan_Id == plan.Plan_Id);
execNum = rtPlan.Exec_Num;
var hwWeigh = hwWeighList.FirstOrDefault(d => d.MID == execNum);
if (hwWeigh == null) return null;
return hwWeigh;
}
}
else
int planNum = plcList.plc.ReadInt16("DB110.DBW2.0");//执行批次
if (plan.Plan_Num > plan.Real_Num)
{
var rtPlanList = await _planRepository.QueryAsync(d => d.Plan_State == 3);
var rtPlan = rtPlanList.FirstOrDefault(d => d.Plan_Id == plan.Plan_Id);
@ -371,8 +359,18 @@ namespace Admin.Core.Service
return hwWeigh;
}
}
}
else
{
var rtPlanList = await _planRepository.QueryAsync(d => d.Plan_State == 3);
var rtPlan = rtPlanList.FirstOrDefault(d => d.Plan_Id == plan.Plan_Id);
execNum = rtPlan.Exec_Num;
var hwWeigh = hwWeighList.FirstOrDefault(d => d.MID == execNum);
if (hwWeigh == null) return null;
return hwWeigh;
}
}
return null;
}
catch (System.Exception ex)

Loading…
Cancel
Save