提交代码
This commit is contained in:
@ -125,7 +125,5 @@ namespace WCS.BLL.DbModels
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -90,5 +90,17 @@ namespace WCS.BLL.DbModels
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "modify_time", IsNullable = true, ColumnDescription = "更新时间")]
|
||||
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 用于绑定DataGrid中是否选择
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用于绑定中显示序号
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int RowNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,11 @@ namespace WCS.BLL.HardWare
|
||||
/// 货架复位
|
||||
/// </summary>
|
||||
public void Reset();
|
||||
|
||||
/// <summary>
|
||||
/// 货架自检
|
||||
/// </summary>
|
||||
public void ShelfCheck();
|
||||
}
|
||||
|
||||
public enum Mode
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -6,8 +7,95 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace WCS.BLL.HardWare
|
||||
{
|
||||
public interface IWarningLightBase
|
||||
public class WarningLight
|
||||
{
|
||||
public void BlueLight();
|
||||
#region 关于协议的几个枚举
|
||||
public enum LightColorEnum
|
||||
{
|
||||
红色 = 0x01,
|
||||
绿色 = 0x02,
|
||||
蓝色 = 0x03,
|
||||
}
|
||||
public enum LightModeEnum
|
||||
{
|
||||
关闭 = 0x00,
|
||||
常亮 = 0x01,
|
||||
闪烁 = 0x02,
|
||||
短亮一次 = 0x03
|
||||
}
|
||||
public enum LightBuzzerStatus
|
||||
{
|
||||
关闭 = 0x00,
|
||||
循环鸣叫 = 0x01,
|
||||
鸣叫一次 = 0x02
|
||||
}
|
||||
#endregion
|
||||
public int LightId { get; set; } = 2047;
|
||||
|
||||
public void LightOperation(LightColorEnum lightColor, LightModeEnum lightMode, LightBuzzerStatus lightBuzzerStatus, TCPClient tcpClient, byte time = 0x00)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = new byte[8] { 0x20, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 };
|
||||
data[2] = (byte)lightColor;
|
||||
data[3] = (byte)lightMode;
|
||||
data[5] = (byte)lightBuzzerStatus;
|
||||
|
||||
data[4] = time;//灯短亮一次的时间
|
||||
data[6] = time;//蜂鸣器持续鸣叫的时间
|
||||
|
||||
tcpClient.Send(tcpClient.GenerateMessage(LightId, data));
|
||||
return;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void BlueLight(TCPClient tcpClient)
|
||||
{
|
||||
LightOperation(LightColorEnum.蓝色, LightModeEnum.常亮, LightBuzzerStatus.关闭, tcpClient);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//public void CloseLight(string ip, int tagId)
|
||||
//{
|
||||
// LightOperation(LightColorEnum.蓝色, LightModeEnum.关闭, LightBuzzerStatus.关闭, ip, "00", tagId);
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 红色报警灯 响三秒
|
||||
///// </summary>
|
||||
///// <param name="ip"></param>
|
||||
///// <param name="tagId"></param>
|
||||
///// <returns></returns>
|
||||
//public void WaringLight(string ip, int tagId)
|
||||
//{
|
||||
// LightOperation(LightColorEnum.红色, LightModeEnum.短亮一次, LightBuzzerStatus.鸣叫一次, ip, "22", tagId);
|
||||
// Thread.Sleep(3300);
|
||||
// return BlueLight(ip, tagId);
|
||||
//}
|
||||
|
||||
//public void WaringLightAlwaysRed(string ip, int tagId)
|
||||
//{
|
||||
// return LightOperation(LightColorEnum.红色, LightModeEnum.常亮, LightBuzzerStatus.鸣叫一次, ip, "22", tagId);
|
||||
//}
|
||||
|
||||
//public void SuccessLightBlueEnd(string ip, int tagId)
|
||||
//{
|
||||
// LightOperation(LightColorEnum.绿色, LightModeEnum.短亮一次, LightBuzzerStatus.鸣叫一次, ip, "03", tagId);
|
||||
// Thread.Sleep(300);
|
||||
// return BlueLight(ip, tagId);
|
||||
//}
|
||||
|
||||
//public void SuccessLightGreenEnd(string ip, int tagId)
|
||||
//{
|
||||
// LightOperation(LightColorEnum.绿色, LightModeEnum.短亮一次, LightBuzzerStatus.鸣叫一次, ip, "03", tagId);
|
||||
// Thread.Sleep(300);
|
||||
// return GreenLight(ip, tagId);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -60,6 +60,11 @@ namespace WCS.BLL.HardWare
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShelfCheck()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Warning()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -5,6 +5,8 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.DAL;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.DAL.DbModels;
|
||||
@ -35,6 +37,7 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
ModuleId = module.Id,
|
||||
ModuleCode = module.ModuleCode,
|
||||
BoardId = module.BoardId,
|
||||
IsEnable = module.IsEnable,
|
||||
CurrentMode = module.CurentMode
|
||||
});
|
||||
@ -71,6 +74,9 @@ namespace WCS.BLL.HardWare
|
||||
case 0x01:
|
||||
;
|
||||
break;
|
||||
case 0x03://正常入库信号
|
||||
InStoreReturnProcess(dataTemp);
|
||||
break;
|
||||
default:
|
||||
;
|
||||
break;
|
||||
@ -91,7 +97,7 @@ namespace WCS.BLL.HardWare
|
||||
public List<SmartShelfModule> Modules { get; set; } = new List<SmartShelfModule>();
|
||||
public TCPClient TcpCleint { get; set; }
|
||||
|
||||
public IWarningLightBase WarningLight { get; set; }
|
||||
public WarningLight WarningLight { get; set; }
|
||||
public List<string> ExceptionMessages { get; set; } = new List<string>();
|
||||
|
||||
public string? InstoreIpAddress { get; set; } = string.Empty;
|
||||
@ -100,6 +106,7 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
public string OrderNumber { get; set; }
|
||||
|
||||
#region 协议处理
|
||||
public void GoInInstore(string? IPAddress)
|
||||
{
|
||||
//判断当前模式是否为待机模式
|
||||
@ -139,16 +146,10 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
//警示灯亮起
|
||||
//WarningLight.BlueLight();
|
||||
//绑定当前入库PDA的IP
|
||||
//绑定当前进入入库PDA/WCS前端的IP
|
||||
InstoreIpAddress = IPAddress;
|
||||
//返回成功
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public void GoInInstoreReturn()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void GoOutInstore()
|
||||
@ -181,7 +182,6 @@ namespace WCS.BLL.HardWare
|
||||
this.CurentMode = Mode.盘点模式;
|
||||
}
|
||||
|
||||
|
||||
public void GoOutOutstore()
|
||||
{
|
||||
this.CurentMode = Mode.待机模式;
|
||||
@ -206,5 +206,140 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void ShelfCheck()
|
||||
{
|
||||
foreach (var module in Modules.Where(t => t.IsEnable).ToList())
|
||||
{
|
||||
module.ShelfCheck(TcpCleint);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 协议返回处理
|
||||
public void InStoreReturnProcess(byte[] data)
|
||||
{
|
||||
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();
|
||||
if (storeInfo == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
return;
|
||||
}
|
||||
var module = this.Modules.Where(t => t.BoardId == boardId)
|
||||
.FirstOrDefault();
|
||||
if (module == null)
|
||||
{
|
||||
//TO DO 报错
|
||||
return;
|
||||
}
|
||||
#region 判断是否扫码获取物料信息
|
||||
//物料未扫码
|
||||
if (this.InStoreData == null)
|
||||
{
|
||||
//重复给了多次信号
|
||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||
{
|
||||
module.ComfirmInstore(TcpCleint);
|
||||
//TO DO Logs.Write($"[{guid}]CAN给了多次正常入库信号,防止硬件异常,返回了确认入库");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
module.ComfirmErrInstore(TcpCleint);
|
||||
//WaringLight(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
//TO DO Logs.Write($"[{guid}]当前物料信息不存在,请取出后重新扫码进行入库!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//该位置已放置物料
|
||||
else if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn))
|
||||
{
|
||||
//ComfirmErrInstoreByIp(shelfStatus.ClientIp, boardId);
|
||||
//WaringLight(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
//Logs.Write($"[{guid}]该位置已放置物料!");
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 已扫码且库位未被占用 保存数据
|
||||
{
|
||||
try
|
||||
{
|
||||
DbHelp.db.BeginTran();
|
||||
//库存明细表
|
||||
var inventoryDetail = new InventoryDetail
|
||||
{
|
||||
StoreCode = storeInfo.StoreCode,
|
||||
StoreId = storeInfo.Id,
|
||||
|
||||
MatSN = this.InStoreData.materialBar,
|
||||
MatCode = this.InStoreData.materialCode,
|
||||
MatName = this.InStoreData.materialName,
|
||||
MatSpec = this.InStoreData.materialSpec,
|
||||
MatBatch = this.InStoreData.batchNo,
|
||||
MatQty = (int)this.InStoreData.materialQty,
|
||||
MatCustomer = this.InStoreData.customer,
|
||||
MatSupplier = this.InStoreData.supplier,
|
||||
|
||||
InstoreTime = DateTime.Now,
|
||||
InstoreUser = ""
|
||||
};
|
||||
|
||||
//出入库记录表
|
||||
var inOutRecord = new InOutRecord()
|
||||
{
|
||||
StoreCode = storeInfo.StoreCode,
|
||||
StoreId = storeInfo.Id,
|
||||
StoreInfo = storeInfo,
|
||||
|
||||
MatSN = this.InStoreData.materialBar,
|
||||
MatCode = this.InStoreData.materialCode,
|
||||
MatName = this.InStoreData.materialName,
|
||||
MatSpec = this.InStoreData.materialSpec,
|
||||
MatBatch = this.InStoreData.batchNo,
|
||||
MatQty = (int)this.InStoreData.materialQty,
|
||||
MatCustomer = this.InStoreData.customer,
|
||||
MatSupplier = this.InStoreData.supplier,
|
||||
|
||||
OperateUser = this.InStoreData.InstoreUser,
|
||||
Direction = DirectionEnum.入库,
|
||||
};
|
||||
|
||||
//库位表
|
||||
storeInfo.CurrentMatSn = this.InStoreData.materialBar;
|
||||
|
||||
//保存and更新数据
|
||||
DbHelp.db.Insertable(inventoryDetail).ExecuteCommand();
|
||||
DbHelp.db.Insertable(inOutRecord).ExecuteCommand();
|
||||
DbHelp.db.Updateable(storeInfo).ExecuteCommand();
|
||||
DbHelp.db.CommitTran();
|
||||
|
||||
//清空扫码信息
|
||||
this.InStoreData = null;
|
||||
|
||||
//实际入库位置亮灯1S,报警灯同时进行亮绿灯并鸣叫一次提示。
|
||||
Thread.Sleep(20);
|
||||
Task.Run(() =>
|
||||
{
|
||||
//确认入库(硬件入库位置亮灯1秒)
|
||||
//ComfirmInstoreByIp(client.IP, boardId);
|
||||
//报警灯亮绿灯 鸣叫一次提示
|
||||
//SuccessLightBlueEnd(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DbHelp.db.RollbackTran();
|
||||
Logs.Write($"入库保存数据异常,异常信息为{ex.Message}");
|
||||
//报警灯报警
|
||||
//WaringLight(shelfStatus.ClientIp, shelfStatus.LightId);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -10,18 +10,32 @@ namespace WCS.BLL.HardWare
|
||||
{
|
||||
public class SmartShelfModule : IModuleBase
|
||||
{
|
||||
#region 协议明细
|
||||
#region 协议
|
||||
/// <summary>
|
||||
/// 进入入库模式
|
||||
/// </summary>
|
||||
public byte[] GoInInstoreData = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
/// <summary>
|
||||
/// 确认入库
|
||||
/// </summary>
|
||||
public byte[] ComfirmInstoreData = { 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
public byte[] ComfirmErrInstoreData = { 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
/// <summary>
|
||||
/// 退出入库模式
|
||||
/// </summary>
|
||||
public byte[] GoOutInstoreData = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
/// <summary>
|
||||
/// 自检模式
|
||||
/// </summary>
|
||||
public byte[] CheckModeData = { 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
#endregion
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleCode { get; set; }
|
||||
public int BoardId { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public Mode CurrentMode { get; set; }
|
||||
|
||||
@ -30,16 +44,14 @@ namespace WCS.BLL.HardWare
|
||||
|
||||
}
|
||||
|
||||
public void GoInInstoreMode(TCPClient tcpCleint)
|
||||
public void GoInInstoreMode(TCPClient tcpClient)
|
||||
{
|
||||
|
||||
if (CurrentMode != Mode.待机模式)
|
||||
{
|
||||
//退出对应的模式 然后再发送进入入库模式
|
||||
//TO DO 退出对应的模式 然后再发送进入入库模式
|
||||
}
|
||||
|
||||
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == ModuleId)
|
||||
.Where(t => t.BoardId == BoardId)
|
||||
.OrderBy(t => t.LightNumber)
|
||||
.ToList();
|
||||
char[] data = "0000000000000000".ToCharArray();
|
||||
@ -57,14 +69,24 @@ namespace WCS.BLL.HardWare
|
||||
GoInInstoreData[1] = Convert.ToByte(data1, 2);
|
||||
GoInInstoreData[2] = Convert.ToByte(data2, 2);
|
||||
|
||||
tcpCleint.Send(tcpCleint.GenerateMessage(ModuleId, GoInInstoreData));
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoInInstoreData));
|
||||
}
|
||||
|
||||
public void GoOutInstoreMode(TCPClient tcpCleint)
|
||||
public void ComfirmInstore(TCPClient tcpClient)
|
||||
{
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ComfirmInstoreData));
|
||||
}
|
||||
|
||||
public void ComfirmErrInstore(TCPClient tcpClient)
|
||||
{
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, ComfirmErrInstoreData));
|
||||
}
|
||||
|
||||
public void GoOutInstoreMode(TCPClient tcpClient)
|
||||
{
|
||||
if (CurrentMode == Mode.入库模式)
|
||||
{
|
||||
tcpCleint.Send(tcpCleint.GenerateMessage(ModuleId, GoOutInstoreData));
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, GoOutInstoreData));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -73,7 +95,32 @@ namespace WCS.BLL.HardWare
|
||||
}
|
||||
}
|
||||
|
||||
public void ShelfCheck(TCPClient tcpClient)
|
||||
{
|
||||
if (CurrentMode != Mode.待机模式)
|
||||
{
|
||||
//TO DO 退出对应的模式 然后再发送进入入库模式
|
||||
}
|
||||
var storeInfos = DbHelp.db.Queryable<StoreInfo>()
|
||||
.Where(t => t.BoardId == BoardId)
|
||||
.OrderBy(t => t.LightNumber)
|
||||
.ToList();
|
||||
char[] data = "0000000000000000".ToCharArray();
|
||||
var boardStoreNumber = storeInfos.Count();
|
||||
foreach (var storeInfo in storeInfos)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(storeInfo.CurrentMatSn) && storeInfo.LightNumber > 0 && storeInfo.LightNumber <= boardStoreNumber)
|
||||
{
|
||||
data[storeInfo.LightNumber - 1] = '1';
|
||||
}
|
||||
}
|
||||
var dataStr = string.Join("", data.Reverse());
|
||||
var data1 = dataStr.Substring(8, 8);
|
||||
var data2 = dataStr.Substring(0, 8);
|
||||
CheckModeData[1] = Convert.ToByte(data1, 2);
|
||||
CheckModeData[2] = Convert.ToByte(data2, 2);
|
||||
|
||||
|
||||
tcpClient.Send(tcpClient.GenerateMessage(BoardId, CheckModeData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,5 +22,8 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<ResponseCommon<object>> deleteMatBaseInfo(DeleteMatBaseInfosRequest request);
|
||||
|
||||
public Task<ResponseCommon<List<string>>> getMatCodeList(GetMatCodeListRequest request);
|
||||
|
||||
|
||||
public Task<PageQueryResponse<MatInfo>> getMatInfo(GetMatInfoRequest request);
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,7 @@ namespace WCS.BLL.Services.IService
|
||||
public Task<PageQueryResponse<InventoryDetail>> getMatInventoryDetail(GetMatInventoryDetailRequest request);
|
||||
|
||||
public Task<PageQueryResponse<InventoryDetail>> exportMatInventoryDetail(GetMatInventoryDetailRequest request);
|
||||
|
||||
public Task<ResponseCommon<List<MatInventorySummaryModel>>> getMatInventorySummary(GetMatInventorySummaryRequest request);
|
||||
}
|
||||
}
|
||||
|
16
WCS.BLL/Services/IService/ISelfCheckService.cs
Normal file
16
WCS.BLL/Services/IService/ISelfCheckService.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model.ApiModel.Stocktaking;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
|
||||
namespace WCS.BLL.Services.IService
|
||||
{
|
||||
public interface ISelfCheckService
|
||||
{
|
||||
public Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request);
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
@ -86,7 +87,7 @@ namespace WCS.BLL.Services.Service
|
||||
var shelf = ShelfManager.Shelves.Where(t => t.ShelfCode == request.ShelfCode).FirstOrDefault();
|
||||
if (shelf == null)//货架不存在
|
||||
{
|
||||
return new QueryByMatSnResponse()
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不存在!",
|
||||
@ -95,7 +96,7 @@ namespace WCS.BLL.Services.Service
|
||||
//判断当前是否是入库模式
|
||||
if (shelf.CurentMode != Mode.入库模式)
|
||||
{
|
||||
return new QueryByMatSnResponse()
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:货架[{request.ShelfCode}]不在入库模式!\r\n当前为{shelf.CurentMode}",
|
||||
@ -105,7 +106,7 @@ namespace WCS.BLL.Services.Service
|
||||
var inventory = await DbHelp.db.Queryable<InventoryDetail>().Where(t => t.MatSN == request.MatSn).FirstAsync();
|
||||
if (inventory != null)
|
||||
{
|
||||
return new QueryByMatSnResponse()
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"操作失败:物料{inventory.MatSN}已入库,库位为{inventory.StoreCode}",
|
||||
@ -134,17 +135,19 @@ namespace WCS.BLL.Services.Service
|
||||
batchNo = matInfo.MatBatch,
|
||||
supplier = matInfo.MatSupplier,
|
||||
customer = matInfo.MatCustomer,
|
||||
|
||||
InstoreUser = request.UserName
|
||||
};
|
||||
|
||||
return new QueryByMatSnResponse()
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Data = shelf.InStoreData,
|
||||
Data = matInfo,
|
||||
Message = "success"
|
||||
};
|
||||
}
|
||||
else
|
||||
return new QueryByMatSnResponse()
|
||||
return new ResponseCommon<MatInfo>()
|
||||
{
|
||||
Code = 201,
|
||||
Data = null,
|
||||
@ -176,6 +179,7 @@ namespace WCS.BLL.Services.Service
|
||||
Message = $"货架[{request.ShelfCode}]已退出入库模式!\r\n当前为{shelf.CurentMode}",
|
||||
};
|
||||
}
|
||||
|
||||
//这个时间相当于需要入库扫码后需要等待的时间
|
||||
var timeOut = 5000;
|
||||
var timeSpan = TimeSpan.FromMilliseconds(0);
|
||||
|
@ -378,8 +378,6 @@ namespace WCS.BLL.Services.Service
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
List<string> matCodeList = null;
|
||||
if (request.IsFromBaseData)
|
||||
{
|
||||
@ -412,5 +410,50 @@ namespace WCS.BLL.Services.Service
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<PageQueryResponse<MatInfo>> getMatInfo(GetMatInfoRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
var recordsQueryable = DbHelp.db.Queryable<MatInfo>()
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatCode), t => t.MatCode.Contains(request.MatCode))
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName))
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatSpec), t => t.MatSpec.Contains(request.MatSpec))
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatSN), t => t.MatSn.Contains(request.MatSN));
|
||||
var totalCount = await recordsQueryable.CountAsync();
|
||||
var records = await recordsQueryable
|
||||
.Skip((request.PageNumber - 1) * request.PageSize).Take(request.PageSize)
|
||||
.ToListAsync();
|
||||
//生成序号
|
||||
for (int i = 0; i < records.Count; i++)
|
||||
{
|
||||
records[i].RowNumber = (request.PageNumber - 1) * 10 + i + 1;
|
||||
}
|
||||
|
||||
return new PageQueryResponse<MatInfo>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"success",
|
||||
Data = new PageQueryResponseData<MatInfo>()
|
||||
{
|
||||
TotalCount = totalCount,
|
||||
MaxPage = request.PageSize == 0 ? 0 : (int)Math.Ceiling((decimal)totalCount / request.PageSize),
|
||||
Count = records.Count,
|
||||
Lists = records.ToList()
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new PageQueryResponse<MatInfo>()
|
||||
{
|
||||
Code = 300,
|
||||
Message = $"操作失败:{ex.Message}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -123,5 +123,31 @@ namespace WCS.BLL.Services.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ResponseCommon<List<MatInventorySummaryModel>>> getMatInventorySummary(GetMatInventorySummaryRequest request)
|
||||
{
|
||||
var inventortyDetails = await DbHelp.db.Queryable<InventoryDetail>()
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatName), t => t.MatName.Contains(request.MatName))
|
||||
.WhereIF(!string.IsNullOrEmpty(request.MatCode), t => t.MatCode.Contains(request.MatCode))
|
||||
.GroupBy(t => t.MatCode)
|
||||
.GroupBy(t => t.MatBatch)
|
||||
.Select(t => new MatInventorySummaryModel
|
||||
{
|
||||
MatCode = t.MatCode,
|
||||
MatName = t.MatName,
|
||||
MatBatch = t.MatBatch,
|
||||
MatSpec = t.MatSpec,
|
||||
MatCustomer = t.MatCustomer,
|
||||
MatSupplier = t.MatSupplier,
|
||||
TotalQty = SqlFunc.AggregateSum(t.MatQty)
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return new ResponseCommon<List<MatInventorySummaryModel>>()
|
||||
{
|
||||
Code = 200,
|
||||
Message = inventortyDetails.Count().ToString(),
|
||||
Data = inventortyDetails
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
46
WCS.BLL/Services/Service/SelfCheckService.cs
Normal file
46
WCS.BLL/Services/Service/SelfCheckService.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
|
||||
namespace WCS.BLL.Services.Service
|
||||
{
|
||||
public class SelfCheckService : ISelfCheckService
|
||||
{
|
||||
public async Task<ResponseBase> StartSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request)
|
||||
{
|
||||
//获取货架
|
||||
var shelfs = ShelfManager.Shelves
|
||||
.Where(t => request.ShelfCodes.Contains(t.ShelfCode))
|
||||
.ToList();
|
||||
|
||||
if (shelfs.Count < request.ShelfCodes.Count)
|
||||
{
|
||||
foreach (var shelf in shelfs)
|
||||
{
|
||||
request.ShelfCodes.RemoveAll(t => t == shelf.ShelfCode);
|
||||
}
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = $"货架{string.Join(",", request.ShelfCodes)}不存在!",
|
||||
};
|
||||
}
|
||||
|
||||
foreach (var shelf in shelfs)
|
||||
{
|
||||
shelf.ShelfCheck();
|
||||
}
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 200,
|
||||
Message = $"货架{string.Join(",", request.ShelfCodes)}已开始自检!",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
|
||||
namespace WCS.Model
|
||||
{
|
||||
@ -28,5 +29,8 @@ namespace WCS.Model
|
||||
public string supplier { get; set; }
|
||||
|
||||
public string customer { get; set; }
|
||||
|
||||
|
||||
public string InstoreUser { get; set; }
|
||||
}
|
||||
}
|
||||
|
17
WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs
Normal file
17
WCS.Model/ApiModel/MatBaseInfo/GetMatInfoRequest.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.MatBaseInfo
|
||||
{
|
||||
public class GetMatInfoRequest : PageQueryRequestBase
|
||||
{
|
||||
public string MatCode { get; set; }
|
||||
|
||||
public string MatName { get; set; }
|
||||
|
||||
public string MatSpec { get; set; }
|
||||
|
||||
public string MatSN { get; set; }
|
||||
}
|
||||
}
|
@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.MatBaseInfo
|
||||
{
|
||||
public class MatInfoModel
|
||||
public class MatInfoModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
public int Id { get; set; }
|
||||
|
||||
public string MatSn { get; set; }
|
||||
public string MatSN { get; set; }
|
||||
|
||||
public string MatCode { get; set; }
|
||||
|
||||
@ -32,5 +33,24 @@ namespace WCS.Model.ApiModel.MatBaseInfo
|
||||
public string? ModifyUser { get; set; }
|
||||
|
||||
public DateTime? ModifyTime { get; set; } = DateTime.Now;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return isSelected; }
|
||||
set
|
||||
{
|
||||
isSelected = value;
|
||||
OnPropertyChanged(nameof(IsSelected));
|
||||
}
|
||||
}
|
||||
public bool isSelected;
|
||||
|
||||
public int RowNumber { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.MatInventoryDetail
|
||||
{
|
||||
public class GetMatInventorySummaryRequest
|
||||
{
|
||||
public string MatCode { get; set; }
|
||||
|
||||
public string MatName { get; set; }
|
||||
|
||||
public string MatSpec { get; set; }
|
||||
|
||||
public string MatBatch { get; set; }
|
||||
|
||||
public string MatSupplier { get; set; }
|
||||
|
||||
public string MatCustomer { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.MatInventoryDetail
|
||||
{
|
||||
public class MatInventorySummaryModel: INotifyPropertyChanged
|
||||
{
|
||||
public string MatCode { get; set; }
|
||||
|
||||
public string MatName { get; set; }
|
||||
|
||||
public string MatSpec { get; set; }
|
||||
|
||||
public string MatBatch { get; set; }
|
||||
|
||||
public string MatSupplier { get; set; }
|
||||
|
||||
public string MatCustomer { get; set; }
|
||||
|
||||
public int TotalQty { get; set; }
|
||||
|
||||
public int NeedQty { get; set; } = 0;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get { return isSelected; }
|
||||
set
|
||||
{
|
||||
isSelected = value;
|
||||
OnPropertyChanged(nameof(IsSelected));
|
||||
}
|
||||
}
|
||||
public bool isSelected;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WCS.Model.ApiModel.SelfCheck
|
||||
{
|
||||
public class StartSelfCheckByShelfCodeRequest : RequestBase
|
||||
{
|
||||
public List<string> ShelfCodes { get; set; }
|
||||
}
|
||||
}
|
@ -36,7 +36,8 @@ namespace WebApi.Controllers
|
||||
var IPAdress = HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(IPAdress))
|
||||
{
|
||||
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ TO DO <20><>¼<EFBFBD><C2BC>־δ<D6BE><CEB4>ȡ<EFBFBD><C8A1>IP
|
||||
//δ<><CEB4>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8>IP<49><50>ַ
|
||||
//TO DO <20><>¼<EFBFBD><C2BC>־δ<D6BE><CEB4>ȡ<EFBFBD><C8A1>IP
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,5 +110,17 @@ namespace WCS.WebApi.Controllers
|
||||
{
|
||||
return await _generateMatInfoService.generateMatInfo(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料明细
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Route("getMatInfo")]
|
||||
[HttpPost(Name = "getMatInfo")]
|
||||
public async Task<ResponseBase> getMatInfo(GetMatInfoRequest request)
|
||||
{
|
||||
return await _matBaseInfoService.getMatInfo(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,5 +80,11 @@ namespace WCS.WebApi.Controllers
|
||||
//}
|
||||
}
|
||||
|
||||
[Route("getMatInventorySummary")]
|
||||
[HttpPost(Name = "getMatInventorySummary")]
|
||||
public async Task<ResponseBase> getMatInventorySummary(GetMatInventorySummaryRequest request)
|
||||
{
|
||||
return await _matInventoryDetailService.getMatInventorySummary(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
47
WCS.WebApi/Controllers/SelfCheckController.cs
Normal file
47
WCS.WebApi/Controllers/SelfCheckController.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.DAL.Db;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.Home;
|
||||
using WCS.Model.ApiModel.SelfCheck;
|
||||
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 自检
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class SelfCheckController : ControllerBase
|
||||
{
|
||||
public ISelfCheckService _selfCheckService { get; set; }
|
||||
|
||||
public SelfCheckController(ISelfCheckService selfCheckService)
|
||||
{
|
||||
_selfCheckService = selfCheckService;
|
||||
}
|
||||
|
||||
[Route("startSelfCheckByShelfCode")]
|
||||
[HttpPost(Name = "startSelfCheckByShelfCode")]
|
||||
public async Task<ResponseBase> startSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
return await _selfCheckService.StartSelfCheckByShelfCode(request);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase()
|
||||
{
|
||||
Code = 300,
|
||||
Message = "开始自检失败:" + ex.Message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -60,6 +60,7 @@ namespace WebApi
|
||||
builder.Services.AddScoped<IMatInventoryDetailService, MatInventoryDetailService>();
|
||||
builder.Services.AddScoped<IStoreInfoService, StoreInfoService>();
|
||||
builder.Services.AddScoped<IStockTakingService, StockTakingService>();
|
||||
builder.Services.AddScoped<ISelfCheckService, SelfCheckService>();
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>롢<EFBFBD><EBA1A2><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ģʽ
|
||||
builder.Services.AddSingleton<IGenerateService, GenerateService>();
|
||||
|
||||
|
31
货架标准上位机/Converters/WorkItemBackgroundConverter.cs
Normal file
31
货架标准上位机/Converters/WorkItemBackgroundConverter.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
class WorkItemBackgroundConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value.ToString() == "True")
|
||||
{
|
||||
return Brushes.ForestGreen;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Brushes.White;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ namespace 货架标准上位机.ViewModel
|
||||
public WrapPanel wrapPanel;
|
||||
public async void AddUserControl()
|
||||
{
|
||||
var dia = Dialog.Show(new TextDialog());
|
||||
//var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
var body = new GetShelfStatusRequest()
|
||||
@ -75,7 +75,7 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
finally
|
||||
{
|
||||
dia.Close();
|
||||
//dia.Close();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -185,15 +185,16 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
var body = new QueryByMatSnRequest()
|
||||
{
|
||||
MatSn = scanner.TempCode,
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IpAddress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<QueryByMatSnResponse>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
scanner.MatSn = Result.Data.materialBar;
|
||||
scanner.MatSn = Result.Data.MatSN;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
278
货架标准上位机/ViewModels/MatInfoViewModel.cs
Normal file
278
货架标准上位机/ViewModels/MatInfoViewModel.cs
Normal file
@ -0,0 +1,278 @@
|
||||
using HandyControl.Controls;
|
||||
using MiniExcelLibs;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using SqlSugar;
|
||||
using HandyControl.Data;
|
||||
using System.Windows;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using 货架标准上位机.Views.Controls;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using 货架标准上位机.Api;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using System.Windows.Controls;
|
||||
using WCS.Model.ApiModel.InterfaceRecord;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using System.Collections.ObjectModel;
|
||||
using HandyControl.Tools.Extension;
|
||||
using 货架标准上位机.Tool;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
public class MatInfoViewModel : BindableBase
|
||||
{
|
||||
#region Property
|
||||
private ObservableCollection<MatInfoModel> dataGridItemSource;
|
||||
public ObservableCollection<MatInfoModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
public MatInfoModel selectedataGridItem;
|
||||
public MatInfoModel SelectedataGridItem
|
||||
{
|
||||
get { return selectedataGridItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedataGridItem, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
private string matCode;
|
||||
public string MatCode
|
||||
{
|
||||
get { return matCode; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matCode, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
private string matName;
|
||||
public string MatName
|
||||
{
|
||||
get { return matName; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matName, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料规格
|
||||
/// </summary>
|
||||
private string matSpec;
|
||||
public string MatSpec
|
||||
{
|
||||
get { return matSpec; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matSpec, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string matSN;
|
||||
public string MatSN
|
||||
{
|
||||
get { return matSN; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matSN, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
public ICommand BtnResetCommand { get => new DelegateCommand(BtnReset); }
|
||||
public void BtnReset()
|
||||
{
|
||||
MatCode = string.Empty;
|
||||
MatName = string.Empty;
|
||||
MatSpec = string.Empty;
|
||||
MatSN = string.Empty;
|
||||
}
|
||||
|
||||
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearchReset); }
|
||||
public void BtnSearchReset()
|
||||
{
|
||||
BtnSearch(true);
|
||||
}
|
||||
public void BtnSearch(bool IsPageReset = true)
|
||||
{
|
||||
if (CurrentPage == 0 || IsPageReset)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口获取数据
|
||||
//var dia = Dialog.Show(new TextDialog());
|
||||
try
|
||||
{
|
||||
var body = new GetMatInfoRequest()
|
||||
{
|
||||
MatCode = MatCode,
|
||||
MatName = MatName,
|
||||
MatSpec = MatSpec,
|
||||
MatSN = MatSN,
|
||||
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
PageNumber = CurrentPage,
|
||||
PageSize = 10,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<MatInfoModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/getMatInfo", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Lists != null)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<MatInfoModel>(Result.Data.Lists);
|
||||
MaxPage = Result.Data.MaxPage;
|
||||
TotalCount = Result.Data.TotalCount;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("加载数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//dia.Close();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 物料删除操作
|
||||
/// </summary>
|
||||
public ICommand BtnDeleteCommand { get => new DelegateCommand(BtnDelete); }
|
||||
public async void BtnDelete()
|
||||
{
|
||||
Growl.Ask($"是否删除所有勾选得数据]!", isConfirmed =>
|
||||
{
|
||||
if (isConfirmed)
|
||||
{
|
||||
//查询勾选的第一个数据
|
||||
var matBaseInfoIds = DataGridItemSource?.Where(t => t.IsSelected == true)
|
||||
.Select(t => t.Id)
|
||||
.ToList();
|
||||
|
||||
if (matBaseInfoIds == null)
|
||||
{
|
||||
Growl.Warning("请选择需要修改的数据!");
|
||||
}
|
||||
else
|
||||
{
|
||||
var body = new DeleteMatBaseInfosRequest()
|
||||
{
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
MatBaseInfoIds = matBaseInfoIds,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "matBaseInfo/deleteMatBaseInfo", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
CurrentPage = 1;
|
||||
Growl.Success("删除成功!" + Result?.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Error($"{Result?.Message?.ToString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
public ICommand BtnPrintCommand { get => new DelegateCommand(BtnPrint); }
|
||||
public async void BtnPrint()
|
||||
{
|
||||
var matBaseInfo = DataGridItemSource?.Where(t => t.IsSelected == true).ToList();
|
||||
//TO DO后台批量打印
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PageOperation 分页操作
|
||||
private int currentPage;
|
||||
public int CurrentPage
|
||||
{
|
||||
get { return currentPage; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref currentPage, value);
|
||||
BtnSearch(false);
|
||||
}
|
||||
}
|
||||
|
||||
private int maxPage;
|
||||
public int MaxPage
|
||||
{
|
||||
get { return maxPage; }
|
||||
set { SetProperty(ref maxPage, value); }
|
||||
}
|
||||
|
||||
//总数量
|
||||
private int totalCount;
|
||||
public int TotalCount
|
||||
{
|
||||
get { return totalCount; }
|
||||
set { SetProperty(ref totalCount, value); }
|
||||
}
|
||||
|
||||
public ICommand BtnFirstPageCommand { get => new DelegateCommand(BtnFirstPage); }
|
||||
public void BtnFirstPage()
|
||||
{
|
||||
CurrentPage = 1;
|
||||
}
|
||||
|
||||
public ICommand BtnPrePageCommand { get => new DelegateCommand(BtnPrePage); }
|
||||
public void BtnPrePage()
|
||||
{
|
||||
if (CurrentPage > 1)
|
||||
{
|
||||
CurrentPage--;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnNextPageCommand { get => new DelegateCommand(BtnNextPage); }
|
||||
public void BtnNextPage()
|
||||
{
|
||||
if (CurrentPage < MaxPage)
|
||||
{
|
||||
CurrentPage++;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand BtnLastPageCommand { get => new DelegateCommand(BtnLastPage); }
|
||||
public void BtnLastPage()
|
||||
{
|
||||
if (CurrentPage != MaxPage)
|
||||
{
|
||||
CurrentPage = MaxPage;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
66
货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs
Normal file
66
货架标准上位机/ViewModels/OutInventoryAddDucumentViewModel.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
|
||||
namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
public class OutInventoryAddDucumentViewModel : BindableBase
|
||||
{
|
||||
#region Property
|
||||
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
|
||||
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
/// <summary>
|
||||
/// 新增物料
|
||||
/// </summary>
|
||||
public ICommand BtnAddCommand { get => new DelegateCommand(BtnAdd); }
|
||||
public void BtnAdd()
|
||||
{
|
||||
var window = new OutInventoryAddMatView();
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
var result = window.ShowDialog();
|
||||
if (result == true)
|
||||
{
|
||||
if (DataGridItemSource == null)
|
||||
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>();
|
||||
DataGridItemSource.Add(window.inventorySummary);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand DelCommand { get => new DelegateCommand<MatInventorySummaryModel>(Del); }
|
||||
public void Del(MatInventorySummaryModel obj)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
DataGridItemSource.Remove(obj);
|
||||
;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
95
货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs
Normal file
95
货架标准上位机/ViewModels/OutInventoryAddMatViewModel.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using HandyControl.Controls;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using WCS.BLL.DbModels;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
using 货架标准上位机.Api;
|
||||
|
||||
namespace 货架标准上位机.ViewModels
|
||||
{
|
||||
public class OutInventoryAddMatViewModel : BindableBase
|
||||
{
|
||||
#region Property
|
||||
private ObservableCollection<MatInventorySummaryModel> dataGridItemSource;
|
||||
public ObservableCollection<MatInventorySummaryModel> DataGridItemSource
|
||||
{
|
||||
get { return dataGridItemSource; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref dataGridItemSource, value);
|
||||
}
|
||||
}
|
||||
|
||||
private MatInventorySummaryModel selectedataGridItem;
|
||||
public MatInventorySummaryModel SelectedataGridItem
|
||||
{
|
||||
get { return selectedataGridItem; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedataGridItem, 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);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
/// <summary>
|
||||
/// 搜索
|
||||
/// </summary>
|
||||
public ICommand BtnSearchCommand { get => new DelegateCommand(BtnSearch); }
|
||||
public void BtnSearch()
|
||||
{
|
||||
#region 调用接口获取数据
|
||||
try
|
||||
{
|
||||
var body = new GetMatInventorySummaryRequest()
|
||||
{
|
||||
MatName = MatName,
|
||||
MatCode = MatCode,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInventorySummaryModel>>>(LocalFile.Config.ApiIpHost + "matInventoryDetail/getMatInventorySummary", body, "POST");
|
||||
if (Result != null && Result.Data != null)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<MatInventorySummaryModel>(Result.Data);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("加载数据失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
379
货架标准上位机/ViewModels/OutInventoryViewModel.cs
Normal file
379
货架标准上位机/ViewModels/OutInventoryViewModel.cs
Normal file
@ -0,0 +1,379 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using MiniExcelLibs;
|
||||
using Ping9719.WpfEx.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using TouchSocket.Core;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
public class OutInventoryViewModel : BindableBase
|
||||
{
|
||||
public OutInventoryViewModel()
|
||||
{
|
||||
//线程 更新当前选择的订单的状态
|
||||
//Task.Run(() =>
|
||||
//{
|
||||
// while (true)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// Thread.Sleep(1000);
|
||||
// //if (LocalStatic.IsRefreshOrderDetail)
|
||||
// //{
|
||||
// // LocalStatic.IsRefreshOrderDetail = false;
|
||||
// // SelectedPickBillNumberChanged();
|
||||
// //}
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// //Logs.Write("更新订单状态异常!!");
|
||||
// }
|
||||
// }
|
||||
//});
|
||||
}
|
||||
|
||||
public System.Windows.Controls.TextBox textBox { get; set; }
|
||||
|
||||
#region Property
|
||||
private string number;
|
||||
public string Number
|
||||
{
|
||||
get { return number; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref number, value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool isOrderOut;
|
||||
public bool IsOrderOut
|
||||
{
|
||||
get { return isOrderOut; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref isOrderOut, value);
|
||||
//LocalStatic.IsOrderOut = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string matCode1;
|
||||
public string MatCode1
|
||||
{
|
||||
get { return matCode1; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matCode1, value);
|
||||
}
|
||||
}
|
||||
|
||||
private int matQty1;
|
||||
public int MatQty1
|
||||
{
|
||||
get { return matQty1; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref matQty1, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string order_prod_number;
|
||||
public string Order_prod_number
|
||||
{
|
||||
get { return order_prod_number; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref order_prod_number, value);
|
||||
}
|
||||
}
|
||||
|
||||
private string material_code;
|
||||
public string Material_code
|
||||
{
|
||||
get { return material_code; }
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private string orderStatus;
|
||||
public string OrderStatus
|
||||
{
|
||||
get { return orderStatus; }
|
||||
set
|
||||
{
|
||||
SetProperty(ref orderStatus, value);
|
||||
}
|
||||
}
|
||||
|
||||
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(() =>
|
||||
{
|
||||
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()
|
||||
{
|
||||
var window = new OutInventoryAddDucumentView();
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
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;
|
||||
}
|
||||
|
||||
public ICommand BtnPauseCommand { get => new DelegateCommand(BtnPause); }
|
||||
public void BtnPause()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region PageOperation
|
||||
private int totalPan;
|
||||
public int TotalPan
|
||||
{
|
||||
get { return totalPan; }
|
||||
set { SetProperty(ref totalPan, value); }
|
||||
}
|
||||
|
||||
private int sendedPan;
|
||||
public int SendedPan
|
||||
{
|
||||
get { return sendedPan; }
|
||||
set { SetProperty(ref sendedPan, value); }
|
||||
}
|
||||
|
||||
private int unSendedPan;
|
||||
public int UnSendedPan
|
||||
{
|
||||
get { return unSendedPan; }
|
||||
set { SetProperty(ref unSendedPan, value); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region private method
|
||||
public bool GrowlCallBack(bool aaa)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -110,7 +110,7 @@
|
||||
</StackPanel>
|
||||
</TabItem.Header>
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:MatBaseInfoView/>
|
||||
<View:OutVentoryView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
|
||||
|
@ -42,6 +42,8 @@ namespace 货架标准上位机
|
||||
MatBaseInfo = matBaseInfo,
|
||||
TotalCount = Convert.ToInt32(txtTotalCount.Text),
|
||||
MatQty = Convert.ToInt32(txtMatQty.Text),
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<MatInfoModel>>>(LocalFile.Config.ApiIpHost + "matBaseInfo/generateMatInfo", body, "POST");
|
||||
if (Result != null && Result.Data != null && Result.Data.Count > 0)
|
||||
|
@ -56,7 +56,7 @@
|
||||
Text="物料条码:" FontSize="18" ></TextBlock>
|
||||
<TextBox Grid.Column="7"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Stretch"
|
||||
FontSize="18" MinWidth="90" Text="{Binding MatSn}"></TextBox>
|
||||
FontSize="18" MinWidth="90" Text="{Binding MatSN}"></TextBox>
|
||||
|
||||
|
||||
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
|
||||
@ -82,13 +82,13 @@
|
||||
|
||||
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
<!--<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
Content="删 除" FontFamily="{StaticResource IconFont}"
|
||||
Foreground="WhiteSmoke"
|
||||
Command="{Binding BtnDeleteCommand}"
|
||||
Style="{StaticResource ButtonDanger}"
|
||||
>
|
||||
</Button>
|
||||
</Button>-->
|
||||
|
||||
|
||||
<Button MinHeight="40" FontSize="18" Margin="5"
|
||||
@ -124,12 +124,13 @@
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="序号" Binding="{Binding RowNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="单位" Binding="{Binding MatUnit}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料规格" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
|
||||
<DataGridTextColumn IsReadOnly="True" Header="客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="状态" Binding="{Binding IsEnableStr}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="供应商" Binding="{Binding MatSupplier}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料条码" Binding="{Binding MatSN}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="打印次数" Binding="{Binding PrintTimes}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="更新人" Binding="{Binding ModifyUser}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="更新时间" Binding="{Binding ModifyTime ,StringFormat='yyyy-MM-dd HH:mm:ss'}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
|
@ -18,7 +18,7 @@ namespace 货架标准上位机
|
||||
{
|
||||
public partial class MatInfoView : UserControlBase
|
||||
{
|
||||
public MatBaseInfoViewModel viewModel { get; set; } = new MatBaseInfoViewModel();
|
||||
public MatInfoViewModel viewModel { get; set; } = new MatInfoViewModel();
|
||||
public MatInfoView()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -49,18 +49,7 @@ namespace 货架标准上位机
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// if (viewModel.SelectedataGridItem != null)
|
||||
// {
|
||||
// viewModel.SelectedataGridItem.IsSelected = !viewModel.SelectedataGridItem.IsSelected;
|
||||
// }
|
||||
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
private void allChecked_Checked(object sender, RoutedEventArgs e)
|
||||
|
@ -27,15 +27,7 @@ namespace 货架标准上位机
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// DataGrid datagrid = sender as DataGrid;
|
||||
// datagrid.UnselectAllCells();
|
||||
//}
|
||||
//catch
|
||||
//{
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
private void LoadedVisible(object sender, EventArgs e)
|
||||
|
90
货架标准上位机/Views/OutInventoryAddDucumentView.xaml
Normal file
90
货架标准上位机/Views/OutInventoryAddDucumentView.xaml
Normal file
@ -0,0 +1,90 @@
|
||||
<hc:Window x:Class="货架标准上位机.OutInventoryAddDucumentView"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Height="500" Width="850" WindowStyle="None" Background="{x:Null}" BorderThickness="0" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||
<hc:Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||
<Setter Property="Padding" Value="25,0"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:Window.Resources>
|
||||
|
||||
<Border Background="AliceBlue" CornerRadius="10" BorderThickness="1.5" BorderBrush="Black" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
<RowDefinition Height="10*"></RowDefinition>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<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 Orientation="Vertical">
|
||||
<TextBlock FontSize="25" Name="Title" Text="新增出库单据" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Center"/>
|
||||
<hc:Divider Margin="0"></hc:Divider>
|
||||
</StackPanel>
|
||||
|
||||
<Border Grid.Row="1" Margin="2 2 2 0" Background="AliceBlue" Padding="0">
|
||||
<Border Background="AliceBlue" Padding="0">
|
||||
<Grid >
|
||||
<StackPanel Margin="3" Orientation="Horizontal">
|
||||
<Button MinHeight="40" FontSize="18"
|
||||
Content="增加物料" FontFamily="{StaticResource IconFont}"
|
||||
Foreground="WhiteSmoke"
|
||||
Background="HotPink"
|
||||
Command="{Binding BtnAddCommand}">
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<Grid Margin="5,0" Grid.Row="2" >
|
||||
<DataGrid Grid.Row="1" SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
RowHeight="39" ItemsSource="{Binding DataGridItemSource}"
|
||||
AutoGenerateColumns="False" Name="dg1" FontSize="15">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" MaxWidth="150" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料规格" MaxWidth="150" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="库存数量" Binding="{Binding TotalQty}"></DataGridTextColumn>
|
||||
<DataGridTemplateColumn CanUserResize="False" Header="需求数量">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBox Width="80" Height="25" Text="{Binding NeedQty}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn CanUserResize="False" Header="">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Button Style="{StaticResource ButtonDanger}" Margin="0,0,0,0" IsEnabled="True" Content="删除" Width="60" Command="{Binding DataContext.DelCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}" CommandParameter="{Binding }"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="3" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock FontSize="20" Text="已选物料:"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="{Binding SelectedTypeCount}"></TextBlock>
|
||||
<TextBlock FontSize="20" Text="种"></TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="3" x:Name="spacingPanel" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Margin="0" Content="生成出库单" Background="ForestGreen" Foreground="White" MinHeight="40" FontSize="20" Click="comfirmClick"/>
|
||||
<TextBlock Margin="20" Text=""></TextBlock>
|
||||
<Button Margin="0" Content="取消" Background="IndianRed" Foreground="White" MinHeight="40" FontSize="20" Click="closeClick"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Window>
|
97
货架标准上位机/Views/OutInventoryAddDucumentView.xaml.cs
Normal file
97
货架标准上位机/Views/OutInventoryAddDucumentView.xaml.cs
Normal file
@ -0,0 +1,97 @@
|
||||
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using 货架标准上位机.ViewModels;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public partial class OutInventoryAddDucumentView : HandyControl.Controls.Window
|
||||
{
|
||||
public OutInventoryAddDucumentViewModel viewModel = new OutInventoryAddDucumentViewModel();
|
||||
public OutInventoryAddDucumentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
DataGrid datagrid = sender as DataGrid;
|
||||
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();
|
||||
}
|
||||
|
||||
private void txtMatQty1_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
if (!Regex.IsMatch(e.Text, "^[0-9]"))
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
//public List<InventoryDetail> DataGridItemSource = new List<InventoryDetail>();
|
||||
|
||||
private void comfirmClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = true;
|
||||
//if (viewModel.DataGridItemSource != null)
|
||||
// DataGridItemSource = viewModel.DataGridItemSource.Where(t => t.IsSelected).ToList();
|
||||
this.Close();
|
||||
}
|
||||
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//viewModel.RefreshCount();
|
||||
}
|
||||
private void allChecked_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//if (viewModel != null && viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > 0)
|
||||
//{
|
||||
// foreach (var item in viewModel.DataGridItemSource)
|
||||
// {
|
||||
// item.IsSelected = true;
|
||||
// }
|
||||
// viewModel.DataGridItemSource = viewModel.DataGridItemSource.ToList();
|
||||
//}
|
||||
}
|
||||
|
||||
private void allChecked_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//var viewMode = this.DataContext as OutInventoryDocumentDetailViewModel;
|
||||
//if (viewMode != null && viewMode.DataGridItemSource != null && viewMode.DataGridItemSource.Count() > 0)
|
||||
//{
|
||||
// foreach (var item in viewMode.DataGridItemSource)
|
||||
// {
|
||||
// item.IsSelected = false;
|
||||
// }
|
||||
// viewMode.DataGridItemSource = viewMode.DataGridItemSource.ToList();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
102
货架标准上位机/Views/OutInventoryAddMatView.xaml
Normal file
102
货架标准上位机/Views/OutInventoryAddMatView.xaml
Normal file
@ -0,0 +1,102 @@
|
||||
<hc:Window x:Class="货架标准上位机.OutInventoryAddMatView"
|
||||
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:local="clr-namespace:货架标准上位机"
|
||||
mc:Ignorable="d"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
Height="500" Width="900" WindowStyle="None" BorderThickness="0" Background="{x:Null}" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Opacity="1">
|
||||
<hc:Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource ButtonDefault}">
|
||||
<Setter Property="Padding" Value="25,0"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:Window.Resources>
|
||||
|
||||
<Border BorderThickness="1.5" BorderBrush="Black" Background="AliceBlue" CornerRadius="10" >
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="1.2*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
<RowDefinition Height="9*"></RowDefinition>
|
||||
<RowDefinition Height="1.5*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<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 Orientation="Vertical">
|
||||
<TextBlock Margin="2" FontSize="25" Name="Title" Text="选择物料(双击选中)" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<hc:Divider Margin="0"/>
|
||||
</StackPanel>
|
||||
<Border Grid.Row="1" Margin="2 2 2 0" Background="LightGray" Padding="0">
|
||||
<Border Background="AliceBlue" Padding="0">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Margin="2" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Center" Text="物料编码:">
|
||||
</TextBlock>
|
||||
<TextBox MinWidth="120" Grid.Column="1" MaxWidth="120" Text="{Binding MatCode}" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" ></TextBox>
|
||||
<TextBlock Grid.Column="2" Margin="10 2 2 2" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Center" Text="物料名称:">
|
||||
</TextBlock>
|
||||
<TextBox Grid.Column="3" MinWidth="120" MaxWidth="120" Text="{Binding MatName}" Name="txtMatQty1" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Black" >
|
||||
</TextBox>
|
||||
|
||||
<Button Grid.Column="4" Style="{StaticResource ButtonSuccess}"
|
||||
Command="{Binding BtnSearchCommand}"
|
||||
hc:BorderElement.CornerRadius="10"
|
||||
MinHeight="35" FontSize="20" Content=" 搜索" FontFamily="{StaticResource IconFont}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
|
||||
<Grid Margin="5,0" Grid.Row="2" >
|
||||
<DataGrid Grid.Row="1"
|
||||
Name="dataGrid"
|
||||
SelectionChanged="DataGrid_SelectionChanged"
|
||||
MouseDoubleClick="dataGrid_MouseDoubleClick"
|
||||
RowHeight="39"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
SelectedItem="{Binding SelectedataGridItem}"
|
||||
AutoGenerateColumns="False" FontSize="14">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn CanUserResize="False">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<RadioButton Width="30" Height="30"
|
||||
GroupName="111222333"
|
||||
IsChecked="{Binding IsSelected , UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料编码" Binding="{Binding MatCode}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料名称" MaxWidth="200" Binding="{Binding MatName}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="库存数量" Binding="{Binding TotalQty}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料规格" MaxWidth="200" Binding="{Binding MatSpec}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料批次" Binding="{Binding MatBatch}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料客户" Binding="{Binding MatCustomer}"></DataGridTextColumn>
|
||||
<DataGridTextColumn IsReadOnly="True" Header="物料供应商" Binding="{Binding MatSupplier}"></DataGridTextColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Margin="3" x:Name="spacingPanel" Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Button Margin="0 0 10 0 " Content="选择" Background="ForestGreen" Foreground="White" MinHeight="40" FontSize="21" Click="comfirmClick">
|
||||
</Button>
|
||||
<Button Margin="10 0 0 0 " Content="取消" Background="IndianRed" Foreground="White" MinHeight="40" FontSize="21" Click="closeClick"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:Window>
|
81
货架标准上位机/Views/OutInventoryAddMatView.xaml.cs
Normal file
81
货架标准上位机/Views/OutInventoryAddMatView.xaml.cs
Normal file
@ -0,0 +1,81 @@
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using TouchSocket.Core;
|
||||
using WCS.Model.ApiModel.MatInventoryDetail;
|
||||
using 货架标准上位机.ViewModels;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public partial class OutInventoryAddMatView : HandyControl.Controls.Window
|
||||
{
|
||||
public OutInventoryAddMatViewModel viewModel = new OutInventoryAddMatViewModel();
|
||||
|
||||
public MatInventorySummaryModel inventorySummary = null;
|
||||
|
||||
public OutInventoryAddMatView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void closeClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.DialogResult = false;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void comfirmClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//
|
||||
var item = viewModel.DataGridItemSource.Where(t => t.isSelected).FirstOrDefault();
|
||||
if (item == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("请选择物料!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//选中物料返回
|
||||
inventorySummary = item;
|
||||
this.DialogResult = true;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (viewModel.SelectedataGridItem != null)
|
||||
{
|
||||
viewModel.SelectedataGridItem.IsSelected = true;
|
||||
//dataGrid.UnselectAllCells();//取消选中 避免手动点击check选项时反选失败 和重新点击该项时反选失败
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
comfirmClick(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
200
货架标准上位机/Views/OutInventoryView.xaml
Normal file
200
货架标准上位机/Views/OutInventoryView.xaml
Normal file
@ -0,0 +1,200 @@
|
||||
<pi:UserControlBase
|
||||
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||
x:Class="货架标准上位机.OutVentoryView"
|
||||
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"
|
||||
xmlns:货架标准上位机="clr-namespace:货架标准上位机"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="737" d:DesignWidth="1192">
|
||||
<Border Margin="0" Background="LightGray" CornerRadius="3" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.9*"></RowDefinition>
|
||||
<RowDefinition Height="0.9*"></RowDefinition>
|
||||
<RowDefinition Height="9*"></RowDefinition>
|
||||
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Grid.Row="0" Margin="0" Background="AliceBlue" Padding="0">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
<ColumnDefinition></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Button Style="{StaticResource ButtonSuccess}" hc:BorderElement.CornerRadius="15"
|
||||
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}"
|
||||
Command="{Binding BtnPauseCommand}">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Margin="0" Background="LightGray" Padding="0">
|
||||
<Border Margin="1" CornerRadius="3" Background="AliceBlue" Padding="0">
|
||||
<Grid >
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button
|
||||
hc:BorderElement.CornerRadius="15"
|
||||
Background="Green" Foreground="White"
|
||||
Grid.Column="1" MinHeight="45" FontSize="28" Content=" 发 料 单" FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnOutOrderCommand}">
|
||||
</Button>
|
||||
<StackPanel Grid.Column="2" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<TextBlock FontSize="26" Text="发料单号:">
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="26" Text="{Binding SelectedPickBillNumber}">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--</TabItem>-->
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="2" Margin="0" Background="AliceBlue" Padding="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="8*"></RowDefinition>
|
||||
<RowDefinition Height="0.8*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="6*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<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>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<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="12*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" >
|
||||
<TextBlock Text="订单号:" FontSize="24">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding OrderProdNumber}" FontSize="24">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid Grid.Row="2"
|
||||
SelectedCellsChanged="DataGrid_SelectedCellsChanged"
|
||||
ItemsSource="{Binding DataGridItemSource}"
|
||||
RowHeight="40"
|
||||
AutoGenerateColumns="False" FontSize="15">
|
||||
<DataGrid.Resources>
|
||||
<货架标准上位机:WorkItemBackgroundConverter x:Key="converter"/>
|
||||
</DataGrid.Resources>
|
||||
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="{Binding Path=IsSend, 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 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>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Grid Grid.Row="2" Grid.ColumnSpan="2">
|
||||
<Border CornerRadius="3" Background="Transparent" VerticalAlignment="Center" >
|
||||
<Grid HorizontalAlignment="Stretch" Margin="5 0 1 0" VerticalAlignment="Top" Width="Auto" Height="40">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="5*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
|
||||
<TextBlock Text=" 当前状态:" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding OrderStatus,FallbackValue=未发料或未发完}" Foreground="red" FontSize="22">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="2">
|
||||
<TextBlock Text="总盘数:" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding TotalPan}" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text=" 取料进度:" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding SendedPan}" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text="/" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding TotalPan}" VerticalAlignment="Bottom" FontSize="22">
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</pi:UserControlBase>
|
108
货架标准上位机/Views/OutInventoryView.xaml.cs
Normal file
108
货架标准上位机/Views/OutInventoryView.xaml.cs
Normal file
@ -0,0 +1,108 @@
|
||||
using Ping9719.WpfEx;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Text.RegularExpressions;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
public partial class OutVentoryView : UserControlBase
|
||||
{
|
||||
public OutVentoryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = new OutInventoryViewModel();
|
||||
}
|
||||
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var viewModel = this.DataContext as InInventoryViewModel;
|
||||
DataGrid datagrid = sender as DataGrid;
|
||||
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();
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// ListView拦截鼠标滚轮事件
|
||||
e.Handled = true;
|
||||
|
||||
// 激发一个鼠标滚轮事件,冒泡给外层ListView接收到
|
||||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
||||
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
eventArg.Source = sender;
|
||||
var parent = ((Control)sender).Parent as UIElement;
|
||||
parent.RaiseEvent(eventArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user