提交代码
This commit is contained in:
@ -89,7 +89,7 @@ namespace WCS.BLL.HardWare
|
||||
/// <summary>
|
||||
/// 货架进入出库模式
|
||||
/// </summary>
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder);
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder,string OperateUser);
|
||||
|
||||
/// <summary>
|
||||
/// 货架退出出库模式
|
||||
|
@ -42,7 +42,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
}
|
||||
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder)
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder, string OperateUser)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ namespace WCS.BLL.HardWare
|
||||
//websocket通知的前端的IP地址
|
||||
public string WebSocketIpAddress { get; set; } = "127.0.0.2";
|
||||
|
||||
public string OutOperateUser { get; set; } = string.Empty;
|
||||
#region 协议处理
|
||||
public void GoInInstore(string? IPAddress)
|
||||
{
|
||||
@ -430,7 +431,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
.Distinct()
|
||||
.ToList();
|
||||
shelf.GoInOutstore(matDetails, outOrder);
|
||||
shelf.GoInOutstore(matDetails, outOrder, OutOperateUser);
|
||||
shelf.OrderNumber = outOrder.OrderNumber;
|
||||
});
|
||||
}
|
||||
@ -488,7 +489,7 @@ namespace WCS.BLL.HardWare
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder)
|
||||
public void GoInOutstore(List<OutOrderMatDetail> MatDetails, OutOrder outOrder, string OperateUser)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -501,6 +502,8 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
//CurrentMode = Mode.出库模式;
|
||||
SetCurrentMode(Mode.出库模式);
|
||||
//设置当前操作人
|
||||
OutOperateUser = OperateUser;
|
||||
|
||||
//第二步:货架添加需要出的SN 出库的领料单号
|
||||
//移除货架所有现有待出库的MatSN
|
||||
@ -1844,7 +1847,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
.Distinct()
|
||||
.ToList();
|
||||
shelf.GoInOutstore(matDetails, outOrder);
|
||||
shelf.GoInOutstore(matDetails, outOrder, OutOperateUser);
|
||||
shelf.OrderNumber = outOrder.OrderNumber;
|
||||
});
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using WCS.BLL.Config;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.BLL.Tool;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
|
||||
@ -25,16 +26,17 @@ namespace WCS.BLL.Manager
|
||||
{
|
||||
Logs.Write("【InitTcpClient】开始", LogsType.StartBoot);
|
||||
|
||||
var ips = DbHelp.db.Queryable<ShelfInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName),t => t.GroupName == LocalFile.Config.GroupName)
|
||||
.Select(t => t.ClientIp)
|
||||
var clientsInDB = DbHelp.db.Queryable<ShelfInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(LocalFile.Config.GroupName), t => t.GroupName == LocalFile.Config.GroupName)
|
||||
.Select(t => new { IP = t.ClientIp, ShelfTypeName = t.ShelfTypeName })
|
||||
.Distinct()
|
||||
.ToList();
|
||||
foreach (var ip in ips)
|
||||
Logs.Write($"【InitTcpClient】需要连接的服务端地址如下:\r\n{string.Join(";", clientsInDB)}", LogsType.StartBoot);
|
||||
foreach (var cleientInDB in clientsInDB)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
var tcpCleint = new TCPClient(ip, "");
|
||||
var tcpCleint = new TCPClient(cleientInDB.IP, "",cleientInDB.ShelfTypeName);
|
||||
tcpCleint.tcpClient.Received += (client, e) =>
|
||||
{
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
@ -48,6 +50,15 @@ namespace WCS.BLL.Manager
|
||||
Logs.Write($"【接收】{BitConverter.ToString(data)}", LogsType.Instructions);
|
||||
e.ByteBlock.Clear();
|
||||
var len = data.Length;
|
||||
|
||||
if (tcpCleint.ShelfTypeName == "信息化货架")
|
||||
{
|
||||
Logs.Write($"【信息化货架开始处理接收数据】{BitConverter.ToString(data)}", LogsType.Instructions);
|
||||
Helper.ReturnDataProcess(TcpCleint, data);
|
||||
Logs.Write($"【信息化货架完成处理接收数据】{BitConverter.ToString(data)}", LogsType.Instructions);
|
||||
return EasyTask.CompletedTask;
|
||||
}
|
||||
|
||||
for (int index = 0; index < data.Length - TcpCleint.PreFixLength; index++)
|
||||
{
|
||||
//协议拆包 通过前缀校验是否为完整数据包
|
||||
@ -92,6 +103,7 @@ namespace WCS.BLL.Manager
|
||||
//配置首次连接后复位操作
|
||||
tcpCleint.tcpClient.Connected += (client, e) =>
|
||||
{
|
||||
Logs.Write($"【TcpClient】{client.IP}完成连接,端口号{client.Port}", LogsType.StartBoot);
|
||||
var clientIpHost = client.IP + ":" + client.Port;
|
||||
var TcpCleint = TCPClientManager.GetTCPClientByIPHost(clientIpHost);
|
||||
if (TcpCleint == null)
|
||||
@ -102,6 +114,13 @@ namespace WCS.BLL.Manager
|
||||
if (TcpCleint.IsFirstConnected == false)
|
||||
{
|
||||
Logs.Write($"【InitTcpClient】{clientIpHost}完成首次连接", LogsType.StartBoot);
|
||||
//获取剩余未完成连接的tcp
|
||||
var noFirstConnectedTcps = TCPClientManager.TCPClients.Where(t => t.IsFirstConnected == false)
|
||||
.Select(t => t.RemoteIPHost)
|
||||
.ToList();
|
||||
|
||||
Logs.Write($"【InitTcpClient】剩余未完成连接的TCP为{string.Join(";", noFirstConnectedTcps)}", LogsType.StartBoot);
|
||||
|
||||
Console.WriteLine($"【InitTcpClient】{clientIpHost}完成首次连接");
|
||||
InitStatus(TcpCleint);
|
||||
TcpCleint.IsFirstConnected = true;
|
||||
@ -176,19 +195,15 @@ namespace WCS.BLL.Manager
|
||||
//后台启动时给所有板子、警示灯发送复位操作 保持状态一致
|
||||
public static void InitStatus(TCPClient tcpClient)
|
||||
{
|
||||
|
||||
List<ModuleInfo> MI = DbHelp.db.Queryable<ModuleInfo>().Where(it => it.CleintIp == tcpClient.RemoteIPHost).ToList();
|
||||
if (MI.Count != 0)
|
||||
var shelfInfo = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.ClientIp == tcpClient.RemoteIPHost).ToList();
|
||||
if (shelfInfo.Count != 0)
|
||||
{
|
||||
List<ShelfInfo> SI = DbHelp.db.Queryable<ShelfInfo>().Where(it => it.ShelfCode == MI[0].ShelfCode).ToList();
|
||||
if (SI.Count != 0)
|
||||
if (shelfInfo[0].ShelfTypeName == "信息化货架")
|
||||
{
|
||||
if (SI[0].ShelfTypeName == "信息化货架")
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
try
|
||||
|
@ -213,6 +213,7 @@ namespace WCS.BLL.Manager
|
||||
module.CurrentOutSns.RemoveAll(t => t == inventoryDetail.MatSN);
|
||||
Logs.Write($"【出库自检】发现物料{inventoryDetail.MatSN}丢失,已删除模组缓存,剩余物料为{string.Join(",", module.CurrentOutSns)}", LogsType.Outstore);
|
||||
}
|
||||
|
||||
//删除已丢失的出库明细数据
|
||||
var outOrderMatDetail = DbHelp.db.Queryable<OutOrderMatDetail>()
|
||||
.Where(t => t.OrderId == smartShelf.CurrentOutOrder.Id)
|
||||
|
@ -17,5 +17,16 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<string> generateOutOrderNumber();
|
||||
|
||||
public Task<string> generateMXPDOutOrderNumber();
|
||||
|
||||
|
||||
//金川项目增加接口
|
||||
/// <summary>
|
||||
/// 查询当前物料编码是哪个物料 没有则直接添加
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public Task<ResponseBase> JinChuanGenerateMatInfo(JinChuanGenerateMatInfoRequest request);
|
||||
|
||||
public Task<ResponseBase> JinChuanCommitMatInfo(JinChuanCommitMatInfoRequest request);
|
||||
}
|
||||
}
|
||||
|
@ -166,5 +166,150 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> JinChuanGenerateMatInfo(JinChuanGenerateMatInfoRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
//第一步 查询
|
||||
var matBaseInfo = await DbHelp.db.Queryable<MatBaseInfo>().Where(t => t.MatCode == request.MatCode).FirstAsync();
|
||||
if (matBaseInfo != null)
|
||||
{
|
||||
return new ResponseBase<MatBaseInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success",
|
||||
Data = matBaseInfo
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
//不存在 则先创建
|
||||
matBaseInfo = new MatBaseInfo()
|
||||
{
|
||||
MatCode = request.MatCode,
|
||||
MatName = string.Empty,
|
||||
};
|
||||
matBaseInfo.Id = DbHelp.db.Insertable(matBaseInfo).ExecuteReturnIdentity();
|
||||
return new ResponseBase<MatBaseInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success",
|
||||
Data = matBaseInfo
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<MatBaseInfo>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseBase> JinChuanCommitMatInfo(JinChuanCommitMatInfoRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
//
|
||||
if (request.TotalPan <= 0 && request.TotalPan >= 500)
|
||||
{
|
||||
return new ResponseBase<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:物料盘数请输入1-500",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
//第二步 查询基础物料
|
||||
var matBaseInfo = await DbHelp.db.Queryable<MatBaseInfo>().Where(t => t.Id == request.MatId).FirstAsync();
|
||||
if (matBaseInfo != null)
|
||||
{
|
||||
//存在此物料的情况下 判断当前的数量
|
||||
if (request.CurrentSerilNumber != matBaseInfo.SerialNumber + 1)
|
||||
{
|
||||
return new ResponseBase<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:当前物料流水号冲突!请重新扫码!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
//流水号不冲突
|
||||
else
|
||||
{
|
||||
var matInfoList = new List<MatInfo>();
|
||||
|
||||
try
|
||||
{
|
||||
DbHelp.db.BeginTran();
|
||||
for (int i = 0; i < request.TotalPan; i++)
|
||||
{
|
||||
//保存matBaseInfo
|
||||
matBaseInfo.SerialNumber++;
|
||||
|
||||
//保存条码信息
|
||||
var matInfo = new MatInfo()
|
||||
{
|
||||
MatSn = request.CurrentMatSn[i],
|
||||
MatCode = matBaseInfo.MatCode,
|
||||
MatName = matBaseInfo.MatName,
|
||||
MatBatch = request.MatBatch,
|
||||
MatSpec = matBaseInfo.MatSpec,
|
||||
MatUnit = matBaseInfo.MatUnit,
|
||||
MatSupplier = matBaseInfo.MatSupplier,
|
||||
MatCustomer = matBaseInfo.MatCustomer,
|
||||
MatQty = request.MatQty,
|
||||
ModifyUser = request.UserName
|
||||
};
|
||||
matInfo.Id = DbHelp.db.Insertable(matInfo).ExecuteReturnIdentity();
|
||||
matInfoList.Add(matInfo);
|
||||
}
|
||||
//await DbHelp.db.Insertable(matInfoList).ExecuteCommandAsync();
|
||||
await DbHelp.db.Updateable(matBaseInfo).ExecuteCommandAsync();
|
||||
DbHelp.db.CommitTran();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
return new ResponseBase<List<MatInfo>> ()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"失败:{ex.Message}",
|
||||
Data = matInfoList
|
||||
};
|
||||
}
|
||||
return new ResponseBase<List<MatInfo>>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = "Success",
|
||||
Data = matInfoList
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseBase<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "操作失败:不存在此物料,请重试!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase<MatInfo>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = ex.Message,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -439,15 +439,6 @@ namespace WCS.BLL.Services.Service
|
||||
public async Task<ResponseBase> queryInstoreStatusSingle(QueryByMatSnRequestSingle request)
|
||||
{
|
||||
//获取货架
|
||||
//var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
|
||||
//if (shelf == null)//货架不存在
|
||||
//{
|
||||
// return new ResponseCommon()
|
||||
// {
|
||||
// Code = 201,
|
||||
// Message = $"货架[{request.ShelfCode}]不存在!",
|
||||
// };
|
||||
//}
|
||||
List<ModuleInfo> MI = DbHelp.db.Queryable<ModuleInfo>().Where(it => it.ModuleCode == request.ShelfCode).ToList();
|
||||
if (MI.Count == 0)
|
||||
{
|
||||
@ -529,8 +520,8 @@ namespace WCS.BLL.Services.Service
|
||||
//data1[6] = 0x02;
|
||||
//data1[7] = 0x02;
|
||||
//byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, false);
|
||||
byte[] senddata1 = Tool.Helper.InstoreWarnLight(warnLightID);
|
||||
tCPClient.Send(senddata1); //报警灯短亮一次
|
||||
//byte[] senddata1 = Tool.Helper.InstoreWarnLight(warnLightID);
|
||||
//tCPClient.Send(senddata1); //报警灯短亮一次
|
||||
|
||||
//byte[] data2 = new byte[8];
|
||||
//data2[0] = 0xff;
|
||||
@ -542,8 +533,12 @@ namespace WCS.BLL.Services.Service
|
||||
//data2[6] = 0x03;
|
||||
//data2[7] = 0x02;
|
||||
//byte[] senddata2 = Tool.Helper.Crc16(data2, data2.Length, true);
|
||||
byte[] senddata2 = Tool.Helper.InstoreLight(PCBId);
|
||||
tCPClient.Send(senddata2); //库位灯短亮一次
|
||||
//byte[] senddata2 = Tool.Helper.InstoreLight(PCBId);
|
||||
//tCPClient.Send(senddata2); //库位灯短亮一次
|
||||
|
||||
byte[] senddata1 = Tool.Helper.InstoreLightAndWarnLight(PCBId, warnLightID);
|
||||
tCPClient.Send(senddata1); //报警灯和库位灯同时短亮
|
||||
|
||||
|
||||
return new ResponseCommonSingle()
|
||||
{
|
||||
|
@ -162,6 +162,7 @@ namespace WCS.BLL.Services.Service
|
||||
MatSpec = mat.规格,
|
||||
MatUnit = mat.单位,
|
||||
MatCustomer = mat.客户,
|
||||
ModifyUser = userName,
|
||||
IsEnable = mat.状态 == "启用" ? true : false,
|
||||
};
|
||||
await DbHelp.db.Insertable(matBaseInfo).ExecuteCommandAsync();
|
||||
|
@ -435,6 +435,7 @@ namespace WCS.BLL.Services.Service
|
||||
|
||||
var totalCount = await recordsQueryable.CountAsync();
|
||||
var records = await recordsQueryable
|
||||
.OrderByDescending(t => t.Id)
|
||||
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
||||
.ToListAsync();
|
||||
//生成序号
|
||||
@ -802,7 +803,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, request.UserName);
|
||||
shelf.OrderNumber = order.OrderNumber;
|
||||
Logs.Write($"出库单{order.OrderNumber},货架{shelf.ShelfCode}进入入库模式!", LogsType.Outstore);
|
||||
});
|
||||
@ -1382,12 +1383,12 @@ namespace WCS.BLL.Services.Service
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
//物料校验
|
||||
var invetoryDetail = await DbHelp.db.Queryable<InventoryDetail>()
|
||||
.Where(it => it.Id == request.MatId)
|
||||
.Where(it => it.MatSN == request.MatSn)
|
||||
.FirstAsync();
|
||||
|
||||
if (invetoryDetail == null)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
@ -1398,6 +1399,27 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
|
||||
//获取库位是否是信息化货架的库位
|
||||
var shelf = await DbHelp.db.Queryable<StoreInfo>()
|
||||
.LeftJoin<ShelfTypeInfo>((si, sti) => si.ShelfTypeId == sti.Id)
|
||||
.Where((si, sti) => si.Id == invetoryDetail.StoreId)
|
||||
.Select((si, sti) => new
|
||||
{
|
||||
ShelfId = si.ShelfId,
|
||||
ShelfTypeName = sti.ShelfTypeName
|
||||
})
|
||||
.FirstAsync();
|
||||
if (shelf != null && shelf.ShelfTypeName != "信息化货架")
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"该物料库存不在信息化货架上,不能进行出库!",
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//物料需求明细校验
|
||||
var outOrderDetail = await DbHelp.db.Queryable<OutOrderDetail>().Where(it => it.OrderNumber == request.OrderNumber)
|
||||
.Where(it => it.MatCode == invetoryDetail.MatCode)
|
||||
@ -1437,6 +1459,28 @@ namespace WCS.BLL.Services.Service
|
||||
outOrderDetail.OutQty += invetoryDetail.MatQty;
|
||||
DbHelp.db.Updateable(outOrderDetail).ExecuteCommand();
|
||||
|
||||
//蜂鸣器提示
|
||||
Task.Run(() =>
|
||||
{
|
||||
Logs.Write("【单灯出库蜂鸣器提示】开始");
|
||||
if (shelf != null)
|
||||
{
|
||||
var Shelf = DbHelp.db.Queryable<ShelfInfo>().Where(t => t.Id == shelf.ShelfId).First();
|
||||
if (Shelf != null)
|
||||
{
|
||||
TCPClient tCPClient = TCPClientManager.GetTCPClientByIPHost(Shelf.ClientIp);
|
||||
byte[] lightOn = Helper.CommitOutstoreBee(Shelf.LightId);
|
||||
tCPClient.Send(lightOn);
|
||||
Logs.Write($"【单灯出库蜂鸣器提示】已发送指令");
|
||||
}
|
||||
else
|
||||
Logs.Write($"【单灯出库蜂鸣器提示】Shelf == null ID为{shelf.ShelfId}");
|
||||
}
|
||||
else
|
||||
Logs.Write("【单灯出库蜂鸣器提示】shelf == null");
|
||||
});
|
||||
|
||||
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -240,6 +241,52 @@ namespace WCS.BLL.Tool
|
||||
return senddata1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] InstoreLightAndWarnLight(int board_id, int lightid)
|
||||
{
|
||||
byte[] data1 = new byte[8 + 3 * 7];
|
||||
data1[0] = 0xff;
|
||||
data1[1] = 0x01;
|
||||
data1[2] = 0x00;
|
||||
data1[3] = (byte)(data1.Length + 2);
|
||||
data1[4] = 0x07;
|
||||
|
||||
//库位灯
|
||||
data1[5] = (byte)board_id;
|
||||
data1[6] = 0x03;
|
||||
data1[7] = 0x02;
|
||||
|
||||
//7就是带的有蜂鸣器
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
data1[8 + i * 3] = (byte)(lightid + i);
|
||||
data1[9 + i * 3] = 0x03;
|
||||
data1[10 + i * 3] = 0x02;
|
||||
}
|
||||
|
||||
byte[] senddata1 = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||
return senddata1;
|
||||
}
|
||||
|
||||
//出库确认 蜂鸣器鸣叫一次
|
||||
public static byte[] CommitOutstoreBee(int lightid)
|
||||
{
|
||||
byte[] data1 = new byte[5 + 3 * 1];
|
||||
data1[0] = 0xff;
|
||||
data1[1] = 0x01;
|
||||
data1[2] = 0x00;
|
||||
data1[3] = (byte)(data1.Length + 2);
|
||||
data1[4] = 0x07;
|
||||
|
||||
data1[5] = (byte)(lightid + 6);
|
||||
data1[6] = 0x03;
|
||||
data1[7] = 0x02;
|
||||
|
||||
byte[] sendData = Tool.Helper.Crc16(data1, data1.Length, true);
|
||||
return sendData;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 库位灯常亮/关闭
|
||||
/// </summary>
|
||||
@ -293,5 +340,20 @@ namespace WCS.BLL.Tool
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据处理
|
||||
/// </summary>
|
||||
public static void ReturnDataProcess(TCPClient tcpClient, byte[] returnData)
|
||||
{
|
||||
if (returnData[0] == 0xFF && returnData[1] == 0x00 && returnData[3] == 0x08
|
||||
&& returnData[4] == 0x01 && returnData[5] == 0x06)
|
||||
{
|
||||
var sendData = Query();
|
||||
tcpClient.Send(sendData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ namespace WCS.BLL
|
||||
|
||||
public string BindIPHost { get; set; } = "127.0.0.1:20003";
|
||||
|
||||
public string ShelfTypeName { get; set; }
|
||||
public bool IsOnline { get; set; } = false;
|
||||
|
||||
//第一次连接是否已连接
|
||||
@ -53,14 +54,16 @@ namespace WCS.BLL
|
||||
/// 初始化配置连接
|
||||
/// </summary>
|
||||
/// <param name="remoteIPHost"></param>
|
||||
public TCPClient(string remoteIPHost, string bindIPHost)
|
||||
public TCPClient(string remoteIPHost, string bindIPHost,string shelfTypeName)
|
||||
{
|
||||
try
|
||||
{
|
||||
RemoteIPHost = remoteIPHost;
|
||||
BindIPHost = bindIPHost;
|
||||
ShelfTypeName = shelfTypeName;
|
||||
|
||||
tcpClient = new TcpClient();
|
||||
|
||||
//载入配置
|
||||
tcpClient.Setup(new TouchSocketConfig()
|
||||
.SetRemoteIPHost(RemoteIPHost)
|
||||
|
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.MatBaseInfo
|
||||
{
|
||||
public class JinChuanGenerateMatInfoRequest : RequestBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询是否有这个 没得的话新建一个再返回
|
||||
/// </summary>
|
||||
public string MatCode { get; set; }
|
||||
}
|
||||
|
||||
public class JinChuanCommitMatInfoRequest : RequestBase
|
||||
{
|
||||
public int MatId { get; set; }
|
||||
public int CurrentSerilNumber { get; set; }
|
||||
public int TotalPan { get; set; }
|
||||
public string MatBatch { get; set; }
|
||||
public int MatQty { get; set; }
|
||||
public List<string> CurrentMatSn { get; set; }
|
||||
}
|
||||
}
|
@ -55,6 +55,8 @@ namespace WCS.BLL.DbModels
|
||||
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
public int SerialNumber { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
|
@ -82,6 +82,9 @@ namespace WCS.WebApi.Controllers
|
||||
await excelFile.CopyToAsync(stream);
|
||||
stream.Position = 0;
|
||||
var list = MiniExcelLibs.MiniExcel.Query<MatBaseInfoImportModel>(stream, "物料管理", ExcelType.XLSX).ToList();
|
||||
//去除空白行
|
||||
list.RemoveAll(x => string.IsNullOrWhiteSpace(x.物料编码));
|
||||
|
||||
return await _matBaseInfoService.importMatBaseInfo(list, userName, deviceType);
|
||||
}
|
||||
}
|
||||
@ -134,5 +137,28 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
return await _matBaseInfoService.printedMatInfo(request);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 金川项目-编码获取 没得的就生成
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("JinChuanGenerateMatInfo")]
|
||||
public async Task<ResponseBase> JinChuanGenerateMatInfo(JinChuanGenerateMatInfoRequest request)
|
||||
{
|
||||
return await _generateMatInfoService.JinChuanGenerateMatInfo(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 金川项目-扫描解析生成打印
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("JinChuanCommitMatInfo")]
|
||||
public async Task<ResponseBase> JinChuanCommitMatInfo(JinChuanCommitMatInfoRequest request)
|
||||
{
|
||||
return await _generateMatInfoService.JinChuanCommitMatInfo(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@
|
||||
<!--字体-->
|
||||
<FontFamily x:Key="IconFont">pack://application,,,/货架标准上位机;component/Fonts/#iconfont</FontFamily>
|
||||
<!--字符串-->
|
||||
<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>
|
||||
<sys:String x:Key="AboutInfo1">金川数智</sys:String>
|
||||
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
@ -29,7 +29,10 @@ namespace 货架标准上位机
|
||||
/// 日志目录
|
||||
/// </summary>
|
||||
public static readonly string LogDir = Path.Combine(AppDir, "logs");
|
||||
|
||||
/// <summary>
|
||||
/// 资源目录
|
||||
/// </summary>
|
||||
public static readonly string ResourcesDir = Path.Combine(AppDir, "Resources");
|
||||
/// <summary>
|
||||
/// 运行主程序
|
||||
/// </summary>
|
||||
@ -46,6 +49,10 @@ namespace 货架标准上位机
|
||||
/// 帮助文档路径
|
||||
/// </summary>
|
||||
public static readonly string DocPath = Path.Combine(DataDir, "操作说明书.docx");
|
||||
/// <summary>
|
||||
/// 打印模板
|
||||
/// </summary>
|
||||
public static readonly string PrintTemplatePath = Path.Combine(ResourcesDir, "物料条码.btw");
|
||||
|
||||
static object lockConfig = new object();
|
||||
static JsConfig config;
|
||||
|
@ -15,5 +15,9 @@ namespace 货架标准上位机
|
||||
/// 前端当前登录的用户名
|
||||
/// </summary>
|
||||
public static string CurrentUser { get; set; } = "未登录";
|
||||
|
||||
public static bool IsScanGenarateMatInfoWindowOpen { get; set; } = false;
|
||||
|
||||
public static MatBaseInoScanGenarateMatInfoView ScanGenarateMatInfoWindow { get; set; } = null;
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,21 @@ namespace 货架标准上位机
|
||||
/// </summary>
|
||||
public string ElectronicSiloPush { get; set; }
|
||||
#endregion
|
||||
|
||||
#region 金川公司配置
|
||||
//固定码
|
||||
public string ChangelessCode { get; set; }
|
||||
|
||||
//预留码
|
||||
public string ReservedCode { get; set; }
|
||||
|
||||
//正则 物料编码
|
||||
public string RegexMatCode { get; set; }
|
||||
//正则 物料数量
|
||||
public string RegexMatQty { get; set; }
|
||||
//正则 物料批次
|
||||
public string RegexMatBatch { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class JsSysConfig
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 264 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 15 KiB |
BIN
货架标准上位机/Resources/LogoMX.ico
Normal file
BIN
货架标准上位机/Resources/LogoMX.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
BIN
货架标准上位机/Resources/LogoMX.png
Normal file
BIN
货架标准上位机/Resources/LogoMX.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -39,7 +39,11 @@ namespace 货架标准上位机
|
||||
/// <summary>
|
||||
/// Api接口调用
|
||||
/// </summary>
|
||||
Api
|
||||
Api,
|
||||
/// <summary>
|
||||
/// WebSocket通信
|
||||
/// </summary>
|
||||
WebSocket
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -9,6 +9,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Markup;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using 货架标准上位机.Api;
|
||||
@ -46,6 +47,20 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public ICommand BarcodePrintTemplateCommand { get => new DelegateCommand(BarcodePrintTemplate); }
|
||||
public void BarcodePrintTemplate()
|
||||
{
|
||||
try
|
||||
{
|
||||
Folder.OpenFolderAndSelectedFile(LocalFile.PrintTemplatePath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Growl.Error("打开文件夹失败。");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceReadModel : BindableBase
|
||||
|
@ -57,7 +57,7 @@ namespace 货架标准上位机.ViewModel
|
||||
/// </summary>
|
||||
public void ClearTextInfo()
|
||||
{
|
||||
TextBoxLog.ClearLog();
|
||||
TextBoxLog.ClearLog("selfCheck");
|
||||
}
|
||||
public ICommand ClearTextErrCommand { get => new DelegateCommand(ClearTextErr); }
|
||||
/// <summary>
|
||||
|
@ -29,6 +29,7 @@ using WCS.BLL.DbModels;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using System.Security.Cryptography;
|
||||
using Ping9719.WpfEx;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
@ -81,41 +82,59 @@ namespace 货架标准上位机.ViewModel
|
||||
if (scanner.TempCode.EndsWith("\r"))//结束符 TODO结束符是否需要自定义 现场配置
|
||||
{
|
||||
scanner.TempCode = scanner.TempCode.Replace("\r", string.Empty).Replace("\n", string.Empty);
|
||||
try
|
||||
//金川项目-扫物料码生成本地物料码流程
|
||||
if (LocalStatic.IsScanGenarateMatInfoWindowOpen)
|
||||
{
|
||||
//TO DO 配置项进行配置正则表达式
|
||||
//数据处理
|
||||
//获取配置文件的正则表达式
|
||||
var configModuleCodePattern = LocalFile.Config.ModuleCodePattern;
|
||||
string ModuleCodePattern = string.IsNullOrEmpty(configModuleCodePattern) ? "^[ABCD][0-9]{2}-R[0-9]{1,2}C[0-9]{1,2}$" : configModuleCodePattern;
|
||||
var isModuleCode = Regex.IsMatch(scanner.TempCode, ModuleCodePattern);
|
||||
if (isModuleCode)
|
||||
try
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为货架码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ModuleCodeProcess(scanner);
|
||||
LocalStatic.ScanGenarateMatInfoWindow.viewModel.ParsingBarcode(scanner.TempCode);
|
||||
}
|
||||
else if (scanner.TempCode == "shelfGoOutInStore")
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ShelfGoOutInstoreProcess(scanner);
|
||||
var message = "物料扫码发生异常:" + ex.Message;
|
||||
Logs.Write(message, LogsType.Scanner);
|
||||
}
|
||||
//TODO 增加正则表达式进行判断是否扫到的是物料码
|
||||
else
|
||||
finally
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
MatSnProcess(scanner);
|
||||
scanner.TempCode = string.Empty;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var message = "入库扫码枪扫码发生异常:" + ex.Message;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
//不管入库成功与否 认为本次扫码完毕 清空暂存数据
|
||||
scanner.TempCode = string.Empty;
|
||||
}
|
||||
else
|
||||
//入库流程的情况下
|
||||
try
|
||||
{
|
||||
//数据处理
|
||||
//获取配置文件的正则表达式
|
||||
var configModuleCodePattern = LocalFile.Config.ModuleCodePattern;
|
||||
string ModuleCodePattern = string.IsNullOrEmpty(configModuleCodePattern) ? "^[ABCD][0-9]{2}-R[0-9]{1,2}C[0-9]{1,2}$" : configModuleCodePattern;
|
||||
var isModuleCode = Regex.IsMatch(scanner.TempCode, ModuleCodePattern);
|
||||
if (isModuleCode)
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为货架码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ModuleCodeProcess(scanner);
|
||||
}
|
||||
else if (scanner.TempCode == "shelfGoOutInStore")
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ShelfGoOutInstoreProcess(scanner);
|
||||
}
|
||||
//TODO 增加正则表达式进行判断是否扫到的是物料码
|
||||
else
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
MatSnProcess(scanner);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var message = "入库扫码枪扫码发生异常:" + ex.Message;
|
||||
Logs.Write(message, LogsType.Scanner);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//不管入库成功与否 认为本次扫码完毕 清空暂存数据
|
||||
scanner.TempCode = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,6 +362,15 @@ namespace 货架标准上位机.ViewModel
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand ClearTextInfoCommand { get => new DelegateCommand(ClearTextInfo); }
|
||||
/// <summary>
|
||||
/// 清除信息文本
|
||||
/// </summary>
|
||||
public void ClearTextInfo()
|
||||
{
|
||||
TextBoxLog.ClearLog("InstoreLog");
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -384,6 +384,28 @@ namespace 货架标准上位机.ViewModel
|
||||
var generateWindow = new MatBaseInoGenarateMatInfoView(matBaseInfo);
|
||||
var result = generateWindow.ShowDialog();
|
||||
}
|
||||
|
||||
public ICommand BtnScanPrintCommand { get => new DelegateCommand(BtnScanPrint); }
|
||||
public async void BtnScanPrint()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
var generateWindow = new MatBaseInoScanGenarateMatInfoView();
|
||||
LocalStatic.IsScanGenarateMatInfoWindowOpen = true;
|
||||
LocalStatic.ScanGenarateMatInfoWindow = generateWindow;
|
||||
var result = generateWindow.ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
LocalStatic.IsScanGenarateMatInfoWindowOpen = false;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
|
376
货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs
Normal file
376
货架标准上位机/ViewModels/MatBaseInoScanGenarateMatInfoViewModel.cs
Normal file
@ -0,0 +1,376 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Tools.Extension;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.Tool;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
public class MatBaseInoScanGenarateMatInfoViewModel : BindableBase
|
||||
{
|
||||
public MatBaseInoScanGenarateMatInfoViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region Property
|
||||
private string matCode;
|
||||
public string MatCode
|
||||
{
|
||||
get => matCode; set
|
||||
{
|
||||
SetProperty(ref matCode, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matName;
|
||||
public string MatName
|
||||
{
|
||||
get => matName;
|
||||
set { SetProperty(ref matName, value); }
|
||||
}
|
||||
|
||||
private string matSpec;
|
||||
public string MatSpec
|
||||
{
|
||||
get => matSpec;
|
||||
set { SetProperty(ref matSpec, value); }
|
||||
}
|
||||
|
||||
private int matQty;
|
||||
public int MatQty
|
||||
{
|
||||
get => matQty;
|
||||
set { SetProperty(ref matQty, value); }
|
||||
}
|
||||
|
||||
|
||||
private int totalPan = 1;
|
||||
public int TotalPan
|
||||
{
|
||||
get => totalPan; set
|
||||
{
|
||||
SetProperty(ref totalPan, value);
|
||||
UpdateMatSN();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string matBatch;
|
||||
public string MatBatch
|
||||
{
|
||||
get => matBatch;
|
||||
set
|
||||
{
|
||||
SetProperty(ref matBatch, value);
|
||||
UpdateMatSN();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string reservedCode;
|
||||
public string ReservedCode
|
||||
{
|
||||
get => reservedCode; set
|
||||
{
|
||||
SetProperty(ref reservedCode, value);
|
||||
UpdateMatSN();
|
||||
}
|
||||
}
|
||||
|
||||
private string changelessCode;
|
||||
public string ChangelessCode
|
||||
{
|
||||
get => changelessCode; set
|
||||
{
|
||||
SetProperty(ref changelessCode, value);
|
||||
UpdateMatSN();
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> matSNs = new List<string>();
|
||||
|
||||
public List<string> MatSNs { get => matSNs; set { SetProperty(ref matSNs, value); } }
|
||||
|
||||
|
||||
private string matSNsStr;
|
||||
public string MatSNsStr
|
||||
{
|
||||
get => matSNsStr;
|
||||
set { SetProperty(ref matSNsStr, value); }
|
||||
}
|
||||
|
||||
|
||||
public MatBaseInfoModel MatBaseInfo { get; set; } = null;
|
||||
public List<MatInfoModel> MatInfos { get; set; } = null;
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
//public ICommand BtnGenerateCommand { get => new DelegateCommand(BtnGenerate); }
|
||||
//public void BtnGenerate()
|
||||
//{
|
||||
// #region 调用接口获取物料 MatBaseInfo
|
||||
// try
|
||||
// {
|
||||
// var body = new JinChuanCommitMatInfoRequest()
|
||||
// {
|
||||
// MatId = MatBaseInfo.Id,
|
||||
// CurrentSerilNumber = MatBaseInfo.SerialNumber,
|
||||
// MatBatch = MatBatch,
|
||||
// MatQty = MatQty,
|
||||
// TotalPan = totalPan,
|
||||
// CurrentMatSn = MatSNs,
|
||||
// DeviceType = LocalFile.Config.DeviceType,
|
||||
// UserName = LocalStatic.CurrentUser,
|
||||
// };
|
||||
// var Result = ApiHelp.GetDataFromHttp<ResponseBase<List<MatInfoModel>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/JinChuanCommitMatInfo", body, "POST");
|
||||
// if (Result != null && Result.Code == 200 && Result.Data != null)
|
||||
// {
|
||||
// MatInfos = Result.Data;
|
||||
// MatSNs = MatSNs + " 已生成";
|
||||
// Growl.Success("生成成功!");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
// {
|
||||
// HandyControl.Controls.MessageBox.Show(Result.Message);
|
||||
// }
|
||||
// else
|
||||
// HandyControl.Controls.MessageBox.Show("操作失败,请重试!");
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Growl.Warning(ex.Message);
|
||||
// }
|
||||
// #endregion
|
||||
//}
|
||||
|
||||
|
||||
public ICommand BtnGeneratePrintCommand { get => new DelegateCommand(BtnGeneratePrint); }
|
||||
public void BtnGeneratePrint()
|
||||
{
|
||||
#region 调用接口获取物料 MatBaseInfo
|
||||
try
|
||||
{
|
||||
var body = new JinChuanCommitMatInfoRequest()
|
||||
{
|
||||
MatId = MatBaseInfo.Id,
|
||||
CurrentSerilNumber = MatBaseInfo.SerialNumber,
|
||||
MatBatch = MatBatch,
|
||||
MatQty = MatQty,
|
||||
TotalPan = TotalPan,
|
||||
CurrentMatSn = MatSNs,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<List<MatInfoModel>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/JinChuanCommitMatInfo", body, "POST");
|
||||
if (Result != null && Result.Code == 200 && Result.Data != null && Result.Data.Count != 0)
|
||||
{
|
||||
MatInfos = Result.Data;
|
||||
MatSNsStr = MatSNsStr + " 已生成";
|
||||
Task.Run(() =>
|
||||
{
|
||||
ProcessDialog process = null;
|
||||
Dialog dia = null;
|
||||
var totalCount = MatInfos.Count;
|
||||
int currentCount = 0;
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
process = new ProcessDialog();
|
||||
dia = Dialog.Show(process);
|
||||
});
|
||||
|
||||
foreach (var matInfo in MatInfos)
|
||||
{
|
||||
PrintTender.PrintTag(new PrintClass()
|
||||
{
|
||||
MatSn = matInfo.MatSN,
|
||||
MatName = matInfo.MatName,
|
||||
MatCode = matInfo.MatCode,
|
||||
MatBatch = matInfo.MatBatch,
|
||||
MatQty = matInfo.MatQty.ToString(),
|
||||
MatSpec = matInfo.MatSpec,
|
||||
});
|
||||
currentCount++;
|
||||
if (process != null)
|
||||
process.viewModel.ProcessValue = Convert.ToInt32(((decimal)currentCount / totalCount) * 100);
|
||||
}
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
dia.Close();
|
||||
dia.Collapse();
|
||||
});
|
||||
|
||||
#region 回传后端打印成功
|
||||
try
|
||||
{
|
||||
var body = new PrintedMatInfoRequest()
|
||||
{
|
||||
PrintedMatInfoIds = MatInfos.Select(t => t.Id).ToList(),
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result11 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "matBaseInfo/printedMatInfo", body, "POST");
|
||||
if (Result11 != null && Result11.Code == 200)
|
||||
{
|
||||
MatSNsStr = MatSNsStr + " 已打印";
|
||||
//回传成功
|
||||
}
|
||||
else
|
||||
{
|
||||
//回传失败
|
||||
Logs.Write("回传“打印成功”失败");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logs.Write("回传“打印成功”失败:" + ex.Message);
|
||||
}
|
||||
#endregion
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show(Result.Message);
|
||||
}
|
||||
else
|
||||
HandyControl.Controls.MessageBox.Show("操作失败,请重试!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void ParsingBarcode(string input)
|
||||
{
|
||||
#region 解析扫码文本
|
||||
// 提取第一个字段 CPN物料编码
|
||||
//string firstField = Regex.Match(input, @"^[0-9,a-z,A-Z, ]{9}{").Value;
|
||||
string firstField = Regex.Match(input, LocalFile.Config.RegexMatCode).Value;
|
||||
MatCode = firstField.Replace("{", "").Replace(" ", "");
|
||||
|
||||
try
|
||||
{
|
||||
// 第二个字段 数量
|
||||
//string secondField = Regex.Match(input, @"{[1-9][0]{2,5}[ ]{").Value;
|
||||
string secondField = Regex.Match(input, LocalFile.Config.RegexMatQty).Value;
|
||||
MatQty = Convert.ToInt32(secondField.Replace("{", "").Replace(" ", ""));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Growl.Warning("数量解析失败!请重试或手动输入");
|
||||
}
|
||||
|
||||
// 第三个字段 批次
|
||||
//string thirdField = Regex.Match(input, @"{[0-9, ]{5}{").Value;
|
||||
string thirdField = Regex.Match(input, LocalFile.Config.RegexMatBatch).Value;
|
||||
MatBatch = thirdField.Replace("{", "").Replace(" ", ""); ;
|
||||
#endregion
|
||||
|
||||
//调用接口获取物料信息
|
||||
#region 调用接口获取物料 MatBaseInfo
|
||||
try
|
||||
{
|
||||
var body = new JinChuanGenerateMatInfoRequest()
|
||||
{
|
||||
MatCode = MatCode,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<MatBaseInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/JinChuanGenerateMatInfo", body, "POST");
|
||||
if (Result != null && Result.Code == 200 && Result.Data != null)
|
||||
{
|
||||
MatBaseInfo = Result.Data;
|
||||
MatName = MatBaseInfo.MatName;
|
||||
MatSpec = MatBaseInfo.MatSpec;
|
||||
MatBaseInfo.SerialNumber++;
|
||||
|
||||
GenerateMatSN();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Result == null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show(Result.Message);
|
||||
}
|
||||
else
|
||||
HandyControl.Controls.MessageBox.Show("接口调用失败,请重试!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void UpdateMatSN()
|
||||
{
|
||||
if (MatSNs != null && totalPan > 1)
|
||||
{
|
||||
MatSNs.Clear();
|
||||
for (int i = 0; i < TotalPan; i++)
|
||||
{
|
||||
var newMatSn = ChangelessCode + MatCode + ReservedCode + MatBatch + (MatBaseInfo.SerialNumber + i).ToString("000");
|
||||
MatSNs.Add(newMatSn);
|
||||
}
|
||||
|
||||
if (MatSNs == null || MatSNs.Count == 0)
|
||||
{
|
||||
MatSNsStr = string.Empty;
|
||||
}
|
||||
else if (MatSNs.Count == 1)
|
||||
{
|
||||
MatSNsStr = MatSNs[0].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
MatSNsStr = MatSNs[0].ToString() + "\r\n~" + MatSNs[MatSNs.Count - 1].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GenerateMatSN()
|
||||
{
|
||||
MatSNs.Clear();
|
||||
for (int i = 0; i < TotalPan; i++)
|
||||
{
|
||||
var newMatSn = ChangelessCode + MatCode + ReservedCode + MatBatch + (MatBaseInfo.SerialNumber + i).ToString("000");
|
||||
MatSNs.Add(newMatSn);
|
||||
}
|
||||
|
||||
if (MatSNs == null || MatSNs.Count == 0)
|
||||
{
|
||||
MatSNsStr = string.Empty;
|
||||
}
|
||||
else if (MatSNs.Count == 1)
|
||||
{
|
||||
MatSNsStr = MatSNs[0].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
MatSNsStr = MatSNs[0].ToString() + "\r\n~" + MatSNs[MatSNs.Count - 1].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +1,23 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using QRCoder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
|
||||
namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
@ -302,6 +308,17 @@ namespace 货架标准上位机.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
//判断是否是信息化货架
|
||||
if (selectedOutOrder.ShelfTypeName == "信息化货架")
|
||||
{
|
||||
Growl.Info("请使用PDA进行出库");
|
||||
//生成二维码
|
||||
var qrCodeImage = GenerateQRCode(selectedOutOrder.Id.ToString() + "," + selectedOutOrder.OrderNumber);
|
||||
//展示二维码
|
||||
Dialog.Show(new ImageDialog(qrCodeImage));
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
@ -340,6 +357,29 @@ namespace 货架标准上位机.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public BitmapImage GenerateQRCode(string data)
|
||||
{
|
||||
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||
QRCodeData qrCodeData = qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.Q);
|
||||
QRCode qrCode = new QRCode(qrCodeData);
|
||||
Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, true);
|
||||
// 将System.Drawing.Bitmap转换为System.Windows.Media.Imaging.BitmapImage
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
// 假设Bitmap的Save方法支持Png格式(通常是这样)
|
||||
qrCodeImage.Save(memoryStream, ImageFormat.Png);
|
||||
memoryStream.Position = 0;
|
||||
var bitmapImage = new BitmapImage();
|
||||
bitmapImage.BeginInit();
|
||||
bitmapImage.StreamSource = memoryStream;
|
||||
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bitmapImage.EndInit();
|
||||
|
||||
// 返回BitmapImage
|
||||
return bitmapImage;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||
public void BtnPause()
|
||||
{
|
||||
|
@ -16,6 +16,8 @@
|
||||
<GroupBox Header="调试功能" Margin="3" Style="{StaticResource GroupBoxTab}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Margin="5,3" Padding="30,0" Name="resetShelf" Content="货架状态初始化" Command="{Binding ResetAllShelfCommand}"></Button>
|
||||
|
||||
<Button Margin="5,3" Padding="30,0" Content="打开打印模板路径" Command="{Binding BarcodePrintTemplateCommand}"></Button>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
|
@ -6,8 +6,11 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="737" d:DesignWidth="1192" LoadedVisibleFirst="LoadedVisible">
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="737" d:DesignWidth="1192"
|
||||
LoadedVisibleFirst="LoadedVisible"
|
||||
Loaded="UserControlBase_Loaded"
|
||||
>
|
||||
|
||||
<Border Margin="0" Background="AliceBlue" CornerRadius="3" Padding="0">
|
||||
<Grid>
|
||||
@ -79,7 +82,7 @@
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="4" Margin="5"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right"
|
||||
Text="物料条码:" FontSize="18" ></TextBlock>
|
||||
Text="物 料 SN:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Row="2" Grid.Column="5" Text="{Binding MatSN}"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Left"
|
||||
FontSize="18" MinWidth="120" ></TextBox>
|
||||
|
@ -32,9 +32,14 @@ namespace 货架标准上位机
|
||||
|
||||
private void LoadedVisible(object sender, EventArgs e)
|
||||
{
|
||||
viewModel.InitMatCode();
|
||||
viewModel.BtnReset();
|
||||
viewModel.BtnSearchReset();
|
||||
}
|
||||
|
||||
|
||||
private void UserControlBase_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.InitMatCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -263,16 +263,11 @@
|
||||
</StackPanel>
|
||||
</TabItem.Header>
|
||||
<TabControl Margin="5" Style="{StaticResource TabControlBaseStyle.MouseOver}">
|
||||
<TabItem Header="PLC">
|
||||
<TabItem Header="调试">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DeviceView Margin="0,5"/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="扫码枪">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<pi:TextBoxScanner Style="{StaticResource TextBoxExtend.Multi}" hc:InfoElement.Placeholder="鼠标点击此处激活" hc:InfoElement.Title="码信息" hc:InfoElement.TitlePlacement="Top" AutoClear="NextClear" IsAutoFocus="True"></pi:TextBoxScanner>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</TabItem>
|
||||
|
||||
|
@ -131,9 +131,15 @@
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="生成&打印" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnPrintCommand}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="DarkOrange"
|
||||
>
|
||||
Foreground="WhiteSmoke"
|
||||
Background="DarkOrange">
|
||||
</Button>
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="扫描生成打印" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnScanPrintCommand}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="BlueViolet">
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
@ -64,7 +64,7 @@
|
||||
<TextBox Name="txtTotalCount" MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
InputScope="Number"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
@ -56,11 +56,6 @@ namespace 货架标准上位机
|
||||
Growl.Warning("【物料批次】请输入数字!");
|
||||
txtMatBatch.Focus();
|
||||
return;
|
||||
//正则表达式
|
||||
//匹配年周
|
||||
//^\d{ 4}\d{ 1,2}$
|
||||
//匹配年月日
|
||||
//^\d{ 4} (0[1 - 9] | 1[0 - 2])(0[1 - 9] | [12]\d | 3[01])$
|
||||
}
|
||||
|
||||
var matQty = txtMatQty.Text.Trim();
|
||||
|
107
货架标准上位机/Views/MatBaseInoScanGenarateMatInfoView.xaml
Normal file
107
货架标准上位机/Views/MatBaseInoScanGenarateMatInfoView.xaml
Normal file
@ -0,0 +1,107 @@
|
||||
<Window
|
||||
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||
x:Class="货架标准上位机.MatBaseInoScanGenarateMatInfoView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Height="400" Width="340" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||
<Border BorderBrush="Gray" Background="WhiteSmoke" CornerRadius="5" BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock FontSize="22" Name="Title" Text="{Binding Title, FallbackValue= 扫描生成物料条码}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Button Margin="-5,-1"
|
||||
Visibility="{Binding IsClose,Converter={StaticResource Boolean2VisibilityConverter}}"
|
||||
Style="{StaticResource ButtonIcon}"
|
||||
hc:IconElement.Geometry="{StaticResource CloseGeometry}" HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top" Click="closeClick"/>
|
||||
|
||||
<StackPanel Margin="5,0" Grid.Row="1" >
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="两位固定码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBox MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||
Text="{Binding ChangelessCode}"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="物料编码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBlock Text="{Binding MatCode}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="物料名称:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBlock Text="{Binding MatName}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="物料规格:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBlock Text="{Binding MatSpec}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="两位预留码:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBox MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||
Text="{Binding ReservedCode}"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="物料批次:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBox MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||
Text="{Binding MatBatch}"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="物料数量:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBox Name="txtMatQty" MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||
Text="{Binding MatQty}"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="打印盘数:" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
|
||||
<TextBox Name="txtTotalCount"
|
||||
MinWidth="200" MaxWidth="200" FontSize="15"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
PreviewTextInput="txtMatBatch_PreviewTextInput"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||
Text="{Binding TotalPan}"
|
||||
Style="{StaticResource TextBoxExtend}">
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="{Binding MatSNsStr}" FontSize="15" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="5" x:Name="spacingPanel" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<!--<Button Margin="5" Command="{Binding BtnGenerateCommand}" MinHeight="30" FontSize="15" Content="生成" Name="btnOk" />-->
|
||||
<Button Margin="5" x:Name="BtnGeneratePrint" Command="{Binding BtnGeneratePrintCommand}" MinHeight="30" FontSize="15" Content="生成并打印" />
|
||||
<Button Margin="5" MinHeight="30" FontSize="15" Content="关 闭" Click="closeClick"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Window>
|
73
货架标准上位机/Views/MatBaseInoScanGenarateMatInfoView.xaml.cs
Normal file
73
货架标准上位机/Views/MatBaseInoScanGenarateMatInfoView.xaml.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Tools.Extension;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using 货架标准上位机.Api;
|
||||
using 货架标准上位机.Tool;
|
||||
using 货架标准上位机.ViewModel;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public partial class MatBaseInoScanGenarateMatInfoView : System.Windows.Window
|
||||
{
|
||||
public MatBaseInoScanGenarateMatInfoViewModel viewModel = new MatBaseInoScanGenarateMatInfoViewModel();
|
||||
public MatBaseInoScanGenarateMatInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
viewModel.ChangelessCode = LocalFile.Config.ChangelessCode;
|
||||
viewModel.ReservedCode = LocalFile.Config.ReservedCode;
|
||||
this.Topmost = true;
|
||||
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
|
||||
|
||||
private void btnOk_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var button = sender as Button;
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void txtMatBatch_PreviewTextInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = !IsInputNumberAllowed(e.Text);
|
||||
}
|
||||
|
||||
private bool IsInputNumberAllowed(string text)
|
||||
{
|
||||
Regex regex = new Regex("^[0-9]+$"); // 只允许数字
|
||||
return regex.IsMatch(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
txtMatQty.Focus();
|
||||
Thread.Sleep(1);
|
||||
txtTotalCount.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,23 +23,35 @@ namespace 货架标准上位机
|
||||
{
|
||||
lock (flag)
|
||||
{
|
||||
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
Logs.Write($"【添加报警信息弹窗】报警类型:{warningModel.WarningType} 报警信息:{warningModel.WarningMessage} Guid:{warningModel.Guid}", LogsType.WebSocket);
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
warnings.Add(WarningWindow.Show(warningModel.WarningMessage, "报警信息", warningModel));
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void RemoveWarning(Guid guid)
|
||||
{
|
||||
lock(flag)
|
||||
lock (flag)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var warning = warnings.Where(t => t.warning.Guid == guid).First();
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
var warningWindow = warnings.Where(t => t.warning.Guid == guid).First();
|
||||
if (warningWindow != null)
|
||||
{
|
||||
warning?.Close();
|
||||
warnings.Remove(warning);
|
||||
}));
|
||||
Logs.Write($"【移除报警信息弹窗】报警类型:{warningWindow.warning.WarningType} 报警信息:{warningWindow.warning.WarningMessage} Guid:{warningWindow.warning.Guid}", LogsType.WebSocket);
|
||||
Application.Current.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
warningWindow?.Close();
|
||||
warnings.Remove(warningWindow);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write($"【移除报警信息弹窗失败】Guid为:{guid}的窗体未找到!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -25,6 +25,11 @@
|
||||
"FirstSendRecommendedBarCode": "http://192.168.2.23:9213/integrate/inOut/firstsetPush",
|
||||
//盟讯公司配置-后续发料获取要料单明细
|
||||
"ElectronicSiloPush": "http://192.168.2.23:9213/integrate/inOut/electronicSiloPush",
|
||||
"ChangelessCode": "11",
|
||||
"ReservedCode": "09",
|
||||
"RegexMatCode": "^[0-9,a-z,A-Z, ]{9}{",
|
||||
"RegexMatQty": "{[1-9]{1,3}[0]{2,6}[ ]{",
|
||||
"RegexMatBatch": "{[0-9, ]{5}{",
|
||||
//系统配置
|
||||
"Sys": {
|
||||
//是否保存登录历史
|
||||
|
Binary file not shown.
@ -131,6 +131,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Views\MatBaseInoScanGenarateMatInfoView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\ShelfInfoAddOrUpdateView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
Reference in New Issue
Block a user