生产汇报单pda
This commit is contained in:
@@ -189,8 +189,13 @@ namespace WMS.Web.Api.Controllers
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return ResultList<SourceBillNoQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
////将传过来的sourceBillNo进行分割
|
||||
//string[] s=sourceBillNo.Split('&');
|
||||
//sourceBillNo=s[0];
|
||||
//string type=s[1];
|
||||
|
||||
var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo});
|
||||
|
||||
var list = await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo});
|
||||
|
||||
//获取物料对应的仓位
|
||||
var materialNumbers = list.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
|
||||
|
||||
@@ -339,16 +339,34 @@ namespace WMS.Web.Repositories
|
||||
if (materials_result.IsSuccess)
|
||||
materials = materials_result.Data.ToList();
|
||||
|
||||
string[] s = dto.SourceBillNo.Split('&');
|
||||
string sourceBillNo = s[0];
|
||||
string type = s[1];
|
||||
InstockType t = InstockType.Purchase;
|
||||
if(type=="6")
|
||||
{
|
||||
t = InstockType.ProduceSotck;
|
||||
}
|
||||
else
|
||||
{
|
||||
t = InstockType.Purchase;
|
||||
}
|
||||
|
||||
//这里只查状态为:部分入库和等待收货
|
||||
|
||||
|
||||
|
||||
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.Type == InstockType.Purchase
|
||||
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + sourceBillNo + "%")
|
||||
&& w.order.Type == t
|
||||
&& (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status == InstockStatus.WaitInStock)
|
||||
&& w.detail.AccruedQty > 0
|
||||
&& w.detail.IsRepeal != true);
|
||||
|
||||
|
||||
|
||||
//仓库
|
||||
if (!string.IsNullOrEmpty(dto.StockCode))
|
||||
query = query.Where(x => x.detail.StockCode == dto.StockCode);
|
||||
@@ -398,6 +416,83 @@ namespace WMS.Web.Repositories
|
||||
|
||||
}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 列表-根据来源单号模糊-采购上架使用
|
||||
///// </summary>
|
||||
///// <param name="sourceBillNo"></param>
|
||||
///// <returns></returns>
|
||||
//public async Task<List<SourceBillNoQueryResponse>> GetListBy(InStockTaskBillNoQueryRequest dto)
|
||||
//{
|
||||
// //1.获取物料集合
|
||||
// var materials_result = await _erpService.BillQueryForMaterial();
|
||||
// var materials = new List<ErpMaterialDto>();
|
||||
// if (materials_result.IsSuccess)
|
||||
// materials = materials_result.Data.ToList();
|
||||
|
||||
// string[] s = dto.SourceBillNo.Split('&');
|
||||
// string sourceBillNo = s[0];
|
||||
// string type = s[1];
|
||||
|
||||
// //这里只查状态为:部分入库和等待收货
|
||||
// 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.Type == InstockType.Purchase
|
||||
// && (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status == InstockStatus.WaitInStock)
|
||||
// && w.detail.AccruedQty > 0
|
||||
// && w.detail.IsRepeal != true);
|
||||
|
||||
// //仓库
|
||||
// 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,
|
||||
// CustomerCode = s.detail.CustomerCode,
|
||||
// SupplierId = s.detail.SupplierId,
|
||||
// OrgId = s.detail.OrgId,
|
||||
// OrgCode = s.detail.OrgCode,
|
||||
// SourceBillNo = s.order.SourceBillNo,
|
||||
// StockCode = s.detail.StockCode,
|
||||
// StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode + s.detail.OrgCode),
|
||||
// MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialNumber),
|
||||
// MaterialNumber = s.detail.MaterialNumber,
|
||||
// Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialNumber),
|
||||
// Qty = s.detail.AccruedQty,
|
||||
// DeliveredQty = s.detail.DeliveredQty,
|
||||
// ReceiveQty = s.detail.ReceiveQty,
|
||||
// //采购:可入库数量=应入库数量-收货数量-已交数量+该明细的入库数量之和;
|
||||
// AvailableQty = s.detail.AccruedQty - s.detail.ReceiveQty - (s.detail.DeliveredQty > s.detail.RealityQty ? s.detail.DeliveredQty : s.detail.RealityQty),
|
||||
// WaitSlefQty = s.detail.ReceiveQty - s.detail.RealityQty,
|
||||
// Remark = s.detail.Remark,
|
||||
// ErpDetailId = s.detail.ErpDetailId
|
||||
// }).ToListAsync();
|
||||
|
||||
|
||||
// //找到入库单:通过erp明细ID
|
||||
// var erpDetIds = list.GroupBy(x => x.ErpDetailId).Select(x => x.Key).ToList();
|
||||
// var instockDets = await _context.InStockDetails.Where(x => erpDetIds.Contains(x.ErpDetailId)).ToListAsync();
|
||||
// if (instockDets != null && instockDets.Count != 0)
|
||||
// {
|
||||
// list.ForEach(x =>
|
||||
// {
|
||||
// var current_instock_dets = instockDets.Where(t => t.ErpDetailId == x.ErpDetailId && t.MaterialNumber == x.MaterialNumber && t.Qty != 0).ToList();
|
||||
// if (current_instock_dets != null && current_instock_dets.Count != 0 && x.ErpDetailId == current_instock_dets.FirstOrDefault().ErpDetailId)
|
||||
// {
|
||||
// //+该明细的入库数量之和;在这里处理
|
||||
// var instock_qty = current_instock_dets.Sum(s => s.Qty);
|
||||
// x.AvailableQty = x.AvailableQty + instock_qty;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// return list;
|
||||
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 列表-根据来源单模糊查询-非采购上架使用
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user