修改二维码,打印箱体码

dev
liulb@mesnac.com 11 months ago
parent 8245c781f2
commit 51c85794ad

@ -9,7 +9,7 @@ namespace Admin.Core.Common.Config
public sealed class PlcSpaceConfig
{
private static IniHelper iniHelper = new IniHelper(System.Environment.CurrentDirectory + "/config/PlcSpace.Ini");
//private static IniHelper iniHelper = new IniHelper("E:/桌面/澳柯玛MES项目/程序设计/Aucma.Scada/Aucma.Scada.UI/bin/Debug/config/PlcSpace.Ini");
private static readonly Lazy<PlcSpaceConfig> lazy = new Lazy<PlcSpaceConfig>(() => new PlcSpaceConfig());
@ -26,7 +26,12 @@ namespace Admin.Core.Common.Config
}
/// <summary>
/// 获取6条货道的信息在库数量,货道物料号,入库完成,仓库状态,出库完成
/// </summary>
/// <param name="storeCode"></param>
/// <param name="spaceCode"></param>
/// <returns></returns>
public SpaceAddress GetSpaceAddress(string storeCode, string spaceCode)
{
SpaceAddress spaceAddress = new SpaceAddress();

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Common")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
6a34387ae32f06dc60426c9cf287eb1c66486231a61d0eedf7e1ffe92bb8269e
7375a15a975688f69480b55b4b462536f6fd22ce7cf47bf0c6f3e8edab83e11e

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.EventBus")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
8ac8b1e0f3b0ac5354ed9139acb9f6d7fdfeac7088c9c4ab5289f9da57d3f6a8
02add3d2cb395595fe600d6167e5daef66bb27148dab06b4b7532433dc390ea2

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Extensions")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
d8d4317afa066d5616d7c75f9235dc29daae42da6bd2f97d2293b43963e6570c
432c2bb18cc576c24532bf445a4fe0c309332a7c74e62e10119b394420d2cd69

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
0e57fdca1b5f4ef1b4980d51aa282744c9be6b9216bd493762e6796c1e1d166b
d3df34dd26ef5e697e60aee32448ed5b9e28832338f19df640acbc4c509e31cc

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.IService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
06ee9f3773181e78eb6481eab76aa1646bfc374e59d7a45438faef77d44b2b66
72606ad10287fd46cd5d033ee795f548a10a751bdf4e317d1fbefc61d14606f9

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Model")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
0b32a3ac1b417e198b98cfbf21983432fc89ad6f4b2052a55fd777fe7fd45492
11425a6931627be119b42ad36f244fa6ecb9e8a32e515ec3d4afb2305a3bc045

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Repository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
536df73917913680572e6943cf0cb9f4ad18351f86d4530d44b0fa1225fcf43e
d60f19334e720da9e10e4a5ba436dd2232e41bb97f9b14e2546acec090a39e91

@ -46,20 +46,17 @@ namespace Admin.Core.Service
/// <returns>获取合适货道</returns>
public async Task<List<BaseSpaceInfo>> InStoreGetSpaceInfoByMaterialType(string store, string materialType)
{
List<BaseSpaceInfo> spaceInfos = null;
try
{
spaceInfos = await _baseSpaceInfoRepository.QueryAsync(x => x.StoreCode == store && (x.MaterialType == materialType || x.typeCodeB == materialType || x.typeCodeC == materialType ) && x.SpaceStatus == 1);
if (spaceInfos == null || spaceInfos.Count == 0)
return null;
logHelper.Info($"根据仓库{store};物料:{materialType};获取到的货道信息:{spaceInfos.ToJson()}");
spaceInfos = await _baseSpaceInfoRepository.QueryAsync(x => x.StoreCode == store && (x.MaterialType == materialType || x.typeCodeB == materialType || x.typeCodeC == materialType) && x.SpaceStatus == 1);
if (spaceInfos == null || spaceInfos.Count == 0) return null;
}
catch (Exception ex)
{
logHelper.Error("入库通过物料类型获取货道信息异常", ex);
Console.WriteLine($"入库通过物料类型获取货道信息异常:{ex.Message}");
}
return spaceInfos;
}

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Service")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
23b81d138451fdc405c3dfb335c7bc2230c9afb39f46730fc8d13c3cf41154aa
ab635b9c97558c7b1c30c4739d485f0a5193bc1d8233b6488455c677a648a0d8

@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+b490218d75f73a2a8262a5684a1de0678e4eb101")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8245c781f27f7e58143f46ea6e58b04f5cb32079")]
[assembly: System.Reflection.AssemblyProductAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyTitleAttribute("Admin.Core.Tasks")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

@ -1 +1 @@
196a05b2280e8f2075535eb1f5f0be07342cf9d2f66ca232de2798647cdca00f
a8927559d24917f654c616b5eddca8c8a85200ea0ae4cb0ffdb70f0d1b2e462f

@ -67,11 +67,14 @@ namespace Aucma.Core.BoxFoam.Business
//采集注料记录
Task.Run(() =>
{
Thread.Sleep(3000);
while (true)
{
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("foamMachinePlc"));
ReadFillingRecord(obj);
if (obj.plc.IsConnected)
{
ReadFillingRecord(obj);
}
Thread.Sleep(200);
}
});

@ -2,26 +2,15 @@
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Service;
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Aucma.Core.Scanner;
using static Aucma.Core.Scanner.ScannerService;
using Admin.Core.Model.Model_New;
using Quartz;
using StackExchange.Profiling.Internal;
using Aucma.Core.HwPLc;
using System.Windows.Documents;
using System.Timers;
using NetTaste;
using Org.BouncyCastle.Asn1.Tsp;
using System.Printing;
namespace Aucma.Core.BoxFoam.Business
{
@ -43,6 +32,7 @@ namespace Aucma.Core.BoxFoam.Business
/// </summary>
private List<RealTaskInfo> TaskInfos = new List<RealTaskInfo>();
private Dictionary<string, int> KeyValuePairs = new Dictionary<string, int>();
#region 事件
/// <summary>
/// 扫码信息刷新
@ -83,7 +73,10 @@ namespace Aucma.Core.BoxFoam.Business
#endregion
private string storeCode = string.Empty;
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(InStoreBusiness));
#region 初始化
private readonly IBaseSpaceInfoServices? _baseSpaceInfoServices = App.ServiceProvider.GetService<IBaseSpaceInfoServices>();
private readonly IRealTaskInfoServices? _realTaskInfoService = App.ServiceProvider.GetService<IRealTaskInfoServices>();
private readonly IProductPlanInfoServices? _productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>();
@ -93,22 +86,36 @@ namespace Aucma.Core.BoxFoam.Business
// 过点数据表物料完成记录MaterialCompletion
private readonly IMaterialCompletionServices? _iMaterialCompletionServices = App.ServiceProvider.GetService<IMaterialCompletionServices>();
private readonly IPrintBarCodeServices? _printBarCodeServices = App.ServiceProvider.GetService<IPrintBarCodeServices>();
private PlcSpaceConfig spaceConfig = PlcSpaceConfig.Instance;
private readonly IBaseMaterialInfoServices? _baseMaterialInfoServices = App.ServiceProvider.GetService<IBaseMaterialInfoServices>();
#endregion
#region 初始化对象
private PlcSpaceConfig spaceConfig = PlcSpaceConfig.Instance;
private SemaphoreSlim semaphore = new SemaphoreSlim(0);
private string storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");//泡前库code
private List<BaseSpaceInfo> allSpaces = null;
private List<SpaceAddress> spaceAddresses = new List<SpaceAddress>();
private SemaphoreSlim _lock = new SemaphoreSlim(1);
#endregion
#region 构造函数
public InStoreBusiness()
{
MvCodeHelper.PQKReceiveCodeEvent += InStore;
storeCode = Appsettings.app("StoreInfo", "BeforeStoreCode");//泡前库code
}
public void init()
{
#endregion
#region 初始化入库任务---模拟测试启用
/// <summary>
/// 初始化入库任务
/// </summary>
public async void init()
{
try
{
allSpaces = _baseSpaceInfoServices.Query(x => x.StoreCode == storeCode);
@ -117,10 +124,10 @@ namespace Aucma.Core.BoxFoam.Business
spaceAddresses.Add(spaceConfig.GetSpaceAddress(storeCode, space.SpaceCode));
}
// 模拟入库
//Task.Run(() =>
//Task.Run(async () =>
//{
// Thread.Sleep(5000);
// InStore("B24010183025024860011");
// await InStore("B24010183025024860011");
//});
//实时监测入库任务下发和入库任务完成
StartPassDownAndRealInstoreFinish();
@ -128,9 +135,12 @@ namespace Aucma.Core.BoxFoam.Business
catch (Exception ex)
{
logHelper.Info(ex.Message.ToString());
Console.WriteLine($"初始化异常:{ex.Message}");
}
}
}
#endregion
#region 定时器实时监测入库出库完成信号
/// <summary>
/// 定时器实时监测入库出库完成信号
/// </summary>
@ -157,7 +167,9 @@ namespace Aucma.Core.BoxFoam.Business
}
}
}
#endregion
#region 实时监测入库任务下发和入库任务完成
/// <summary>
///实时监测入库任务下发和入库任务完成
/// </summary>
@ -181,10 +193,10 @@ namespace Aucma.Core.BoxFoam.Business
Thread.Sleep(1000);
}
});
}
#endregion
}
#region 获取入库任务下发plc
/// <summary>
/// 获取入库任务下发plc
@ -199,7 +211,7 @@ namespace Aucma.Core.BoxFoam.Business
if (taskInfo != null)
{
if (SendFoamTask_InStore(taskInfo))
{
logHelper.Info($"泡前入库任务:{taskInfo.TaskCode}下发成功等待PLC执行反馈");
@ -217,7 +229,7 @@ namespace Aucma.Core.BoxFoam.Business
RefreshDataGridDelegateEvent?.Invoke();//刷新datagrid 列表
// logHelper.Info($"泡后入库任务:{taskInfo.TaskCode};执行完成");
//logHelper.Info($"泡后入库任务:{taskInfo.TaskCode};执行完成");
// 刷新入库任务列表
}
else
@ -237,6 +249,10 @@ namespace Aucma.Core.BoxFoam.Business
}
}
#endregion
#region 获取待执行的入库任务
/// <summary>
/// 获取待执行的入库任务
/// </summary>
@ -256,9 +272,12 @@ namespace Aucma.Core.BoxFoam.Business
logHelper.Info("获取待执行的入库任务异常", ex);
}
return taskInfo;
}
}
#endregion
#region 入库
#region 入库,扫码器委托触发
/// <summary>
/// 入库,扫码器委托触发
/// </summary>
@ -268,25 +287,34 @@ namespace Aucma.Core.BoxFoam.Business
{
try
{
if (string.IsNullOrEmpty(materialBarCode))
{
LogDelegateEvent?.Invoke("未扫到二维码信息!");
Console.WriteLine($"【{DateTime.Now}】未扫到二维码信息,请重新扫码!");
return;
}
Console.WriteLine($"【{DateTime.Now}】扫码成功,物料条码:{materialBarCode}");
logHelper.Info($"扫码成功,物料条码:{materialBarCode}");
LogDelegateEvent?.Invoke($"扫码成功,物料条码:{materialBarCode}");
var taskList = await _realTaskInfoService.QueryAsync(d => d.MaterialCode.Equals(materialBarCode) && d.StoreCode == storeCode);
if (taskList.Count() > 0)
{
LogDelegateEvent?.Invoke($"物料条码[{materialBarCode}],任务创建失败,该物料入库任务已存在!");
Console.WriteLine($"【{DateTime.Now}】物料条码[{materialBarCode}],任务创建失败,该物料入库任务已存在!");
return;
}
//获取要进入的货道
string materialType = SubString(materialBarCode);//截取中间物料条码
BaseSpaceInfo spaceInfo = await GetSpaceInfoByMaterialType(storeCode, materialType);
if (spaceInfo != null)
{
logHelper.Info($"匹配货道:{spaceInfo.ToJson()}");
LogDelegateEvent?.Invoke($"匹配货道:{spaceInfo.ToJson()}");
//Console.WriteLine($"【{DateTime.Now}】匹配货道:{spaceInfo.ToJson()}");
string message = $"箱体码[{materialBarCode}], 入{spaceInfo.SpaceName},入库中....";
Console.WriteLine($"【{DateTime.Now}】{message}");
PrintBarCode print = await _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == materialBarCode);
Console.WriteLine($"【{DateTime.Now}】{message}");
RefreshScanMateriaCodeEvent?.Invoke(materialBarCode, materialType, print.MaterialName, spaceInfo.SpaceName, message); //刷新界面扫码信息
var result = await CreateInStoreTask(spaceInfo, materialBarCode); //创建入库任务
if (result)
@ -304,6 +332,7 @@ namespace Aucma.Core.BoxFoam.Business
//await _iMaterialCompletionServices.AddAsync(completion);
#endregion
RefreshDataGridDelegateEvent?.Invoke();
await _baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo);
}
@ -321,6 +350,8 @@ namespace Aucma.Core.BoxFoam.Business
}
}
#endregion
#region 创建入库任务
/// <summary>
/// 创建入库任务
@ -369,59 +400,54 @@ namespace Aucma.Core.BoxFoam.Business
#endregion
#region 筛选货道
/// <summary>
/// 筛选货道
/// </summary>
/// <param name="storeCode"></param>
/// <param name="materialType"></param>
/// <param name="storeCode">货道编码</param>
/// <param name="materialType">二维码中间8位</param>
/// <returns></returns>
private async Task<BaseSpaceInfo> GetSpaceInfoByMaterialType(string storeCode, string materialType)
{
BaseSpaceInfo result = null;
try
{
List<BaseSpaceInfo> info = await _baseSpaceInfoServices.InStoreGetSpaceInfoByMaterialType(storeCode, materialType);
if (info != null)
Console.WriteLine($"根据仓库{storeCode};物料:{materialType};获取到的货道信息:{info.ToJson()}");
if (info == null || info.Count == 0) return result;
// 更新货道库存
foreach (BaseSpaceInfo item in info)
{
if (info.Count > 0)
{
// 更新货道库存
foreach (BaseSpaceInfo item in info)
{
var spaceInfo = ReadSpaceInfoByPlc(item);
item.SpaceStock = spaceInfo.SpaceStock;
var spaceInfo = ReadSpaceInfoByPlc(item);//更新货道信息
item.SpaceStock = spaceInfo.SpaceStock;
if(item.typeCodeB=="materialType" && (item.SpaceStock+item.OnRouteAmount)==0)
{
string str1 = item.typeCodeB;
string str2 = item.typeNameB;
item.typeCodeB = item.MaterialType;
item.typeNameB = item.typeNameA;
item.MaterialType = str1;
item.typeNameA = str2;
}
// 对调C型号和主型号
else if(spaceInfo.typeCodeC=="materialType" && (item.SpaceStock + item.OnRouteAmount) == 0)
{
string str1 = item.typeCodeC;
string str2 = item.typeNameC;
item.typeCodeC = item.MaterialType;
item.typeNameC = item.typeNameA;
item.MaterialType = str1;
item.typeNameA = str2;
}
}
info = info.Where(x => x.SpaceStatus == 1 && x.SpaceCapacity > (x.SpaceStock + x.OnRouteAmount)).ToList();
if(info.Count > 0)
{
result = info.OrderByDescending(x => x.SpaceStock).First();
}
if (item.typeCodeB == "materialType" && (item.SpaceStock + item.OnRouteAmount) == 0)
{
string str1 = item.typeCodeB;
string str2 = item.typeNameB;
item.typeCodeB = item.MaterialType;
item.typeNameB = item.typeNameA;
item.MaterialType = str1;
item.typeNameA = str2;
}
// 对调C型号和主型号 需要确定未什么要对调类型?
else if (spaceInfo.typeCodeC == "materialType" && (item.SpaceStock + item.OnRouteAmount) == 0)
{
string str1 = item.typeCodeC;
string str2 = item.typeNameC;
item.typeCodeC = item.MaterialType;
item.typeNameC = item.typeNameA;
item.MaterialType = str1;
item.typeNameA = str2;
}
}
info = info.Where(x => x.SpaceStatus == 1 && x.SpaceCapacity > (x.SpaceStock + x.OnRouteAmount)).ToList();
if (info == null || info.Count == 0) return result;
result = info.OrderByDescending(x => x.SpaceStock).First();
return result;
}
catch (Exception ex)
{
@ -431,10 +457,13 @@ namespace Aucma.Core.BoxFoam.Business
return result;
}
#endregion
#region 通过PLC获取货道信息
/// <summary>
/// 通过PLC获取货道信息
/// </summary>
/// <param name="spaceInfo"></param>
/// <param name="spaceInfo">货道信息</param>
/// <returns></returns>
public BaseSpaceInfo ReadSpaceInfoByPlc(BaseSpaceInfo spaceInfo)
{
@ -442,13 +471,14 @@ namespace Aucma.Core.BoxFoam.Business
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("泡前库Plc"));
if (obj != null && obj.plc.IsConnected)
{
//将货道信息更新到配置文件中
SpaceAddress spaceAddress = spaceConfig.GetSpaceAddress(spaceInfo.StoreCode, spaceInfo.SpaceCode);
spaceInfo.SpaceStock = obj.plc.ReadInt16(spaceAddress.onStore);
spaceInfo.SpaceStock = obj.plc.ReadInt16(spaceAddress.onStore);//获取
}
return spaceInfo;
}
}
#endregion
#endregion
@ -465,7 +495,6 @@ namespace Aucma.Core.BoxFoam.Business
}
#endregion
#region 泡前入库任务下发处理
public bool SendFoamTask_InStore(RealTaskInfo taskInfo)
{
@ -564,6 +593,7 @@ namespace Aucma.Core.BoxFoam.Business
}
#endregion
#region 入库完成
/// <summary>
/// 入库完成
/// </summary>
@ -583,20 +613,20 @@ namespace Aucma.Core.BoxFoam.Business
if (spaceInfo != null)
{
spaceInfo.MaterialType = taskInfo.MaterialType;
//读取PLC获取货道信息存放数量、在途数量,
#region Add By wenjy 2023-10-30 13:44:00 通过PLC获取货道信息
var item = ReadSpaceInfoByPlc(spaceInfo);
spaceInfo.SpaceStock = item.SpaceStock;
if (spaceInfo.OnRouteAmount>0)
if (spaceInfo.OnRouteAmount > 0)
{
// 入库完成在途减1
spaceInfo.OnRouteAmount -= 1;
}
#endregion
#region 添加货道明细 不控制出库,暂时未添加明细
BaseSpaceDetail spaceDetail = new BaseSpaceDetail();
@ -623,8 +653,8 @@ namespace Aucma.Core.BoxFoam.Business
await _baseSpaceInfoServices.UpdateSpaceInfo(spaceInfo);
_ = _recordInstoreServices.AddAsync(recordInstore).Result;
bool result = _realTaskInfoService.DeleteAsync(taskInfo).Result;
// bool result = await _recordInstoreServices.SaveRecordToDb(recordInstore, taskInfo, spaceInfo, spaceDetail);
bool result = _realTaskInfoService.DeleteAsync(taskInfo).Result;
// bool result = await _recordInstoreServices.SaveRecordToDb(recordInstore, taskInfo, spaceInfo, spaceDetail);
if (result)
{
LogDelegateEvent?.Invoke($"入库完成,更新数据库成功");
@ -634,7 +664,7 @@ namespace Aucma.Core.BoxFoam.Business
{
LogDelegateEvent?.Invoke($"更新数据库异常");
}
}
////清除任务信息
//await _realTaskInfoService.DeleteTaskInfo(taskCode, storeCode);
@ -647,6 +677,9 @@ namespace Aucma.Core.BoxFoam.Business
}
}
#endregion
#region 获取物料名称
/// <summary>
///获取物料名称
/// </summary>
@ -663,6 +696,8 @@ namespace Aucma.Core.BoxFoam.Business
return materialName;
}
#endregion
#region PLC 任务处理表
/// <summary>
/// PLC 任务处理表

@ -31,7 +31,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
public IndexPageViewModel()
{
inStoreBusiness.init();
// inStoreBusiness.init();//初始化界面?
_recordInstoreServices = App.ServiceProvider.GetService<IRecordInStoreServices>();

@ -153,7 +153,7 @@ namespace Aucma.Core.PrintTo.ViewModels
}
if (type == "箱体")
{
printType = 400;
printType = 200;
}
}
#endregion

@ -261,7 +261,7 @@ namespace Aucma.Core.PrintTo.ViewModels
tmpList.Clear();
BaseBomInfo baseBomInfo = null;
List<BaseBomInfo> orderBomInfoList = await _baseBomInfoServices.QueryAsync();
if (printType== 400)//箱壳
if (printType== 200)//箱壳
{
GetParentID(orderBomInfoList, productCode);
//OrderBomInfo obj = await _orderBomInfoServices.FirstAsync(d => d.MaterialCode == materialCode);
@ -270,7 +270,7 @@ namespace Aucma.Core.PrintTo.ViewModels
MessageBox.Show("无法查询打印条码数据", "系统提醒");
return;
}
baseBomInfo= tmpList.FirstOrDefault(d=>d.MaterialType== "400");
baseBomInfo= tmpList.FirstOrDefault(d=>d.MaterialType== "200");
}
if (printType == 500)//内胆
{
@ -314,7 +314,7 @@ namespace Aucma.Core.PrintTo.ViewModels
{
var item = BarcodesUnprinted.Peek();
string barCode = string.Empty;
if (_printType== 400)
if (_printType== 200)
{
string rowNum = GetMaxNumAsync(item.MaterialCode,"B").Result;//最大值+1
barCode = $"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";

Loading…
Cancel
Save