diff --git a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 index 94e1a988..0d472f88 100644 Binary files a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 and b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 differ diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index ff3e68e6..95978038 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -130,6 +130,11 @@ 明细ID + + + 单据编号 + + 所属箱号ID diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index 2a468b9f..5a899556 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -284,6 +284,11 @@ + + + 生成单据号 + + erp同步时间管理 记录最新一次重金蝶和ops拉取数据时间 @@ -734,6 +739,11 @@ + + + 生成单据号 + + wms出库单 diff --git a/src/WMS.Web.Domain/Entitys/ChangeBoxRecord.cs b/src/WMS.Web.Domain/Entitys/ChangeBoxRecord.cs index e0f6d70d..d8c97553 100644 --- a/src/WMS.Web.Domain/Entitys/ChangeBoxRecord.cs +++ b/src/WMS.Web.Domain/Entitys/ChangeBoxRecord.cs @@ -76,5 +76,27 @@ namespace WMS.Web.Domain.Entitys this.CreatorId = creatorId; this.CreateTime = DateTime.Now; } + /// + /// 生成单据号 + /// + public void GenerateNo() + { + //用户手动输入了 就不自动生成了 + if (!string.IsNullOrEmpty(this.BillNo)) return; + + if (this.Id.ToString().Length >= 8) + { + this.BillNo = "GX" + this.Id.ToString(); + return; + } + + string idStr = this.Id.ToString(); + while (true) + { + idStr = "0" + idStr; + if (idStr.Length >= 8) break; + } + this.BillNo = "GX" + idStr; + } } } diff --git a/src/WMS.Web.Domain/Entitys/MoveBoxRecord.cs b/src/WMS.Web.Domain/Entitys/MoveBoxRecord.cs index d1f7d138..10454ccf 100644 --- a/src/WMS.Web.Domain/Entitys/MoveBoxRecord.cs +++ b/src/WMS.Web.Domain/Entitys/MoveBoxRecord.cs @@ -70,5 +70,27 @@ namespace WMS.Web.Domain.Entitys this.CreatorId = creatorId; this.CreateTime = DateTime.Now; } + /// + /// 生成单据号 + /// + public void GenerateNo() + { + //用户手动输入了 就不自动生成了 + if (!string.IsNullOrEmpty(this.BillNo)) return; + + if (this.Id.ToString().Length >= 8) + { + this.BillNo = "YX" + this.Id.ToString(); + return; + } + + string idStr = this.Id.ToString(); + while (true) + { + idStr = "0" + idStr; + if (idStr.Length >= 8) break; + } + this.BillNo = "YX" + idStr; + } } } diff --git a/src/WMS.Web.Repositories/ChangeBoxRecordRepositories.cs b/src/WMS.Web.Repositories/ChangeBoxRecordRepositories.cs index 762b6ef2..8b45a925 100644 --- a/src/WMS.Web.Repositories/ChangeBoxRecordRepositories.cs +++ b/src/WMS.Web.Repositories/ChangeBoxRecordRepositories.cs @@ -58,11 +58,11 @@ namespace WMS.Web.Repositories await _context.ChangeBoxRecord.AddAsync(entity); await _context.SaveChangesAsync(); - //if (string.IsNullOrEmpty(entity.OutSourcFeedNo)) - //{ - // entity.GenerateNo(); - // await _context.SaveChangesAsync(); - //} + if (string.IsNullOrEmpty(entity.BillNo)) + { + entity.GenerateNo(); + await _context.SaveChangesAsync(); + } if (_transaction != null) _transaction.Commit(); @@ -92,6 +92,14 @@ namespace WMS.Web.Repositories _context.ChangeBoxRecord.AddRange(list); await _context.SaveChangesAsync(); + foreach (var item in list) + { + if (string.IsNullOrEmpty(item.BillNo)) + //自动生成单据编号 + item.GenerateNo(); + } + await _context.SaveChangesAsync(); + if (_transaction != null) _transaction.Commit(); return true; diff --git a/src/WMS.Web.Repositories/MoveBoxRecordRepositories.cs b/src/WMS.Web.Repositories/MoveBoxRecordRepositories.cs index 3cc2a3de..e6792154 100644 --- a/src/WMS.Web.Repositories/MoveBoxRecordRepositories.cs +++ b/src/WMS.Web.Repositories/MoveBoxRecordRepositories.cs @@ -53,11 +53,11 @@ namespace WMS.Web.Repositories await _context.MoveBoxRecord.AddAsync(entity); await _context.SaveChangesAsync(); - //if (string.IsNullOrEmpty(entity.OutSourcFeedNo)) - //{ - // entity.GenerateNo(); - // await _context.SaveChangesAsync(); - //} + if (string.IsNullOrEmpty(entity.BillNo)) + { + entity.GenerateNo(); + await _context.SaveChangesAsync(); + } if (_transaction != null) _transaction.Commit();