liulb@mesnac.com 10 months ago
parent 7d68a3ad51
commit cf85055ea4

@ -9,6 +9,7 @@ using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using log4net;
using Microsoft.Extensions.DependencyInjection;
using NPOI.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -164,7 +165,7 @@ namespace Aucma.Core.PrintTo.ViewModels
/// 打印
/// </summary>
[RelayCommand]
private void Print(string obj)
private async void Print(string obj)
{
if (string.IsNullOrEmpty(obj))
{
@ -184,7 +185,7 @@ namespace Aucma.Core.PrintTo.ViewModels
}
if (SelectedCells.PlanAmount < PrintAmount)
{
MessageBox.Show("打印数量能高于计划数量!", "系统提醒");
MessageBox.Show("打印数量能高于计划数量!", "系统提醒");
return;
}
if (printType==0)
@ -193,6 +194,7 @@ namespace Aucma.Core.PrintTo.ViewModels
return;
}
try
{
string order_code = SelectedCells.OrderCode;
@ -202,8 +204,34 @@ namespace Aucma.Core.PrintTo.ViewModels
//string material_name = SelectedCells.MaterialName;
int standard_amount = PrintAmount;
string printName = SelectedCells.PrintName;
PrintIsEnabled = "False";
int type = 0;
if (printType == 500)
{
type = 2;
}
if (printType == 200)
{
type = 1;
}
var list= await _printBarCodeServices.QueryAsync(d => d.OrderCode == order_code&&d.PrintBarType== printType);
if (list!=null||list.Count!= 0)
{
int num= list.Count;//已经打印数量
int residue= SelectedCells.PlanAmount - num;//剩余打印数量
if (residue == standard_amount)
{
MessageBox.Show("订单数量已经打印到规定订单数量!", "系统提醒");
return;
}
if ((residue- standard_amount)< 1)
{
MessageBox.Show("订单数量已经打印到规定订单数量!", "系统提醒");
return;
}
}
//更新打印名称
var baseOrder = _baseOrderInfoServices.FirstAsync(d => d.OrderCode == order_code).Result;
if (string.IsNullOrEmpty(baseOrder.PrintName))

@ -235,7 +235,7 @@
<TextBlock Text="&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;打印数量" FontSize="18" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" />
<Slider x:Name="PlanAmount" FontSize="18" Minimum="0" Maximum="500" BorderBrush="White" Value="{Binding PrintAmount,Mode=TwoWay}" Foreground="White" Height="30" VerticalContentAlignment="Center"
HorizontalContentAlignment="Left" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="15 0 0 0" Width="{Binding Path=ActualWidth, ElementName=ProductNo}"/>
<!--<TextBlock Text="1~500" Width="60" Margin="10 0 0 0" Foreground="White" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center" />-->
<TextBlock Text="{Binding SelectedItem.PlanAmount, ElementName=dgvMH}" />
</WrapPanel>
<Border Grid.Row="5" BorderBrush="#0288d1" BorderThickness="1" CornerRadius="5" Width="420" >
<StackPanel >

@ -177,7 +177,11 @@ namespace Aucma.Core.ProductOffLine.Business
// Thread.Sleep(1000);
// MaterialBarScanEvent("33160030000000910780", "192.168.1.20");
}
/// <summary>
/// 开始扫码约我处理
/// </summary>
/// <param name="code"></param>
/// <param name="scannerIp"></param>
public void MaterialBarScan(string code, string scannerIp)
{
Task.Run(() =>
@ -190,7 +194,7 @@ namespace Aucma.Core.ProductOffLine.Business
/// </summary>
/// <param name="code"></param>
/// <param name="scannerIp">扫码器IP</param>
public void MaterialBarScanHandle(string code,string scannerIp)
public void MaterialBarScanHandle(string code, string scannerIp)
{
try
{
@ -316,7 +320,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
catch (Exception ex)
{
log.Error("MaterialBarScanHandle异常:"+ex.Message.ToString());
log.Error("MaterialBarScanHandle异常:" + ex.Message.ToString());
}
}
@ -348,7 +352,7 @@ namespace Aucma.Core.ProductOffLine.Business
{
OffLineInfo info11 = MapperTwo(TempOffLineInfo);
CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x=>x.ProductCode == info11.ProductSNCode).Result;
CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x => x.ProductCode == info11.ProductSNCode).Result;
if (bindingRecord1 == null)
{
@ -371,13 +375,13 @@ namespace Aucma.Core.ProductOffLine.Business
info11.PlcResult = 1;
// 查询本地数据库是否有数据
OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == TempOffLineInfo.ProductSNCode).Result;
if(offLineInfo == null)
if (offLineInfo == null)
{
info11.ProductOrderNo = "0000" + info11.ProductOrderNo;
int flag = _offLineInfoServices.AddAsync(info11).Result;
if (flag < 0)
{
log.Info(TempOffLineInfo.ProductSNCode+"插入下线记录失败");
log.Info(TempOffLineInfo.ProductSNCode + "插入下线记录失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "插入下线记录失败";
TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新
@ -393,7 +397,7 @@ namespace Aucma.Core.ProductOffLine.Business
BaseOrderInfo order = _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo).Result;
if (order == null)
{
log.Info("条码:"+TempOffLineInfo.ProductBarNo+" 订单号:"+TempOffLineInfo.ProductOrderNo+" 查询mes订单失败");
log.Info("条码:" + TempOffLineInfo.ProductBarNo + " 订单号:" + TempOffLineInfo.ProductOrderNo + " 查询mes订单失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "查询mes订单失败";
TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新
@ -408,7 +412,7 @@ namespace Aucma.Core.ProductOffLine.Business
}
order.UpdatedTime = DateTime.Now;
bool uploadOrder = _baseOrderInfoServices.UpdateAsync(order).Result;
if(!uploadOrder)
if (!uploadOrder)
{
log.Info("条码:" + TempOffLineInfo.ProductBarNo + " 订单号:" + TempOffLineInfo.ProductOrderNo + " 更新mes订单完成数失败");
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + "更新mes订单完成数失败";
@ -455,7 +459,7 @@ namespace Aucma.Core.ProductOffLine.Business
/// </summary>
/// <param name="BarCode"></param>
/// <returns></returns>
public bool HandleMaterialBarCode(string BarCode,TempInfo TempOffLineInfo)
public bool HandleMaterialBarCode(string BarCode, TempInfo TempOffLineInfo)
{
try
{
@ -628,7 +632,7 @@ namespace Aucma.Core.ProductOffLine.Business
// string strSave = "Y";
if (!string.IsNullOrEmpty(strSave))
{
if (strSave == "Y" || strSave=="S")
if (strSave == "Y" || strSave == "S")
{
log.Info(TempOffLineInfo.ProductSNCode + "上传条码成功:" + strSave);
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",上传条码成功";
@ -700,7 +704,7 @@ namespace Aucma.Core.ProductOffLine.Business
// 查询本地数据库是否有数据
OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == TempOffLineInfo.ProductSNCode).Result;
if (offLineInfo != null && offLineInfo.PlcResult==1)
if (offLineInfo != null && offLineInfo.PlcResult == 1)
{
log.Info(TempOffLineInfo.ProductSNCode + "条码重复上传plc应答字为1未响应为2可以再次放行");
@ -792,7 +796,7 @@ namespace Aucma.Core.ProductOffLine.Business
/// strDirection "A" ? 1 : 2;入库方向A,B
/// </summary>
/// <param name="materialType"></param>
private bool DownLoadPassFlag(int scannerNo,string strDirection)
private bool DownLoadPassFlag(int scannerNo, string strDirection)
{
// 入库方向A,B
int direction = strDirection == "A" ? 1 : 2;
@ -804,9 +808,9 @@ namespace Aucma.Core.ProductOffLine.Business
if (obj != null)
{
if(scannerNo == 1) // 扫码器1对应的货道地址内侧
if (scannerNo == 1) // 扫码器1对应的货道地址内侧
{
log.Info(TempOffLineInfo1.ProductSNCode + ":内侧下发plc放行信号,入库方向ZR1001,放行信号ZR1003分别写:"+ direction.ToString()+"/1" + ",等待反馈");
log.Info(TempOffLineInfo1.ProductSNCode + ":内侧下发plc放行信号,入库方向ZR1001,放行信号ZR1003分别写:" + direction.ToString() + "/1" + ",等待反馈");
TempOffLineInfo1.MsgInfo = TempOffLineInfo1.MsgInfo + "下发放行,";
RefreshScanMateriaCodeEvent(TempOffLineInfo1);
//TempOffLineInfo1.ProductRefreshFlag = true;
@ -832,7 +836,7 @@ namespace Aucma.Core.ProductOffLine.Business
// 等待plc反馈信号
while (true)
{
if(DateTime.Now > targetTime) // plc超最大时限无反馈
if (DateTime.Now > targetTime) // plc超最大时限无反馈
{
log.Info("等待plc放行反馈信号超时");
result = false;
@ -1083,6 +1087,14 @@ namespace Aucma.Core.ProductOffLine.Business
#endregion
/// <summary>
/// 验证条码是否是包含特征
/// </summary>
/// <param name="packagBarCode">成品码</param>
/// <param name="SNCode">包装码</param>
public void check(string packagBarCode, string SNCode)
{
}
}
}

@ -61,7 +61,7 @@ namespace Aucma.Core.TemperatureTask
try
{
flag = false;
var historyList = _codeMESServices.QueryAsync(d=>d.IsSync==0).Result;
var historyList = _codeMESServices.QueryAsync(d => d.IsSync == 0).Result;
Console.WriteLine(historyList.ToJson());
var query = (from a in historyList
select new TemperatureHistory
@ -77,7 +77,7 @@ namespace Aucma.Core.TemperatureTask
TestTime = a.TestTime,
TestedTime = a.TestedTime,
Etemp = a.Etemp,
BeginDateTime =Convert.ToDateTime(a.BeginDateTime),
BeginDateTime = Convert.ToDateTime(a.BeginDateTime),
CpResult = a.CpResult,
EndDateTime = Convert.ToDateTime(a.EndDateTime),
UserName = a.UserName,
@ -91,27 +91,27 @@ namespace Aucma.Core.TemperatureTask
LowV_PowerMax = a.LowV_PowerMax,
LowV_PowerFact = a.LowV_PowerFact,
LowVoltage = a.LowVoltage,
SyncDate =DateTime.Now
SyncDate = DateTime.Now
}).ToList();
if (query == null || query.Count == 0) return;
logHelper.Error($"读取数据个数:{historyList.Count()}");
Console.WriteLine($"【{DateTime.Now}】读取数据个数:{historyList.Count()}");
var result = _temperatureHistoryServices.AddAsync(query).Result;
if (result >0)
if (result > 0)
{
historyList.ForEach(d => d.IsSync = 1);
int r = _codeMESServices.UpateTemperatureHistoryFlag(historyList);
if (r> 0)
if (r > 0)
{
InsertToCompleteAndCheck(query);//保存过点数据
//发送post 请求
PostToMes(query);
Console.WriteLine($"【{DateTime.Now}】保存测温数据成功!保存数量:{query.Count}");
} }
}
}
Console.WriteLine($"【{DateTime.Now}】测温数据同步成功!数量:{query.Count}");
}
catch (Exception ex)
{

Loading…
Cancel
Save