liulb@mesnac.com 1 year ago
parent 81af2959e0
commit 89862dc1a3

@ -112,8 +112,7 @@ namespace Admin.Core.Tasks
if (r > 0)
{
//数据采集完成设为2
obj.plc.WriteInt32("DB55.444.0", 2);//应答字:1数据采集2存盘成功
//obj.plc.WriteInt32("DB55.444.0", 2);//应答字:1数据采集2存盘成功
Console.WriteLine($"灌注数据保存成功!=>数据写入2存盘成功:{record.ToJson()}");
}
else

@ -55,6 +55,7 @@ namespace Aucma.Core.BoxFoam.Business
if (obj != null)
{
if (obj.plc.IsConnected == false) return;
BoxTypeList.Clear();
HolderStatusList.Clear();
HolderOutPutList.Clear();

@ -1,6 +1,8 @@
using Admin.Core.Common.Helper;
using Admin.Core.IService;
using Admin.Core.Model;
using Aucma.Core.BoxFoam.Models;
using Aucma.Core.BoxFoam.ViewModels;
using Aucma.Core.HwPLc;
using NetTaste;
@ -22,24 +24,27 @@ namespace Aucma.Core.BoxFoam.Business
public class CollectionFoamMachine
{
private static System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
//List<FoamMachinesModel> foamMachinesList = new List<FoamMachinesModel>();
private static BoxLastShotRecord tempLastRecord = null;
public CollectionFoamMachine()
public void startCollect()
{
}
public async void startCollect()
{
Task.Run(() =>
Task.Run( () =>
{
Thread.Sleep(6000);
Task.Delay(2000);
//Thread.Sleep(6000);
var obj = PlcHelper.siemensList.FirstOrDefault(d => d.EquipName.Equals("foamMachinePlc"));
// ReadEquipSystem(obj, "DB50.388"); //采集1系统
// ReadEquipSystem(obj, "DB50.642"); //采集2系统
// ReadGunData(obj, "DB50.896"); //A1枪数据
// ReadGunData(obj, "DB50.1084"); //A1枪数据
// ReadGunData(obj, "DB50.1272"); //A1枪数据
// ReadGunData(obj, "DB50.1460"); //A1枪数据
if (obj != null)
{
ReadEquipSystem(obj, "DB50.388"); //采集1系统
//ReadEquipSystem(obj, "DB50.642"); //采集2系统
//ReadGunData(obj, "DB50.896"); //A1枪数据
//ReadGunData(obj, "DB50.1084"); //A1枪数据
//ReadGunData(obj, "DB50.1272"); //A1枪数据
//ReadGunData(obj, "DB50.1460"); //A1枪数据
}
});
}
@ -52,11 +57,12 @@ namespace Aucma.Core.BoxFoam.Business
if (obj == null && !obj.plc.IsConnected) return;
if (obj.plc.IsConnected)
{
FoamMachinesModel mode=new FoamMachinesModel();
byte[] info = obj.plc.Read(startStr, 170);
int temp1 = judgeStatus(ByteArrayToBinary(info.Skip(0).Take(1).ToArray()));
int temp2 = judgeStatus(ByteArrayToBinary(info.Skip(1).Take(1).ToArray()));
float temp3 = byteToFloat(info.Skip(2).Take(4).ToArray());
float temp4 = byteToFloat(info.Skip(14).Take(4).ToArray());
float temp5 = byteToFloat(info.Skip(18).Take(4).ToArray());
float temp6 = byteToFloat(info.Skip(22).Take(4).ToArray());

@ -0,0 +1,310 @@
using Admin.Core.IService;
using Admin.Core.Tasks;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Aucma.Core.BoxFoam.Models
{
public partial class FoamMachinesModel
{
#region 料位
/// <summary>
/// POL料位
/// </summary>
public int Syst1_POLMaterialLevel { get; set; }
/// <summary>
/// ISO料位
/// </summary>
public int Syst1_ISOMaterialLevel { get; set; }
#endregion
#region 温度
/// <summary>
/// Plo温度
/// </summary>
public string Syst1_PolTmperature { get; set; }
/// <summary>
/// ISO温度
/// </summary>
public string Syst1_IsoTmperature { get; set; }
#endregion
#region 压力
/// <summary>
/// Pol压力
/// </summary>
public string Syst1_PolPressure { get; set; }
/// <summary>
/// Iso压力
/// </summary>
public string Syst1_IsoPressure { get; set; }
#endregion
#region 温度
/// <summary>
/// Iso温度
/// </summary>
public string Syst1_PolTemperature { get; set; }
/// <summary>
/// Iso温度
/// </summary>
public string Syst1_IsoTemperature { get; set; }
#endregion
#region 输出压力
/// <summary>
/// POL输出压力
/// </summary>
public string Syst1_PolOutputPressure { get; set; }
/// <summary>
/// ISO输出压力
/// </summary>
public string Syst1_IsoOutputPressure { get; set; }
#endregion
#region 流量
/// <summary>
/// POL流量
/// </summary>
public string Syst1_PolFlow { get; set; }
/// <summary>
/// ISO流量
/// </summary>
public string Syst1_IsoFlow { get; set; }
#endregion
#region 原料用量
/// <summary>
/// POL流量
/// </summary>
public string Syst1_PolMaterialLeve { get; set; }
/// <summary>
/// ISO流量
/// </summary>
public string Syst1_IsoMaterialLeve { get; set; }
#endregion
#region 液压
/// <summary>
/// 液压压力
/// </summary>
public string Syst1_Pressure { get; set; }
/// <summary>
/// 液压
/// </summary>
public string Syst1_Temperature { get; set; }
#endregion
#region 结束信号
/// <summary>
/// A1结束信号
/// </summary>
public string Syst1_A1_End { get; set; }
/// <summary>
/// 结束信号
/// </summary>
public string Syst1_B1_End { get; set; }
#endregion
#region A1-B1 POL注料压力
/// <summary>
/// A1 POL注料压力
/// </summary>
public string Syst1_A1_POLPressure { get; set; }
/// <summary>
/// B1 POL注料压力
/// </summary>
public string Syst1_B1_POLPressure { get; set; }
#endregion
#region A1-B1 POL注料温度
/// <summary>
/// A1 POL注料温度
/// </summary>
public string Syst1_A1_POLTemperature { get; set; }
/// <summary>
/// B1 POL注料温度
/// </summary>
public string Syst1_B1_POLTemperature { get; set; }
#endregion
#region A1-B1 ISO注料压力
/// <summary>
/// A1 ISO注料压力
/// </summary>
public string Syst1_A1_ISOPressure { get; set; }
/// <summary>
/// B1 ISO注料压力
/// </summary>
public string Syst1_B1_ISOPressure { get; set; }
#endregion
#region A1-B1 ISO注料压力
/// <summary>
/// A1 ISO注料压力
/// </summary>
public string Syst1_A1_ISOTemperature { get; set; }
/// <summary>
/// B1 ISO注料压力
/// </summary>
public string Syst1_B1_ISOTemperature { get; set; }
#endregion
#region 系统2料位
/// <summary>
/// POL料位
/// </summary>
public int Syst2_POLMaterialLevel { get; set; }
/// <summary>
/// ISO料位
/// </summary>
public int Syst2_ISOMaterialLevel { get; set; }
#endregion
#region 系统2温度
/// <summary>
/// Plo温度
/// </summary>
public string Syst2_PolTmperature { get; set; }
/// <summary>
/// ISO温度
/// </summary>
public string Syst2_IsoTmperature { get; set; }
#endregion
#region 系统2压力
/// <summary>
/// Pol压力
/// </summary>
public string Syst2_PolPressure { get; set; }
/// <summary>
/// Iso压力
/// </summary>
public string Syst2_IsoPressure { get; set; }
#endregion
#region 系统2温度
/// <summary>
/// Iso温度
/// </summary>
public string Syst2_PolTemperature { get; set; }
/// <summary>
/// Iso温度
/// </summary>
public string Syst2_IsoTemperature { get; set; }
#endregion
#region 系统2输出压力
/// <summary>
/// POL输出压力
/// </summary>
public string Syst2_PolOutputPressure { get; set; }
/// <summary>
/// ISO输出压力
/// </summary>
public string Syst2_IsoOutputPressure { get; set; }
#endregion
#region 系统2流量
/// <summary>
/// POL流量
/// </summary>
public string Syst2_PolFlow { get; set; }
/// <summary>
/// ISO流量
/// </summary>
public string Syst2_IsoFlow { get; set; }
#endregion
#region 系统2原料用量
/// <summary>
/// POL流量
/// </summary>
public string Syst2_PolMaterialLeve { get; set; }
/// <summary>
/// ISO流量
/// </summary>
public string Syst2_IsoMaterialLeve { get; set; }
#endregion
#region 系统2液压
/// <summary>
/// 液压压力
/// </summary>
public string Syst2_Pressure { get; set; }
/// <summary>
/// 液压
/// </summary>
public string Syst2_Temperature { get; set; }
#endregion
#region 系统2结束信号
/// <summary>
/// A1结束信号
/// </summary>
public string Syst2_A1_End { get; set; }
/// <summary>
/// 结束信号
/// </summary>
public string Syst2_B1_End { get; set; }
#endregion
#region 系统2 A1-B1 POL注料压力
/// <summary>
/// A1 POL注料压力
/// </summary>
public string Syst2_A1_POLPressure { get; set; }
/// <summary>
/// B1 POL注料压力
/// </summary>
public string Syst2_B1_POLPressure { get; set; }
#endregion
#region 系统2 A1-B1 POL注料温度
/// <summary>
/// A1 POL注料温度
/// </summary>
public string Syst2_A1_POLTemperature { get; set; }
/// <summary>
/// B1 POL注料温度
/// </summary>
public string Syst2_B1_POLTemperature { get; set; }
#endregion
#region 系统2 A1-B1 ISO注料压力
/// <summary>
/// A1 ISO注料压力
/// </summary>
public string Syst2_A1_ISOPressure { get; set; }
/// <summary>
/// B1 ISO注料压力
/// </summary>
public string Syst2_B1_ISOPressure { get; set; }
#endregion
#region 系统2 A1-B1 ISO注料压力
/// <summary>
/// A1 ISO注料压力
/// </summary>
public string Syst2_A1_ISOTemperature { get; set; }
/// <summary>
/// B1 ISO注料压力
/// </summary>
public string Syst2_B1_ISOTemperature { get; set; }
#endregion
}
}

@ -24,7 +24,7 @@ namespace Aucma.Core.BoxFoam.ViewModels
{
Job_BoxFoamLastData_Quartz.RefreshLastShotDataDelegateEvent += RefreshData;
_boxLastShotRecordServices = App.ServiceProvider.GetService<IBoxLastShotRecordServices>();
//Task.WaitAll(LoadData());
}

@ -118,6 +118,22 @@ namespace Aucma.Core.BoxFoam.ViewModels
MessageBox.Show("任务添加失败!", "系统提醒");
}
}
else
{
//task.MaterialCode = _planInfo.MaterialCode;
//task.MaterialName = _planInfo.MaterialName;
//task.PlanAmount = Convert.ToInt32(TransmitAmount);
//var plan = _boxFoamPlanServices.AddAsync(task).Result;
//if (plan)
//{
// MessageBox.Show("任务添加成功!", "系统提醒");
// WeakReferenceMessenger.Default.Send<string>("RefreshTask");//刷新任务界面
//}
//else
//{
// MessageBox.Show("任务添加失败!", "系统提醒");
//}
}
}
else
{

@ -147,7 +147,7 @@
<TextBlock Text="输入压力" FontSize="18" Foreground="White"/>
</StackPanel>
<WrapPanel Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="{Binding PolInputPressure1}" FontSize="18" Margin="0 0 18 0" Foreground="White" Width="200" VerticalAlignment="Center" Block.TextAlignment="Center"/>
<TextBlock Text="{Binding POPressure}" FontSize="18" Margin="0 0 18 0" Foreground="White" Width="200" VerticalAlignment="Center" Block.TextAlignment="Center"/>
<TextBlock Text="MPa" FontSize="18" Foreground="White" />
</WrapPanel>
<WrapPanel Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Left">

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="06/07/2017 15:25:22" ReportInfo.Modified="10/27/2023 18:08:52" ReportInfo.CreatorVersion="2013.2.5.0">
<Report ScriptLanguage="CSharp" ReportInfo.Created="06/07/2017 15:25:22" ReportInfo.Modified="01/01/2024 12:05:55" ReportInfo.CreatorVersion="2013.2.5.0">
<Dictionary>
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqJUrEa/KIcQqhhcfnlqC6PGg5imbaGg6zUaNTAYc5sc03TfePxSblja2w5ZBQ6XB2KW3rzKVqcx6AloZTNTR44dHkYeZUDGBO29MmMS3/EQZ1uB8oN4b6VT05NhkHDu4nSS02ixL5sCDaWruiw1dvBMMaAoWWyrYZLApMwLWsLZEeqEyh/0UQi7oolfLZFm7d">
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqJUrEa/KIcQqhhcfnlqC6PGg5imbaGg6zUaNTAYc5sc03TfePxSblja2w5ZBQ6XB2KW3rzKVqcx6AloZTNTR44dHkYeZUDGBO29MmMS3/EQZ1uB8oN4b6VT05NhkHDu4nSS02ixL5sCDaWruiw1dvBMMaAoWWyrYZLApMwLWsLZFJVG0OalNUEnAGsAtmWtX/">
<TableDataSource Name="Wms_Product_BarCode" Alias="BoxBarData" DataType="System.Int32" Enabled="true" TableName="Wms_Product_BarCode">
<Column Name="Bar_ID" Enabled="false" DataType="System.Int32"/>
<Column Name="Bar_Code" DataType="System.String"/>
@ -31,10 +31,10 @@
</Dictionary>
<ReportPage Name="Page1" PaperWidth="70" PaperHeight="30" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" Guides="94.5,198.45">
<DataBand Name="Data1" Width="264.6" Height="117.18" StartNewPage="true" Guides="28.35">
<BarcodeObject Name="BarText" Left="13.7" Top="-9.45" Width="105.84" Height="105.84" AutoSize="false" Text="[BoxBarData.Bar_Code]" ShowText="false" Zoom="1.13" Barcode="QR Code" Barcode.ErrorCorrection="L" Barcode.Encoding="UTF8" Barcode.QuietZone="true"/>
<TextObject Name="Text5" Left="113.4" Top="13.23" Width="122.85" Height="15.12" Text=" [BoxBarData.Order_Material_Name]" WordWrap="false" Font="微软雅黑, 10.5pt, style=Bold"/>
<TextObject Name="Text7" Left="113.4" Top="51.03" Width="85.05" Height="15.12" Text="[BoxBarData.Order_No]" Font="微软雅黑, 10.5pt, style=Bold"/>
<TextObject Name="Text5" Left="113.4" Top="13.23" Width="141.75" Height="15.12" Text="[BoxBarData.Order_Material_Name]" WordWrap="false" Font="微软雅黑, 10.5pt, style=Bold"/>
<TextObject Name="Text7" Left="113.4" Top="51.03" Width="151.2" Height="15.12" Text="[BoxBarData.Order_No]" Font="微软雅黑, 10.5pt, style=Bold"/>
<TextObject Name="Text6" Left="22.68" Top="88.83" Width="245.15" Height="15.12" Text="[BoxBarData.Bar_Code]" VertAlign="Center" Font="微软雅黑, 12pt, style=Bold"/>
<BarcodeObject Name="BarText" Left="17.01" Top="-9.45" Width="86.94" Height="96.39" AutoSize="false" Expression="[BoxBarData.Id]" Text="L17091183015003164839" ShowText="false" Zoom="1.13" Barcode="QR Code" Barcode.ErrorCorrection="L" Barcode.Encoding="UTF8" Barcode.QuietZone="true"/>
</DataBand>
</ReportPage>
</Report>

@ -182,11 +182,12 @@ namespace Aucma.Core.PrintTo.ViewModels
MessageBox.Show("请输入打印数量!", "系统提醒");
return;
}
if (SelectedCells.PlanAmount == 0)
if (printType==0)
{
MessageBox.Show("请输入打印数量", "系统提醒");
MessageBox.Show("请选择打印类型", "系统提醒");
return;
}
try
{
string order_code = SelectedCells.OrderCode;
@ -194,7 +195,7 @@ namespace Aucma.Core.PrintTo.ViewModels
string product_name = SelectedCells.ProductName;
//string material_code = SelectedCells.MaterialCode;
//string material_name = SelectedCells.MaterialName;
int standard_amount = SelectedCells.StandardAmount;
int standard_amount = SelectedCells.PlanAmount;
string printName = SelectedCells.PrintName;
PrintIsEnabled = "False";

@ -50,6 +50,7 @@ namespace Aucma.Core.PrintTo.ViewModels
_orderCode = order_code;
ProductCode = productCode;
ProductName = productName;
//MaterialName = materialName;
//MaterialCode= materialCode;
PrintAmount = printAmount;
@ -99,6 +100,12 @@ namespace Aucma.Core.PrintTo.ViewModels
public string ProductCode { get => _productCode; set => SetProperty(ref _productCode, value); }
#endregion
#region 产品名称
private string _productName;
public string ProductName { get => _productName; set => SetProperty(ref _productName, value); }
#endregion
#region 型号简码
private string _materialName;
@ -193,9 +200,9 @@ namespace Aucma.Core.PrintTo.ViewModels
{
isPrint = false;
// 非阻塞打印
Task.Run(async () =>
Task.Run(() =>
{
await Print();
Print();
});
}
}
@ -253,7 +260,7 @@ namespace Aucma.Core.PrintTo.ViewModels
tmpList.Clear();
BaseBomInfo baseBomInfo = null;
List<BaseBomInfo> orderBomInfoList = await _baseBomInfoServices.QueryAsync();
if (printType==1)//箱壳
if (printType== 500)//箱壳
{
GetParentID(orderBomInfoList, productCode);
//OrderBomInfo obj = await _orderBomInfoServices.FirstAsync(d => d.MaterialCode == materialCode);
@ -262,7 +269,7 @@ namespace Aucma.Core.PrintTo.ViewModels
MessageBox.Show("无法查询打印条码数据", "系统提醒");
return;
}
baseBomInfo= tmpList.FirstOrDefault(d=>d.MaterialType=="200");
baseBomInfo= tmpList.FirstOrDefault(d=>d.MaterialType== "600");
}
if (printType == 2)//内胆
{
@ -287,7 +294,7 @@ namespace Aucma.Core.PrintTo.ViewModels
#region 打印
public async Task<bool> Print()
public void Print()
{
try
{
@ -308,7 +315,7 @@ namespace Aucma.Core.PrintTo.ViewModels
string barCode = string.Empty;
if (_printType== 500)
{
string rowNum = await GetMaxNumAsync(item.MaterialCode,"B");//最大值+1
string rowNum = GetMaxNumAsync(item.MaterialCode,"B").Result;//最大值+1
barCode = $"B{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
PrintProgress = $"[{PrintAmount}/{i}] {barCode}";
printBarCode.MaterialBarcode = barCode;
@ -317,7 +324,7 @@ namespace Aucma.Core.PrintTo.ViewModels
}
if (_printType == 200)
{
string rowNum = await GetMaxNumAsync(item.MaterialCode, "L");//最大值+1
string rowNum = GetMaxNumAsync(item.MaterialCode, "L").Result;//最大值+1
barCode = $"L{DateTime.Now.ToString("yyMMdd")}{item.MaterialCode}{rowNum}";
PrintProgress = $"[{PrintAmount}/{i}] {barCode}";
printBarCode.MaterialBarcode = barCode;
@ -340,7 +347,6 @@ namespace Aucma.Core.PrintTo.ViewModels
barReport.SetParameterValue("BoxBarData.Order_No", _orderCode);//订单号
barReport.SetParameterValue("BoxBarData.Order_Material_Name", PrintName);//物料简码
barReport.SetParameterValue("BoxBarData.Bar_Code", barCode);//二维码
//barReport.Prepare();
//string BarPath = System.Environment.CurrentDirectory + @"\pdf\" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
//barReport.Export(new PDFExport(), BarPath);
@ -358,14 +364,18 @@ namespace Aucma.Core.PrintTo.ViewModels
{
throw new Exception("条码生成异常");//抛出异常,回滚事务,事务退出
}
var num= await _printBarCodeServices.AddAsync(printBarCode);
var num= _printBarCodeServices.AddAsync(printBarCode).Result;
if (num<=0)
{
ErrorNum++;
BarcodesPrinted.Enqueue(BarcodesUnprinted.Dequeue());
Thread.Sleep(1000);
}
else
{
ErrorNum++;
log.Error($"打印保存出错:{printBarCode.ToJson()}");
}
BarcodesPrinted.Enqueue(BarcodesUnprinted.Dequeue());
Thread.Sleep(1000);
}
catch (Exception ex)
{
@ -378,12 +388,11 @@ namespace Aucma.Core.PrintTo.ViewModels
}
//打印完成
SetCompletetd();
return await Task.FromResult(true);
Thread.Sleep (3000);
}
catch (Exception ex)
{
log.Error($"打印出错:{ex.Message}");
return await Task.FromResult(false);
}
finally
{
@ -407,11 +416,12 @@ namespace Aucma.Core.PrintTo.ViewModels
{
return "0001";
}
list.ForEach(item =>
foreach (var item in list)
{
int num = Convert.ToInt32(item.MaterialBarcode.Substring(item.MaterialBarcode.Length - 1, 4));
string code = item.MaterialBarcode.Substring(item.MaterialBarcode.Length - 4);
int num = Convert.ToInt32(code);
tempList.Add(num);
});
}
string maxStr = (tempList.Max() + 1).ToString();
string rowNum = maxStr.PadLeft(4, '0');
return rowNum;

@ -38,7 +38,7 @@
</WrapPanel>
<WrapPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="产品型号" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBox Text="{Binding MaterialName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White"
<TextBox Text="{Binding ProductName}" FontSize="18" Width="300" Foreground="White" BorderBrush="White"
Margin="15 0 0 0"
HorizontalAlignment="Center" VerticalAlignment="Center" IsReadOnly="True"/>
</WrapPanel>

Loading…
Cancel
Save