Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -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>
|
||||
@@ -82,6 +84,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("OutStockEndTime")]
|
||||
public DateTime? OutStockEndTime { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, "箱对应物料信息不存在");
|
||||
|
||||
Reference in New Issue
Block a user