提交代码
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}",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -122,6 +122,32 @@ 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)}已开始自检!",
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user