|
|
|
@ -103,11 +103,10 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
|
|
|
|
|
public async void test()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result = await _productOffLineServices.QueryChecked("1531000AP0098DCU0481");
|
|
|
|
|
Console.WriteLine(result);
|
|
|
|
|
|
|
|
|
|
// string tt = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000004899@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
|
|
|
|
|
//Task.Run(() =>
|
|
|
|
|
//{
|
|
|
|
@ -122,10 +121,8 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="code"></param>
|
|
|
|
|
/// <param name="direction">扫码器方向</param>
|
|
|
|
|
public async void MaterialBarScanEvent(string code,string scannerIp)//接收条码数据
|
|
|
|
|
public void MaterialBarScanEvent(string code,string scannerIp)//接收条码数据
|
|
|
|
|
{
|
|
|
|
|
await Task.Run(async () =>
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(scannerIp);
|
|
|
|
|
int ScannerNo = scannerIp == Appsettings.app("Middleware", "Scanner1", "Ip") ? 1 : 2; // 确定是哪个扫码器
|
|
|
|
|
string materialType = "";
|
|
|
|
@ -133,26 +130,26 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
if (ScannerNo == 1)
|
|
|
|
|
{
|
|
|
|
|
//1.扫描的SN条码去条码系统校验
|
|
|
|
|
BackResult = await HandleMaterialBarCode(code.Trim(), TempOffLineInfo1); //扫码器1
|
|
|
|
|
BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo1); //扫码器1
|
|
|
|
|
materialType = TempOffLineInfo1.ProductCode;
|
|
|
|
|
if (!BackResult)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 2.更新mes数据库
|
|
|
|
|
BackResult = await updateMesData(TempOffLineInfo1);
|
|
|
|
|
BackResult = updateMesData(TempOffLineInfo1);
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo1.ProductOrderNo, TempOffLineInfo1.OrderQty));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
BackResult = await HandleMaterialBarCode(code.Trim(), TempOffLineInfo2); //扫码器2
|
|
|
|
|
BackResult = HandleMaterialBarCode(code.Trim(), TempOffLineInfo2); //扫码器2
|
|
|
|
|
materialType = TempOffLineInfo2.ProductCode;
|
|
|
|
|
if (!BackResult)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// 2.更新mes数据库
|
|
|
|
|
BackResult = await updateMesData(TempOffLineInfo2);
|
|
|
|
|
BackResult = updateMesData(TempOffLineInfo2);
|
|
|
|
|
log.Info(String.Format("订单号{0} 订单数量{1}", TempOffLineInfo2.ProductOrderNo, TempOffLineInfo2.OrderQty));
|
|
|
|
|
}
|
|
|
|
|
if (BackResult == true)
|
|
|
|
@ -170,8 +167,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
}
|
|
|
|
|
log.Info("plc放行反馈成功");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -179,23 +175,23 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BarCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> updateMesData(TempInfo TempOffLineInfo)
|
|
|
|
|
public bool updateMesData(TempInfo TempOffLineInfo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
OffLineInfo info11 = MapperTwo(TempOffLineInfo);
|
|
|
|
|
// 添加成品下线表
|
|
|
|
|
CodeBindingRecord bindingRecord1 = await _codeBindingServices.FirstAsync(x=>x.ProductCode == info11.ProductCode);
|
|
|
|
|
CodeBindingRecord bindingRecord1 = _codeBindingServices.FirstAsync(x=>x.ProductCode == info11.ProductCode).Result;
|
|
|
|
|
if (bindingRecord1 == null) return false;
|
|
|
|
|
info11.BoxCode = bindingRecord1.BoxCode;
|
|
|
|
|
// 产线
|
|
|
|
|
info11.ProductLineCode = "CX_01";
|
|
|
|
|
await _offLineInfoServices.AddAsync(info11);
|
|
|
|
|
_offLineInfoServices.AddAsync(info11);
|
|
|
|
|
// 修改订单表
|
|
|
|
|
////6.更新mes 数据库完成数量和时间(BASE_ORDERINFO) 注意:查询的字段可能需要修改,确保数据一致
|
|
|
|
|
|
|
|
|
|
////6.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo);
|
|
|
|
|
BaseOrderInfo order = _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo).Result;
|
|
|
|
|
|
|
|
|
|
// order.CompleteAmount++;
|
|
|
|
|
//if (order.CompleteAmount == order.OrderAmount)
|
|
|
|
@ -205,17 +201,19 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
//order.UpdatedTime = DateTime.Now;
|
|
|
|
|
//await _baseOrderInfoServices.UpdateAsync(order);
|
|
|
|
|
|
|
|
|
|
#region 更新过点数据
|
|
|
|
|
PrintBarCode print = await _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == bindingRecord1.BoxCode);
|
|
|
|
|
MaterialCompletion completion = new MaterialCompletion();
|
|
|
|
|
completion.OrderCode = print.OrderCode;
|
|
|
|
|
completion.MaterialBarcode = bindingRecord1.BoxCode;
|
|
|
|
|
completion.MaterialCode = print.MaterialCode;
|
|
|
|
|
completion.MaterialName = print.MaterialName;
|
|
|
|
|
completion.StationName = "1008" ;
|
|
|
|
|
completion.CompleteDate = DateTime.Now;
|
|
|
|
|
await _iMaterialCompletionServices.AddAsync(completion);
|
|
|
|
|
#region 暂时不启用,因为还没打箱体码,查不到数据,更新过点数据
|
|
|
|
|
//PrintBarCode print = await _printBarCodeServices.FirstAsync(x => x.MaterialBarcode == bindingRecord1.BoxCode);
|
|
|
|
|
//MaterialCompletion completion = new MaterialCompletion();
|
|
|
|
|
//completion.OrderCode = print.OrderCode;
|
|
|
|
|
//completion.MaterialBarcode = bindingRecord1.BoxCode;
|
|
|
|
|
//completion.MaterialCode = print.MaterialCode;
|
|
|
|
|
//completion.MaterialName = print.MaterialName;
|
|
|
|
|
//completion.StationName = "1008" ;
|
|
|
|
|
//completion.CompleteDate = DateTime.Now;
|
|
|
|
|
//await _iMaterialCompletionServices.AddAsync(completion);
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
@ -226,13 +224,13 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 去条码系统查询校验并保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BarCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<bool> HandleMaterialBarCode(string BarCode,TempInfo TempOffLineInfo)
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 去条码系统查询校验并保存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="BarCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool HandleMaterialBarCode(string BarCode,TempInfo TempOffLineInfo)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 1.先质检
|
|
|
|
@ -316,7 +314,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// mes查询订单数据, 异常处理:后期可能根据SN码查箱体码,查订单号并检查更新订单数据
|
|
|
|
|
BaseOrderInfo order = await _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo.Replace("0000", ""));
|
|
|
|
|
BaseOrderInfo order = _baseOrderInfoServices.FirstAsync(x => x.OrderCode == TempOffLineInfo.ProductOrderNo.Replace("0000", "")).Result;
|
|
|
|
|
//2.上传条码系统
|
|
|
|
|
if (!string.IsNullOrEmpty(TempOffLineInfo.ProductOrderNo))
|
|
|
|
|
{
|
|
|
|
@ -347,7 +345,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
if (strSave.Contains("条码重复"))
|
|
|
|
|
{
|
|
|
|
|
// 查询本地数据库是否有数据
|
|
|
|
|
OffLineInfo offLineInfo = await _offLineInfoServices.FirstAsync(x => x.ProductSNCode == BarCode);
|
|
|
|
|
OffLineInfo offLineInfo = _offLineInfoServices.FirstAsync(x => x.ProductSNCode == BarCode).Result;
|
|
|
|
|
if (offLineInfo != null)
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "条码重复,本地已存在,放行");
|
|
|
|
@ -365,7 +363,7 @@ namespace Aucma.Core.ProductOffLine.Business
|
|
|
|
|
{
|
|
|
|
|
log.Info(BarCode + "条码重复,本地不存在,已插入,放行");
|
|
|
|
|
OffLineInfo info11 = MapperTwo(TempOffLineInfo);
|
|
|
|
|
await _offLineInfoServices.AddAsync(info11);
|
|
|
|
|
_offLineInfoServices.AddAsync(info11);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|