diff --git a/src/WMS.Web.Api/Controllers/InStockTaskController.cs b/src/WMS.Web.Api/Controllers/InStockTaskController.cs
index 4e3bf6d5..5c23c39c 100644
--- a/src/WMS.Web.Api/Controllers/InStockTaskController.cs
+++ b/src/WMS.Web.Api/Controllers/InStockTaskController.cs
@@ -135,7 +135,7 @@ namespace WMS.Web.Api.Controllers
}
///
- /// 来源单-编号模糊查询-pad
+ /// 来源单-编号模糊查询-采购上架使用-pad
///
/// 来源单号
///
@@ -147,7 +147,24 @@ namespace WMS.Web.Api.Controllers
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultList.ReFailure(ResultCodes.Token_Invalid_Error);
- var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo, InstockType = null });
+ var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo});
+ return ResultList.ReSuccess(list);
+ }
+
+ ///
+ /// 来源单-编号模糊查询-采购上架使用-pad
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("GetSourceOrder")]
+ public async Task> GetSourceOrderBy([FromBody] InStockTaskBillNoQueryRequest dto)
+ {
+ var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
+ if (loginInfo == null || loginInfo.UserInfo == null)
+ return ResultList.ReFailure(ResultCodes.Token_Invalid_Error);
+
+ var list = await _inStockTaskRepositories.GetListBy(dto);
return ResultList.ReSuccess(list);
}
@@ -164,12 +181,29 @@ namespace WMS.Web.Api.Controllers
if (loginInfo == null || loginInfo.UserInfo == null)
return ResultList.ReFailure(ResultCodes.Token_Invalid_Error);
- var list = await _inStockTaskRepositories.GetListInfoBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo, InstockType = null });
+ var list = await _inStockTaskRepositories.GetListInfoBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo });
return ResultList.ReSuccess(list);
}
///
- /// 来源单的信息校准-对应金蝶-pad
+ ///
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Route("GetSourceOrderNoPurchase")]
+ public async Task> GetSourceOrderNoPurchaseBy([FromBody] InStockTaskBillNoQueryRequest dto)
+ {
+ var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
+ if (loginInfo == null || loginInfo.UserInfo == null)
+ return ResultList.ReFailure(ResultCodes.Token_Invalid_Error);
+
+ var list = await _inStockTaskRepositories.GetListInfoBy(dto);
+ return ResultList.ReSuccess(list);
+ }
+
+ ///
+ /// 来源单的信息校准-采购上架使用-对应金蝶-pad
///
///
///
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
index 63998b45..41e3cef5 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml
@@ -177,11 +177,18 @@
- 来源单-编号模糊查询-pad
+ 来源单-编号模糊查询-采购上架使用-pad
来源单号
+
+
+ 来源单-编号模糊查询-采购上架使用-pad
+
+
+
+
来源单-编号模糊查询-非采购上架使用-pad
@@ -189,9 +196,16 @@
+
+
+
+
+
+
+
- 来源单的信息校准-对应金蝶-pad
+ 来源单的信息校准-采购上架使用-对应金蝶-pad
diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
index e1c93222..a16d9279 100644
--- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
+++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml
@@ -1270,9 +1270,9 @@
来源单据编号
-
+
- 来源单据类型
+ 仓库编码
diff --git a/src/WMS.Web.Core/Dto/InStockTask/InStockTaskBillNoQueryRequest.cs b/src/WMS.Web.Core/Dto/InStockTask/InStockTaskBillNoQueryRequest.cs
index 6720ddb8..6502f0a7 100644
--- a/src/WMS.Web.Core/Dto/InStockTask/InStockTaskBillNoQueryRequest.cs
+++ b/src/WMS.Web.Core/Dto/InStockTask/InStockTaskBillNoQueryRequest.cs
@@ -15,8 +15,8 @@ namespace WMS.Web.Core.Dto.InStockTask
public string SourceBillNo { get; set; }
///
- /// 来源单据类型
+ /// 仓库编码
///
- public int? InstockType { get; set; }
+ public string StockCode { get; set; }
}
}
diff --git a/src/WMS.Web.Domain/Services/InStockService.cs b/src/WMS.Web.Domain/Services/InStockService.cs
index 06bd8d00..6c6d3c20 100644
--- a/src/WMS.Web.Domain/Services/InStockService.cs
+++ b/src/WMS.Web.Domain/Services/InStockService.cs
@@ -448,7 +448,7 @@ namespace WMS.Web.Domain.Services
var boxDetails = boxs.SelectMany(x => x.Details).GroupBy(x => x.MaterialId).Select(x => new { MaterialId = x.Key, Qty = x.Sum(t => t.Qty) }).ToList();
//3.比对:false为比对失败;
- bool isRight = boxDetails.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count == task.Details.Count;
+ bool isRight = boxDetails.All(x => task.Details.Any(t => t.MaterialId == x.MaterialId && t.AccruedQty >= x.Qty)) && boxDetails.Count <= task.Details.Count;
if (!isRight)
return Result.ReFailure(ResultCodes.ContrastError);
diff --git a/src/WMS.Web.Repositories/InStockTaskRepositories.cs b/src/WMS.Web.Repositories/InStockTaskRepositories.cs
index 93eb3f61..a09bebf5 100644
--- a/src/WMS.Web.Repositories/InStockTaskRepositories.cs
+++ b/src/WMS.Web.Repositories/InStockTaskRepositories.cs
@@ -83,7 +83,7 @@ namespace WMS.Web.Repositories
var query = _context.InStockTaskDetails
.GroupJoin(_context.InStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
- .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
+ .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.Where(adv => 1 == 1);
if (!string.IsNullOrEmpty(dto.SourceBillNo))
@@ -95,7 +95,7 @@ namespace WMS.Web.Repositories
var mids = materials.Select(x => x.MaterialId).ToList();
query = query.Where(w => mids.Contains(w.detail.MaterialId));
}
-
+
if (dto.SupplierId.HasValue)
query = query.Where(w => w.detail.SupplierId == dto.SupplierId.Value);
@@ -117,9 +117,9 @@ namespace WMS.Web.Repositories
if (dto.CreateEndDate != null)
query = query.Where(w => w.order.ShelfTime <= dto.CreateEndDate.Value);
-
- int total = await query.CountAsync();
- var list =await query.Select(s => new InStockTaskQueryResponse()
+
+ int total = await query.CountAsync();
+ var list = await query.Select(s => new InStockTaskQueryResponse()
{
Id = s.order.Id,
DetailsId = s.detail.Id,
@@ -128,23 +128,23 @@ namespace WMS.Web.Repositories
Status = s.order.Status.GetRemark(),
SourceBillNo = s.order.SourceBillNo,
Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, s.detail.SupplierId),
- Org = _erpBasicDataExtendService.GetOrgName(orgs,s.detail.OrgId),
- MaterialName = _erpBasicDataExtendService.GetMaterialName(materials,s.detail.MaterialId),
+ Org = _erpBasicDataExtendService.GetOrgName(orgs, s.detail.OrgId),
+ MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
- Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
+ Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
FactoryPrice = s.detail.FactoryPrice,
- Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode+s.detail.OrgCode),
+ Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode + s.detail.OrgCode),
AccruedQty = s.detail.AccruedQty,
ReceiveQty = s.detail.ReceiveQty,
RealityQty = s.detail.RealityQty,
- Receiver = s.order.ReceiverId.HasValue? _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.ReceiverId.Value):"",
+ Receiver = s.order.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.ReceiverId.Value) : "",
ReceiveTime = s.order.ReceiveTime.HasValue ? s.order.ReceiveTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
Shelfer = s.order.ShelferId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.ShelferId.Value) : "",
ShelfTime = s.order.ShelfTime.HasValue ? s.order.ShelfTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
-
- return (list,total);
+
+ return (list, total);
}
///
@@ -154,8 +154,8 @@ namespace WMS.Web.Repositories
///
public async Task Get(int id)
{
- var entity =await _context.InStockTask
- .Include(x=>x.Boxs)
+ var entity = await _context.InStockTask
+ .Include(x => x.Boxs)
.Include(s => s.Details)
.FirstOrDefaultAsync(f => f.Id == id);
return entity;
@@ -168,7 +168,7 @@ namespace WMS.Web.Repositories
///
public async Task GetBy(string boxBillNo)
{
- var entity= await _context.InStockTask
+ var entity = await _context.InStockTask
.Include(s => s.Boxs.Where(b => b.BoxBillNo == boxBillNo))
.Include(s => s.Details)
.Where(w => w.Boxs.Where(b => b.BoxBillNo == boxBillNo).Count() > 0).FirstOrDefaultAsync();
@@ -187,7 +187,7 @@ namespace WMS.Web.Repositories
var entity = await _context.InStockTask
.Include(s => s.Boxs)
.Include(s => s.Details)
- .Where(w => w.SourceBillNo==sourceBillNo).FirstOrDefaultAsync();
+ .Where(w => w.SourceBillNo == sourceBillNo).FirstOrDefaultAsync();
return entity;
@@ -214,7 +214,7 @@ namespace WMS.Web.Repositories
///
public async Task> GetList(List ids)
{
- var entitys= await _context.InStockTask
+ var entitys = await _context.InStockTask
.Include(s => s.Details)
.Where(f => ids.Contains(f.Id))
.ToListAsync();
@@ -228,7 +228,7 @@ namespace WMS.Web.Repositories
///
public async Task> GetListBy(List sourceBillNos)
{
- var entitys= await _context.InStockTask
+ var entitys = await _context.InStockTask
.Include(s => s.Details)
.Where(w => sourceBillNos.Contains(w.SourceBillNo))
.ToListAsync();
@@ -252,7 +252,7 @@ namespace WMS.Web.Repositories
}
///
- /// 列表-根据来源单号模糊
+ /// 列表-根据来源单号模糊-采购上架使用
///
///
///
@@ -268,28 +268,29 @@ namespace WMS.Web.Repositories
var query = _context.InStockTaskDetails
.GroupJoin(_context.InStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
- .Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.order.Status== InstockStatus.Part || w.order.Status==InstockStatus.Wait));
+ .Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait));
- if(dto.InstockType.HasValue)
- query = query.Where(w => (int)w.order.Type == dto.InstockType.Value);
+ //仓库
+ if (!string.IsNullOrEmpty(dto.StockCode))
+ query = query.Where(x => x.detail.StockCode == dto.StockCode);
var list = await query.Select(s => new SourceBillNoQueryResponse()
{
- Id=s.order.Id,
- DetailsId=s.detail.Id,
- SupplierId=s.detail.SupplierId,
- OrgId=s.detail.OrgId,
- SourceBillNo=s.order.SourceBillNo,
- MaterialId=s.detail.MaterialId,
- StockCode=s.detail.StockCode,
- StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode+s.detail.OrgCode),
+ Id = s.order.Id,
+ DetailsId = s.detail.Id,
+ SupplierId = s.detail.SupplierId,
+ OrgId = s.detail.OrgId,
+ SourceBillNo = s.order.SourceBillNo,
+ MaterialId = s.detail.MaterialId,
+ StockCode = s.detail.StockCode,
+ StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode + s.detail.OrgCode),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
- Qty =s.detail.AccruedQty,
- DeliveredQty=s.detail.DeliveredQty,
- ReceiveQty=s.detail.ReceiveQty,
- AvailableQty =s.detail.AccruedQty- s.detail.ReceiveQty- s.detail.DeliveredQty,
+ Qty = s.detail.AccruedQty,
+ DeliveredQty = s.detail.DeliveredQty,
+ ReceiveQty = s.detail.ReceiveQty,
+ AvailableQty = s.detail.AccruedQty - s.detail.ReceiveQty - s.detail.DeliveredQty,
Remark = s.detail.Remark
}).ToListAsync();
return list;
@@ -311,47 +312,50 @@ namespace WMS.Web.Repositories
materials = materials_result.Data.ToList();
//这里只查状态为:部分入库和等待收货
- var task_query = _context.InStockTask
+ var task_query = _context.InStockTask
.Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait));
- if (dto.InstockType.HasValue)
- task_query = task_query.Where(w => (int)w.Type == dto.InstockType.Value);
//找到头列表
var taskList = await task_query
- .Select(x=>new SourceBillNoNoPurchaseQueryResponse()
+ .Select(x => new SourceBillNoNoPurchaseQueryResponse()
{
- Id=x.Id,
- SourceBillNo=x.SourceBillNo
+ Id = x.Id,
+ SourceBillNo = x.SourceBillNo
}).ToListAsync();
- if (taskList != null && taskList.Count != 0)
+ if (taskList != null && taskList.Count != 0)
{
var ids = taskList.Select(x => x.Id).ToList();
//找明细
- var task_details = await _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid))
- .Select(s=>new SourceBillNoNoPurchaseDetailsQueryResponse()
- {
- TaskId=s.Fid,
- DetailsId=s.Id,
- SupplierId = s.SupplierId,
- OrgId = s.OrgId,
- MaterialId = s.MaterialId,
- StockCode = s.StockCode,
- StockName = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode),
- MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId),
- MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId),
- Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId),
- Qty = s.AccruedQty,
- DeliveredQty = s.DeliveredQty,
- Remark = s.Remark
- }).ToListAsync();
+ var query = _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid));
+
+ //仓库
+ if (!string.IsNullOrEmpty(dto.StockCode))
+ query = query.Where(x => x.StockCode == dto.StockCode);
+
+ var task_details = await query.Select(s => new SourceBillNoNoPurchaseDetailsQueryResponse()
+ {
+ TaskId = s.Fid,
+ DetailsId = s.Id,
+ SupplierId = s.SupplierId,
+ OrgId = s.OrgId,
+ MaterialId = s.MaterialId,
+ StockCode = s.StockCode,
+ StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.StockCode+s.OrgCode),
+ MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId),
+ MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId),
+ Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId),
+ Qty = s.AccruedQty,
+ DeliveredQty = s.DeliveredQty,
+ Remark = s.Remark
+ }).ToListAsync();
//找箱
var task_box = await _context.InstockTaskBox.Where(x => ids.Contains(x.TaskId))
.Select(s => new SourceBillNoNoPurchaseBoxQueryResponse()
{
Id = s.Id,
- TaskId=s.TaskId,
+ TaskId = s.TaskId,
BoxId = s.BoxId,
- BoxBillNo = s.BoxBillNo
+ BoxBillNo = s.BoxBillNo
}).ToListAsync();
//对应头赋值:明细和箱
foreach (var item in taskList)
@@ -359,7 +363,7 @@ namespace WMS.Web.Repositories
item.Details = task_details.Where(x => x.TaskId == item.Id).ToList();
item.Boxs = task_box.Where(x => x.TaskId == item.Id).ToList();
}
- }
+ }
return taskList;
}
@@ -445,7 +449,7 @@ namespace WMS.Web.Repositories
try
{
List list = entitys.Select(s => s.Id).ToList();
- var res = await _context.InStockTask.AsNoTracking().Include(x=>x.Boxs).Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
+ var res = await _context.InStockTask.AsNoTracking().Include(x => x.Boxs).Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
_mapper.ToMapList(entitys, res);
await _context.SaveChangesAsync();
if (_transaction != null)
@@ -475,7 +479,7 @@ namespace WMS.Web.Repositories
{
var model = await _context.InStockTask
.AsNoTracking()
- .Include(s=>s.Boxs)
+ .Include(s => s.Boxs)
.Include(s => s.Details)
.FirstOrDefaultAsync(f => f.Id == entity.Id);
if (model == null)