提交代码
This commit is contained in:
16
WCS.BLL/Config/JsConfig.cs
Normal file
16
WCS.BLL/Config/JsConfig.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WCS.BLL.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// json配置文件
|
||||
/// </summary>
|
||||
public class JsConfig
|
||||
{
|
||||
public List<string> ModuleCodePatterns { get; set; }
|
||||
}
|
||||
}
|
@ -11,17 +11,15 @@ namespace WCS.BLL.Config
|
||||
/// <summary>
|
||||
/// 本地文件
|
||||
/// </summary>
|
||||
public class LocalFile
|
||||
public static class LocalFile
|
||||
{
|
||||
|
||||
public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
/// <summary>
|
||||
/// 程序运行名称(BaseUi.exe)
|
||||
/// </summary>
|
||||
public static readonly string AppName = AppDomain.CurrentDomain.FriendlyName;
|
||||
/// <summary>
|
||||
/// 程序运行目录
|
||||
/// </summary>
|
||||
public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
/// <summary>
|
||||
/// 数据目录
|
||||
/// </summary>
|
||||
public static readonly string DataDir = Path.Combine(AppDir, "data");
|
||||
@ -30,76 +28,72 @@ namespace WCS.BLL.Config
|
||||
/// </summary>
|
||||
public static readonly string LogDir = Path.Combine(AppDir, "logs");
|
||||
/// <summary>
|
||||
/// 运行主程序
|
||||
/// </summary>
|
||||
public static readonly string AppPath = Path.Combine(AppDir, AppDomain.CurrentDomain.FriendlyName);
|
||||
/// <summary>
|
||||
/// 配置文件路径
|
||||
/// </summary>
|
||||
public static readonly string ConfigPath = Path.Combine(DataDir, "jsconfig.json");
|
||||
/// <summary>
|
||||
/// 货架模组编码正则表达式
|
||||
/// </summary>
|
||||
public static readonly string ModuleCodePattern = "^[ABCD][0-9]{1,2}-R[0-9]{1,2}C[0-9]{1,2}$";
|
||||
public static readonly string DefaultModuleCodePattern = "^[ABCD][0-9]{1,2}-R[0-9]{1,2}C[0-9]{1,2}$";
|
||||
|
||||
static object lockConfig = new object();
|
||||
|
||||
//static JsConfig config;
|
||||
///// <summary>
|
||||
///// 配置信息
|
||||
///// </summary>
|
||||
//public static JsConfig Config
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// if (config != null)
|
||||
// return config;
|
||||
// else
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// if (File.Exists(ConfigPath))
|
||||
// lock (lockConfig)
|
||||
// config = JsonConvert.DeserializeObject<JsConfig>(File.ReadAllText(ConfigPath, Encoding.UTF8));
|
||||
// else
|
||||
// config = null;
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// config = null;
|
||||
// }
|
||||
// }
|
||||
// return config ?? new JsConfig();
|
||||
// }
|
||||
//}
|
||||
static JsConfig config;
|
||||
/// <summary>
|
||||
/// 配置信息
|
||||
/// </summary>
|
||||
public static JsConfig Config
|
||||
{
|
||||
get
|
||||
{
|
||||
if (config != null)
|
||||
return config;
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(ConfigPath))
|
||||
lock (lockConfig)
|
||||
config = JsonConvert.DeserializeObject<JsConfig>(File.ReadAllText(ConfigPath, Encoding.UTF8));
|
||||
else
|
||||
config = null;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
config = null;
|
||||
}
|
||||
}
|
||||
return config ?? new JsConfig();
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 刷新配置信息。将本地的配置信息重新加载到内存中
|
||||
///// </summary>
|
||||
//public static void UpdateConfig()
|
||||
//{
|
||||
// if (File.Exists(ConfigPath))
|
||||
// lock (lockConfig)
|
||||
// config = JsonConvert.DeserializeObject<JsConfig>(File.ReadAllText(ConfigPath, Encoding.UTF8));
|
||||
// else
|
||||
// config = null;
|
||||
//}
|
||||
/// <summary>
|
||||
/// 刷新配置信息。将本地的配置信息重新加载到内存中
|
||||
/// </summary>
|
||||
public static void UpdateConfig()
|
||||
{
|
||||
if (File.Exists(ConfigPath))
|
||||
lock (lockConfig)
|
||||
config = JsonConvert.DeserializeObject<JsConfig>(File.ReadAllText(ConfigPath, Encoding.UTF8));
|
||||
else
|
||||
config = null;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 保存配置信息。将内存中的配置信息保存到本地
|
||||
///// </summary>
|
||||
//public static void SaveConfig()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// lock (lockConfig)
|
||||
// File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(Config, Formatting.Indented), Encoding.UTF8);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// UpdateConfig();
|
||||
// throw ex;
|
||||
// }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 保存配置信息。将内存中的配置信息保存到本地
|
||||
/// </summary>
|
||||
public static void SaveConfig()
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (lockConfig)
|
||||
File.WriteAllText(ConfigPath, JsonConvert.SerializeObject(Config, Formatting.Indented), Encoding.UTF8);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UpdateConfig();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,8 @@ namespace WCS.BLL.HardWare
|
||||
/// 过程中异常 入库过程中异常/出库过程中异常
|
||||
/// </summary>
|
||||
public List<ProcessingExceptionType> ProcessingExceptions { get; set; } = new List<ProcessingExceptionType>();
|
||||
public string? InstoreIpAddress { get; set; } = string.Empty;
|
||||
public string? CurrentCom { get; set; } = string.Empty;
|
||||
//TODO 退出入库清除
|
||||
|
||||
public MatInfoResponse InStoreData { get; set; }
|
||||
|
||||
@ -137,7 +138,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
if (this.CurentMode == Mode.入库模式)
|
||||
{
|
||||
InstoreIpAddress = IPAddress;
|
||||
CurrentCom = IPAddress;
|
||||
return;
|
||||
}
|
||||
//判断当前模式是否为待机模式
|
||||
@ -181,7 +182,6 @@ namespace WCS.BLL.HardWare
|
||||
if (deficientTime > 0)
|
||||
Thread.Sleep(deficientTime);
|
||||
//出现异常的未进入入库模式,有红灯进行指引
|
||||
this.CurentMode = Mode.待机模式;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
if (notInstoreList.Count > 0)
|
||||
{
|
||||
CurentMode = Mode.待机模式;
|
||||
|
||||
foreach (var item in notInstoreList)
|
||||
{
|
||||
ExceptionMessages.Add($"模组{item.ModuleCode}未进入入库模式!");
|
||||
@ -205,7 +205,7 @@ namespace WCS.BLL.HardWare
|
||||
//警示灯亮起
|
||||
WarningLight.BlueLight(TcpCleint);
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
InstoreIpAddress = IPAddress;
|
||||
CurrentCom = IPAddress;
|
||||
//返回成功
|
||||
return;
|
||||
}
|
||||
@ -356,7 +356,7 @@ namespace WCS.BLL.HardWare
|
||||
#region 协议返回处理
|
||||
public void ProtocolProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
Logs.Write("协议处理中的数据" + BitConverter.ToString(data) + $"板子id{boardId}");
|
||||
Logs.Write("协议处理4");
|
||||
//协议处理 判断功能位
|
||||
switch (data[TcpCleint.PreFixLength + 2])
|
||||
{
|
||||
@ -381,13 +381,18 @@ namespace WCS.BLL.HardWare
|
||||
case 0x07://正常出库返回信号
|
||||
OutstoreReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x08://出库模式中异常信号
|
||||
OutstoreExceptionReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
case 0x13://复位的返回信号
|
||||
ResetReturnProcess(data, boardId, lightNumber);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
|
||||
}
|
||||
Logs.Write("协议处理5");
|
||||
}
|
||||
/// <summary>
|
||||
/// 进入入库模式返回信号处理
|
||||
@ -510,7 +515,7 @@ namespace WCS.BLL.HardWare
|
||||
//库位未配置、返回数据异常
|
||||
else
|
||||
{
|
||||
//Logs.Write($"[进入入库模式异常]板Id{boardIds},库位号{index + 1}找不到对应库位!");
|
||||
Logs.Write($"[进入入库模式异常]板Id{boardId},库位号{index + 1}找不到对应库位!");
|
||||
}
|
||||
}
|
||||
else if (dataTemp[2 * index] == '0')
|
||||
@ -556,22 +561,26 @@ namespace WCS.BLL.HardWare
|
||||
/// <param name="data"></param>
|
||||
public void InStoreReturnProcess(byte[] data)
|
||||
{
|
||||
Logs.Write("协议处理5.1");
|
||||
var boardId = (data[TcpCleint.PreFixLength + 0] << 8) + data[TcpCleint.PreFixLength + 1];
|
||||
var number = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||
var storeInfo = DbHelp.db.Queryable<StoreInfo>().Where(t => t.BoardId == boardId
|
||||
&& t.LightNumber == number).First();
|
||||
Logs.Write("协议处理5.2");
|
||||
if (storeInfo == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
//TODO 报错
|
||||
return;
|
||||
}
|
||||
Logs.Write("协议处理5.3");
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId)
|
||||
.FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
//TODO 报错
|
||||
return;
|
||||
}
|
||||
Logs.Write("协议处理5.4");
|
||||
#region 判断是否扫码获取物料信息
|
||||
//物料未扫码
|
||||
if (this.InStoreData == null)
|
||||
@ -580,18 +589,17 @@ namespace WCS.BLL.HardWare
|
||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||
{
|
||||
module.ComfirmInstore(TcpCleint);
|
||||
//TO DO Logs.Write($"[{guid}]CAN给了多次正常入库信号,防止硬件异常,返回了确认入库");
|
||||
Logs.Write($"CAN给了多次正常入库信号,防止硬件异常,返回了确认入库");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write("协议处理5.5");
|
||||
var exceptionMessage = storeInfo.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
Logs.Write("协议处理5.4");
|
||||
module.ComfirmErrInstore(TcpCleint);
|
||||
WarningLight.WaringLightBlueEnd(TcpCleint);
|
||||
//WaringLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
//TO DO Logs.Write($"[{guid}]当前物料信息不存在,请取出后重新扫码进行入库!");
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -664,7 +672,6 @@ namespace WCS.BLL.HardWare
|
||||
this.InStoreData = null;
|
||||
|
||||
//实际入库位置亮灯1S,报警灯同时进行亮绿灯并鸣叫一次提示。
|
||||
Thread.Sleep(20);
|
||||
Task.Run(() =>
|
||||
{
|
||||
//确认入库(硬件入库位置亮灯1秒)
|
||||
@ -694,50 +701,56 @@ namespace WCS.BLL.HardWare
|
||||
/// <param name="lightNumber"></param>
|
||||
public void InStoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
Logs.Write("协议处理5.1");
|
||||
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
|
||||
var store = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
|
||||
.First();
|
||||
Logs.Write("协议处理5.2");
|
||||
if (store == null)
|
||||
{
|
||||
//TO DO 库位未找到
|
||||
return;
|
||||
}
|
||||
Logs.Write("协议处理5.3");
|
||||
//已放物料丢失了 物料多放了 储位恢复正常
|
||||
switch (data[TcpCleint.PreFixLength + 3])
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
Logs.Write("协议处理5.4");
|
||||
var exceptionMessage = store.StoreCode + "恢复正常!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.RemoveAll(t => t.BoardId == boardId);
|
||||
Logs.Write("协议处理5.5");
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
{
|
||||
Logs.Write("协议处理5.4");
|
||||
var exceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "入库过程中存在物料未扫描上架!"
|
||||
});
|
||||
Logs.Write("协议处理5.5");
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
{
|
||||
Logs.Write("协议处理5.4");
|
||||
var exceptionMessage = store.StoreCode + "物料被取出!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "入库过程中物料丢失!"
|
||||
});
|
||||
Logs.Write("协议处理5.5");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -896,7 +909,7 @@ namespace WCS.BLL.HardWare
|
||||
if (CurentMode != Mode.出库模式)
|
||||
{
|
||||
//TO DO 未在出库模式 要报错
|
||||
//Logs.Write($"[{guid}]出库错误:该货架模式不是出库模式或盘点模式{storeInfo.ShelfCode}!");
|
||||
Logs.Write($"出库错误:{ShelfCode}该货架模式不是出库模式或盘点模式!");
|
||||
return;
|
||||
}
|
||||
lightNumber = Convert.ToInt32(data[TcpCleint.PreFixLength + 3]);
|
||||
@ -927,7 +940,7 @@ namespace WCS.BLL.HardWare
|
||||
//不是本次出库需要出的物料
|
||||
if (!CurrentOutStoreMatSNs.Contains(storeInfo.CurrentMatSn))
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN}不是本次需要出库的物料");
|
||||
Logs.Write($"{storeInfo.CurrentMatSn}不是本次需要出库的物料");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
@ -937,7 +950,7 @@ namespace WCS.BLL.HardWare
|
||||
var inventoryDetail = DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == storeInfo.CurrentMatSn).First();
|
||||
if (inventoryDetail == null)
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN}库存信息不存在");
|
||||
Logs.Write($"{storeInfo.CurrentMatSn}库存信息不存在");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
@ -949,7 +962,7 @@ namespace WCS.BLL.HardWare
|
||||
.ToList();
|
||||
if (orderOrderDetails == null || orderOrderDetails.Count == 0)
|
||||
{
|
||||
//Logs.Write($"{storeInfo.CurrentMatSN},OrderDetail出库明细信息不存在");
|
||||
Logs.Write($"{storeInfo.CurrentMatSn},OrderDetail出库明细信息不存在");
|
||||
//报警灯报警
|
||||
WarningLight.WaringLightAlwaysRed(TcpCleint);
|
||||
return;
|
||||
@ -1003,27 +1016,24 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
//确认本次出库
|
||||
module.ComfirmOutstore(TcpCleint, data[TcpCleint.PreFixLength + 3]);
|
||||
//shelfStatus.SetCurrentModeTime = DateTime.Now;
|
||||
//LocalStatic.IsRefreshOrderDetail = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
//给信号通知出库页面更新页面的状态
|
||||
});
|
||||
|
||||
//当前柜子是否还存在未出库的
|
||||
CurrentOutStoreMatSNs.RemoveAll(t => t == matSN);//删除本次已出的物料SN
|
||||
|
||||
|
||||
var isExsistOut = CurrentOutStoreMatSNs.Any();
|
||||
//本批次出库已完成
|
||||
if (!isExsistOut)
|
||||
{
|
||||
//Logs.Write($"货架[{shelfStatus.ShelfCode}]:不存在待出物料,退出出库模式");
|
||||
//退出出库模式
|
||||
GoOutOutstore();
|
||||
WarningLight.CloseLight(TcpCleint);
|
||||
|
||||
var currentPickBillNumber = CurrentOutOrder.OrderNumber;
|
||||
CurrentOutOrder = null;
|
||||
Task.Run(() =>
|
||||
{
|
||||
//LocalStatic.UpdatOutOrderStatus(currentPickBillNumber);
|
||||
//给信号通知出库页面更新页面的状态
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1052,6 +1062,63 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库模式中异常处理
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <param name="boardId"></param>
|
||||
/// <param name="lightNumber"></param>
|
||||
public void OutstoreExceptionReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
lightNumber = (int)data[TcpCleint.PreFixLength + 4];
|
||||
var store = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == boardId && t.LightNumber == lightNumber)
|
||||
.First();
|
||||
if (store == null)
|
||||
{
|
||||
//TO DO 库位未找到
|
||||
return;
|
||||
}
|
||||
//已放物料丢失了 物料多放了 储位恢复正常
|
||||
switch (data[TcpCleint.PreFixLength + 3])
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "恢复正常!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
ProcessingExceptions.RemoveAll(t => t.BoardId == boardId);
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "出库过程中存在物料上架!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "出库过程中存在物料上架!"
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 0x02:
|
||||
{
|
||||
var exceptionMessage = store.StoreCode + "物料被取出!";
|
||||
WebSoceketManager.TrySendMessage("127.0.0.1", exceptionMessage);
|
||||
ProcessingExceptions.Add(new ProcessingExceptionType()
|
||||
{
|
||||
BoardId = boardId,
|
||||
LightNumber = lightNumber,
|
||||
ExceptionMessage = store.StoreCode + "出库过程中物料被异常取出!"
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ResetReturnProcess(byte[] data, int boardId, int lightNumber)
|
||||
{
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId && t.CurrentMode == Mode.入库模式).FirstOrDefault();
|
||||
@ -1065,7 +1132,6 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@ namespace WCS.BLL.Manager
|
||||
public static List<TCPClient> TCPClients = new List<TCPClient>();
|
||||
public static void InitTcpClient()
|
||||
{
|
||||
var ips = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ShelfCode.Contains("A")).Select(t => t.ClientIp).ToList();
|
||||
var ips = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ShelfCode.Contains("C")).Select(t => t.ClientIp).ToList();
|
||||
foreach (var ip in ips)
|
||||
{
|
||||
var tcpCleint = new TCPClient(ip, "192.168.0.183:20003");
|
||||
var tcpCleint = new TCPClient(ip, "192.168.9.183:20003");
|
||||
|
||||
|
||||
//var tcpCleint = new TCPClient("192.168.0.183:20002", "192.168.0.183:20003");
|
||||
@ -31,6 +31,7 @@ namespace WCS.BLL.Manager
|
||||
|
||||
tcpCleint.tcpClient.Received += (client, e) =>
|
||||
{
|
||||
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||
if (TcpCleint == null)
|
||||
@ -49,8 +50,8 @@ namespace WCS.BLL.Manager
|
||||
var isEqual = prefixInData.SequenceEqual(TcpCleint.Prefix);
|
||||
if (isEqual)
|
||||
{
|
||||
Logs.Write("协议处理1!");
|
||||
var dataTemp = data.Skip(index).Take(TcpCleint.PreFixLength + TcpCleint.DataLength).ToArray();
|
||||
Logs.Write($"接受到数据:{BitConverter.ToString(dataTemp)}");
|
||||
if (dataTemp.Length < TcpCleint.PreFixLength + TcpCleint.DataLength)//拆包后不满足一条指令的长度
|
||||
{
|
||||
continue;
|
||||
@ -60,6 +61,7 @@ namespace WCS.BLL.Manager
|
||||
var boardId = (dataTemp[TcpCleint.PreFixLength + 0] << 8) + dataTemp[TcpCleint.PreFixLength + 1];
|
||||
var lightNumber = Convert.ToInt32(dataTemp[TcpCleint.PreFixLength + 3]);
|
||||
|
||||
Logs.Write("协议处理2!");
|
||||
//报警灯
|
||||
if (dataTemp[TcpCleint.PreFixLength + 2] == 0x20)
|
||||
{
|
||||
@ -69,9 +71,10 @@ namespace WCS.BLL.Manager
|
||||
var smartShelf = shelf as SmartShelf;
|
||||
smartShelf?.ProtocolProcess(dataTemp, boardId, lightNumber);
|
||||
}
|
||||
//货架类型协议返回
|
||||
//!= 0x20 货架类型协议返回
|
||||
else
|
||||
{
|
||||
Logs.Write("协议处理3!");
|
||||
var shelf = ShelfManager.Shelves
|
||||
.Where(t => t.ClientIp == clientIpHost)
|
||||
.Where(t => t.ModuleIds.Contains(boardId))
|
||||
@ -96,6 +99,7 @@ namespace WCS.BLL.Manager
|
||||
//}
|
||||
}
|
||||
}
|
||||
Logs.Write("协议处理完毕!");
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.User;
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
|
@ -1,6 +1,5 @@
|
||||
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
|
@ -15,6 +15,8 @@ namespace WCS.BLL.Services.IService
|
||||
|
||||
public Task<ResponseBase> GetOutOrderList(GetOutOrderListRequest request);
|
||||
|
||||
public Task<ResponseBase> GetOutOrderListByStatus(GetOutOrderListByStatusRequest request);
|
||||
|
||||
public Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request);
|
||||
|
||||
public Task<ResponseBase> GetOutOrderMatDetail(GetOutOrderDetailRequest request);
|
||||
|
@ -27,7 +27,7 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseBase> queryMatInfoInStocktakingOrder(QueryMatInfoInStocktakingOrderRequest request);
|
||||
|
||||
|
||||
public Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request);
|
||||
public Task<ResponseBase> confirmStocktakingOrder(ConfirmStocktakingOrderRequest request);
|
||||
|
||||
public Task<ResponseBase> commitStockTakingOrder(GetStockTakingOrderMatDetailRequest request);
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model;
|
||||
using WCS.DAL.DbModels;
|
||||
|
@ -1,5 +1,4 @@
|
||||
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db.AuthDb;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.User;
|
||||
|
@ -11,7 +11,6 @@ using TouchSocket.Core;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
|
@ -23,7 +23,25 @@ namespace WCS.BLL.Services.Service
|
||||
public ResponseBase shelfGoInInStore(ShelfGoInInstoreRequest request)
|
||||
{
|
||||
//校验货架编码规则
|
||||
bool isValid = Regex.IsMatch(request.ModuleCode, LocalFile.ModuleCodePattern);
|
||||
//取配置文件中得货架编码规则
|
||||
bool isValid = false;
|
||||
var patterns = LocalFile.Config.ModuleCodePatterns;
|
||||
if (patterns != null && patterns.Count > 0)
|
||||
{
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
isValid = Regex.IsMatch(request.ModuleCode, pattern);
|
||||
//匹配到第一个符合条件的货架码 就直接退出循环 认为匹配成功
|
||||
if (isValid)
|
||||
break;
|
||||
}
|
||||
}
|
||||
//如果配置文件缺失 使用默认正则进行匹配
|
||||
else
|
||||
{
|
||||
isValid = Regex.IsMatch(request.ModuleCode, LocalFile.DefaultModuleCodePattern);
|
||||
}
|
||||
|
||||
if (!isValid)
|
||||
{
|
||||
return new ResponseBase()
|
||||
@ -50,7 +68,7 @@ namespace WCS.BLL.Services.Service
|
||||
return new ShelfGoInInstoreResponse()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "货架进入入库模式成功!",
|
||||
Message = $"货架进入入库模式成功!{string.Join(",", shelf.ExceptionMessages)}",
|
||||
Data = new ShelfGoInInstoreDto()
|
||||
{
|
||||
ShelfCode = shelf.ShelfCode,
|
||||
@ -130,7 +148,7 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
#region 获取物料数据 //调用接口或者直接查询数据库
|
||||
//调用接口
|
||||
//TODO做成配置 调用接口
|
||||
if (1 != 1)
|
||||
{
|
||||
|
||||
@ -141,7 +159,7 @@ namespace WCS.BLL.Services.Service
|
||||
var matInfo = await DbHelp.db.Queryable<MatInfo>().Where(t => t.MatSn == request.MatSn).FirstAsync();
|
||||
if (matInfo != null)
|
||||
{
|
||||
|
||||
//TODO 改成wcs的实体
|
||||
shelf.InStoreData = new MatInfoResponse()
|
||||
{
|
||||
materialBar = matInfo.MatSn,
|
||||
@ -198,7 +216,7 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
|
||||
//这个时间相当于需要入库扫码后需要等待的时间
|
||||
//TODO 配置这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = 5000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
var beginTime = DateTime.Now;
|
||||
|
@ -9,7 +9,6 @@ using TouchSocket.Core;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
|
@ -10,7 +10,6 @@ using TouchSocket.Core;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
|
@ -8,8 +8,6 @@ using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
|
@ -204,6 +204,7 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
}
|
||||
|
||||
|
||||
public async Task<ResponseBase> GetOutOrderList(GetOutOrderListRequest request)
|
||||
{
|
||||
//直接查询
|
||||
@ -236,6 +237,43 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> GetOutOrderListByStatus(GetOutOrderListByStatusRequest request)
|
||||
{
|
||||
if (request.OrderExeStatus == null || request.OrderExeStatus.Count == 0)
|
||||
{
|
||||
//不传入状态不显示
|
||||
return new PageQueryResponse<OutOrder>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new PageQueryResponseData<OutOrder>()
|
||||
{
|
||||
Lists = new List<OutOrder>()
|
||||
}
|
||||
};
|
||||
}
|
||||
//直接查询
|
||||
var recordsQueryable = DbHelp.db.Queryable<OutOrder>();
|
||||
|
||||
var totalCount = await recordsQueryable.CountAsync();
|
||||
var records = await recordsQueryable
|
||||
.OrderByDescending(t => t.CreateTime)
|
||||
//.Take(request.PageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return new PageQueryResponse<OutOrder>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new PageQueryResponseData<OutOrder>()
|
||||
{
|
||||
//TotalCount = totalCount,
|
||||
//MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
|
||||
//Count = records.Count,
|
||||
Lists = records.ToList()
|
||||
}
|
||||
};
|
||||
}
|
||||
public async Task<ResponseBase> GetOutOrderDetail(GetOutOrderDetailRequest request)
|
||||
{
|
||||
OutOrder outOrder = null;
|
||||
@ -288,7 +326,6 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
return new ResponseCommon<List<OutOrderDetail>>()
|
||||
{
|
||||
Code = 200,
|
||||
@ -428,7 +465,7 @@ namespace WCS.BLL.Services.Service
|
||||
var matDetails = outOrderMatDetails.Where(t => t.StoreInfo.ShelfCode == shelf.ShelfCode)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
shelf.GoInOutstore(matDetails,order);
|
||||
shelf.GoInOutstore(matDetails, order);
|
||||
});
|
||||
|
||||
//返回
|
||||
|
@ -606,7 +606,7 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request)
|
||||
public async Task<ResponseBase> confirmStocktakingOrder(ConfirmStocktakingOrderRequest request)
|
||||
{
|
||||
//获取盘点物料明细
|
||||
var stockTakingMatDetail =await DbHelp.db.Queryable<StockTakingOrderMatDetail>()
|
||||
|
@ -8,7 +8,6 @@ using TouchSocket.Core;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
using WCS.Model;
|
||||
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db.AuthDb;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.User;
|
||||
|
@ -77,6 +77,7 @@ namespace WCS.BLL
|
||||
{
|
||||
var data = e.ByteBlock.Buffer.Take((int)e.ByteBlock.Length).ToArray();
|
||||
//e.ByteBlock.Clear();
|
||||
Logs.Write($"校验发送接收,收到数据" + BitConverter.ToString(data));
|
||||
var len = data.Length;
|
||||
for (int index = 0; index < data.Length - PreFixLength; index++)
|
||||
{
|
||||
@ -103,7 +104,9 @@ namespace WCS.BLL
|
||||
index += (PreFixLength + DataLength - 1);//每次循环index会+1 所以这里-1
|
||||
}
|
||||
}
|
||||
Logs.Write($"校验发送接收处理完毕" + BitConverter.ToString(data));
|
||||
return null;
|
||||
|
||||
};
|
||||
|
||||
tcpClient.Connected += (client, e) =>
|
||||
@ -125,15 +128,23 @@ namespace WCS.BLL
|
||||
{
|
||||
try
|
||||
{
|
||||
//TO DO如果指令未回应n次 则取消重发
|
||||
//TODO如果指令未回应n次 则取消重发
|
||||
Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
|
||||
await Task.Delay(3000);
|
||||
await Task.Delay(100);
|
||||
if (MessageList.Count > 0)
|
||||
{
|
||||
var failedMessage = MessageList.Where(t => t.Value.SendTimes >= 3).ToList();
|
||||
foreach (var message in failedMessage)
|
||||
{
|
||||
Logs.Write(BitConverter.ToString(message.Value.Message) +
|
||||
"指令未响应");
|
||||
}
|
||||
MessageList.RemoveWhen(t => t.Value.SendTimes >= 3);
|
||||
|
||||
Console.WriteLine(Thread.CurrentThread.ManagedThreadId);
|
||||
foreach (var item in MessageList)
|
||||
{
|
||||
if (item.Value.LastSendTime < DateTime.Now.AddSeconds(3))
|
||||
if (item.Value.LastSendTime < DateTime.Now.AddSeconds(-1))
|
||||
{
|
||||
tcpClient.Send(item.Value.Message);
|
||||
item.Value.SendTimes++;
|
||||
@ -141,6 +152,7 @@ namespace WCS.BLL
|
||||
await Task.Delay(10);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch
|
||||
@ -170,6 +182,7 @@ namespace WCS.BLL
|
||||
lock (sendLockObject)
|
||||
{
|
||||
tcpClient.Send(message);
|
||||
//TODO MessageList.AddOrUpdate(new Mes)
|
||||
//发送自带10ms间隔
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
@ -225,6 +238,7 @@ namespace WCS.BLL
|
||||
/// </summary>
|
||||
public byte[] Message { get; set; }
|
||||
|
||||
public bool IsWating { get; set; }
|
||||
/// <summary>
|
||||
/// 发送次数
|
||||
/// </summary>
|
||||
|
@ -5,7 +5,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.DAL.AuthDbModel;
|
||||
using WCS.DAL.Db.AuthDb;
|
||||
|
||||
namespace WCS.DAL
|
||||
{
|
||||
@ -14,9 +14,11 @@ namespace WCS.DAL
|
||||
/// </summary>
|
||||
public static class AuthDbHelp
|
||||
{
|
||||
|
||||
|
||||
public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = $"Data Source={LocalFile.AuthDbPath};",
|
||||
ConnectionString = $"Data Source={DbPath.AuthDbPath};",
|
||||
DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite.Core];
|
||||
IsAutoCloseConnection = true
|
||||
}, db =>
|
@ -5,7 +5,7 @@ using System.Text;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
|
||||
namespace WCS.DAL.AuthDbModel
|
||||
namespace WCS.DAL.Db.AuthDb
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户
|
||||
@ -32,7 +32,7 @@ namespace WCS.DAL.AuthDbModel
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<string> RoleNames { get => (RoleIds == null || !RoleIds.Any()) ? new List<string>() : AuthDbHelp.db.Queryable<RoleBase>().Where(o => RoleIds.Contains(o.Id)).Select(o => o.Name).ToList(); }
|
||||
public List<string> RoleNames { get => RoleIds == null || !RoleIds.Any() ? new List<string>() : AuthDbHelp.db.Queryable<RoleBase>().Where(o => RoleIds.Contains(o.Id)).Select(o => o.Name).ToList(); }
|
||||
/// <summary>
|
||||
/// 是否最大权限
|
||||
/// </summary>
|
||||
@ -70,7 +70,7 @@ namespace WCS.DAL.AuthDbModel
|
||||
/// 认证模块名称
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<string> AuthNames { get => (Auths == null || !Auths.Any()) ? new List<string>() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); }
|
||||
public List<string> AuthNames { get => Auths == null || !Auths.Any() ? new List<string>() : EnumHelps.GetEnumDescriptionList(typeof(AuthEnum), true).Where(o => Auths.Contains(o.Item1)).Select(o => o.Item3).ToList(); }
|
||||
/// <summary>
|
||||
/// 是否最大权限
|
||||
/// </summary>
|
@ -14,7 +14,7 @@ namespace WCS.DAL.Db
|
||||
/// </summary>
|
||||
public static SqlSugarScope db = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = $"Data Source={LocalFile.DataDbPath};",
|
||||
ConnectionString = $"Data Source={DbPath.DataDbPath};",
|
||||
DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite];
|
||||
IsAutoCloseConnection = true
|
||||
}, db =>
|
||||
@ -31,7 +31,7 @@ namespace WCS.DAL.Db
|
||||
/// </summary>
|
||||
public static SqlSugarScope dbLog = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = $"Data Source={LocalFile.LogDbPath};",
|
||||
ConnectionString = $"Data Source={DbPath.LogDbPath};",
|
||||
DbType = DbType.Sqlite,//[Sqlite]安装[System.Data.SQLite];
|
||||
IsAutoCloseConnection = true
|
||||
}, db =>
|
||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace WCS.DAL
|
||||
{
|
||||
public static class LocalFile
|
||||
public static class DbPath
|
||||
{
|
||||
public static readonly string AppDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
@ -27,7 +27,15 @@ namespace WCS.Model.ApiModel.MatInventoryDetail
|
||||
|
||||
public DateTime InstoreTime { get; set; } = DateTime.Now;
|
||||
public string InstoreUser { get; set; }
|
||||
public bool IsLocked { get; set; } = false;
|
||||
public bool IsLocked { get; set; }
|
||||
|
||||
public string IsLockedStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsLocked ? "是" : "否";
|
||||
}
|
||||
}
|
||||
public int RowNumber { get; set; }
|
||||
public bool IsSelected { get; set; }
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WCS.Model
|
||||
{
|
||||
public class GetOutOrderListByStatusRequest : PageQueryRequestBase
|
||||
{
|
||||
public List<OutOrderExeStatus> OrderExeStatus { get; set; }
|
||||
}
|
||||
}
|
@ -40,7 +40,15 @@ namespace WCS.Model.ApiModel.OutStore
|
||||
public string? MatCustomer { get; set; }
|
||||
#endregion
|
||||
|
||||
public bool IsSended { get; set; } = false;
|
||||
public bool IsSended { get; set; }
|
||||
|
||||
public string IsSendedStr
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsSended ? "是" : "否";
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.Stocktaking
|
||||
{
|
||||
public class ComfirmStocktakingOrderRequest
|
||||
public class ConfirmStocktakingOrderRequest
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string StocktakingOrderNumber { get; set; }
|
@ -90,6 +90,29 @@ namespace WebApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><>״̬<D7B4><CCAC>ѯ<EFBFBD><D1AF><EFBFBD>ⵥ<EFBFBD><E2B5A5>
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Route("getOutOrderListByStatus")]
|
||||
[HttpPost(Name = "getOutOrderListByStatus")]
|
||||
public async Task<ResponseBase> getOutOrderListByStatus(GetOutOrderListByStatusRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _outstoreService.GetOutOrderListByStatus(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "<22><>ѯʧ<D1AF>ܣ<EFBFBD>" + ex.Message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ⵥ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD>ϸ
|
||||
/// </summary>
|
||||
|
@ -71,11 +71,11 @@ namespace WCS.WebApi.Controllers
|
||||
return await _stockTakingService.queryMatInfoInStocktakingOrder(request);
|
||||
}
|
||||
|
||||
[Route("comfirmStocktakingOrder")]
|
||||
[HttpPost(Name = "comfirmStocktakingOrder")]
|
||||
public async Task<ResponseBase> comfirmStocktakingOrder(ComfirmStocktakingOrderRequest request)
|
||||
[Route("confirmStocktakingOrder")]
|
||||
[HttpPost(Name = "confirmStocktakingOrder")]
|
||||
public async Task<ResponseBase> confirmStocktakingOrder(ConfirmStocktakingOrderRequest request)
|
||||
{
|
||||
return await _stockTakingService.comfirmStocktakingOrder(request);
|
||||
return await _stockTakingService.confirmStocktakingOrder(request);
|
||||
}
|
||||
|
||||
[Route("commitStocktakingOrder")]
|
||||
|
@ -1,10 +1,12 @@
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using System.Configuration;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using WCS.BLL.Config;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
@ -24,6 +26,8 @@ namespace WebApi
|
||||
|
||||
DbInit.InitDb();
|
||||
|
||||
LocalFile.SaveConfig();
|
||||
|
||||
ShelfManager.InitShelves();
|
||||
|
||||
TCPClientManager.InitTcpClient();
|
||||
|
@ -278,11 +278,11 @@ namespace 货架标准上位机.Api
|
||||
try
|
||||
{
|
||||
if (isSaveLog)
|
||||
Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}");
|
||||
Logs.Write($"【{guid}】开始请求调用接口 url:{url} 请求方式:{httpMethod} 数据:{data}",LogsType.Api);
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = httpMethod;
|
||||
request.ContentType = "application/json";
|
||||
request.Timeout = 100000;
|
||||
request.Timeout = 10000;
|
||||
|
||||
if (!string.IsNullOrEmpty(data))
|
||||
{
|
||||
@ -303,7 +303,7 @@ namespace 货架标准上位机.Api
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
|
||||
string retString = reader.ReadToEnd();
|
||||
if (isSaveLog)
|
||||
Logs.Write($"【{guid}】请求调用接口结束 返回数据为{retString}");
|
||||
Logs.Write($"【{guid}】请求调用接口结束 返回数据为{retString}", LogsType.Api);
|
||||
return JsonConvert.DeserializeObject<T>(retString);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -40,10 +40,6 @@ namespace 货架标准上位机
|
||||
Scanners.Add(Scanner);
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
client.Received = async (c, e) =>
|
||||
{
|
||||
;
|
||||
};
|
||||
client.Setup(new TouchSocket.Core.TouchSocketConfig()
|
||||
.SetSerialPortOption(new SerialPortOption()
|
||||
{
|
||||
|
@ -35,7 +35,11 @@ namespace 货架标准上位机
|
||||
/// <summary>
|
||||
/// 扫码枪
|
||||
/// </summary>
|
||||
Scanner
|
||||
Scanner,
|
||||
/// <summary>
|
||||
/// Api接口调用
|
||||
/// </summary>
|
||||
Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -90,7 +90,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
ModuleCodeProcess(scanner);
|
||||
}
|
||||
//TO DO 增加正则表达式进行判断是否扫到的是物料码
|
||||
//TODO 增加正则表达式进行判断是否扫到的是物料码
|
||||
else
|
||||
{
|
||||
MatSnProcess(scanner);
|
||||
@ -168,6 +168,14 @@ namespace 货架标准上位机.ViewModel
|
||||
scanner.IsInstoreMode = true;
|
||||
scanner.ShelfCode = Result.Data.ShelfCode;
|
||||
scanner.ModulesStr = Result.Data.ModulesStr;
|
||||
//TODO 清除其他扫码枪的占用
|
||||
var sacnners = ScannerManager.Scanners
|
||||
.Where(t => ShelfCode == Result.Data.ShelfCode)
|
||||
.ToList();
|
||||
foreach (var item in sacnners)
|
||||
{
|
||||
item.ShelfCode = string.Empty;
|
||||
}
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
|
@ -24,6 +24,8 @@ using WCS.Model.ApiModel.InterfaceRecord;
|
||||
using HandyControl.Collections;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
using HandyControl.Tools.Extension;
|
||||
using WCS.Model.ApiModel.Stocktaking;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
@ -39,7 +41,6 @@ namespace 货架标准上位机.ViewModel
|
||||
// })
|
||||
// .Distinct()
|
||||
// .ToList();
|
||||
|
||||
}
|
||||
|
||||
public void InitMatCode()
|
||||
@ -270,6 +271,192 @@ namespace 货架标准上位机.ViewModel
|
||||
Growl.Error("导出失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnGenerateOutstoreCommand { get => new DelegateCommand(BtnGenerateOutstore); }
|
||||
public async void BtnGenerateOutstore()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 调用接口获取物料SN
|
||||
try
|
||||
{
|
||||
var body = new GetMatInventoryDetailRequest()
|
||||
{
|
||||
MatName = MatName,
|
||||
MatSN = MatSN,
|
||||
MatBatch = MatBatch,
|
||||
MatCode = MatCode,
|
||||
StoreCode = StoreCode,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageSize = 10000,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||
{
|
||||
//获取搜索条件返回数据中未锁定的物料
|
||||
var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false)
|
||||
.Select(t => t.MatSN)
|
||||
.ToList();
|
||||
|
||||
if (unLockedMatSns.Count == 0)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以出库的物料(或物料已全部被锁定)!");
|
||||
return;
|
||||
}
|
||||
//提示 是否生成出库单
|
||||
var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成出库单并锁定物料?", "提示", MessageBoxButton.OKCancel);
|
||||
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
#region 调用接口生成出库单据
|
||||
var body1 = new SysOutOrderByMatSnRequest()
|
||||
{
|
||||
OrderType = "出库",
|
||||
OrderSource = "WCS前端-库存数据出库",
|
||||
SnList = unLockedMatSns,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser
|
||||
};
|
||||
var Result1 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outstore/sysOutOrderByMatSn", body1, "POST");
|
||||
if (Result1 != null && Result1.Code == 200)
|
||||
{
|
||||
Growl.Success(Result1.Message);
|
||||
}
|
||||
else if (Result1 != null)
|
||||
{
|
||||
Growl.Warning(Result1.Message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("生成出库单据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
dia.Close();
|
||||
dia.Collapse();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("获取数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("导出失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnGenerateStocktakingCommand { get => new DelegateCommand(BtnGenerateStocktaking); }
|
||||
public void BtnGenerateStocktaking()
|
||||
{
|
||||
try
|
||||
{
|
||||
#region 调用接口获取物料SN
|
||||
try
|
||||
{
|
||||
var body = new GetMatInventoryDetailRequest()
|
||||
{
|
||||
MatName = MatName,
|
||||
MatSN = MatSN,
|
||||
MatBatch = MatBatch,
|
||||
MatCode = MatCode,
|
||||
StoreCode = StoreCode,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageSize = 10000,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInventoryDetailModel>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventoryDetail", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||
{
|
||||
//获取搜索条件返回数据中未锁定的物料
|
||||
var unLockedMatSns = Result.Data.Lists.Where(t => t.IsLocked == false)
|
||||
.Select(t => t.MatSN)
|
||||
.ToList();
|
||||
|
||||
if (unLockedMatSns.Count == 0)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("根据您的搜索条件不存在可以盘点的物料!");
|
||||
return;
|
||||
}
|
||||
//提示 是否生成出库单
|
||||
var result = HandyControl.Controls.MessageBox.Show($"根据您的搜索条件,共有{unLockedMatSns.Count}盘未锁定的物料,是否生成盘点单?", "提示", MessageBoxButton.OKCancel);
|
||||
|
||||
if (result == MessageBoxResult.OK)
|
||||
{
|
||||
var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
#region 调用接口生成盘点单据
|
||||
var body1 = new SysStockTakingOrderRequest()
|
||||
{
|
||||
StocktakingOrderType = "snList",
|
||||
StocktakingOrderSource = "WCS前端-库存数据",
|
||||
List = unLockedMatSns,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser
|
||||
};
|
||||
var Result1 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "stockTaking/sysStockTakingOrder", body1, "POST");
|
||||
if (Result1 != null && Result1.Code == 200)
|
||||
{
|
||||
Growl.Success(Result1.Message);
|
||||
}
|
||||
else if (Result1 != null)
|
||||
{
|
||||
Growl.Warning(Result1.Message);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("生成盘点单据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
dia.Close();
|
||||
dia.Collapse();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("获取数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("导出失败:" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
|
@ -145,5 +145,5 @@ namespace 货架标准上位机.ViewModels
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,14 +123,16 @@ namespace 货架标准上位机.ViewModels
|
||||
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
|
||||
public void BtnReset()
|
||||
{
|
||||
|
||||
OrderNumber = string.Empty;
|
||||
OrderType = string.Empty;
|
||||
OrderSource = string.Empty;
|
||||
}
|
||||
|
||||
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||
public void BtnDelete()
|
||||
{
|
||||
//public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||
//public void BtnDelete()
|
||||
//{
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
public ICommand BtnOrderDetailCommand { get => new DelegateCommand(BtnOrderDetail); }
|
||||
public void BtnOrderDetail()
|
||||
|
@ -4,18 +4,25 @@ using MiniExcelLibs;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using TouchSocket.Core;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
using WCS.Model.ApiModel.Stocktaking;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
@ -44,169 +51,78 @@ namespace 货架标准上位机.ViewModel
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
}
|
||||
|
||||
public System.Windows.Controls.TextBox textBox { get; set; }
|
||||
RefreshOutOrderList();
|
||||
}
|
||||
|
||||
#region Property
|
||||
private string number;
|
||||
public string Number
|
||||
private OutOrderModel selectedOutOrder;
|
||||
public OutOrderModel SelectedOutOrder
|
||||
{
|
||||
get { return number; }
|
||||
get { return selectedOutOrder; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref number, value);
|
||||
SetProperty(ref selectedOutOrder, value);
|
||||
if (selectedOutOrder != null)
|
||||
{
|
||||
SelectedOutOrderNumber = selectedOutOrder.OrderNumber;
|
||||
RefreshDataGridItemSource();
|
||||
}
|
||||
else
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool isOrderOut;
|
||||
public bool IsOrderOut
|
||||
private string selectedOutOrderNumber;
|
||||
public string SelectedOutOrderNumber
|
||||
{
|
||||
get { return isOrderOut; }
|
||||
get => selectedOutOrderNumber;
|
||||
set
|
||||
{
|
||||
SetProperty(ref isOrderOut, value);
|
||||
//LocalStatic.IsOrderOut = value;
|
||||
SetProperty(ref selectedOutOrderNumber, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matCode1;
|
||||
public string MatCode1
|
||||
|
||||
private ObservableCollection<OutOrderModel> outOrderList;
|
||||
public ObservableCollection<OutOrderModel> OutOrderList
|
||||
{
|
||||
get { return matCode1; }
|
||||
get => outOrderList;
|
||||
set
|
||||
{
|
||||
SetProperty(ref matCode1, value);
|
||||
SetProperty(ref outOrderList, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int matQty1;
|
||||
public int MatQty1
|
||||
private ObservableCollection<OutOrderMatDetailModel> dataGridItemSource;
|
||||
public ObservableCollection<OutOrderMatDetailModel> DataGridItemSource
|
||||
{
|
||||
get { return matQty1; }
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matQty1, value);
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
RefreshCount();
|
||||
}
|
||||
}
|
||||
|
||||
private string order_prod_number;
|
||||
public string Order_prod_number
|
||||
//单据总盘数
|
||||
private int totalPan;
|
||||
public int TotalPan
|
||||
{
|
||||
get { return order_prod_number; }
|
||||
set
|
||||
get => totalPan; set
|
||||
{
|
||||
SetProperty(ref order_prod_number, value);
|
||||
SetProperty(ref totalPan, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string material_code;
|
||||
public string Material_code
|
||||
private int sendedPan;
|
||||
public int SendedPan
|
||||
{
|
||||
get { return material_code; }
|
||||
set
|
||||
get => sendedPan; set
|
||||
{
|
||||
SetProperty(ref material_code, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string material_name;
|
||||
public string Material_name
|
||||
{
|
||||
get { return material_name; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref material_name, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string material_spec;
|
||||
public string Material_spec
|
||||
{
|
||||
get { return material_spec; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref material_spec, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matCode;
|
||||
public string MatCode
|
||||
{
|
||||
get { return matCode; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matCode, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matName;
|
||||
public string MatName
|
||||
{
|
||||
get { return matName; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matName, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matCode3;
|
||||
public string MatCode3
|
||||
{
|
||||
get { return matCode3; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matCode3, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matName3;
|
||||
public string MatName3
|
||||
{
|
||||
get { return matName3; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matName3, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matSpec3;
|
||||
public string MatSpec3
|
||||
{
|
||||
get { return matSpec3; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matSpec3, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matBatch3;
|
||||
public string MatBatch3
|
||||
{
|
||||
get { return matBatch3; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matBatch3, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string selectedPickBillNumber;
|
||||
public string SelectedPickBillNumber
|
||||
{
|
||||
get { return selectedPickBillNumber; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedPickBillNumber, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string orderProdNumber;
|
||||
public string OrderProdNumber
|
||||
{
|
||||
get { return orderProdNumber; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderProdNumber, value);
|
||||
SetProperty(ref sendedPan, value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,88 +136,17 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private List<object> dataGridItemSource;
|
||||
public List<object> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
RefreshCount();
|
||||
}
|
||||
}
|
||||
|
||||
//领料单号列表
|
||||
private List<string> pickBillNumberList;
|
||||
public List<string> PickBillNumberList
|
||||
{
|
||||
get { return pickBillNumberList; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref pickBillNumberList, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void RefreshCount()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
//SendedPan = dataGridItemSource.Where(t => t.IsSend == true).Count();
|
||||
//UnSendedPan = dataGridItemSource.Where(t => t.IsSend == false).Count();
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
//public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); }
|
||||
//public void BtnSearch()
|
||||
//{
|
||||
// if (string.IsNullOrEmpty(MatCode1))
|
||||
// {
|
||||
// Growl.Warning("请输入料号进行筛选!");
|
||||
// return;
|
||||
// }
|
||||
// else if (MatQty1 == 0)
|
||||
// {
|
||||
// Growl.Warning("请输入需要的数量!");
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
// var inventoryDetails = DbHelp.db.Queryable<InventoryDetail>();
|
||||
// if (!string.IsNullOrEmpty(MatCode1))
|
||||
// {
|
||||
// inventoryDetails = inventoryDetails
|
||||
// .Where(t => t.MatCode.Contains(MatCode1))
|
||||
// .Includes(t => t.StoreInfo)
|
||||
// .OrderBy(t => t.MatQty);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// var inventorys = inventoryDetails.ToList();
|
||||
// int totalMatQty = 0;
|
||||
// //List<InventoryDetail> dataSourceTemp = new List<InventoryDetail>();
|
||||
// foreach (var item in inventorys)
|
||||
// {
|
||||
// if (totalMatQty < MatQty1)
|
||||
// {
|
||||
// totalMatQty += item.MatQty;
|
||||
// item.IsSelected = true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// DataGridItemSource = inventorys;
|
||||
//}
|
||||
|
||||
public ICommand BtnOutOrderCommand { get => new DelegateCommand(BtnOutOrder); }
|
||||
public void BtnOutOrder()
|
||||
{
|
||||
@ -310,69 +155,164 @@ namespace 货架标准上位机.ViewModel
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
//public ICommand BtnTempOutCommand { get => new DelegateCommand(BtnTempOut); }
|
||||
//public void BtnTempOut()
|
||||
//{
|
||||
// var window = new OutInventoryDocumentDetailView();
|
||||
// window.ShowDialog();
|
||||
// if (window.DialogResult == true)
|
||||
// {
|
||||
// DataGridItemSource = window.DataGridItemSource;
|
||||
|
||||
// }
|
||||
//}
|
||||
|
||||
public ICommand BtnReset3Command { get => new DelegateCommand(BtnReset3); }
|
||||
public void BtnReset3()
|
||||
{
|
||||
MatCode3 = string.Empty;
|
||||
MatName3 = string.Empty;
|
||||
MatSpec3 = string.Empty;
|
||||
MatBatch3 = string.Empty;
|
||||
}
|
||||
|
||||
|
||||
public ICommand BtnStartCommand { get => new DelegateCommand(BtnStart); }
|
||||
public void BtnStart()
|
||||
{
|
||||
return;
|
||||
try
|
||||
{
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功开始入库!");
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("出现异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||
public void BtnPause()
|
||||
{
|
||||
try
|
||||
{
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
}
|
||||
|
||||
#region 调用接口结束出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goOutOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功结束入库!");
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region PageOperation
|
||||
private int totalPan;
|
||||
public int TotalPan
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
get { return totalPan; }
|
||||
set { SetProperty(ref totalPan, value); }
|
||||
Growl.Error("出现异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private int sendedPan;
|
||||
public int SendedPan
|
||||
public void RefreshOutOrderList()
|
||||
{
|
||||
get { return sendedPan; }
|
||||
set { SetProperty(ref sendedPan, value); }
|
||||
#region 调用接口获取发料单
|
||||
try
|
||||
{
|
||||
var body = new GetOutOrderListByStatusRequest()
|
||||
{
|
||||
OrderExeStatus = new List<OutOrderExeStatus>() { OutOrderExeStatus.开始发料, OutOrderExeStatus.发料完成 }
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outstore/getOutOrderListByStatus", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
OutOrderList = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||
}
|
||||
|
||||
private int unSendedPan;
|
||||
public int UnSendedPan
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
get { return unSendedPan; }
|
||||
set { SetProperty(ref unSendedPan, value); }
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region private method
|
||||
public bool GrowlCallBack(bool aaa)
|
||||
public void RefreshDataGridItemSource()
|
||||
{
|
||||
return true;
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
//选择的单据为空无法进行查询
|
||||
return;
|
||||
}
|
||||
#region 调用接口获取出库单物料明细
|
||||
Task.Run(() =>
|
||||
{
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
if (Result.Data.Count > 0)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(Result.Data);
|
||||
}
|
||||
else
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
});
|
||||
|
||||
Growl.Warning("该单据未查询到发料明细!");
|
||||
}
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Warning("调用接口失败!");
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -108,8 +108,21 @@
|
||||
Content=" 导 出" FontFamily="{StaticResource IconFont}"
|
||||
Style="{StaticResource ButtonWarning}" Background="DarkOrange">
|
||||
</Button>
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnGenerateOutstoreCommand}"
|
||||
Content=" 搜索结果出库" FontFamily="{StaticResource IconFont}"
|
||||
Style="{StaticResource ButtonWarning}" Background="IndianRed">
|
||||
</Button>
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5" Command="{Binding BtnGenerateStocktakingCommand}"
|
||||
Content=" 搜索结果盘点" FontFamily="{StaticResource IconFont}"
|
||||
Style="{StaticResource ButtonWarning}" Background="IndianRed">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
|
||||
|
||||
<DataGrid Grid.Row="1"
|
||||
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
@ -123,9 +136,7 @@
|
||||
<DataGridTextColumn MaxWidth="100" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
||||
<!--<DataGridTextColumn IsReadOnly="True" Header="R" Binding="{Binding R}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="C" Binding="{Binding C}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="位" Binding="{Binding Wei}"></DataGridTextColumn>-->
|
||||
<DataGridTextColumn IsReadOnly="True" Header="已锁定" Binding="{Binding IsLockedStr}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="入库时间" Binding="{Binding InstoreTime,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="物料SN" Binding="{Binding MatSN}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
|
@ -31,12 +31,12 @@
|
||||
|
||||
|
||||
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
|
||||
Grid.Column="3" MinHeight="45" FontSize="28" Content="完整发料" FontFamily="{StaticResource IconFont}"
|
||||
Grid.Column="3" MinHeight="45" FontSize="28" Content="开始发料" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnStartCommand}"
|
||||
>
|
||||
</Button>
|
||||
<Button Style="{StaticResource ButtonWarning}" hc:BorderElement.CornerRadius="15"
|
||||
Grid.Column="4" MinHeight="45" FontSize="28" Content="取消发料" FontFamily="{StaticResource IconFont}"
|
||||
Grid.Column="4" MinHeight="45" FontSize="28" Content="暂停发料" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnPauseCommand}">
|
||||
</Button>
|
||||
</Grid>
|
||||
@ -64,7 +64,7 @@
|
||||
<StackPanel Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock FontSize="26" Text="发料单号:">
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="26" Text="{Binding SelectedPickBillNumber}">
|
||||
<TextBlock FontSize="26" Text="{Binding SelectedOutOrderNumber}">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@ -88,12 +88,21 @@
|
||||
<RowDefinition Height="1*"></RowDefinition>
|
||||
<RowDefinition Height="12*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<!--<Border CornerRadius="3" Margin="1 1 1 0" Grid.Row="0" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">-->
|
||||
<TextBlock Text="发料单列表" FontWeight="DemiBold" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" TextAlignment="Center"></TextBlock>
|
||||
<!--</Border>-->
|
||||
<Border CornerRadius="3" Margin="1" Grid.Row="1" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Visible">
|
||||
<ListView FontSize="18" ItemsSource="{Binding PickBillNumberList}" SelectedItem="{Binding SelectedPickBillNumber}" PreviewMouseWheel="ListView_PreviewMouseWheel">
|
||||
<ListView FontSize="18" ItemsSource="{Binding OutOrderList}" SelectedItem="{Binding SelectedOutOrder,Mode=TwoWay}" PreviewMouseWheel="ListView_PreviewMouseWheel">
|
||||
<ListView.View>
|
||||
|
||||
<GridView AllowsColumnReorder="False">
|
||||
<GridView.ColumnHeaderContainerStyle>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</Style>
|
||||
</GridView.ColumnHeaderContainerStyle>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding OrderNumber}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
@ -102,18 +111,18 @@
|
||||
<Border CornerRadius="3" Margin="1" Grid.Row="0" Grid.Column="1" Background="AliceBlue" BorderBrush="CadetBlue" BorderThickness="1.5">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1*"></RowDefinition>
|
||||
<!--<RowDefinition Height="1*"></RowDefinition>-->
|
||||
<RowDefinition Height="12*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" >
|
||||
<TextBlock Text="订单号:" FontSize="24">
|
||||
<!--<StackPanel VerticalAlignment="Center" Orientation="Horizontal" >
|
||||
<TextBlock FontSize="24">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding OrderProdNumber}" FontSize="24">
|
||||
<TextBlock Text="{Binding SelectedOutOrderNumber}" FontSize="24">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>-->
|
||||
|
||||
<DataGrid Grid.Row="2"
|
||||
<DataGrid Grid.Row="0"
|
||||
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
RowHeight="40"
|
||||
@ -121,39 +130,22 @@
|
||||
<DataGrid.Resources>
|
||||
<货架标准上位机:WorkItemBackgroundConverter x:Key="converter"/>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="{Binding Path=IsSend, Converter={StaticResource converter}}"/>
|
||||
<Setter Property="Background" Value="{Binding Path=IsSended, Converter={StaticResource converter}}"/>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTemplateColumn CanUserResize="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Width="30" Height="30"
|
||||
Checked="CheckBox_Checked"
|
||||
Unchecked="CheckBox_Checked"
|
||||
IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox Width="30" Height="30" Unchecked="allChecked_Unchecked" Checked="allChecked_Checked" Name="allChecked"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
</DataGridTemplateColumn>-->
|
||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="库位" Binding="{Binding StoreCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="数量" Binding="{Binding MatQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="是否已取料" Binding="{Binding IsSendStr}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="False" Header="最小包装条码" Binding="{Binding MatSN}"></DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn IsReadOnly="True" Header="已取料" Binding="{Binding IsSendedStr}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="False" Header="物料SN" Binding="{Binding MatSN}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
@ -19,10 +19,11 @@ namespace 货架标准上位机
|
||||
{
|
||||
public partial class OutVentoryView : UserControlBase
|
||||
{
|
||||
public static OutInventoryViewModel viewModel = new OutInventoryViewModel();
|
||||
public OutVentoryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new OutInventoryViewModel();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
@ -34,12 +35,7 @@ namespace 货架标准上位机
|
||||
var index = datagrid.SelectedIndex;
|
||||
if (index >= 0)
|
||||
{
|
||||
//if (viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > index)
|
||||
//{
|
||||
// var data = viewModel.DataGridItemSource.ElementAt(index);
|
||||
// //data.IsSelected = !data.IsSelected;
|
||||
// viewModel.DataGridItemSource = viewModel.DataGridItemSource.ToList();
|
||||
//}
|
||||
|
||||
}
|
||||
datagrid.UnselectAllCells();
|
||||
}
|
||||
@ -49,46 +45,6 @@ namespace 货架标准上位机
|
||||
}
|
||||
}
|
||||
|
||||
private void allChecked_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var viewMode = this.DataContext as OutInventoryViewModel;
|
||||
//if (viewMode != null && viewMode.DataGridItemSource != null && viewMode.DataGridItemSource.Count() > 0)
|
||||
//{
|
||||
// foreach (var item in viewMode.DataGridItemSource)
|
||||
// {
|
||||
// //item.IsSelected = true;
|
||||
// }
|
||||
// viewMode.DataGridItemSource = viewMode.DataGridItemSource.ToList();
|
||||
//}
|
||||
}
|
||||
|
||||
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var viewMode = this.DataContext as OutInventoryViewModel;
|
||||
//if (viewMode != null && viewMode.DataGridItemSource != null && viewMode.DataGridItemSource.Count() > 0)
|
||||
//{
|
||||
// foreach (var item in viewMode.DataGridItemSource)
|
||||
// {
|
||||
// //item.IsSelected = false;
|
||||
// }
|
||||
// viewMode.DataGridItemSource = viewMode.DataGridItemSource.ToList();
|
||||
//}
|
||||
}
|
||||
|
||||
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var viewMode = this.DataContext as OutInventoryViewModel;
|
||||
//viewMode.RefreshCount();
|
||||
}
|
||||
|
||||
private void txtMatQty1_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if (!Regex.IsMatch(e.Text, "^[0-9]"))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListView_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (!e.Handled)
|
||||
|
@ -74,14 +74,14 @@ namespace 货架标准上位机
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "user/userLogin",
|
||||
body, "POST");
|
||||
if (Result.Code != 200 || Result.Data == null)
|
||||
if (Result!= null && Result.Code != 200)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning(Result.Message, "提示");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewModel.User = Result.Data;
|
||||
viewModel.User = Result?.Data;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -56,13 +56,12 @@ namespace 货架标准上位机
|
||||
m_logger.Info(e.DataFrame.ToText());
|
||||
if (!client.Client.IsClient)
|
||||
{
|
||||
client.Send("我已收到");
|
||||
client.Send("已收到");
|
||||
}
|
||||
//返回的报警信息 出入库盘点等日志信息
|
||||
else
|
||||
{
|
||||
TextBoxLog.AddLog(e.DataFrame.ToText(), "123", DateTime.Now);
|
||||
//Growl.Error(e.DataFrame.ToText());
|
||||
TextBoxLog.AddLog(e.DataFrame.ToText(), "InstoreLog", DateTime.Now);
|
||||
}
|
||||
return;
|
||||
|
||||
|
Reference in New Issue
Block a user