add-2楼托盘到位读取RFID及出口到位绑定小托盘

dev
liuwf 3 months ago
parent 2daa756b5e
commit 4e78b67ec0

@ -81,8 +81,6 @@ namespace SlnMesnac.Business
/// </summary> /// </summary>
private void EmptyPalletHandle() private void EmptyPalletHandle()
{ {
//读取PLC空托盘流转信号 //读取PLC空托盘流转信号
while (true) while (true)
{ {

@ -1,4 +1,5 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SlnMesnac.Business.@base; using SlnMesnac.Business.@base;
using SlnMesnac.Common; using SlnMesnac.Common;
using SlnMesnac.Config; using SlnMesnac.Config;
@ -7,6 +8,7 @@ using SlnMesnac.Model.dto;
using SlnMesnac.Plc; using SlnMesnac.Plc;
using SlnMesnac.Repository.service; using SlnMesnac.Repository.service;
using SlnMesnac.Rfid; using SlnMesnac.Rfid;
using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -14,6 +16,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
#region << 版 本 注 释 >> #region << 版 本 注 释 >>
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
@ -47,29 +50,57 @@ namespace SlnMesnac.Business
private readonly IMesProductPlanService _mesProductPlanService; private readonly IMesProductPlanService _mesProductPlanService;
private readonly IMesPrdBarCodeService _barCodeTaskService; private readonly IMesPrdBarCodeService _barCodeTaskService;
private readonly IMesBaseBarcodeInfoService _mesBaseBarcodeInfoService;
public readonly IMesPrdBarCodeService _mesPrdBarCodeService;
private readonly IRealPalletTaskService _realPalletTaskService;
private ISqlSugarClient sqlSugarClient;
public ProdCompletionBusiness(ISqlSugarClient _sqlSugarClient,ILogger<BaseBusiness> logger, AppConfig appConfig, List<PlcAbsractFactory> plcFactories, List<RfidAbsractFactory> rfidFactories, IMesProductPlanService mesProductPlanService, IMesPrdBarCodeService barCodeTaskService, IServiceProvider serviceProvider) : base(logger, appConfig, plcFactories, rfidFactories, serviceProvider)
public ProdCompletionBusiness(ILogger<BaseBusiness> logger, AppConfig appConfig, List<PlcAbsractFactory> plcFactories, List<RfidAbsractFactory> rfidFactories, IMesProductPlanService mesProductPlanService, IMesPrdBarCodeService barCodeTaskService, IServiceProvider serviceProvider) : base(logger, appConfig, plcFactories, rfidFactories, serviceProvider)
{ {
sqlSugarClient = _sqlSugarClient;
_mesProductPlanService = mesProductPlanService; _mesProductPlanService = mesProductPlanService;
_barCodeTaskService = barCodeTaskService; _barCodeTaskService = barCodeTaskService;
_realPalletTaskService = serviceProvider.GetRequiredService<IRealPalletTaskService>();
_mesBaseBarcodeInfoService = serviceProvider.GetRequiredService<IMesBaseBarcodeInfoService>();
_mesPrdBarCodeService = serviceProvider.GetRequiredService<IMesPrdBarCodeService>();
Init();
} }
private void test()
{
string epc = "A123456";
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
string bigCode = GenerateBigBarcode(productPlanDto, epc);
BindingBarCode(bigCode, epc);
}
public void Init() public void Init()
{
Task.Run(() =>
{
EmptyPalletHandle();
});
Task.Run(() =>
{ {
DeviceOutPutHandle(); DeviceOutPutHandle();
});
} }
/// <summary> /// <summary>
/// 设备产出逻辑处理 /// 设备产出逻辑处理
/// </summary> /// </summary>
private void DeviceOutPutHandle() private async void DeviceOutPutHandle()
{ {
// 读取RFID失败重试次数超过5次推送报警
int readRfidAmount = 0;
while(true) while(true)
{ {
try try
@ -78,60 +109,206 @@ namespace SlnMesnac.Business
if (plc == null) if (plc == null)
{ {
_logger.LogInformation("读取设备产出信号,PLC连接信息为空......"); _logger.LogInformation("读取小包出口信号,PLC连接信息为空......");
Thread.Sleep(3000); Thread.Sleep(3000);
continue; continue;
} }
if (plc.readInt16ByAddress(GetPlcAddressByConfigKey("设备产出")) != 1) if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("2楼码垛出口到位信号")))
{ {
_logger.LogInformation("等待设备产出信号触发......"); _logger.LogInformation("等待小包出口信号触发......");
Thread.Sleep(5000); Thread.Sleep(5000);
continue; continue;
} }
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto); string epcStr = await ReadEpcStrByRfidKeyAsync("secondFloorOut");
if (string.IsNullOrEmpty(epcStr))
{
_logger.LogError("小包出口到位信号触发,读取RFID失败......");
//判断前一位置是否有托盘缓存
RealPalletTask realPalletTask = _realPalletTaskService.Query().FirstOrDefault();
if (realPalletTask != null)
{
epcStr = realPalletTask.PalletCode;
}
else
{
readRfidAmount++;
if(readRfidAmount == 5)
{
//TODO 推送报警
_logger.LogError("小包出口到位信号触发,读取RFID失败超过5次......");
}
Thread.Sleep(1000 * 5);
continue;
}
}
RefreshMessage($"小包出口读取到RFID条码{epcStr},开始绑定流程:");
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
if (productPlanDto == null) if (productPlanDto == null)
{ {
//TODO:没有计划的话,处理方式待定
throw new ArgumentException($"未获取到正在执行的生产计划"); throw new ArgumentException($"未获取到正在执行的生产计划");
} }
plc.writeInt16ByAddress(GetPlcAddressByConfigKey("设备产出"), 0);
//生成小包条码
string barCode = $"JYHB{(string.IsNullOrEmpty(productPlanDto.MaterialCode) ? "000000000" : productPlanDto.MaterialCode)}-000001";
//if (_barCodeTasks.Count > 0)
//{
// var info = _barCodeTasks.OrderByDescending(x => x.RecordTime).Where(x=>x.MaterialCode == productPlanDto.MaterialCode);
// if(info.Count() > 0)
// {
// var task = info.FirstOrDefault();
// ExtractNumber(task.BarCode, out int orFlag); sqlSugarClient.AsTenant().BeginTran();
//1.生成大条码插入mes_barcode_info
string bigCode =GenerateBigBarcode(productPlanDto, epcStr);
//2.40个小条码及大条码绑定托盘号,小条码绑定大条码
BindingBarCode(bigCode,epcStr);
//3.更新mes_product_plan及mes_product_order表更新已生产数量
// barCode = $"JYHB{(string.IsNullOrEmpty(productPlanDto.MaterialCode) ? "000000000" : productPlanDto.MaterialCode)}-{orFlag.ToString().PadLeft(6,'0')}";
// }
//}
sqlSugarClient.AsTenant().CommitTran();
//RealBarCodeTask barCodeTask = new RealBarCodeTask() plc.writeBoolByAddress(GetPlcAddressByConfigKey("2楼码垛出口到位信号"), false);
//{ readRfidAmount = 0;
// BarCode = barCode,
// PlanCode = productPlanDto.PlanCode,
// MaterialCode = productPlanDto.MaterialCode,
// RecordTime = DateTime.Now
//};
//_barCodeTaskService.InsertBarCodeTask(barCodeTask);
//RefreshBarCodeTaskListEvent?.Invoke(_barCodeTasks);
} }
catch (Exception ex) catch (Exception ex)
{
sqlSugarClient.AsTenant().RollbackTran();
// TODO:推送报警
_logger.LogError($"DeviceOutPutHandle异常:{ex.Message}");
}
}
}
/// <summary>
/// 生成大条码插入mes_barcode_info
/// </summary>
/// <param name="productPlanDto"></param>
/// <param name="epcStr"></param>
/// <returns></returns>
private string GenerateBigBarcode(MesProductPlanDto productPlanDto,string epcStr)
{
string bigBarcode = productPlanDto.PlanCode+DateTime.Now.ToString("_MMddHHmmss");
MesBaseBarcodeInfo mesBaseBarcodeInfo = new MesBaseBarcodeInfo();
mesBaseBarcodeInfo.printTime = DateTime.Now;
mesBaseBarcodeInfo.printPerson = "SlnMesnac";
mesBaseBarcodeInfo.printFlag = "1";
mesBaseBarcodeInfo.batchFlag = "0";
mesBaseBarcodeInfo.barcodeType = "3";
mesBaseBarcodeInfo.barcodeInfo = bigBarcode;
mesBaseBarcodeInfo.batchCode = bigBarcode;
mesBaseBarcodeInfo.palletInfoCode = epcStr;
mesBaseBarcodeInfo.materialId = productPlanDto.MaterialId;
mesBaseBarcodeInfo.amount = 1;
mesBaseBarcodeInfo.printNumber = 1;
mesBaseBarcodeInfo.productionDate = DateTime.Now;
mesBaseBarcodeInfo.acceptedDate = DateTime.Now;
mesBaseBarcodeInfo.planCode = productPlanDto.PlanCode;
mesBaseBarcodeInfo.safeFlag = productPlanDto.SaleOrderId ==0 ?"1" : "0";
mesBaseBarcodeInfo.saleOrderId = productPlanDto.SaleOrderId;
mesBaseBarcodeInfo.saleorderCode = productPlanDto.SaleorderCode;
mesBaseBarcodeInfo.bindStatus = "1";
mesBaseBarcodeInfo.bindTime = DateTime.Now;
mesBaseBarcodeInfo.updateBy = "SlnMesnac";
mesBaseBarcodeInfo.updateTime = DateTime.Now;
mesBaseBarcodeInfo.completeFlag = "1";
mesBaseBarcodeInfo.singleFlag = "0";
mesBaseBarcodeInfo.barcodeSpec = productPlanDto.MaterialName;
sqlSugarClient.AsTenant().GetConnection("mes").Insertable(mesBaseBarcodeInfo).ExecuteCommand();
return bigBarcode;
}
/// <summary>
/// 40个小条码及大条码绑定托盘号小条码绑定大条码
/// </summary>
/// <param name="bigBarcode"></param>
/// <param name="epcStr"></param>
private void BindingBarCode(string bigBarcode,string epcStr)
{
List<MesPrdBarcodeInfo> list = _mesPrdBarCodeService.GetUseBarCodeList();
if(list==null || list.Count == 0)
{
throw new Exception("托盘未找到可以绑定的小条码");
}else if(list.Count > 40)
{
list = list.Take(40).ToList();
}
foreach (var item in list)
{
item.PalletInfoCode = epcStr;
item.MesBarcodeInfo = bigBarcode;
item.BindTime = DateTime.Now;
}
sqlSugarClient.AsTenant().GetConnection("mes").Updateable(list).ExecuteCommand();
}
private void UpdatePlanInfoAndOrder(MesProductPlanDto productPlanDto)
{ {
} }
/// <summary>
/// 空托盘进入码垛位,读取RFID备用
/// </summary>
private async void EmptyPalletHandle()
{
//读取PLC空托盘流转信号
while (true)
{
try
{
var plc = base.GetPlcByKey("plc");
if (plc == null)
{
_logger.LogInformation("读取PLC空托盘码垛到位信号,PLC连接信息为空......");
Thread.Sleep(5000);
continue;
}
if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("2楼码垛到位信号")))
{
_logger.LogInformation("等待空托盘到位信号触发......");
Thread.Sleep(5000);
continue;
}
//读取RFID、获取当前正在执行的计划、将当前计划、工单等信息与托盘绑定
RefreshMessage("空托盘到位信号触发成功,读取托盘RFID信息");
string epcStr = await ReadEpcStrByRfidKeyAsync("secondFloorPallet");
if (string.IsNullOrEmpty(epcStr))
{
_logger.LogError("空托盘到位信号触发,读取RFID失败......");
Thread.Sleep(1000*10);
continue;
}
RefreshMessage($"空托盘RFID信息读取成功标签信息{epcStr}");
// 插入一条托盘记录
RealPalletTask realPalletTask = new RealPalletTask()
{
PalletCode = epcStr,
RecordTime = DateTime.Now,
};
bool result = _realPalletTaskService.Insert(realPalletTask);
if (result)
{
plc.writeBoolByAddress(GetPlcAddressByConfigKey("2楼码垛到位信号"), false);
}
}
catch (Exception e)
{
RefreshMessage($"空托盘进入码垛位处理异常:{e.Message}");
}
Thread.Sleep(5000);
} }
} }
/// <summary> /// <summary>
/// 根据条码提取序列 /// 根据条码提取序列
/// </summary> /// </summary>
@ -153,18 +330,5 @@ namespace SlnMesnac.Business
} }
} }
//public void testPenCode()
//{
// //生成小包条码
// string materialCode = "000000000";
// string barCode = $"JYHB{(string.IsNullOrEmpty(materialCode) ? "000000000" : materialCode)}-000001";
// ExtractNumber(task.BarCode, out int orFlag);
// barCode = $"JYHB{(string.IsNullOrEmpty(productPlanDto.MaterialCode) ? "000000000" : productPlanDto.MaterialCode)}-{orFlag.ToString().PadLeft(6, '0')}";
//}
} }
} }

@ -122,7 +122,7 @@ namespace SlnMesnac.Business
//tcpClient.Setup(new TouchSocketConfig().SetRemoteIPHost($"192.168.2.51:3000")); //tcpClient.Setup(new TouchSocketConfig().SetRemoteIPHost($"192.168.2.51:3000"));
//tcpClient.Connect(); //tcpClient.Connect();
// byte[] reciveBuffer = await waitClient.SendThenReturnAsync(pMessagePack.m_pData, timeout); // byte[] reciveBuffer = await waitClient.SendThenReturnAsync(pMessagePack.m_pData, timeout);
string aaa = await ReadEpcStrByRfidKeyAsync("test"); string aaa = await ReadEpcStrByRfidKeyAsync("secondFloorPallet");
// ReadEpcStrByRfidKey("test", out string epcStr); // ReadEpcStrByRfidKey("test", out string epcStr);
Console.WriteLine(aaa); Console.WriteLine(aaa);
//RefreshMessage($"投料校验RFID标签读取成功标签信息{epcStr}"); //RefreshMessage($"投料校验RFID标签读取成功标签信息{epcStr}");

@ -192,7 +192,7 @@ namespace SlnMesnac.Business.@base
/// <summary> /// <summary>
/// 根据RFID Key读取RFID信息 /// 使用---根据RFID Key读取RFID信息
/// </summary> /// </summary>
/// <param name="rfidKey"></param> /// <param name="rfidKey"></param>
/// <param name="epcStr"></param> /// <param name="epcStr"></param>
@ -203,6 +203,11 @@ namespace SlnMesnac.Business.@base
{ {
string epcStr = string.Empty; string epcStr = string.Empty;
var rfidEquip = GetRfidByKey(rfidKey); var rfidEquip = GetRfidByKey(rfidKey);
if(rfidEquip == null)
{
//TODO 推送设备报警
return null;
}
List<TagInfo> tagInfoList =await rfidEquip.GetRFIDAsync(); List<TagInfo> tagInfoList =await rfidEquip.GetRFIDAsync();
epcStr = tagInfoList.OrderByDescending(x => x.Count).First().EPCstring; epcStr = tagInfoList.OrderByDescending(x => x.Count).First().EPCstring;
return epcStr; return epcStr;

@ -0,0 +1,253 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.domain
{
[SugarTable("mes_base_barcode_info"), TenantAttribute("mes")]
public partial class MesBaseBarcodeInfo
{
/// <summary>
/// Desc:id
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "barcode_id")]
public long barcodeId { get; set; }
/// <summary>
/// 打印时间
/// </summary>
[SugarColumn(ColumnName = "print_time")]
public DateTime? printTime { get; set; }
/// <summary>
///打印人
/// </summary>
[SugarColumn(ColumnName = "print_person")]
public string? printPerson { get; set; }
/// <summary>
/// 打印标识(0否1是)
/// </summary>
[SugarColumn(ColumnName = "print_flag")]
public string printFlag { get; set; }
/// <summary>
/// 批次标识(0否1是);在打印时,如果物料已设置,则根据物料的批次信息,如果没有设置则在此需要选择,选择物料等信息保存后同步设置物料信息。
/// </summary>
[SugarColumn(ColumnName = "batch_flag")]
public string batchFlag { get; set; }
/// <summary>
///条码类型1原材料,2半成品,3成品,4背板
/// </summary>
[SugarColumn(ColumnName = "barcode_type")]
public string barcodeType { get; set; }
/// <summary>
/// 条码内容;如果是按单个物料贴,则一个物料一个条码,如果是按批次贴,则条码跟批次代码相同
/// </summary>
[SugarColumn(ColumnName = "barcode_info")]
public string barcodeInfo { get; set; }
/// <summary>
/// 批次代码
/// </summary>
[SugarColumn(ColumnName = "batch_code")]
public string batchCode { get; set; }
/// <summary>
///托盘RFID代码
/// </summary>
[SugarColumn(ColumnName = "pallet_info_code")]
public string palletInfoCode { get; set; }
/// <summary>
/// 绑定的物料条码(用来拆分绑定使用)
/// </summary>
[SugarColumn(ColumnName = "bind_barcode")]
public string? bindBarcode { get; set; }
/// <summary>
/// 物料ID关联mes_base_material_info的material_id
/// </summary>
[SugarColumn(ColumnName = "material_id")]
public long? materialId { get; set; }
/// <summary>
///供应商ID
/// </summary>
[SugarColumn(ColumnName = "manufacturer_id")]
public long? manufacturerId { get; set; }
/// <summary>
/// 数量;如果是批次需要输入此字段
/// </summary>
[SugarColumn(ColumnName = "amount")]
public decimal? amount { get; set; }
/// <summary>
/// 成品条码,在四楼成品到五楼作为原材料时需要绑定之前的成品条码
/// </summary>
[SugarColumn(ColumnName = "product_barcode")]
public string? productBarcode { get; set; }
/// <summary>
/// 打印数量
/// </summary>
[SugarColumn(ColumnName = "print_number")]
public int? printNumber { get; set; }
/// <summary>
/// 打印机台名称,打印时获取
/// </summary>
[SugarColumn(ColumnName = "machine_name")]
public string? machineName { get; set; }
/// <summary>
/// 采购订单ID
/// </summary>
[SugarColumn(ColumnName = "purchase_order_id")]
public long? purchaseOrderId { get; set; }
/// <summary>
/// 采购订单号;适合原材料入库时
/// </summary>
[SugarColumn(ColumnName = "po_no")]
public string? poNo { get; set; }
/// <summary>
///生产日期;打印时根据领料单选择输入
/// </summary>
[SugarColumn(ColumnName = "production_date")]
public DateTime? productionDate { get; set; }
/// <summary>
///接受日期;打印时的系统日期
/// </summary>
[SugarColumn(ColumnName = "accepted_date")]
public DateTime? acceptedDate { get; set; }
/// <summary>
/// 最晚出库日期;可以直接输入,也可以根据日限计算
/// </summary>
[SugarColumn(ColumnName = "last_outstock_date")]
public DateTime? lastOutstockDate { get; set; }
/// <summary>
/// 生产计划编号关联mes_pd_product_plan的plan_code;适合生产出入库等
/// </summary>
[SugarColumn(ColumnName = "plan_code")]
public string planCode { get; set; }
/// <summary>
/// 生产计划明细编号关联mes_product_plan_detail的plan_detail_code;适合生产出入库等
/// </summary>
[SugarColumn(ColumnName = "plan_detail_code")]
public string? planDetailCode { get; set; }
/// <summary>
/// 安全库存标识(1是0否)如果销售订单是0则此字段是安全库存
/// </summary>
[SugarColumn(ColumnName = "safe_flag")]
public string safeFlag { get; set; }
/// <summary>
/// 销售订单ID
/// </summary>
[SugarColumn(ColumnName = "sale_order_id")]
public long? saleOrderId { get; set; }
/// <summary>
/// 销售订单编号;适合生产出入库等
/// </summary>
[SugarColumn(ColumnName = "saleorder_code")]
public string saleorderCode { get; set; }
/// <summary>
/// 项目号
/// </summary>
[SugarColumn(ColumnName = "project_no")]
public string? projectNo { get; set; }
/// <summary>
/// 流水号
/// </summary>
[SugarColumn(ColumnName = "serial_number")]
public string? serialNumber { get; set; }
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string? remark { get; set; }
/// <summary>
/// 绑定状态(1绑定0解绑)
/// </summary>
[SugarColumn(ColumnName = "bind_status")]
public string? bindStatus { get; set; }
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "bind_by")]
public string? bindBy { get; set; }
/// <summary>
/// 绑定托盘时间
/// </summary>
[SugarColumn(ColumnName = "bind_time")]
public DateTime? bindTime { get; set; }
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "update_by")]
public string? updateBy { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time")]
public DateTime? updateTime { get; set; }
/// <summary>
/// Desc:
/// Default:
/// Nullable:True
/// </summary>
[SugarColumn(ColumnName = "transferred_plan_detail_code")]
public string? transferredPlanDetailCode { get; set; }
/// <summary>
/// 完整表示
/// </summary>
[SugarColumn(ColumnName = "complete_flag")]
public string? completeFlag { get; set; }
/// <summary>
/// Desc:
/// Default:0
/// Nullable:False
/// </summary>
[SugarColumn(ColumnName = "single_flag")]
public string singleFlag { get; set; }
/// <summary>
/// 物料规格
/// </summary>
[SugarColumn(ColumnName = "barcode_spec")]
public string barcodeSpec { get; set; }
}
}

@ -0,0 +1,12 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Repository.service
{
public interface IMesBaseBarcodeInfoService : IBaseService<MesBaseBarcodeInfo>
{
}
}

@ -17,10 +17,15 @@ namespace SlnMesnac.Repository.service
void InsertBarCodeTask(MesPrdBarcodeInfo barcodeInfo); void InsertBarCodeTask(MesPrdBarcodeInfo barcodeInfo);
/// <summary> /// <summary>
/// 移除条码队列 /// 查询前四十条已经喷印未绑定条码
/// </summary> /// </summary>
/// <param name="barCode"></param> /// <param name="task"></param>
/// <param name="barCodeTasks"></param>
/// <exception cref="InvalidOperationException"></exception> /// <exception cref="InvalidOperationException"></exception>
// void RemoveBarCodeTask(string barCode); List<MesPrdBarcodeInfo> GetUseBarCodeList();
} }
} }

@ -0,0 +1,37 @@
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Text;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2024 WenJY
* CLR4.0.30319.42000
* LAPTOP-E0N2L34V
* SlnMesnac.Repository.service.Impl
* d439bf21-2c36-42dd-8f56-3d22411df57a
*
* WenJY
* wenjy@mesnac.com
* 2024-04-08 10:34:17
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace SlnMesnac.Repository.service.Impl
{
public class MesBaseBarcodeInfoServiceImpl : BaseServiceImpl<MesBaseBarcodeInfo>, IMesBaseBarcodeInfoService
{
public MesBaseBarcodeInfoServiceImpl(Repository<MesBaseBarcodeInfo> rep) : base(rep)
{
}
}
}

@ -67,6 +67,28 @@ namespace SlnMesnac.Repository.service.Impl
} }
} }
/// <summary>
/// 查询前四十条已经喷印未绑定条码
/// </summary>
/// <param name="task"></param>
/// <param name="barCodeTasks"></param>
/// <exception cref="InvalidOperationException"></exception>
public List<MesPrdBarcodeInfo> GetUseBarCodeList()
{
List<MesPrdBarcodeInfo> list = null;
try
{
string sql = "select * from mes_prd_barcode_info where print_flag ='1' and pallet_info_code is null order by print_time limit 40;";
list = _rep.Context.Ado.SqlQuery<MesPrdBarcodeInfo>(sql);
return list;
}catch (Exception e)
{
throw new InvalidOperationException($"查询小条码队列信息异常:{e.Message}");
}
}
/// <summary> /// <summary>
/// 移除条码队列 /// 移除条码队列
/// </summary> /// </summary>

@ -9,6 +9,7 @@ using Autofac;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using SlnMesnac.Ioc; using SlnMesnac.Ioc;
using SlnMesnac.Extensions; using SlnMesnac.Extensions;
using SlnMesnac.Generate;
namespace SlnMesnac.WPF namespace SlnMesnac.WPF
{ {
@ -36,6 +37,10 @@ namespace SlnMesnac.WPF
}); });
services.AddSingleton<GenerateCode>();
//ORM //ORM
services.AddSqlSugarSetup(); services.AddSqlSugarSetup();
@ -64,10 +69,10 @@ namespace SlnMesnac.WPF
/// <param name="env"></param> /// <param name="env"></param>
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
//if (env.IsDevelopment()) if (env.IsDevelopment())
//{ {
// app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
//} }
//启用Serilog中间件 //启用Serilog中间件
app.UseSerilogExtensions(); app.UseSerilogExtensions();

@ -170,7 +170,7 @@ namespace SlnMesnac.WPF.ViewModel
public ProdMgmtViewModel() public ProdMgmtViewModel()
{ {
test();
StartProdPlanCommand = new RelayCommand<string>(obj => StartProdPlan(obj)); StartProdPlanCommand = new RelayCommand<string>(obj => StartProdPlan(obj));
StopProdPlanCommand = new RelayCommand<string>(obj => StopProdPlan(obj)); StopProdPlanCommand = new RelayCommand<string>(obj => StopProdPlan(obj));
_logger = App.ServiceProvider.GetService<ILogger<ProdMgmtViewModel>>(); _logger = App.ServiceProvider.GetService<ILogger<ProdMgmtViewModel>>();

@ -55,11 +55,20 @@
], ],
"RfidConfig": [ "RfidConfig": [
{ {
// RFID
"configId": 1, "configId": 1,
"equipIp": "192.168.2.27", "equipIp": "192.168.2.27",
"equipPort": 20108, "equipPort": 20108,
"equipKey": "test", "equipKey": "secondFloorPallet",
"isFlage": true "isFlage": false
},
{
// RFID
"configId": 2,
"equipIp": "192.168.2.28",
"equipPort": 20108,
"equipKey": "secondFloorOut",
"isFlage": false
} }
] ]
//"redisConfig": "175.27.215.92:6379,password=redis@2023" //"redisConfig": "175.27.215.92:6379,password=redis@2023"

Loading…
Cancel
Save