liuwf 1 year ago
parent 578be1885c
commit 1005bf2fba

@ -141,13 +141,21 @@ namespace Khd.Core.Wcs.Wcs
//浅库位退库单往前排序,尽量避免移库操作 //浅库位退库单往前排序,尽量避免移库操作
if (rawOutStock != null && rawOutStock.Count > 0) if (rawOutStock != null && rawOutStock.Count > 0)
{ {
var locationOrder = dbContext.WmsBaseLocation var locations = dbContext.WmsBaseLocation
.Where(t => rawOutStock.Select(x => x.locationCode).Contains(t.locationCode)) .Where(t => rawOutStock.Select(x => x.locationCode).Contains(t.locationCode))
.OrderBy(x => x.locDeep == 2 ? 0 : 99) .AsEnumerable()
.Select((loc, index) => new { loc.locationCode, Index = index }) .OrderBy(x => x.locDeep == 2 ? 0 : 99)
.ToDictionary(item => item.locationCode, item => item.Index); .Select((loc, index) => new { loc.locationCode, Index = index })
.ToDictionary(item => item.locationCode, item => item.Index);
rawOutStock = rawOutStock.OrderBy(x => locationOrder[x.locationCode]).ToList(); rawOutStock = rawOutStock.OrderBy(x => locations[x.locationCode]).ToList();
//var locationOrder = dbContext.WmsBaseLocation
// .Where(t => rawOutStock.Select(x => x.locationCode).Contains(t.locationCode))
// .OrderBy(x => x.locDeep == 2 ? 0 : 99)
// .Select((loc, index) => new { loc.locationCode, Index = index })
// .ToDictionary(item => item.locationCode, item => item.Index);
//rawOutStock = rawOutStock.OrderBy(x => locationOrder[x.locationCode]).ToList();
} }
foreach (var item in rawOutStock) foreach (var item in rawOutStock)
{ {

@ -810,9 +810,10 @@ namespace Khd.Core.Wcs.Wcs
{ {
if (currentfloor06Value != null && targetfloor06Value != null) if (currentfloor06Value != null && targetfloor06Value != null)
{ {
Outtpyes.Add(5);
warningMsg = "MES屏蔽已打开无法下发任务"; warningMsg = "MES屏蔽已打开无法下发任务";
StaticData.PlcDic[0].WriteToPoint(this.targetfloor06.plcpointAddress, Convert.ToString(currentfloor06Value), this.targetfloor06.plcpointLength.ToString()); StaticData.PlcDic[0].WriteToPoint(this.targetfloor06.plcpointAddress, Convert.ToString(currentfloor06Value), this.targetfloor06.plcpointLength.ToString());
continue; // continue;
} }
} }
if (Outtpyes.Count > 0) if (Outtpyes.Count > 0)

@ -698,7 +698,7 @@ namespace Khd.Core.Wcs.Wcs
wmsBaseLocation.updateBy = "WCS"; wmsBaseLocation.updateBy = "WCS";
var mesBasePalletInfo = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == item.containerNo).FirstOrDefault(); var mesBasePalletInfo = dbContext.MesBasePalletInfo.Where(t => t.palletInfoCode == item.containerNo).FirstOrDefault();
var wmsProductInstock = dbContext.WmsProductInstock var wmsProductInstock = dbContext.WmsProductInstock
.Where(t => t.executeStatus == "1" && t.productType == "2" && t.warehouseId == 521) .Where(t => t.executeStatus == "1" && t.productType == "2" && t.warehouseId == 521).OrderByDescending(x=>x.applyDate)
.FirstOrDefault(); .FirstOrDefault();
if (mesBasePalletInfo != null && wmsProductInstock != null) if (mesBasePalletInfo != null && wmsProductInstock != null)
{ {

@ -252,31 +252,34 @@ namespace Khd.Core.Wpf.Form
if ("192.168.2.26".Equals(ip)) if ("192.168.2.26".Equals(ip))
{ {
// 获取所有可用的串口名称 // 获取所有可用的串口名称
string[] portNames = SerialPort.GetPortNames(); //string[] portNames = SerialPort.GetPortNames();
//虚拟串口 ////虚拟串口
virtualSerialPortModel = new SerialPortModel(); //virtualSerialPortModel = new SerialPortModel();
virtualSerialPortModel = new SerialPortModel(); //virtualSerialPortModel = new SerialPortModel();
virtualSerialPortModel.PortName = "COM10"; //virtualSerialPortModel.PortName = "COM1";
virtualSerialPortModel.BaudRate = 9600; //virtualSerialPortModel.BaudRate = 9600;
virtualSerialPortModel.DataBits = 8; //virtualSerialPortModel.DataBits = 8;
virtualSerialPortModel.Parity = Parity.None; //virtualSerialPortModel.Parity = Parity.None;
virtualSerialPortModel.StopBits = StopBits.One; //virtualSerialPortModel.StopBits = StopBits.One;
serialPortHelper = new SerialPortHelper(); //serialPortHelper = new SerialPortHelper();
serialPortHelper.OpenVirtualMyConn(virtualSerialPortModel); //serialPortHelper.OpenVirtualMyConn(virtualSerialPortModel);
//扫码枪串口
serialPortModel = new SerialPortModel(); serialPortModel = new SerialPortModel();
serialPortModel.PortName = "COM1"; serialPortModel.PortName = "COM1";
serialPortModel.BaudRate = 9600; serialPortModel.BaudRate = 9600;
serialPortModel.DataBits = 8; serialPortModel.DataBits = 8;
serialPortModel.Parity = Parity.None; serialPortModel.Parity = Parity.None;
serialPortModel.StopBits = StopBits.One; serialPortModel.StopBits = StopBits.One;
// serialPortHelper = new SerialPortHelper(); serialPortHelper = new SerialPortHelper();
serialPortHelper.OpenMyConn(serialPortModel); serialPortHelper.OpenMyConn(serialPortModel);
Thread scanThread = new Thread(ScanMessage); Thread scanThread = new Thread(ScanMessage);
scanThread.IsBackground = true; scanThread.IsBackground = true;
scanThread.Start(); scanThread.Start();
} }

@ -104,7 +104,7 @@ namespace Khd.Core.Wpf.Scan
byte[] result = new byte[MyCom.BytesToRead]; byte[] result = new byte[MyCom.BytesToRead];
MyCom.Read(result, 0, MyCom.BytesToRead); MyCom.Read(result, 0, MyCom.BytesToRead);
// 将读取到的数据写入virtualCom // 将读取到的数据写入virtualCom
VirtualCom.Write(result, 0, result.Length); // VirtualCom.Write(result, 0, result.Length);
ReceiveData += Encoding.UTF8.GetString(result); ReceiveData += Encoding.UTF8.GetString(result);
if (ReceiveData.Contains('\r')) if (ReceiveData.Contains('\r'))
{ {

Loading…
Cancel
Save