Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -263,6 +263,23 @@ namespace WMS.Web.Api.Controllers
|
||||
var r = await _basicsRepositories.GetSubUcStockAsync(ManagementSystemCode.GLXT0004.ToString(), name, loginInfo.UserInfo.CompanyId);
|
||||
return Result<List<UcSubStockResponse>>.ReSuccess(r);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取仓位:精确名字
|
||||
/// </summary>
|
||||
/// <param name="name">精确名字</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetSubUcStockPrecisionByName/{name}")]
|
||||
public async Task<Result<UcSubStockResponse>> GetSubUcStockPrecisionByName([FromRoute] string name)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result<UcSubStockResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
var r = await _basicsRepositories.GetSubUcStockAsync(ManagementSystemCode.GLXT0004.ToString(), name, loginInfo.UserInfo.CompanyId);
|
||||
var subStock = r.FirstOrDefault(f => f.Name.Equals(name));
|
||||
if (subStock == null) return Result<UcSubStockResponse>.ReFailure(ResultCodes.NoDateError);
|
||||
return Result<UcSubStockResponse>.ReSuccess(subStock);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据箱号获取箱信息
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.ServiceModel;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
@@ -26,21 +27,24 @@ namespace WMS.Web.Api.Controllers
|
||||
private IBasicsRepositories _transactionRepositories;
|
||||
private readonly IOpsService _opsService;
|
||||
private readonly IBoxService _boxService;
|
||||
private readonly IOutStockTaskRepositories _outStockTaskRepositories;
|
||||
public TestController(IErpService erpService, IInStockTaskService inStockTaskService,
|
||||
IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService)
|
||||
IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService,
|
||||
IOutStockTaskRepositories outStockTaskRepositories)
|
||||
{
|
||||
this._erpService = erpService;
|
||||
this._inStockTaskService = inStockTaskService;
|
||||
this._transactionRepositories = transactionRepositories;
|
||||
_opsService = opsService;
|
||||
_boxService = boxService;
|
||||
_outStockTaskRepositories = outStockTaskRepositories;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("hj")]
|
||||
public async Task<string> TestHJ()
|
||||
{
|
||||
await _boxService.Sync();
|
||||
// await _boxService.Sync();
|
||||
//var res = await this._erpService.BillQueryForDeliveryNoticeOutStock(null,DateTime.Now.AddDays(-300));
|
||||
//var result= await this._erpService.BillQueryForPurchaseInStock();
|
||||
//var result = await this._erpService.BillQueryForOrg();
|
||||
|
||||
@@ -468,6 +468,13 @@
|
||||
<param name="name">仓位名称模糊匹配</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetSubUcStockPrecisionByName(System.String)">
|
||||
<summary>
|
||||
获取仓位:精确名字
|
||||
</summary>
|
||||
<param name="name">精确名字</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetBox(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
根据箱号获取箱信息
|
||||
|
||||
@@ -410,6 +410,11 @@
|
||||
目标箱子ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordDetailsRequest">
|
||||
<summary>
|
||||
明细
|
||||
|
||||
@@ -836,11 +836,6 @@
|
||||
单据编号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.SourceBillNo">
|
||||
<summary>
|
||||
来源单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStock.Type">
|
||||
<summary>
|
||||
单据类型
|
||||
@@ -923,11 +918,16 @@
|
||||
单据头Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.SaleBillNo">
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.SaleBillNos">
|
||||
<summary>
|
||||
销售订单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.SourceBillNos">
|
||||
<summary>
|
||||
来源单号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.MaterialId">
|
||||
<summary>
|
||||
物料Id
|
||||
@@ -1059,7 +1059,7 @@
|
||||
来源单号(合并后有多个)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.SaleBillNo">
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.SaleBillNos">
|
||||
<summary>
|
||||
销售订单号
|
||||
</summary>
|
||||
|
||||
@@ -19,8 +19,10 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "目标箱子不能为空")]
|
||||
public int DestBoxId { get; set; }
|
||||
|
||||
public List<SaveChangeBoxRecordDetailsRequest> Details = new List<SaveChangeBoxRecordDetailsRequest>();
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<SaveChangeBoxRecordDetailsRequest> Details { get; set; } = new List<SaveChangeBoxRecordDetailsRequest>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 明细
|
||||
|
||||
@@ -31,11 +31,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("BillNo")]
|
||||
public string BillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 来源单号
|
||||
///</summary>
|
||||
[Column("SourceBillNo")]
|
||||
public string SourceBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
[Column("Type")]
|
||||
|
||||
@@ -30,8 +30,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 销售订单号
|
||||
///</summary>
|
||||
[Column("SaleBillNo")]
|
||||
public string SaleBillNo { get; set; }
|
||||
|
||||
public List<string> SaleBillNos { get; set; }
|
||||
/// <summary>
|
||||
/// 来源单号
|
||||
///</summary>
|
||||
[Column("SourceBillNo")]
|
||||
public List<string> SourceBillNos { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
///</summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
@@ -148,27 +149,36 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <returns></returns>
|
||||
public Result Merge(List<OutStockTask> list, int creatorId)
|
||||
{
|
||||
if (list.Count() <= 1) return Result.ReFailure(ResultCodes.MergeNumberError);
|
||||
// 符合合并数据逻辑:出库状态为”待拣货”+出库类型为:销售出库+发货组织一致+收货客户一致+发货仓库一致
|
||||
if (list.Where(w => w.Status != OutStockStatus.Wait).Any()) return Result.ReFailure(ResultCodes.MergeStatusError);
|
||||
if (list.Where(w => w.Type != OutStockType.Sal).Any()) return Result.ReFailure(ResultCodes.MergeStatusError);
|
||||
if (list.GroupBy(g => g.DeliveryOrgId).Count() > 1) return Result.ReFailure(ResultCodes.MergeStatusError);
|
||||
if (list.GroupBy(g => g.ReceiptCustomerId).Count() > 1) return Result.ReFailure(ResultCodes.MergeStatusError);
|
||||
|
||||
var details = list.SelectMany(s => s.Details).ToList();
|
||||
|
||||
if (details.GroupBy(g => g.StockCode).Count() > 1) return Result.ReFailure(ResultCodes.MergeStatusError);
|
||||
List<OutStockTaskDetails> details_new = new List<OutStockTaskDetails>();
|
||||
|
||||
//清空数据绑定
|
||||
foreach (var d in details)
|
||||
{
|
||||
d.Id = 0;
|
||||
d.Fid = 0;
|
||||
var detail_new = details_new.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||
if (detail_new != null)
|
||||
{
|
||||
detail_new.AccruedQty += d.AccruedQty;//应出数量累加
|
||||
detail_new.SaleBillNos.AddRange(d.SaleBillNos);
|
||||
detail_new.SourceBillNos.AddRange(d.SourceBillNos);
|
||||
}
|
||||
else
|
||||
details_new.Add(d);
|
||||
}
|
||||
this.OperatorId = creatorId;
|
||||
this.OperateTime = DateTime.Now;
|
||||
this.Status = OutStockStatus.Wait;
|
||||
this.Type = OutStockType.Sal;
|
||||
this.Details = details;
|
||||
this.Details = details_new;
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
@@ -13,7 +14,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_erp_outstock_task_details")]
|
||||
public class OutStockTaskDetails : EntityBase
|
||||
public class OutStockTaskDetails : EntityBase
|
||||
{
|
||||
public OutStockTaskDetails() { }
|
||||
/// <summary>
|
||||
@@ -36,11 +37,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
///</summary>
|
||||
[Column("SourceBillNo")]
|
||||
public List<string> SourceBillNos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 销售订单号
|
||||
///</summary>
|
||||
[Column("SaleBillNo")]
|
||||
public string SaleBillNo { get; set; }
|
||||
public List<string> SaleBillNos { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
///</summary>
|
||||
|
||||
@@ -47,8 +47,8 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// <summary>
|
||||
/// 同步金蝶数据 不传源订单号则更新所有
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <param name="billNos"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> Sync(List<string> sourceBillNos = null);
|
||||
Task<Result> Sync(List<string> billNos = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,12 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourceBillNos);
|
||||
/// <summary>
|
||||
/// 列表-根据订单号
|
||||
/// </summary>
|
||||
/// <param name="billNos"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<OutStockTask>> GetListByBillNo(List<string> billNos);
|
||||
/// 修改实体集合
|
||||
Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true);
|
||||
//编辑
|
||||
|
||||
@@ -34,17 +34,17 @@ namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
//2.记录:开始时间
|
||||
var begindatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行开始时间->{begindatetime}");
|
||||
_logger.LogInformation($"箱信息-同步箱信息数据:执行开始时间->{begindatetime}");
|
||||
//3.同步数据
|
||||
var result = await _boxService.Sync();
|
||||
//5.记录:结束时间
|
||||
var enddatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"出库单-同步金蝶入库单数据:执行结束时间->{begindatetime}");
|
||||
_logger.LogInformation($"箱信息-同步箱信息数据:执行结束时间->{begindatetime}");
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogInformation($"同步金蝶入库单数据:定时任务执行失败->{ex.Message}");
|
||||
_logger.LogInformation($"同步箱信息数据:定时任务执行失败->{ex.Message}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace WMS.Web.Domain.Services
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Sync(List<string> sourceBillNos = null)
|
||||
public async Task<Result> Sync(List<string> billNos = null)
|
||||
{
|
||||
//1.事务
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
@@ -244,7 +244,7 @@ namespace WMS.Web.Domain.Services
|
||||
bool isSuccess = true;
|
||||
Result result;
|
||||
//定时任务更新
|
||||
if (sourceBillNos == null)
|
||||
if (billNos == null)
|
||||
{
|
||||
DateTime begin = await _erpOpsSyncDateRepositories.Get(ErpOpsSyncType.OutStock);
|
||||
//更新时间范围内所有
|
||||
@@ -277,7 +277,7 @@ namespace WMS.Web.Domain.Services
|
||||
List<string> TransferOut_Nos = new List<string>();
|
||||
List<string> AssembledApp_Nos = new List<string>();
|
||||
List<string> MisDeliveryOut_Nos = new List<string>();
|
||||
var taskList = await _outStockTaskRepositories.GetListBySourceBillNo(sourceBillNos);
|
||||
var taskList = await _outStockTaskRepositories.GetListByBillNo(billNos);
|
||||
foreach (var entity in taskList)
|
||||
{
|
||||
if (entity.Type == OutStockType.Sal)
|
||||
|
||||
@@ -187,6 +187,7 @@ namespace WMS.Web.Domain.Services
|
||||
foreach (var entity in entityList)
|
||||
{
|
||||
var box = boxList.FirstOrDefault(f => f.Id == entity.BoxId);
|
||||
var outstockDetail = outStock.Details.FirstOrDefault(f => f.MaterialId == entity.MaterialId);
|
||||
//修改序列号和箱绑定关系
|
||||
entity.OutStock(outStock.BillNo, outStock.Type);
|
||||
|
||||
@@ -200,14 +201,14 @@ namespace WMS.Web.Domain.Services
|
||||
OperateTime = DateTime.Now,
|
||||
OperateType = OutStockTypeConvert(outStock.Type),
|
||||
OperateUser = userName,
|
||||
Remark = "来源单号:" + outStock.SourceBillNo + "\r\n" + "出库单号:" + outStock.BillNo
|
||||
Remark = "来源单号:" + string.Join(",",outstockDetail.SourceBillNos) + "\r\n" + "出库单号:" + outStock.BillNo
|
||||
};
|
||||
if (outStock.Type == OutStockType.Sal)
|
||||
{
|
||||
var detail = outStock.Details.FirstOrDefault(f => f.MaterialId == entity.MaterialId);
|
||||
var res_c = await _erpService.BillQueryForCustomer();
|
||||
var customer = res_c.Data.FirstOrDefault(f => f.Id == outStock.ReceiptCustomerId);
|
||||
op.Remark += "\r\n" + "销售订单号:" + detail.SaleBillNo;
|
||||
op.Remark += "\r\n" + "销售订单号:" + string.Join(",", detail.SaleBillNos);
|
||||
op.Remark += "\r\n" + "客户:" + customer?.Name;
|
||||
}
|
||||
sList.Add(op);
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace WMS.Web.Domain.Values
|
||||
/// 数据操作失败
|
||||
/// </summary>
|
||||
public static ValueTuple<int, string> DateWriteError = (40004, "数据操作失败");
|
||||
|
||||
public static ValueTuple<int, string> NoDateError = (40005, "数据不存在");
|
||||
|
||||
//出库任务单
|
||||
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
|
||||
@@ -29,6 +29,7 @@ namespace WMS.Web.Domain.Values
|
||||
public static ValueTuple<int, string> OutStockMaterialError = (70003, "出库物料在任务单中不存在");
|
||||
public static ValueTuple<int, string> OutStockTaskAlready = (70004, "任务单已全部出库");
|
||||
public static ValueTuple<int, string> OutStockTaskRepeal = (70005, "任务单已作废");
|
||||
public static ValueTuple<int, string> MergeNumberError = (70006, "必须选择两个及以上的单合并");
|
||||
|
||||
public static ValueTuple<int, string> BoxNoData = (80000, "箱信息不存在");
|
||||
public static ValueTuple<int, string> BoxMateriaNoData = (800010, "箱对应物料信息不存在");
|
||||
|
||||
@@ -94,6 +94,14 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
|
||||
ent.Property(f => f.SourceBillNos).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
|
||||
ent.Property(f => f.SaleBillNos).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
});
|
||||
#endregion
|
||||
|
||||
@@ -114,9 +122,14 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.HasKey(x => x.Id);
|
||||
|
||||
ent.Property(f => f.SourceBillNos).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
|
||||
ent.Property(f => f.SaleBillNos).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region 盘点单
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
|
||||
#region 出库任务单
|
||||
var jobKey_out = new JobKey("OutStockOrderQuartzJob", options.QuartzJobValue);
|
||||
q.AddJob<InStockOrderQuartzJob>(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob"));
|
||||
q.AddJob<OutStockOrderQuartzJob>(jobKey_out, j => j.WithDescription("OutStockOrderQuartzJob"));
|
||||
q.AddTrigger(t => t
|
||||
.WithIdentity("OutStockOrderQuartzJobTrigger")
|
||||
.ForJob(jobKey_out)
|
||||
@@ -244,7 +244,7 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
|
||||
#region 箱信息老ops
|
||||
var jobKey_box = new JobKey("BoxQuartzJob", options.QuartzJobValue);
|
||||
q.AddJob<InStockOrderQuartzJob>(jobKey_box, j => j.WithDescription("BoxQuartzJob"));
|
||||
q.AddJob<BoxQuartzJob>(jobKey_box, j => j.WithDescription("BoxQuartzJob"));
|
||||
q.AddTrigger(t => t
|
||||
.WithIdentity("BoxQuartzJobTrigger")
|
||||
.ForJob(jobKey_box)
|
||||
|
||||
@@ -82,6 +82,10 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockQueryInfoResponse> list, int total)> GetListAsync(OutStockQueryRequest dto)
|
||||
{
|
||||
List<int> detailIds = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
detailIds = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_wms_outstock_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.Creator))
|
||||
{
|
||||
@@ -134,8 +138,8 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (ids.Count() > 0)
|
||||
query = query.Where(w => ids.Contains(w.order.CreatorId));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%"));
|
||||
if (detailIds.Count()!=0)
|
||||
query = query.Where(w => detailIds.Contains(w.detail.Id));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
|
||||
if (dto.SuccessSync != null)
|
||||
@@ -160,8 +164,8 @@ namespace WMS.Web.Repositories
|
||||
CreateTime = s.order.CreateTime.DateToStringSeconds(),
|
||||
SuccessSync = s.order.SuccessSync,
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode),
|
||||
SourceBillNo = s.order.SourceBillNo,
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
SourceBillNo =string.Join(",",s.detail.SourceBillNos),
|
||||
SaleBillNo = string.Join(",", s.detail.SaleBillNos),
|
||||
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
ReceiptCustomer = s.order.Type == OutStockType.Sal
|
||||
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
|
||||
|
||||
@@ -216,6 +216,11 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Id FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{dto.SourceBillNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
|
||||
#region erp基础资料
|
||||
List<int> mIds = new List<int>();
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
@@ -262,8 +267,8 @@ namespace WMS.Web.Repositories
|
||||
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
|
||||
if (dto.Ids.Count() > 0)
|
||||
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
|
||||
if (!string.IsNullOrEmpty(dto.SourceBillNo))
|
||||
query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo));
|
||||
if (ids.Count() != 0)
|
||||
query = query.Where(w => ids.Contains(w.detail.Id));
|
||||
if (dto.Type != null)
|
||||
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
|
||||
if (dto.Status != null)
|
||||
@@ -291,7 +296,7 @@ namespace WMS.Web.Repositories
|
||||
OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode),
|
||||
SourceBillNo = string.Join(",", s.detail.SourceBillNos),
|
||||
SaleBillNo = s.detail.SaleBillNo,
|
||||
SaleBillNo = string.Join(",", s.detail.SaleBillNos),
|
||||
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
|
||||
ReceiptCustomer = s.order.Type == OutStockType.Sal
|
||||
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
|
||||
@@ -317,9 +322,12 @@ namespace WMS.Web.Repositories
|
||||
return new List<GetOutStockTaskByNoResponse>();
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
List<int> ids = new List<int>();
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
var list = await _context.OutStockTask.Include(x => x.Details)
|
||||
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
|
||||
f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
|
||||
ids.Contains(f.Id)) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.ToListAsync();
|
||||
@@ -368,11 +376,22 @@ namespace WMS.Web.Repositories
|
||||
/// </summary>
|
||||
/// <param name="sourceBillNos"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> billNos)
|
||||
public async Task<List<OutStockTask>> GetListBySourceBillNo(List<string> sourcebillNos)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
string str=$"SELECT Fid FROM t_erp_outstock_task_details WHERE ";
|
||||
for (int i=0;i<sourcebillNos.Count();i++)
|
||||
{
|
||||
if (i == 0)
|
||||
str += $" SourceBillNo like '%{sourcebillNos[i]}%'";
|
||||
else
|
||||
str += $" or SourceBillNo like '%{sourcebillNos[i]}%'";
|
||||
}
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw(str).Select(s => s.Id).ToListAsync();
|
||||
|
||||
var entitys = await _context.OutStockTask
|
||||
.Include(s => s.Details)
|
||||
.Where(w => billNos.Contains(w.BillNo))
|
||||
.Where(w => ids.Contains(w.Id))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.ToListAsync();
|
||||
|
||||
@@ -417,9 +436,12 @@ namespace WMS.Web.Repositories
|
||||
|
||||
public async Task<List<string>> GetOutStockTaskNosByNo(string billNo)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
ids = await _context.OutStockTaskDetails.FromSqlRaw($"SELECT Fid FROM t_erp_outstock_task_details WHERE SourceBillNo like '%{billNo}%'").Select(s => s.Id).ToListAsync();
|
||||
|
||||
return await _context.OutStockTask.Include(x => x.Details)
|
||||
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
|
||||
f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
|
||||
ids.Contains(f.Id)) &&
|
||||
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.Select(s => s.BillNo)
|
||||
@@ -436,5 +458,16 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
return await GetListAsync(dto);
|
||||
}
|
||||
|
||||
public async Task<List<OutStockTask>> GetListByBillNo(List<string> billNos)
|
||||
{
|
||||
var entitys = await _context.OutStockTask
|
||||
.Include(s => s.Details)
|
||||
.Where(w => billNos.Contains(w.BillNo))
|
||||
.OrderByDescending(o => o.Id)
|
||||
.ToListAsync();
|
||||
|
||||
return entitys.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user