提交代码
This commit is contained in:
@ -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