Skip to content

The open source simple and complete warehouse management system is derived from our many years of experience in implementing erp projects. We stripped the original commercial system wms function and opened it up for free, hoping to help the majority of small and medium-sized enterprises. At present, the system supports cross-platform。

update version

JawerZengfcd341f73fac
diff --git a/backend/ModernWMS.Core/DBContext/SqlDBContext.cs b/backend/ModernWMS.Core/DBContext/SqlDBContext.cs
index f2e0d72..7b786c1 100644
--- a/backend/ModernWMS.Core/DBContext/SqlDBContext.cs
+++ b/backend/ModernWMS.Core/DBContext/SqlDBContext.cs
@@ -10,6 +10,7 @@ using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
using Microsoft.Data.SqlClient;
using Mapster;
using Microsoft.AspNetCore.JsonPatch.Internal;
+using ModernWMS.Core.Models;
namespace ModernWMS.Core.DBContext
{
@@ -71,6 +72,7 @@ namespace ModernWMS.Core.DBContext
/// <param name="modelBuilder"></param>
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
+ modelBuilder.Entity<GlobalUniqueSerialEntity>();
MappingEntityTypes(modelBuilder);
/*foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
diff --git a/backend/ModernWMS.Core/Extentions/StartupExtensions.cs b/backend/ModernWMS.Core/Extentions/StartupExtensions.cs
index 113ae43..0eb381d 100644
--- a/backend/ModernWMS.Core/Extentions/StartupExtensions.cs
+++ b/backend/ModernWMS.Core/Extentions/StartupExtensions.cs
@@ -54,7 +54,7 @@ namespace ModernWMS.Core.Extentions
var cache = new MemoryCache(new MemoryCacheOptions());
return cache;
});
-
+
var database_config = configuration.GetSection("Database")["db"];
services.AddDbContextPool<SqlDBContext>(t =>
{
@@ -73,7 +73,6 @@ namespace ModernWMS.Core.Extentions
var SqlServer_connection = configuration.GetConnectionString("SqlServerConn");
t.UseSqlServer(SqlServer_connection);
}
-
else if (database_config.ToUpper() == "POSTGRES")
{
var Postgre_connection = configuration.GetConnectionString("PostGresConn");
@@ -85,7 +84,7 @@ namespace ModernWMS.Core.Extentions
t.UseLoggerFactory(new LoggerFactory(new[] { new DebugLoggerProvider() }));
}, 100); ;
services.AddMemoryCache();
- services.AddScoped<MultiTenancy.ITenantProvider, MultiTenancy.TenantProvider>();
+ services.AddScoped<MultiTenancy.ITenantProvider, MultiTenancy.TenantProvider>();
services.AddSwaggerService(configuration, AppContext.BaseDirectory);
services.AddTokenGeneratorService(configuration);
services.RegisterAssembly();
@@ -104,7 +103,8 @@ namespace ModernWMS.Core.Extentions
options.SerializerSettings.Converters.Add(new JsonStringTrimConverter());
options.SerializerSettings.Formatting = Formatting.Indented;
options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver();
- }).AddDataAnnotationsLocalization(options => {
+ }).AddDataAnnotationsLocalization(options =>
+ {
options.DataAnnotationLocalizerProvider = (type, factory) =>
factory.Create(typeof(ModernWMS.Core.MultiLanguage));
});
@@ -115,9 +115,9 @@ namespace ModernWMS.Core.Extentions
.UseRecommendedSerializerSettings()
.UseStorage(new MemoryStorage()));
services.AddHangfireServer();
-
-
+ services.AddScoped<FunctionHelper>();
}
+
public static void UseExtensionsConfigure(this IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IConfiguration configuration)
{
if (env.IsDevelopment())
@@ -131,7 +131,7 @@ namespace ModernWMS.Core.Extentions
app.UseTokenGeneratorConfigure(configuration);
app.UseAuthorization();
app.UseMiddleware<GlobalExceptionMiddleware>();
- var support_languages = new[] { "zh-cn", "en-us" };
+ var support_languages = new[] { "zh-cn", "en-us" };
var localization_options = new RequestLocalizationOptions()
.SetDefaultCulture(support_languages[0])
.AddSupportedCultures(support_languages)
@@ -152,7 +152,9 @@ namespace ModernWMS.Core.Extentions
endpoints.MapControllers();
});
}
+
#region Swagger
+
/// <summary>
/// Swagger
/// </summary>
@@ -184,7 +186,6 @@ namespace ModernWMS.Core.Extentions
});
});
-
if (settings.XmlFiles != null && settings.XmlFiles.Count > 0)
{
settings.XmlFiles.ForEach(fileName =>
@@ -200,7 +201,6 @@ namespace ModernWMS.Core.Extentions
c.OperationFilter<AppendAuthorizeToSummaryOperationFilter>();
c.OperationFilter<SecurityRequirementsOperationFilter>();
-
c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Description = "please input Bearer {token}",
@@ -209,10 +209,10 @@ namespace ModernWMS.Core.Extentions
Type = SecuritySchemeType.ApiKey
});
c.SwaggerGeneratorOptions.DescribeAllParametersInCamelCase = false;
-
});
}
}
+
/// <summary>
/// register Swagger
/// </summary>
@@ -220,7 +220,6 @@ namespace ModernWMS.Core.Extentions
/// <param name="configuration">配置文件</param>
private static void UseSwaggerConfigure(this IApplicationBuilder app, IConfiguration configuration)
{
-
var swaggerSettings = configuration.GetSection("SwaggerSettings");
if (swaggerSettings != null && swaggerSettings["Name"].Equals("ModernWMS"))
@@ -236,14 +235,14 @@ namespace ModernWMS.Core.Extentions
c.IndexStream = () => Assembly.GetExecutingAssembly().GetManifestResourceStream("ModernWMS.Core.Swagger.index.html");
c.RoutePrefix = "";
-
});
-
}
}
- #endregion
+
+ #endregion Swagger
#region JWT
+
/// <summary>
/// register JWT
/// </summary>
@@ -251,7 +250,6 @@ namespace ModernWMS.Core.Extentions
/// <param name="configuration">configuration</param>
private static void AddTokenGeneratorService(this IServiceCollection services, IConfiguration configuration)
{
-
if (services == null)
{
throw new ArgumentNullException(nameof(services));
@@ -264,7 +262,7 @@ namespace ModernWMS.Core.Extentions
{
options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
- options.DefaultChallengeScheme = nameof(ApiResponseHandler);
+ options.DefaultChallengeScheme = nameof(ApiResponseHandler);
options.DefaultForbidScheme = nameof(ApiResponseHandler);
}
)
@@ -283,24 +281,23 @@ namespace ModernWMS.Core.Extentions
};
})
.AddScheme<AuthenticationSchemeOptions, ApiResponseHandler>(nameof(ApiResponseHandler), o => { });
-
}
private static void UseTokenGeneratorConfigure(this IApplicationBuilder app, IConfiguration configuration)
{
app.UseAuthentication();
}
- #endregion
- #region dynamic injection
+ #endregion JWT
+
+ #region dynamic injection
+
/// <summary>
- /// judge the dll to be injected by IDependency
+ /// judge the dll to be injected by IDependency
/// </summary>
/// <param name="services">services</param>
private static IServiceCollection RegisterAssembly(this IServiceCollection services)
{
-
-
var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
var referencedAssemblies = System.IO.Directory.GetFiles(path, "ModernWMS*.dll").Select(Assembly.LoadFrom).ToArray();
@@ -335,6 +332,7 @@ namespace ModernWMS.Core.Extentions
return services;
}
+
/// <summary>
/// AddHangfireJob
/// </summary>
@@ -361,7 +359,7 @@ namespace ModernWMS.Core.Extentions
}
}
}
- #endregion
+ #endregion dynamic injection
}
-}
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.Core/JWT/CurrentUser.cs b/backend/ModernWMS.Core/JWT/CurrentUser.cs
index dc32b03..367dfc1 100644
--- a/backend/ModernWMS.Core/JWT/CurrentUser.cs
+++ b/backend/ModernWMS.Core/JWT/CurrentUser.cs
@@ -12,10 +12,12 @@ namespace ModernWMS.Core.JWT
/// user_id
/// </summary>
public int user_id { get; set; } = 1;
+
/// <summary>
/// user_num
/// </summary>
public string user_num { get; set; } = "admin";
+
/// <summary>
/// user_name
/// </summary>
@@ -31,4 +33,4 @@ namespace ModernWMS.Core.JWT
/// </summary>
public long tenant_id { get; set; } = 1;
}
-}
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.Core/Models/GlobalUniqueSerialEntity.cs b/backend/ModernWMS.Core/Models/GlobalUniqueSerialEntity.cs
new file mode 100644
index 0000000..cd76520
--- /dev/null
+++ b/backend/ModernWMS.Core/Models/GlobalUniqueSerialEntity.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ModernWMS.Core.Models
+{
+ /// <summary>
+ /// global_unique_serial entity
+ /// </summary>
+ [Table("global_unique_serial")]
+ public class GlobalUniqueSerialEntity : BaseModel
+ {
+ /// <summary>
+ /// table name
+ /// </summary>
+ public string table_name { get; set; } = string.Empty;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public string prefix_char { get; set; } = string.Empty;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public string reset_rule { get; set; } = string.Empty;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public int current_no { get; set; } = 1;
+
+ /// <summary>
+ ///
+ /// </summary>
+ public DateTime last_update_time { get; set; } = DateTime.Now;
+
+ /// <summary>
+ /// current user's tenant_id
+ /// </summary>
+ public long tenant_id { get; set; } = 1;
+ }
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.Core/Utility/FucntionHelper.cs b/backend/ModernWMS.Core/Utility/FucntionHelper.cs
new file mode 100644
index 0000000..5bfa0e2
--- /dev/null
+++ b/backend/ModernWMS.Core/Utility/FucntionHelper.cs
@@ -0,0 +1,176 @@
+using Microsoft.AspNetCore.Http;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.IdentityModel.Tokens;
+using ModernWMS.Core.DBContext;
+using ModernWMS.Core.JWT;
+using ModernWMS.Core.Models;
+using ModernWMS.Core.Utility;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ModernWMS.Core
+{
+ public class FunctionHelper
+ {
+ private readonly SqlDBContext _dBContext;
+ private readonly IHttpContextAccessor _accessor;
+
+ public FunctionHelper(SqlDBContext dBContext
+ , IHttpContextAccessor accessor)
+ {
+ _dBContext = dBContext;
+ _accessor = accessor;
+ }
+
+ /// <summary>
+ /// Get the current user information in the token
+ /// </summary>
+ /// <returns></returns>
+ public CurrentUser GetCurrentUser()
+ {
+ if (_accessor.HttpContext == null)
+ {
+ return new CurrentUser();
+ }
+ var token = _accessor.HttpContext.Request.Headers["Authorization"].ObjToString();
+ if (!token.StartsWith("Bearer"))
+ {
+ return new CurrentUser();
+ }
+ token = token.Replace("Bearer ", "");
+ if (token.Length > 0)
+ {
+ var principal = new JwtSecurityTokenHandler().ValidateToken(token,
+ new TokenValidationParameters
+ {
+ ValidateAudience = false,
+ ValidateIssuer = false,
+ ValidateIssuerSigningKey = true,
+ IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(GlobalConsts.SigningKey)),
+ ValidateLifetime = false
+ },
+ out var securityToken);
+
+ if (!(securityToken is JwtSecurityToken jwtSecurityToken) ||
+ !jwtSecurityToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256, StringComparison.InvariantCultureIgnoreCase))
+ {
+ return new CurrentUser();
+ }
+ var user = JsonHelper.DeserializeObject<CurrentUser>(principal.Claims.First(claim => claim.Type == ClaimValueTypes.Json).Value);
+ if (user != null)
+ {
+ return user;
+ }
+ else
+ {
+ return new CurrentUser();
+ }
+ }
+ else
+ {
+ return new CurrentUser();
+ }
+ }
+
+ /// <summary>
+ /// 序号表获取单据编号
+ /// </summary>
+ /// <param name="table_name">表名</param>
+ /// <param name="prefix_char">前缀</param>
+ /// <param name="reset_rule">重置规则</param>
+ /// <returns></returns>
+ public async Task<string> GetFormNoAsync(string table_name, string prefix_char = "", ResetRule reset_rule = ResetRule.Day)
+ {
+ var current_user = GetCurrentUser();
+ var nums = await GetFormNoListAsync(table_name, 1, current_user.tenant_id, prefix_char, reset_rule);
+ if (nums == null)
+ {
+ return "";
+ }
+ else
+ {
+ return nums[0];
+ }
+ }
+
+ /// <summary>
+ /// 序号表获取单据编号
+ /// </summary>
+ /// <param name="table_name">表名</param>
+ /// <param name="tenant_id">租户id</param>
+ /// <param name="prefix_char">前缀</param>
+ /// <param name="Qty">编号数量</param>
+ /// <param name="reset_rule">重置规则</param>
+ /// <returns></returns>
+ public async Task<List<string>> GetFormNoListAsync(string table_name, int Qty = 1, long tenant_id = 1, string prefix_char = "", ResetRule reset_rule = ResetRule.Day)
+ {
+ List<string> nums = new List<string>();
+ string _reset_rule = "yyyyMMdd";
+ if (reset_rule == ResetRule.Year) _reset_rule = "yyyy";
+ else if (reset_rule == ResetRule.Month) _reset_rule = "yyyyMM";
+
+ var dbSet = _dBContext.Set<GlobalUniqueSerialEntity>();
+ var entity = await dbSet.FirstOrDefaultAsync(t => t.table_name == table_name && t.prefix_char == prefix_char && t.reset_rule == _reset_rule);
+ if (entity == null)
+ {
+ for (int index = 1; index <= Qty; index++)
+ {
+ nums.Add($"{prefix_char}{DateTime.Now.ToString(_reset_rule)}-{index.ToString().PadLeft(4, '0')}");
+ }
+ entity = new GlobalUniqueSerialEntity
+ {
+ table_name = table_name,
+ prefix_char = prefix_char,
+ reset_rule = _reset_rule,
+ current_no = Qty + 1,
+ last_update_time = DateTime.Now,
+ tenant_id = tenant_id
+ };
+ dbSet.Add(entity);
+ await _dBContext.SaveChangesAsync();
+ }
+ else
+ {
+ int current_no = entity.current_no;
+ if (!DateTime.Now.ToString(_reset_rule).Equals(entity.last_update_time.ToString(_reset_rule)))
+ {
+ current_no = 1;
+ }
+ for (int index = 1; index <= Qty; index++)
+ {
+ nums.Add($"{prefix_char}{DateTime.Now.ToString(_reset_rule)}-{current_no.ToString().PadLeft(4, '0')}");
+ current_no++;
+ }
+ entity.current_no = current_no;
+ entity.last_update_time = DateTime.Now;
+ await _dBContext.SaveChangesAsync();
+ }
+ return nums;
+ }
+
+ /// <summary>
+ /// 重置规则
+ /// </summary>
+ public enum ResetRule
+ {
+ /// <summary>
+ /// 年
+ /// </summary>
+ Year,
+
+ /// <summary>
+ /// 月
+ /// </summary>
+ Month,
+
+ /// <summary>
+ /// 日
+ /// </summary>
+ Day
+ }
+ }
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Controllers/Asn/AsnController.cs b/backend/ModernWMS.WMS/Controllers/Asn/AsnController.cs
index 0d89695..65c8802 100644
--- a/backend/ModernWMS.WMS/Controllers/Asn/AsnController.cs
+++ b/backend/ModernWMS.WMS/Controllers/Asn/AsnController.cs
@@ -362,10 +362,10 @@ namespace ModernWMS.WMS.Controllers
/// <param name="asn_id">asn id</param>
/// <returns></returns>
[HttpGet("sorting")]
- public async Task<ResultModel<List<AsnsortEntity>>> GetAsnsortsAsync(int asn_id)
+ public async Task<ResultModel<List<AsnsortViewModel>>> GetAsnsortsAsync(int asn_id)
{
var data = await _asnService.GetAsnsortsAsync(asn_id);
- return ResultModel<List<AsnsortEntity>>.Success(data);
+ return ResultModel<List<AsnsortViewModel>>.Success(data);
}
/// <summary>
@@ -460,6 +460,19 @@ namespace ModernWMS.WMS.Controllers
}
#endregion
+ #region print series number
+ /// <summary>
+ /// print series number
+ /// </summary>
+ /// <param name="input">selected asn id</param>
+ /// <returns></returns>
+ [HttpPost("print-sn")]
+ public async Task<ResultModel<List<AsnPrintSeriesNumberViewModel>>> GetAsnPrintSeriesNumberAsync(List<int> input)
+ {
+ var data = await _asnService.GetAsnPrintSeriesNumberAsync(input);
+ return ResultModel<List<AsnPrintSeriesNumberViewModel>>.Success(data);
+ }
+ #endregion
}
}
diff --git a/backend/ModernWMS.WMS/Controllers/Dispatchlist/DispatchlistController.cs b/backend/ModernWMS.WMS/Controllers/Dispatchlist/DispatchlistController.cs
index a692074..62e02c3 100644
--- a/backend/ModernWMS.WMS/Controllers/Dispatchlist/DispatchlistController.cs
+++ b/backend/ModernWMS.WMS/Controllers/Dispatchlist/DispatchlistController.cs
@@ -205,6 +205,44 @@ namespace ModernWMS.WMS.Controllers
}
}
+ /// <summary>
+ /// confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <returns></returns>
+ [HttpPost("confirm-pick-detail")]
+ public async Task<ResultModel<string>> ConfirmPickDetail([FromBody]List<int> picklist_id)
+ {
+ var (flag, msg) = await _dispatchlistService.ConfirmPickDetail(picklist_id, CurrentUser);
+ if (flag)
+ {
+ return ResultModel<string>.Success(msg);
+ }
+ else
+ {
+ return ResultModel<string>.Error(msg);
+ }
+ }
+
+ /// <summary>
+ /// confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <returns></returns>
+ [HttpPost("cancel-confirm-pick-detail")]
+ public async Task<ResultModel<string>> CancelConfirmPickDetail([FromBody] List<int> picklist_id)
+ {
+ var (flag, msg) = await _dispatchlistService.CancelConfirmPickDetail(picklist_id, CurrentUser);
+ if (flag)
+ {
+ return ResultModel<string>.Success(msg);
+ }
+ else
+ {
+ return ResultModel<string>.Error(msg);
+ }
+ }
+
/// <summary>
/// package dispatchpicklist
/// </summary>
diff --git a/backend/ModernWMS.WMS/Controllers/Stock/StockController.cs b/backend/ModernWMS.WMS/Controllers/Stock/StockController.cs
index 1304aea..364e784 100644
--- a/backend/ModernWMS.WMS/Controllers/Stock/StockController.cs
+++ b/backend/ModernWMS.WMS/Controllers/Stock/StockController.cs
@@ -169,6 +169,24 @@ namespace ModernWMS.WMS.Controllers
});
}
+
+
+ /// <summary>
+ /// stock age page search
+ /// </summary>
+ /// <param name="pageSearch">args</param>
+ /// <returns></returns>
+ [HttpPost("stock-age-list")]
+ public async Task<ResultModel<PageData<StockAgeViewModel>>> StockAgePageAsync(StockAgeSearchViewModel input)
+ {
+ var (data, totals) = await _stockService.StockAgePageAsync(input, CurrentUser);
+
+ return ResultModel<PageData<StockAgeViewModel>>.Success(new PageData<StockAgeViewModel>
+ {
+ Rows = data,
+ Totals = totals
+ });
+ }
#endregion Api
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Controllers/Stockprocess/StockprocessController.cs b/backend/ModernWMS.WMS/Controllers/Stockprocess/StockprocessController.cs
index 818431b..f61a1fb 100644
--- a/backend/ModernWMS.WMS/Controllers/Stockprocess/StockprocessController.cs
+++ b/backend/ModernWMS.WMS/Controllers/Stockprocess/StockprocessController.cs
@@ -1,6 +1,7 @@
/*
* date:2022-12-23
* developer:NoNo
+ * modify:20240202
*/
using Microsoft.AspNetCore.Mvc;
using ModernWMS.Core.Controller;
diff --git a/backend/ModernWMS.WMS/Entities/Models/Asn/AsnEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Asn/AsnEntity.cs
index 18c20b8..95a280b 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Asn/AsnEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Asn/AsnEntity.cs
@@ -161,6 +161,15 @@ namespace ModernWMS.WMS.Entities.Models
public long tenant_id { get; set; } = 1;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = Core.Utility.UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
#endregion
}
diff --git a/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchlistEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchlistEntity.cs
index 4dcb4d8..ed58677 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchlistEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchlistEntity.cs
@@ -166,16 +166,26 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public long tenant_id { get; set; } = 0;
+ /// <summary>
+ /// pick_checker_id
+ /// </summary>
+ public int pick_checker_id { get; set; } = 0;
+
+ /// <summary>
+ /// pick_checker
+ /// </summary>
+ public string pick_checker { get; set; } = string.Empty;
+
#endregion
#region detail table
- /// <summary>
- /// detail table
- /// </summary>
- public List<DispatchpicklistEntity> detailList { get; set; } = new List<DispatchpicklistEntity>(2);
+ /// <summary>
+ /// detail table
+ /// </summary>
+ public List<DispatchpicklistEntity> detailList { get; set; } = new List<DispatchpicklistEntity>(2);
#endregion
diff --git a/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchpicklistEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchpicklistEntity.cs
index 5a48233..aa0d341 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchpicklistEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Dispatchlist/DispatchpicklistEntity.cs
@@ -75,6 +75,32 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// picker_id
+ /// </summary>
+ public int picker_id { get; set; } = 0;
+
+ /// <summary>
+ /// picker
+ /// </summary>
+ public string picker { get; set; } = string.Empty;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/Models/Stock/StockEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Stock/StockEntity.cs
index 4edea05..bee96bd 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Stock/StockEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Stock/StockEntity.cs
@@ -61,6 +61,22 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/Models/Stockadjust/StockadjustEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Stockadjust/StockadjustEntity.cs
index d5b2e68..f83e457 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Stockadjust/StockadjustEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Stockadjust/StockadjustEntity.cs
@@ -85,6 +85,22 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/Models/Stockmove/StockmoveEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Stockmove/StockmoveEntity.cs
index fef6ade..120da74 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Stockmove/StockmoveEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Stockmove/StockmoveEntity.cs
@@ -90,6 +90,22 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/Models/Stockprocess/StockprocessdetailEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Stockprocess/StockprocessdetailEntity.cs
index b8c2f67..066fb1b 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Stockprocess/StockprocessdetailEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Stockprocess/StockprocessdetailEntity.cs
@@ -80,6 +80,22 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/Models/Stocktaking/StocktakingEntity.cs b/backend/ModernWMS.WMS/Entities/Models/Stocktaking/StocktakingEntity.cs
index d709f74..5ed1a6d 100644
--- a/backend/ModernWMS.WMS/Entities/Models/Stocktaking/StocktakingEntity.cs
+++ b/backend/ModernWMS.WMS/Entities/Models/Stocktaking/StocktakingEntity.cs
@@ -45,6 +45,26 @@ namespace ModernWMS.WMS.Entities.Models
/// </summary>
public int goods_location_id { get; set; } = 0;
+ /// <summary>
+ /// series_number
+ /// </summary>
+ public string series_number { get; set; } = string.Empty;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
/// <summary>
/// book_qty
/// </summary>
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnPrintSeriesNumberViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnPrintSeriesNumberViewModel.cs
new file mode 100644
index 0000000..1476006
--- /dev/null
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnPrintSeriesNumberViewModel.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ModernWMS.WMS.Entities.ViewModels
+{
+ /// <summary>
+ /// AsnPrintSeriesNumberViewModel
+ /// </summary>
+ public class AsnPrintSeriesNumberViewModel
+ {
+ /// <summary>
+ ///
+ /// </summary>
+ public AsnPrintSeriesNumberViewModel()
+ {
+
+ }
+
+
+ /// <summary>
+ /// asn_id
+ /// </summary>
+ public int asn_id { get; set; } = 0;
+
+ /// <summary>
+ /// asnmaster_id
+ /// </summary>
+ public int asnmaster_id { get; set; } = 0;
+
+ /// <summary>
+ /// sku_id
+ /// </summary>
+ public int sku_id { get; set; } = 0;
+
+ /// <summary>
+ /// asn_no
+ /// </summary>
+ public string asn_no { get; set; } = string.Empty;
+
+ /// <summary>
+ /// spu_code
+ /// </summary>
+ public string spu_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// spu_name
+ /// </summary>
+ public string spu_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_code
+ /// </summary>
+ public string sku_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_name
+ /// </summary>
+ public string sku_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// series_number
+ /// </summary>
+ public string series_number { get; set; } = string.Empty;
+
+ }
+}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnViewModel.cs
index efd55ce..2b451c6 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnViewModel.cs
@@ -247,6 +247,19 @@ namespace ModernWMS.WMS.Entities.ViewModels
[Display(Name = "is_valid")]
public bool is_valid { get; set; } = true;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = Core.Utility.UtilConvert.MinDate;
+
+
+ /// <summary>
+ /// price
+ /// </summary>
+ [Display(Name = "price")]
+ public decimal price { get; set; } = 0;
+
#endregion
}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Asnmaster/AsnmasterDetailViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Asnmaster/AsnmasterDetailViewModel.cs
index 635f63a..8f02942 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Asnmaster/AsnmasterDetailViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Asnmaster/AsnmasterDetailViewModel.cs
@@ -2,6 +2,7 @@
* date:2023-08-30
* developer:AMo
*/
+using ModernWMS.Core.Utility;
using System.ComponentModel.DataAnnotations;
namespace ModernWMS.WMS.Entities.ViewModels
@@ -152,6 +153,29 @@ namespace ModernWMS.WMS.Entities.ViewModels
[Display(Name = "is_valid")]
public bool is_valid { get; set; } = true;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ [Display(Name = "expiry_date")]
+ public DateTime expiry_date { get; set; } = Core.Utility.UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ [Display(Name = "price")]
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// sorted_qty
+ /// </summary>
+ public int sorted_qty { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion
}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnsortViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnsortViewModel.cs
new file mode 100644
index 0000000..63a5d40
--- /dev/null
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/AsnsortViewModel.cs
@@ -0,0 +1,73 @@
+/*
+ * date:2024-03-14
+ * developer:AMo
+ */
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ModernWMS.WMS.Entities.ViewModels
+{
+ /// <summary>
+ /// asn sort viewmodel
+ /// </summary>
+ public class AsnsortViewModel
+ {
+ /// <summary>
+ /// id
+ /// </summary>
+ public int id { get; set; } = 0;
+
+ /// <summary>
+ /// asn_id
+ /// </summary>
+ public int asn_id { get; set; } = 0;
+
+ /// <summary>
+ /// sorted_qty
+ /// </summary>
+ public int sorted_qty { get; set; } = 0;
+
+ /// <summary>
+ /// series_number
+ /// </summary>
+ public string series_number { get; set; } = string.Empty;
+
+ /// <summary>
+ /// putaway qty
+ /// </summary>
+ public int putaway_qty { get; set; } = 0;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = Core.Utility.UtilConvert.MinDate;
+
+ /// <summary>
+ /// creator
+ /// </summary>
+ public string creator { get; set; } = string.Empty;
+
+ /// <summary>
+ /// create_time
+ /// </summary>
+ public DateTime create_time { get; set; } = DateTime.Now;
+
+ /// <summary>
+ /// last_update_time
+ /// </summary>
+ public DateTime last_update_time { get; set; } = DateTime.Now;
+
+ /// <summary>
+ /// is_valid
+ /// </summary>
+ public bool is_valid { get; set; } = true;
+
+ /// <summary>
+ /// tenant_id
+ /// </summary>
+ public long tenant_id { get; set; } = 1;
+ }
+}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Flow/AsnsortInputViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Flow/AsnsortInputViewModel.cs
index 7ea1d7a..3c4b0b6 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Flow/AsnsortInputViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Asn/Flow/AsnsortInputViewModel.cs
@@ -31,6 +31,11 @@ namespace ModernWMS.WMS.Entities.ViewModels
[Display(Name = "asn_id")]
public int asn_id { get; set; } = 0;
+ /// <summary>
+ /// is automatically generate series number
+ /// </summary>
+ public bool is_auto_num { get; set; } = false;
+
/// <summary>
/// series_number
/// </summary>
@@ -42,6 +47,12 @@ namespace ModernWMS.WMS.Entities.ViewModels
[Display(Name = "sorted_qty")]
public int sorted_qty { get; set; } = 0;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = Core.Utility.UtilConvert.MinDate;
+
#endregion
}
}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistConfirmPickDetailViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistConfirmPickDetailViewModel.cs
index 098c41c..3556704 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistConfirmPickDetailViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistConfirmPickDetailViewModel.cs
@@ -1,4 +1,5 @@
-using System;
+using ModernWMS.Core.Utility;
+using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -79,6 +80,22 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistDetailViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistDetailViewModel.cs
index 21dd0db..691190a 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistDetailViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistDetailViewModel.cs
@@ -225,6 +225,19 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// sku_code
/// </summary>
public string sku_code { get; set; } = string.Empty;
+
+
+ /// <summary>
+ /// pick_checker_id
+ /// </summary>
+ public decimal pick_checker_id { get; set; } = 0;
+
+ /// <summary>
+ /// pick_checker
+ /// </summary>
+ public string pick_checker { get; set; } = string.Empty;
+
+
#endregion
}
}
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistViewModel.cs
index 1dae34c..97ad410 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchlistViewModel.cs
@@ -292,6 +292,16 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// </summary>
public bool is_todo { get; set; } = false;
+ /// <summary>
+ /// pick_checker_id
+ /// </summary>
+ public int pick_checker_id { get; set; } = 0;
+
+ /// <summary>
+ /// pick_checker
+ /// </summary>
+ public string pick_checker { get; set; } = string.Empty;
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchpicklistViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchpicklistViewModel.cs
index 8c044f5..4811c88 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchpicklistViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Dispatchlist/DispatchpicklistViewModel.cs
@@ -126,6 +126,32 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// picker_id
+ /// </summary>
+ public int picker_id { get; set; } = 0;
+
+ /// <summary>
+ /// picker
+ /// </summary>
+ public string picker { get; set; } = string.Empty;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/DeliveryStatisticViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/DeliveryStatisticViewModel.cs
index dbcf284..c94df0a 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/DeliveryStatisticViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/DeliveryStatisticViewModel.cs
@@ -99,6 +99,22 @@ namespace ModernWMS.WMS.Entities.ViewModels.Stock
/// </summary>
public decimal delivery_amount { get; set; } = 0;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockForPhoneSearchViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockForPhoneSearchViewModel.cs
index e4c45bf..34a48ce 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockForPhoneSearchViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockForPhoneSearchViewModel.cs
@@ -3,8 +3,10 @@
* developer:NoNo
*/
+using ModernWMS.Core.Utility;
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -40,5 +42,15 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// location name
/// </summary>
public string location_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// series_number
+ /// </summary>
+ public string series_number { get; set; } = string.Empty;
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockManagementViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockManagementViewModel.cs
index 14168de..ee492db 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockManagementViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/LocationStockManagementViewModel.cs
@@ -3,6 +3,7 @@
* developer:NoNo
*/
+using ModernWMS.Core.Utility;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -89,5 +90,22 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// goods_location_id
/// </summary>
public int goods_location_id { get; set; } = 0;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeSearchViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeSearchViewModel.cs
new file mode 100644
index 0000000..c930bd3
--- /dev/null
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeSearchViewModel.cs
@@ -0,0 +1,112 @@
+/*
+ * date:2023-9-8
+ * developer:NoNo
+ */
+
+using ModernWMS.Core.Utility;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ModernWMS.WMS.Entities.ViewModels.Stock
+{
+ /// <summary>
+ /// delivery data statistic input viewModel
+ /// </summary>
+ public class StockAgeSearchViewModel
+ {
+ #region constructor
+
+ /// <summary>
+ /// constructor
+ /// </summary>
+ public StockAgeSearchViewModel()
+ {
+ }
+
+ #endregion constructor
+
+ #region Property
+
+ /// <summary>
+ /// current page number
+ /// </summary>
+ public int pageIndex { get; set; } = 1;
+
+ /// <summary>
+ /// rows per page
+ /// </summary>
+ public int pageSize { get; set; } = 20;
+
+ /// <summary>
+ /// spu_code
+ /// </summary>
+ [Display(Name = "spu_code")]
+ [MaxLength(32, ErrorMessage = "MaxLength")]
+ public string spu_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// spu_name
+ /// </summary>
+ [Display(Name = "spu_name")]
+ [MaxLength(200, ErrorMessage = "MaxLength")]
+ public string spu_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_code
+ /// </summary>
+ [Display(Name = "sku_code")]
+ [MaxLength(32, ErrorMessage = "MaxLength")]
+ public string sku_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_name
+ /// </summary>
+ [Display(Name = "sku_name")]
+ [MaxLength(200, ErrorMessage = "MaxLength")]
+ public string sku_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// warehouse_name
+ /// </summary>
+ [Display(Name = "warehouse_name")]
+ [MaxLength(32, ErrorMessage = "MaxLength")]
+ public string warehouse_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// location_name
+ /// </summary>
+ [Display(Name = "location_name")]
+ [MaxLength(32, ErrorMessage = "MaxLength")]
+ public string location_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// stock age date from
+ /// </summary>
+ public int stock_age_from { get; set; } = 0;
+
+ /// <summary>
+ /// stock age date to
+ /// </summary>
+ public int stock_age_to { get; set; } = 0;
+
+
+ /// <summary>
+ ///expiry date from
+ /// </summary>
+ [Display(Name = "expiry_date_from")]
+ [DataType(DataType.DateTime, ErrorMessage = "DataType_DateTime")]
+ public DateTime expiry_date_from { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// expiry date to
+ /// </summary>
+ [Display(Name = "expiry_date_to")]
+ [DataType(DataType.DateTime, ErrorMessage = "DataType_DateTime")]
+ public DateTime expiry_date_to { get; set; } = UtilConvert.MinDate;
+ #endregion Property
+ }
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeViewModel.cs
new file mode 100644
index 0000000..bf68add
--- /dev/null
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockAgeViewModel.cs
@@ -0,0 +1,101 @@
+/*
+ * date:2024-5-7
+ * developer:NoNo
+ */
+
+using ModernWMS.Core.Utility;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+
+namespace ModernWMS.WMS.Entities.ViewModels
+{
+ /// <summary>
+ /// goods stock age management viewmodel
+ /// </summary>
+ public class StockAgeViewModel
+ {
+ /// <summary>
+ /// warehouse_name
+ /// </summary>
+ public string warehouse_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// location_name
+ /// </summary>
+ public string location_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// spu_code
+ /// </summary>
+ public string spu_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// spu_name
+ /// </summary>
+ public string spu_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_id
+ /// </summary>
+ public int sku_id { get; set; } = 0;
+
+ /// <summary>
+ /// sku_code
+ /// </summary>
+ public string sku_code { get; set; } = string.Empty;
+
+ /// <summary>
+ /// sku_name
+ /// </summary>
+ public string sku_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// quantity
+ /// </summary>
+ public int qty { get; set; } = 0;
+
+
+ /// <summary>
+ /// goods owner name
+ /// </summary>
+ public string goods_owner_name { get; set; } = string.Empty;
+
+ /// <summary>
+ /// series_number
+ /// </summary>
+ [Display(Name = "series_number")]
+ [MaxLength(64, ErrorMessage = "MaxLength")]
+ public string series_number { get; set; } = string.Empty;
+
+ /// <summary>
+ /// goods_location_id
+ /// </summary>
+ public int goods_location_id { get; set; } = 0;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// stock_age
+ /// </summary>
+ public int stock_age { get; set; } = 0;
+
+ }
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockManagementViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockManagementViewModel.cs
index 27a1cec..59f6796 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockManagementViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockManagementViewModel.cs
@@ -1,4 +1,5 @@
-using System;
+using ModernWMS.Core.Utility;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -89,6 +90,12 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// </summary>
public int shortage_qty { get; set; } = 0;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockViewModel.cs
index b3a6ff2..f1a86b8 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stock/StockViewModel.cs
@@ -129,6 +129,24 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ [Display(Name = "expiry_date")]
+ [DataType(DataType.DateTime, ErrorMessage = "DataType_DateTime")]
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stockadjust/StockadjustViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stockadjust/StockadjustViewModel.cs
index 74ad15a..a4fde63 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stockadjust/StockadjustViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stockadjust/StockadjustViewModel.cs
@@ -151,6 +151,22 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stockmove/StockmoveViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stockmove/StockmoveViewModel.cs
index 9d6432a..1b869a2 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stockmove/StockmoveViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stockmove/StockmoveViewModel.cs
@@ -164,6 +164,22 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stockprocess/StockprocessdetailViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stockprocess/StockprocessdetailViewModel.cs
index bc08b04..1812252 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stockprocess/StockprocessdetailViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stockprocess/StockprocessdetailViewModel.cs
@@ -119,6 +119,22 @@ namespace ModernWMS.WMS.Entities.ViewModels
[MaxLength(64, ErrorMessage = "MaxLength")]
public string series_number { get; set; } = string.Empty;
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
+
#endregion Property
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Entities/ViewModels/Stocktaking/StocktakingBasicViewModel.cs b/backend/ModernWMS.WMS/Entities/ViewModels/Stocktaking/StocktakingBasicViewModel.cs
index 6c33d58..9ea43bd 100644
--- a/backend/ModernWMS.WMS/Entities/ViewModels/Stocktaking/StocktakingBasicViewModel.cs
+++ b/backend/ModernWMS.WMS/Entities/ViewModels/Stocktaking/StocktakingBasicViewModel.cs
@@ -77,12 +77,32 @@ namespace ModernWMS.WMS.Entities.ViewModels
/// </summary>
public string location_name { get; set; } = string.Empty;
+ /// <summary>
+ /// series_number
+ /// </summary>
+ public string series_number { get; set; } = string.Empty;
+
+ /// <summary>
+ /// expiry_date
+ /// </summary>
+ public DateTime expiry_date { get; set; } = UtilConvert.MinDate;
+
+ /// <summary>
+ /// price
+ /// </summary>
+ public decimal price { get; set; } = 0;
+
/// <summary>
/// book_qty
/// </summary>
[Display(Name = "book_qty")]
public int book_qty { get; set; } = 0;
+ /// <summary>
+ /// putaway_date
+ /// </summary>
+ public DateTime putaway_date { get; set; } = UtilConvert.MinDate;
+
#endregion
}
}
diff --git a/backend/ModernWMS.WMS/IServices/Asn/IAsnService.cs b/backend/ModernWMS.WMS/IServices/Asn/IAsnService.cs
index 45594d0..251c50f 100644
--- a/backend/ModernWMS.WMS/IServices/Asn/IAsnService.cs
+++ b/backend/ModernWMS.WMS/IServices/Asn/IAsnService.cs
@@ -106,7 +106,7 @@ namespace ModernWMS.WMS.IServices
/// </summary>
/// <param name="asn_id">asn id</param>
/// <returns></returns>
- Task<List<AsnsortEntity>> GetAsnsortsAsync(int asn_id);
+ Task<List<AsnsortViewModel>> GetAsnsortsAsync(int asn_id);
/// <summary>
/// update or delete asnsorts data
@@ -187,6 +187,15 @@ namespace ModernWMS.WMS.IServices
/// <returns></returns>
Task<(bool flag, string msg)> DeleteAsnmasterAsync(int id);
#endregion
+
+ #region print series number
+ /// <summary>
+ /// print series number
+ /// </summary>
+ /// <param name="input">selected asn id</param>
+ /// <returns></returns>
+ Task<List<AsnPrintSeriesNumberViewModel>> GetAsnPrintSeriesNumberAsync(List<int> input);
+ #endregion
}
}
diff --git a/backend/ModernWMS.WMS/IServices/Dispatchlist/IDispatchlistService.cs b/backend/ModernWMS.WMS/IServices/Dispatchlist/IDispatchlistService.cs
index d8a24f9..f47ed10 100644
--- a/backend/ModernWMS.WMS/IServices/Dispatchlist/IDispatchlistService.cs
+++ b/backend/ModernWMS.WMS/IServices/Dispatchlist/IDispatchlistService.cs
@@ -87,6 +87,22 @@ namespace ModernWMS.WMS.IServices
/// <returns></returns>
Task<(bool flag, string msg)> ConfirmPickByDispatchNo(string dispatch_no, CurrentUser currentUser);
+ /// <summary>
+ /// confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <param name="currentUser">current user</param>
+ /// <returns></returns>
+ Task<(bool flag, string msg)> ConfirmPickDetail(List<int> picklist_id, CurrentUser currentUser);
+
+ /// <summary>
+ /// cancel confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <param name="currentUser">current user</param>
+ /// <returns></returns>
+ Task<(bool flag, string msg)> CancelConfirmPickDetail(List<int> picklist_id, CurrentUser currentUser);
+
/// <summary>
/// package
/// </summary>
diff --git a/backend/ModernWMS.WMS/IServices/Stock/IStockService.cs b/backend/ModernWMS.WMS/IServices/Stock/IStockService.cs
index 40a2667..6842faa 100644
--- a/backend/ModernWMS.WMS/IServices/Stock/IStockService.cs
+++ b/backend/ModernWMS.WMS/IServices/Stock/IStockService.cs
@@ -75,6 +75,14 @@ namespace ModernWMS.WMS.IServices
/// <returns></returns>
Task<(List<DeliveryStatisticViewModel> datas, int totals)> DeliveryStatistic(DeliveryStatisticSearchViewModel input, CurrentUser currentUser);
+
+ /// <summary>
+ /// stock age page search
+ /// </summary>
+ /// <param name="pageSearch">args</param>
+ /// <param name="currentUser">currentUser</param>
+ /// <returns></returns>
+ Task<(List<StockAgeViewModel> data, int totals)> StockAgePageAsync(StockAgeSearchViewModel input, CurrentUser currentUser);
#endregion Api
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Services/Asn/AsnService.cs b/backend/ModernWMS.WMS/Services/Asn/AsnService.cs
index 833b915..dfdf2d8 100644
--- a/backend/ModernWMS.WMS/Services/Asn/AsnService.cs
+++ b/backend/ModernWMS.WMS/Services/Asn/AsnService.cs
@@ -2,15 +2,18 @@
* date:2022-12-22
* developer:AMo
*/
+
using Mapster;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
+using ModernWMS.Core;
using ModernWMS.Core.DBContext;
using ModernWMS.Core.DynamicSearch;
using ModernWMS.Core.JWT;
using ModernWMS.Core.Models;
using ModernWMS.Core.Services;
+using ModernWMS.Core.Utility;
using ModernWMS.WMS.Entities.Models;
using ModernWMS.WMS.Entities.ViewModels;
using ModernWMS.WMS.IServices;
@@ -25,6 +28,7 @@ namespace ModernWMS.WMS.Services
public class AsnService : BaseService<AsnEntity>, IAsnService
{
#region Args
+
/// <summary>
/// The DBContext
/// </summary>
@@ -34,9 +38,16 @@ namespace ModernWMS.WMS.Services
/// Localizer Service
/// </summary>
private readonly IStringLocalizer<Core.MultiLanguage> _stringLocalizer;
- #endregion
+
+ /// <summary>
+ /// functions
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
+ #endregion Args
#region constructor
+
/// <summary>
///Asn constructor
/// </summary>
@@ -44,15 +55,19 @@ namespace ModernWMS.WMS.Services
/// <param name="stringLocalizer">Localizer</param>
public AsnService(
SqlDBContext dBContext
- , IStringLocalizer<Core.MultiLanguage> stringLocalizer
+ , IStringLocalizer<Core.MultiLanguage> stringLocalizer
+ , FunctionHelper functionHelper
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this._functionHelper = functionHelper;
}
- #endregion
+
+ #endregion constructor
#region Api
+
/// <summary>
/// page search, sqlTitle input asn_status:0 ~ 4
/// </summary>
@@ -69,7 +84,7 @@ namespace ModernWMS.WMS.Services
queries.Add(s);
});
}
- Byte asn_status = 255;
+ Byte asn_status = 255;
var Asns = _dBContext.GetDbSet<AsnEntity>().AsNoTracking();
if (pageSearch.sqlTitle.ToLower().Contains("asn_status:alltodo"))
{
@@ -77,12 +92,12 @@ namespace ModernWMS.WMS.Services
}
else if (pageSearch.sqlTitle.ToLower().Contains("asn_status"))
{
- asn_status = Convert.ToByte(pageSearch.sqlTitle.Trim().ToLower().Replace("asn_status","").Replace(":", "").Replace(":", "").Replace("=", ""));
+ asn_status = Convert.ToByte(pageSearch.sqlTitle.Trim().ToLower().Replace("asn_status", "").Replace(":", "").Replace(":", "").Replace("=", ""));
//asn_status = asn_status.Equals(4) ? (Byte)255 : asn_status;
Asns = Asns.Where(t => t.asn_status == asn_status);
}
var Spus = _dBContext.GetDbSet<SpuEntity>().AsNoTracking();
- var Skus = _dBContext.GetDbSet<SkuEntity>().AsNoTracking();
+ var Skus = _dBContext.GetDbSet<SkuEntity>().AsNoTracking();
var Asnmasters = _dBContext.GetDbSet<AsnmasterEntity>().AsNoTracking();
var query = from m in Asns
@@ -108,6 +123,7 @@ namespace ModernWMS.WMS.Services
length_unit = p.length_unit,
volume_unit = p.volume_unit,
weight_unit = p.weight_unit,
+ price = m.price,
asn_qty = m.asn_qty,
actual_qty = m.actual_qty,
arrival_time = m.arrival_time,
@@ -127,7 +143,8 @@ namespace ModernWMS.WMS.Services
creator = m.creator,
create_time = m.create_time,
last_update_time = m.last_update_time,
- is_valid = m.is_valid
+ is_valid = m.is_valid,
+ expiry_date = m.expiry_date
};
query = query.Where(queries.AsExpression<AsnViewModel>());
int totals = await query.CountAsync();
@@ -170,6 +187,7 @@ namespace ModernWMS.WMS.Services
length_unit = p.length_unit,
volume_unit = p.volume_unit,
weight_unit = p.weight_unit,
+ price = m.price,
asn_qty = m.asn_qty,
actual_qty = m.actual_qty,
arrival_time = m.arrival_time,
@@ -189,11 +207,13 @@ namespace ModernWMS.WMS.Services
creator = m.creator,
create_time = m.create_time,
last_update_time = m.last_update_time,
- is_valid = m.is_valid
+ is_valid = m.is_valid,
+ expiry_date = m.expiry_date
};
var data = await query.FirstOrDefaultAsync(t => t.id.Equals(id));
return data ?? new AsnViewModel();
}
+
/// <summary>
/// add a new record
/// </summary>
@@ -205,7 +225,7 @@ namespace ModernWMS.WMS.Services
var DbSet = _dBContext.GetDbSet<AsnEntity>();
var entity = viewModel.Adapt<AsnEntity>();
entity.id = 0;
- entity.asn_no = await GetOrderCode(currentUser);
+ entity.asn_no = await _functionHelper.GetFormNoAsync("Asn");
entity.creator = currentUser.user_name;
entity.create_time = DateTime.Now;
entity.last_update_time = DateTime.Now;
@@ -263,6 +283,7 @@ namespace ModernWMS.WMS.Services
return code;
}
+
/// <summary>
/// update a record
/// </summary>
@@ -280,6 +301,7 @@ namespace ModernWMS.WMS.Services
entity.asn_no = viewModel.asn_no;
entity.spu_id = viewModel.spu_id;
entity.sku_id = viewModel.sku_id;
+ entity.price = viewModel.price;
entity.asn_qty = viewModel.asn_qty;
entity.weight = viewModel.weight;
entity.volume = viewModel.volume;
@@ -299,6 +321,7 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["save_failed"]);
}
}
+
/// <summary>
/// delete a record
/// </summary>
@@ -361,9 +384,11 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["save_failed"]);
}
}
- #endregion
+
+ #endregion Api
#region Flow Api
+
/// <summary>
/// Confirm Delivery
/// change the asn_status from 0 to 1
@@ -375,6 +400,7 @@ namespace ModernWMS.WMS.Services
var idList = viewModels.Where(t => t.id > 0).Select(t => t.id).ToList();
var Asns = _dBContext.GetDbSet<AsnEntity>();
var entities = await Asns.Where(t => idList.Contains(t.id)).ToListAsync();
+ var last_update_time = DateTime.Now;
if (!entities.Any())
{
return (false, "[202]" + _stringLocalizer["not_exists_entity"]);
@@ -383,13 +409,25 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + $"{_stringLocalizer["ASN_Status_Is_Not_Pre_Delivery"]}");
}
+ // get asnmaster data
+ var asnmaster_id = entities.Select(t => t.asnmaster_id).FirstOrDefault();
+ var Asnmaster = _dBContext.GetDbSet<AsnmasterEntity>();
+ var asnmasterentity = await Asnmaster.FirstOrDefaultAsync(t => t.id.Equals(asnmaster_id));
+ if (asnmasterentity == null)
+ {
+ return (false, "[202]" + _stringLocalizer["not_exists_entity"]);
+ }
+ // update asnmaster last_update_time
+ asnmasterentity.last_update_time = last_update_time;
+
entities.ForEach(t =>
{
- var vm = viewModels.FirstOrDefault(t => t.id == t.id);
+ var vm = viewModels.FirstOrDefault(t => t.id == t.id);
if (vm != null)
{
t.asn_status = 1;
t.arrival_time = vm.arrival_time;
+ t.last_update_time = last_update_time;
}
});
var qty = await _dBContext.SaveChangesAsync();
@@ -402,6 +440,7 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["confirm_failed"]);
}
}
+
/// <summary>
/// Cancel confirm, change asn_status 1 to 0
/// </summary>
@@ -411,6 +450,7 @@ namespace ModernWMS.WMS.Services
{
var Asns = _dBContext.GetDbSet<AsnEntity>();
var entities = await Asns.Where(t => idList.Contains(t.id)).ToListAsync();
+ var last_update_time = DateTime.Now;
if (!entities.Any())
{
return (false, "[202]" + _stringLocalizer["not_exists_entity"]);
@@ -419,10 +459,22 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + $"{_stringLocalizer["ASN_Status_Is_Not_Pre_Delivery"]}");
}
+ // get asnmaster data
+ var asnmaster_id = entities.Select(t => t.asnmaster_id).FirstOrDefault();
+ var Asnmaster = _dBContext.GetDbSet<AsnmasterEntity>();
+ var asnmasterentity = await Asnmaster.FirstOrDefaultAsync(t => t.id.Equals(asnmaster_id));
+ if (asnmasterentity == null)
+ {
+ return (false, "[202]" + _stringLocalizer["not_exists_entity"]);
+ }
+ // update asnmaster last_update_time
+ asnmasterentity.last_update_time = last_update_time;
+
entities.ForEach(e =>
{
e.asn_status = 0;
e.arrival_time = Core.Utility.UtilConvert.MinDate;
+ e.last_update_time = last_update_time;
});
var qty = await _dBContext.SaveChangesAsync();
if (qty > 0)
@@ -501,7 +553,7 @@ namespace ModernWMS.WMS.Services
{
e.asn_status = 1;
e.unload_time = Core.Utility.UtilConvert.MinDate;
- e.unload_person_id =0;
+ e.unload_person_id = 0;
e.unload_person = string.Empty;
e.last_update_time = DateTime.Now;
});
@@ -515,6 +567,7 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["save_failed"]);
}
}
+
/// <summary>
/// sorting, add a new asnsort record and update asn sorted_qty
/// </summary>
@@ -536,26 +589,55 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + $"{_stringLocalizer["ASN_Status_Is_Not_Pre_Sort"]}");
}
- var sortEntities = viewModels.Where(v => entities.Select(e => e.id).ToList().Contains(v.asn_id))
- .Select(v => new AsnsortEntity
+ var models = viewModels.Where(v => entities.Select(e => e.id).ToList().Contains(v.asn_id)).ToList();
+ List<AsnsortEntity> sortEntities = new List<AsnsortEntity>();
+ foreach (var v in models)
+ {
+ if (v.sorted_qty > 1 && v.is_auto_num)
{
- id = 0,
- asn_id = v.asn_id,
- sorted_qty = v.sorted_qty,
- series_number = v.series_number,
- create_time = DateTime.Now,
- creator = currentUser.user_name,
- is_valid = true,
- last_update_time = DateTime.Now,
- tenant_id = currentUser.tenant_id
- }).ToList();
+ List<string> snlist = await _functionHelper.GetFormNoListAsync("Asnsort", v.sorted_qty, currentUser.tenant_id, "sn");
+ for (int i = 0; i < v.sorted_qty; i++)
+ {
+ sortEntities.Add(new AsnsortEntity
+ {
+ id = 0,
+ asn_id = v.asn_id,
+ sorted_qty = 1,
+ series_number = snlist[i],
+ create_time = DateTime.Now,
+ creator = currentUser.user_name,
+ is_valid = true,
+ last_update_time = DateTime.Now,
+ tenant_id = currentUser.tenant_id
+ });
+ }
+ }
+ else
+ {
+ string sn = await _functionHelper.GetFormNoAsync("Asnsort", "sn");
+ sortEntities.Add(new AsnsortEntity
+ {
+ id = 0,
+ asn_id = v.asn_id,
+ sorted_qty = v.sorted_qty,
+ series_number = sn,
+ create_time = DateTime.Now,
+ creator = currentUser.user_name,
+ is_valid = true,
+ last_update_time = DateTime.Now,
+ tenant_id = currentUser.tenant_id
+ });
+ }
+ }
await Asnsorts.AddRangeAsync(sortEntities);
entities.ForEach(e =>
{
int sum_sorted_qty = viewModels.Where(t => t.asn_id.Equals(e.id)).Sum(v => v.sorted_qty);
+ var expiry_date = viewModels.Where(t => t.asn_id.Equals(e.id)).Select(v => v.expiry_date).FirstOrDefault();
e.sorted_qty += sum_sorted_qty;
e.last_update_time = DateTime.Now;
+ e.expiry_date = expiry_date;
});
var qty = await _dBContext.SaveChangesAsync();
if (qty > 0)
@@ -567,24 +649,44 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["save_failed"]);
}
}
+
/// <summary>
/// get asnsorts list by asn_id
/// </summary>
/// <param name="asn_id">asn id</param>
/// <returns></returns>
- public async Task<List<AsnsortEntity>> GetAsnsortsAsync(int asn_id)
+ public async Task<List<AsnsortViewModel>> GetAsnsortsAsync(int asn_id)
{
var Asnsorts = _dBContext.GetDbSet<AsnsortEntity>();
- var sortsEntities = await Asnsorts.AsNoTracking().Where(t => t.asn_id == asn_id).ToListAsync();
- if (sortsEntities.Any())
+ var asns = _dBContext.Set<AsnEntity>().AsNoTracking();
+
+ var data = await (from m in asns
+ join d in Asnsorts on m.id equals d.asn_id
+ where m.id == asn_id
+ select new AsnsortViewModel
+ {
+ id = d.id,
+ asn_id = asn_id,
+ sorted_qty = d.sorted_qty,
+ series_number = d.series_number,
+ putaway_qty = d.putaway_qty,
+ expiry_date = m.expiry_date,
+ creator = d.creator,
+ create_time = d.create_time,
+ last_update_time = d.last_update_time,
+ is_valid = d.is_valid,
+ tenant_id = d.tenant_id
+ }).ToListAsync();
+ if (data != null && data.Count > 0)
{
- return sortsEntities;
+ return data;
}
else
{
- return new List<AsnsortEntity>();
+ return new List<AsnsortViewModel>();
}
}
+
/// <summary>
/// update or delete asnsorts data
/// </summary>
@@ -606,14 +708,12 @@ namespace ModernWMS.WMS.Services
{
t.last_update_time = DateTime.Now;
t.is_valid = true;
- t.create_time = t.create_time.Year < 1985 ? DateTime.Now : t.create_time;
- t.creator = string.IsNullOrEmpty(t.creator) ? user.user_name : t.creator;
});
Asnsorts.UpdateRange(updateEntities);
}
var qty = await _dBContext.SaveChangesAsync();
- if (qty > 0)
+ if (qty >= 0)
{
var Asns = _dBContext.GetDbSet<AsnEntity>();
var asnids = entities.Select(t => t.asn_id).Distinct().ToList();
@@ -636,6 +736,10 @@ namespace ModernWMS.WMS.Services
{
e.sorted_qty = s.sorted_qty;
}
+ else
+ {
+ e.sorted_qty = 0;
+ }
});
await _dBContext.SaveChangesAsync();
}
@@ -806,6 +910,8 @@ namespace ModernWMS.WMS.Services
entity.asn_status = 4;
}
entity.last_update_time = DateTime.Now;
+ // expiry_date
+ var expiry_date = entity.expiry_date;
// 获取已上架数小于分拣数的分拣记录
var sortEntities = await Asnsorts.Where(t => t.asn_id == viewModels[0].asn_id && t.sorted_qty > t.putaway_qty).ToListAsync();
@@ -841,10 +947,15 @@ namespace ModernWMS.WMS.Services
{
entity.damage_qty += viewModel.putaway_qty;
}
+ DateTime putaway_date = DateTime.Now.ToString("yyyy-MM-dd").ObjToDate();
+ // 2024年3月14日 09:40:25 增加单价
var stockEntity = await Stocks.FirstOrDefaultAsync(t => t.sku_id.Equals(entity.sku_id)
&& t.goods_location_id.Equals(viewModel.goods_location_id)
&& t.goods_owner_id.Equals(viewModel.goods_owner_id)
&& t.series_number.Equals(viewModel.series_number)
+ && t.expiry_date.Equals(expiry_date)
+ && t.price.Equals(entity.price)
+ && t.putaway_date.Equals(putaway_date)
);
if (stockEntity == null)
{
@@ -858,6 +969,9 @@ namespace ModernWMS.WMS.Services
is_freeze = false,
last_update_time = DateTime.Now,
tenant_id = currentUser.tenant_id,
+ expiry_date = expiry_date,
+ price = entity.price,
+ putaway_date = putaway_date,
id = 0
};
await Stocks.AddAsync(stockEntity);
@@ -942,9 +1056,11 @@ namespace ModernWMS.WMS.Services
}
*/
}
- #endregion
- #region Arrival list
+ #endregion Flow Api
+
+ #region Arrival list
+
/// <summary>
/// Arrival list
/// </summary>
@@ -1013,17 +1129,21 @@ namespace ModernWMS.WMS.Services
volume = a.volume,
supplier_id = a.supplier_id,
supplier_name = a.supplier_name,
- is_valid = a.is_valid
+ is_valid = a.is_valid,
+ expiry_date = a.expiry_date,
+ price = a.price,
+ sorted_qty = a.sorted_qty,
}).ToList()
};
query = query.Where(queries.AsExpression<AsnmasterBothViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderByDescending(t => t.create_time)
+ var list = await query.OrderByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
return (list, totals);
}
+
/// <summary>
/// get Arrival list
/// </summary>
@@ -1078,7 +1198,10 @@ namespace ModernWMS.WMS.Services
volume = a.volume,
supplier_id = a.supplier_id,
supplier_name = a.supplier_name,
- is_valid = a.is_valid
+ is_valid = a.is_valid,
+ sorted_qty = a.sorted_qty,
+ expiry_date = a.expiry_date,
+ price = a.price
}).ToList()
};
var data = await query.FirstOrDefaultAsync();
@@ -1095,7 +1218,7 @@ namespace ModernWMS.WMS.Services
{
var Asns = _dBContext.GetDbSet<AsnEntity>();
var Asnmasters = _dBContext.GetDbSet<AsnmasterEntity>();
- string asn_no = await GetOrderCode(currentUser);
+ string asn_no = await _functionHelper.GetFormNoAsync("Asnmaster");
var entity = new AsnmasterEntity
{
id = 0,
@@ -1131,7 +1254,8 @@ namespace ModernWMS.WMS.Services
create_time = DateTime.Now,
last_update_time = DateTime.Now,
is_valid = true,
- tenant_id = currentUser.tenant_id
+ tenant_id = currentUser.tenant_id,
+ price = d.price
}).ToList()
};
await Asnmasters.AddAsync(entity);
@@ -1145,6 +1269,7 @@ namespace ModernWMS.WMS.Services
return (0, _stringLocalizer["save_failed"]);
}
}
+
/// <summary>
/// add a new record
/// </summary>
@@ -1188,6 +1313,7 @@ namespace ModernWMS.WMS.Services
d.goods_owner_id = viewModel.goods_owner_id;
d.goods_owner_name = viewModel.goods_owner_name;
d.last_update_time = DateTime.Now;
+ d.price = vm.price;
}
});
}
@@ -1214,7 +1340,8 @@ namespace ModernWMS.WMS.Services
create_time = DateTime.Now,
last_update_time = DateTime.Now,
is_valid = true,
- tenant_id = currentUser.tenant_id
+ tenant_id = currentUser.tenant_id,
+ price = d.price
}).ToList();
entity.detailList.AddRange(adds);
}
@@ -1252,7 +1379,46 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["delete_failed"]);
}
}
+
+ #endregion Arrival list
+
+ #region print series number
+ /// <summary>
+ /// print series number
+ /// </summary>
+ /// <param name="input">selected asn id</param>
+ /// <returns></returns>
+ public async Task<List<AsnPrintSeriesNumberViewModel>> GetAsnPrintSeriesNumberAsync(List<int> input)
+ {
+ var Spus = _dBContext.GetDbSet<SpuEntity>().AsNoTracking();
+ var Skus = _dBContext.GetDbSet<SkuEntity>().AsNoTracking();
+ var Asns = _dBContext.GetDbSet<AsnEntity>().AsNoTracking();
+ var Asnmasters = _dBContext.GetDbSet<AsnmasterEntity>().AsNoTracking();
+ var sorts = _dBContext.GetDbSet<AsnsortEntity>().AsNoTracking();
+
+ var query = from m in Asnmasters
+ join a in Asns on m.id equals a.asnmaster_id
+ join p in Spus.AsNoTracking() on a.spu_id equals p.id
+ join k in Skus.AsNoTracking() on a.sku_id equals k.id
+ join s in sorts on a.id equals s.asn_id
+ where input.Contains(a.id)
+ select new AsnPrintSeriesNumberViewModel
+ {
+ asn_id = a.id,
+ asnmaster_id = m.id,
+ asn_no = m.asn_no,
+ sku_id = a.sku_id,
+ sku_code = k.sku_code,
+ sku_name = k.sku_name,
+ spu_code = p.spu_code,
+ spu_name = p.spu_name,
+ series_number = s.series_number
+ };
+ var data = await query.OrderBy(t => t.asn_id).ToListAsync();
+ data ??= new List<AsnPrintSeriesNumberViewModel>();
+ return data;
+ }
+
#endregion
}
-}
-
+}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs b/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs
index f164677..2eea2cc 100644
--- a/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs
+++ b/backend/ModernWMS.WMS/Services/Dispatchlist/DispatchlistService.cs
@@ -7,6 +7,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
+using ModernWMS.Core;
using ModernWMS.Core.DBContext;
using ModernWMS.Core.DynamicSearch;
using ModernWMS.Core.JWT;
@@ -37,6 +38,11 @@ namespace ModernWMS.WMS.Services
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+ /// <summary>
+ /// functions
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
#endregion Args
#region constructor
@@ -49,10 +55,12 @@ namespace ModernWMS.WMS.Services
public DispatchlistService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
+ , FunctionHelper functionHelper
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this._functionHelper = functionHelper;
}
#endregion constructor
@@ -140,6 +148,8 @@ namespace ModernWMS.WMS.Services
length_unit = spu.length_unit,
volume_unit = spu.volume_unit,
weight_unit = spu.weight_unit,
+ pick_checker = d.pick_checker,
+ pick_checker_id = d.pick_checker_id,
is_todo = pageSearch.sqlTitle.Contains("dispatch_status") || (pageSearch.sqlTitle.Equals("package") && d.dispatch_status.Equals(4))
|| (pageSearch.sqlTitle.Equals("weight") && d.dispatch_status.Equals(5))
|| (pageSearch.sqlTitle.Equals("delivery") && d.dispatch_status.Equals(6)) ? false : true,
@@ -148,7 +158,7 @@ namespace ModernWMS.WMS.Services
.Where(queries.AsExpression<DispatchlistViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderBy(t => t.is_todo == true ? 0 : 1).ThenByDescending(t => t.create_time)
+ var list = await query.OrderBy(t => t.is_todo == true ? 0 : 1).ThenByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
@@ -210,7 +220,9 @@ namespace ModernWMS.WMS.Services
bar_code = sku.bar_code,
unpicked_qty = d.qty - d.picked_qty,
sku_name = sku.sku_name,
- unit = sku.unit
+ unit = sku.unit,
+ pick_checker = d.pick_checker,
+ pick_checker_id = d.pick_checker_id,
}).ToListAsync();
return datas;
}
@@ -230,6 +242,7 @@ namespace ModernWMS.WMS.Services
var delete_id_list = new List<int>();
var sku_id_list = viewModels.Select(t => t.sku_id).ToList();
var skus = await (_dBContext.GetDbSet<SkuEntity>().AsNoTracking().Where(t => sku_id_list.Contains(t.id))).ToListAsync();
+ var now_time = DateTime.Now;
if (entities.Any(t => t.dispatch_status != 1 && t.dispatch_status != 0))
{
return (false, "[202]" + _stringLocalizer["data_changed"]);
@@ -255,7 +268,7 @@ namespace ModernWMS.WMS.Services
}
entity.sku_id = vm.sku_id;
entity.qty = vm.qty;
- entity.last_update_time = DateTime.Now;
+ entity.last_update_time = now_time;
var sku = skus.FirstOrDefault(t => t.id == entity.sku_id);
if (sku != null)
{
@@ -270,8 +283,8 @@ namespace ModernWMS.WMS.Services
id = 0,
dispatch_no = dispatch_no,
creator = currentUser.user_name,
- create_time = DateTime.Now,
- last_update_time = DateTime.Now,
+ create_time = now_time,
+ last_update_time = now_time,
dispatch_status = dispatch_status,
sku_id = vm.sku_id,
qty = vm.qty
@@ -341,7 +354,12 @@ namespace ModernWMS.WMS.Services
warehouse_area_name = location.warehouse_area_name,
warehouse_area_property = location.warehouse_area_property,
warehouse_name = location.warehouse_name,
- series_number = dpl.series_number
+ series_number = dpl.series_number,
+ expiry_date = dpl.expiry_date,
+ price = dpl.price,
+ picker = dpl.picker,
+ picker_id = dpl.picker_id,
+ putaway_date = dpl.putaway_date,
}).ToListAsync();
return datas;
}
@@ -473,6 +491,8 @@ namespace ModernWMS.WMS.Services
waybill_no = dl.waybill_no,
carrier = dl.carrier,
freightfee = dl.freightfee,
+ pick_checker = dl.pick_checker,
+ pick_checker_id = dl.pick_checker_id,
}
).ToListAsync();
return data.Adapt<List<DispatchlistDetailViewModel>>();
@@ -490,14 +510,15 @@ namespace ModernWMS.WMS.Services
var entities = viewModel.Adapt<List<DispatchlistEntity>>();
var sku_id_list = entities.Select(t => t.sku_id).ToList();
var skus = await _dBContext.GetDbSet<SkuEntity>().Where(t => sku_id_list.Contains(t.id)).ToListAsync();
- var dispatch_no = await GetOrderCode(currentUser);
+ var dispatch_no = await _functionHelper.GetFormNoAsync("Dispatchlist");
+ var now_time = DateTime.Now;
foreach (var entity in entities)
{
var sku = skus.FirstOrDefault(t => t.id == entity.sku_id);
entity.id = 0;
- entity.create_time = DateTime.Now;
+ entity.create_time = now_time;
entity.creator = currentUser.user_name;
- entity.last_update_time = DateTime.Now;
+ entity.last_update_time = now_time;
entity.tenant_id = currentUser.tenant_id;
if (sku != null)
{
@@ -565,7 +586,7 @@ namespace ModernWMS.WMS.Services
var stock_group_datas = from stock in stock_DbSet.AsNoTracking()
join gl in _dBContext.GetDbSet<GoodslocationEntity>().AsNoTracking() on stock.goods_location_id equals gl.id
where stock.tenant_id == currentUser.user_id
- group stock by new { stock.id, stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number } into sg
+ group stock by new { stock.id, stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number, stock.expiry_date, stock.price,stock.putaway_date } into sg
select new
{
stock_id = sg.Key.id,
@@ -573,51 +594,63 @@ namespace ModernWMS.WMS.Services
sku_id = sg.Key.sku_id,
goods_location_id = sg.Key.goods_location_id,
series_number = sg.Key.series_number,
+ sg.Key.expiry_date,
+ sg.Key.price,
+ sg.Key.putaway_date,
qty_frozen = sg.Where(t => t.is_freeze == true).Sum(e => e.qty),
qty = sg.Sum(t => t.qty)
};
var dispatch_group_datas = from dp in DbSet.AsNoTracking()
join dpp in dispatchpick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number } into dg
+ group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number, dpp.expiry_date, dpp.price,dpp.putaway_date } into dg
select new
{
goods_owner_id = dg.Key.goods_owner_id,
sku_id = dg.Key.sku_id,
goods_location_id = dg.Key.goods_location_id,
series_number = dg.Key.series_number,
+ dg.Key.expiry_date,
+ dg.Key.price,
+ dg.Key.putaway_date,
qty_locked = dg.Sum(t => t.pick_qty)
};
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false
- group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number } into pdg
+ group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number, pd.expiry_date, pd.price,pd.putaway_date } into pdg
select new
{
goods_owner_id = pdg.Key.goods_owner_id,
sku_id = pdg.Key.sku_id,
goods_location_id = pdg.Key.goods_location_id,
series_number = pdg.Key.series_number,
+ pdg.Key.expiry_date,
+ pdg.Key.price,
+ pdg.Key.putaway_date,
qty_locked = pdg.Sum(t => t.qty)
};
var move_locked_group_datas = from m in move_DBSet.AsNoTracking()
where m.move_status == 0
- group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number } into mg
+ group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price,m.putaway_date } into mg
select new
{
goods_owner_id = mg.Key.goods_owner_id,
sku_id = mg.Key.sku_id,
goods_location_id = mg.Key.orig_goods_location_id,
series_number = mg.Key.series_number,
+ mg.Key.expiry_date,
+ mg.Key.price,
+ mg.Key.putaway_date,
qty_locked = mg.Sum(t => t.qty)
};
var datas = await (from dl in DbSet
join sg in stock_group_datas on dl.sku_id equals sg.sku_id into sg_left
from sg in sg_left.DefaultIfEmpty()
- join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number } into dp_left
+ join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number, dp.expiry_date, dp.price,dp.putaway_date } into dp_left
from dp in dp_left.DefaultIfEmpty()
- join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number } into pl_left
+ join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number, pl.expiry_date, pl.price,pl.putaway_date } into pl_left
from pl in pl_left.DefaultIfEmpty()
- join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number } into m_left
+ join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price,m.putaway_date } into m_left
from m in m_left.DefaultIfEmpty()
join sku in sku_DBSet on dl.sku_id equals sku.id
join spu in spu_DBSet on sku.spu_id equals spu.id
@@ -648,7 +681,10 @@ namespace ModernWMS.WMS.Services
location_name = gl.location_name == null ? "" : gl.location_name,
warehouse_area_name = gl.warehouse_area_name == null ? "" : gl.warehouse_area_name,
warehouse_name = gl.warehouse_name == null ? "" : gl.warehouse_name,
- series_number = sg.series_number
+ series_number = sg.series_number==null ? "":sg.series_number,
+ expiry_date = sg.expiry_date==null ? UtilConvert.MinDate : sg.expiry_date,
+ price = sg.price == null ? 0:sg.price,
+ putaway_date = sg.putaway_date == null ? UtilConvert.MinDate:sg.putaway_date,
}).ToListAsync();
var res = (from d in datas
group d by new
@@ -700,6 +736,9 @@ namespace ModernWMS.WMS.Services
warehouse_name = d.warehouse_name,
pick_qty = 0,
series_number = d.series_number,
+ expiry_date = d.expiry_date,
+ price = d.price,
+ putaway_date=d.putaway_date,
}
).OrderByDescending(o => o.qty_available).ToList();
int pick_qty = 0;
@@ -738,6 +777,7 @@ namespace ModernWMS.WMS.Services
var new_dispatchlists = new List<DispatchlistEntity>();
var topick_viewmodels = new List<StockViewModel>();
var sku_id_list = viewModels.Select(t => t.sku_id).ToList();
+ var now_time = DateTime.Now;
foreach (var vm in viewModels.Where(t => t.confirm == true).ToList())
{
stock_id_list.AddRange(vm.pick_list.Where(t => t.pick_qty > 0).Select(t => t.stock_id).ToList());
@@ -753,7 +793,7 @@ namespace ModernWMS.WMS.Services
if (vm.confirm == true)
{
d.dispatch_status = 2;
- d.last_update_time = DateTime.Now;
+ d.last_update_time = now_time;
d.lock_qty = vm.pick_list.Sum(t => t.pick_qty);
foreach (var p in vm.pick_list.Where(t => t.pick_qty > 0).ToList())
{
@@ -764,9 +804,12 @@ namespace ModernWMS.WMS.Services
dispatchlist_id = p.dispatchlist_id,
goods_location_id = p.goods_location_id,
goods_owner_id = p.goods_owner_id,
- last_update_time = DateTime.Now,
+ last_update_time = now_time,
series_number = p.series_number,
+ expiry_date = p.expiry_date,
+ price = p.price,
pick_qty = p.pick_qty,
+ putaway_date = p.putaway_date,
});
topick_viewmodels.Add(new StockViewModel { id = p.stock_id, qty = p.pick_qty });
}
@@ -800,7 +843,7 @@ namespace ModernWMS.WMS.Services
}
var stock_group_datas = from stock in stock_DBSet.AsNoTracking()
where stock_id_list.Contains(stock.id)
- group stock by new { stock.id, stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number } into sg
+ group stock by new { stock.id, stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number, stock.expiry_date, stock.price,stock.putaway_date } into sg
select new
{
stock_id = sg.Key.id,
@@ -808,49 +851,61 @@ namespace ModernWMS.WMS.Services
sku_id = sg.Key.sku_id,
goods_location_id = sg.Key.goods_location_id,
series_number = sg.Key.series_number,
+ sg.Key.expiry_date,
+ sg.Key.price,
+ sg.Key.putaway_date,
qty_frozen = sg.Where(t => t.is_freeze == true).Sum(e => e.qty),
qty = sg.Sum(t => t.qty)
};
var dispatch_group_datas = from dp in DBSet.AsNoTracking()
join dpp in pick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number } into dg
+ group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number, dpp.expiry_date, dpp.price,dpp.putaway_date } into dg
select new
{
goods_owner_id = dg.Key.goods_owner_id,
sku_id = dg.Key.sku_id,
goods_location_id = dg.Key.goods_location_id,
series_number = dg.Key.series_number,
+ dg.Key.expiry_date,
+ dg.Key.price,
+ dg.Key.putaway_date,
qty_locked = dg.Sum(t => t.pick_qty)
};
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false
- group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number } into pdg
+ group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number, pd.expiry_date, pd.price,pd.putaway_date } into pdg
select new
{
goods_owner_id = pdg.Key.goods_owner_id,
sku_id = pdg.Key.sku_id,
goods_location_id = pdg.Key.goods_location_id,
series_number = pdg.Key.series_number,
+ pdg.Key.expiry_date,
+ pdg.Key.price,
+ pdg.Key.putaway_date,
qty_locked = pdg.Sum(t => t.qty)
};
var move_locked_group_datas = from m in move_DBSet.AsNoTracking()
where m.move_status == 0
- group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number } into mg
+ group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price,m.putaway_date } into mg
select new
{
goods_owner_id = mg.Key.goods_owner_id,
sku_id = mg.Key.sku_id,
goods_location_id = mg.Key.orig_goods_location_id,
series_number = mg.Key.series_number,
+ mg.Key.expiry_date,
+ mg.Key.price,
+ mg.Key.putaway_date,
qty_locked = mg.Sum(t => t.qty)
};
var stock_datas = await (from sg in stock_group_datas
- join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number } into dp_left
+ join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number, dp.expiry_date, dp.price,dp.putaway_date } into dp_left
from dp in dp_left.DefaultIfEmpty()
- join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number } into pl_left
+ join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number, pl.expiry_date, pl.price,pl.putaway_date } into pl_left
from pl in pl_left.DefaultIfEmpty()
- join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number } into m_left
+ join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price,sg.putaway_date } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price,m.putaway_date } into m_left
from m in m_left.DefaultIfEmpty()
select new
{
@@ -866,7 +921,7 @@ namespace ModernWMS.WMS.Services
return (false, "[202]" + _stringLocalizer["data_changed"]);
}
await pick_DBSet.AddRangeAsync(pick_datas);
- var dispatch_no = await GetOrderCode(currentUser);
+ var dispatch_no = await _functionHelper.GetFormNoAsync("Dispatchlist");
var sku_datas = await _dBContext.GetDbSet<SkuEntity>().Where(t => sku_id_list.Contains(t.id)).ToListAsync();
foreach (var nd in new_dispatchlists)
{
@@ -882,14 +937,10 @@ namespace ModernWMS.WMS.Services
};
await DBSet.AddRangeAsync(new_dispatchlists);
var qty = await _dBContext.SaveChangesAsync();
- if (qty > 0)
- {
- return (true, _stringLocalizer["operation_success"]);
- }
- else
- {
- return (false, _stringLocalizer["operation_failed"]);
- }
+
+ return (true, _stringLocalizer["operation_success"]);
+
+
}
/// <summary>
@@ -907,7 +958,7 @@ namespace ModernWMS.WMS.Services
{
return (false, _stringLocalizer["status_changed"]);
}
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
var dispatch_id_list = entities.Select(t => t.id).ToList();
var pick_entities = await pick_DBSet.Where(t => dispatch_id_list.Contains(t.dispatchlist_id)).ToListAsync();
if (viewModel.dispatch_status == 3)
@@ -915,12 +966,12 @@ namespace ModernWMS.WMS.Services
foreach (var pick in pick_entities)
{
pick.picked_qty = 0;
- pick.last_update_time = time;
+ pick.last_update_time = now_time;
}
foreach (var entity in entities)
{
entity.picked_qty = 0;
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.dispatch_status = 2;
}
}
@@ -930,7 +981,7 @@ namespace ModernWMS.WMS.Services
foreach (var entity in entities)
{
entity.lock_qty = 0;
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.dispatch_status = 1;
}
}
@@ -983,7 +1034,7 @@ namespace ModernWMS.WMS.Services
{
var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
var entity = await DBSet.Where(t => t.id == id).FirstOrDefaultAsync();
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
if (entity == null)
{
return (false, _stringLocalizer["not_exists_entity"]);
@@ -1022,7 +1073,7 @@ namespace ModernWMS.WMS.Services
{
return (false, _stringLocalizer["status_changed"]);
}
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
var qty = await _dBContext.SaveChangesAsync();
if (qty > 0)
{
@@ -1047,16 +1098,81 @@ namespace ModernWMS.WMS.Services
var entities = await DBSet.Where(t => t.dispatch_status == 2 && t.dispatch_no == dispatch_no && t.tenant_id == currentUser.tenant_id).ToListAsync();
var dispatchlist_id_list = entities.Select(t => t.id).ToList();
var pick_datas = await pick_DBSet.Where(t => dispatchlist_id_list.Contains(t.dispatchlist_id)).ToListAsync();
+ var now_time = DateTime.Now;
entities.ForEach(t =>
{
t.picked_qty = t.lock_qty;
t.dispatch_status = 3;
- t.last_update_time = DateTime.Now;
+ t.last_update_time = now_time;
+ t.pick_checker = currentUser.user_name;
+ t.pick_checker_id = currentUser.user_id;
});
pick_datas.ForEach(t =>
{
t.picked_qty = t.pick_qty;
- t.last_update_time = DateTime.Now;
+ t.last_update_time = now_time;
+ });
+ var qty = await _dBContext.SaveChangesAsync();
+ if (qty > 0)
+ {
+ return (true, _stringLocalizer["operation_success"]);
+ }
+ else
+ {
+ return (false, _stringLocalizer["operation_failed"]);
+ }
+ }
+
+ /// <summary>
+ /// confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <param name="currentUser">current user</param>
+ /// <returns></returns>
+ public async Task<(bool flag, string msg)> ConfirmPickDetail(List<int> picklist_id, CurrentUser currentUser)
+ {
+ var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
+ var pick_DBSet = _dBContext.GetDbSet<DispatchpicklistEntity>();
+ var pick_datas = await pick_DBSet.Where(t => picklist_id.Contains(t.id)).ToListAsync();
+ if (pick_datas.Any(t=>t.picker_id > 0) || pick_datas.Any(t=>t.picked_qty>0))
+ {
+ return (false, _stringLocalizer["data_changed"]);
+ }
+ pick_datas.ForEach(t=>
+ {
+ t.picker = currentUser.user_name;
+ t.picker_id = currentUser.user_id;
+ });
+ var qty = await _dBContext.SaveChangesAsync();
+ if (qty > 0)
+ {
+ return (true, _stringLocalizer["operation_success"]);
+ }
+ else
+ {
+ return (false, _stringLocalizer["operation_failed"]);
+ }
+ }
+
+ /// <summary>
+ /// cancel confirm pick detail
+ /// </summary>
+ /// <param name="picklist_id">dispatch list pick detail id</param>
+ /// <param name="currentUser">current user</param>
+ /// <returns></returns>
+ public async Task<(bool flag, string msg)> CancelConfirmPickDetail(List<int> picklist_id, CurrentUser currentUser)
+ {
+ var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
+ var pick_DBSet = _dBContext.GetDbSet<DispatchpicklistEntity>();
+ var pick_datas = await pick_DBSet.Where(t => picklist_id.Contains(t.id) ).ToListAsync();
+ if (pick_datas.Any(t =>t.picker_id == 0) || pick_datas.Any(t => t.picked_qty > 0))
+ {
+ return (false, _stringLocalizer["data_changed"]);
+ }
+ pick_datas.ForEach(t =>
+ {
+ t.picker = "";
+ t.picker_id = 0;
});
var qty = await _dBContext.SaveChangesAsync();
if (qty > 0)
@@ -1081,7 +1197,7 @@ namespace ModernWMS.WMS.Services
var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
var dispatchlist_id_list = viewModels.Select(t => t.id).ToList();
var entities = await DBSet.Where(t => dispatchlist_id_list.Contains(t.id)).ToListAsync();
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
var code = GetPackageOrWeightCode();
foreach (var vm in viewModels)
{
@@ -1094,10 +1210,10 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + _stringLocalizer["unpackgeqty_lessthen"]);
}
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.package_person = currentUser.user_name;
entity.package_qty += vm.package_qty;
- entity.package_time = time;
+ entity.package_time = now_time;
entity.package_no = code;
entity.dispatch_status = 4;
}
@@ -1169,7 +1285,7 @@ namespace ModernWMS.WMS.Services
var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
var dispatchlist_id_list = viewModels.Select(t => t.id).ToList();
var entities = await DBSet.Where(t => dispatchlist_id_list.Contains(t.id)).ToListAsync();
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
var code = GetPackageOrWeightCode();
foreach (var vm in viewModels)
{
@@ -1182,7 +1298,7 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + _stringLocalizer["unweightqty_lessthen"]);
}
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.weighing_person = currentUser.user_name;
entity.weighing_qty += vm.weighing_qty;
entity.weighing_weight += vm.weighing_weight;
@@ -1225,7 +1341,7 @@ namespace ModernWMS.WMS.Services
{
proposedValues["dispatch_status"] = 5;
}
- proposedValues["last_update_time"] = DateTime.Now;
+ proposedValues["last_update_time"] = now_time;
}
// Refresh original values to bypass next concurrency check
entry.OriginalValues.SetValues(databaseValues);
@@ -1261,14 +1377,14 @@ namespace ModernWMS.WMS.Services
var pick_DBSet = _dBContext.GetDbSet<DispatchpicklistEntity>();
var stock_DBSet = _dBContext.GetDbSet<StockEntity>();
var entities = await DBSet.Where(t => dispatchlist_id_list.Contains(t.id)).ToListAsync();
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
foreach (var entity in entities)
{
if (entity.dispatch_status != 3 && entity.dispatch_status != 4 && entity.dispatch_status != 5)
{
return (false, "[202]" + _stringLocalizer["data_changed"]);
}
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.dispatch_status = 6;
entity.lock_qty = 0;
entity.actual_qty = entity.picked_qty;
@@ -1276,26 +1392,26 @@ namespace ModernWMS.WMS.Services
}
var pick_sql = pick_DBSet.Where(t => dispatchlist_id_list.Contains(t.dispatchlist_id));
var pick_datas = await pick_sql.ToListAsync();
- var picks_g = pick_sql.AsNoTracking().GroupBy(e => new { e.goods_location_id, e.sku_id, e.goods_owner_id, e.series_number }).Select(c => new { c.Key.goods_location_id, c.Key.sku_id, c.Key.goods_owner_id, c.Key.series_number, picked_qty = c.Sum(t => t.picked_qty) });
+ var picks_g = pick_sql.AsNoTracking().GroupBy(e => new { e.goods_location_id, e.sku_id, e.goods_owner_id, e.series_number, e.expiry_date, e.price,e.putaway_date }).Select(c => new { c.Key.goods_location_id, c.Key.sku_id, c.Key.goods_owner_id, c.Key.series_number, c.Key.expiry_date, c.Key.price,c.Key.putaway_date, picked_qty = c.Sum(t => t.picked_qty) });
var picks = await picks_g.ToListAsync();
var stocks = await (from stock in stock_DBSet
- where pick_sql.Any(t => t.goods_location_id == stock.goods_location_id && t.sku_id == stock.sku_id && t.goods_owner_id == stock.goods_owner_id && t.series_number == stock.series_number)
+ where pick_sql.Any(t => t.goods_location_id == stock.goods_location_id && t.sku_id == stock.sku_id && t.goods_owner_id == stock.goods_owner_id && t.series_number == stock.series_number && t.expiry_date == stock.expiry_date && t.price == stock.price && t.putaway_date == stock.putaway_date)
select stock).ToListAsync();
foreach (var pick in picks)
{
- var s = stocks.FirstOrDefault(t => t.goods_location_id == pick.goods_location_id && t.sku_id == pick.sku_id && t.goods_owner_id == pick.goods_owner_id && t.series_number == pick.series_number);
+ var s = stocks.FirstOrDefault(t => t.goods_location_id == pick.goods_location_id && t.sku_id == pick.sku_id && t.goods_owner_id == pick.goods_owner_id && t.series_number == pick.series_number && t.expiry_date == pick.expiry_date && t.price == pick.price && t.putaway_date == pick.putaway_date);
if (s == null)
{
return (false, "[202]" + _stringLocalizer["data_changed"]);
}
s.qty -= pick.picked_qty;
- s.last_update_time = time;
+ s.last_update_time = now_time;
stock_DBSet.Update(s);
}
foreach (var pick in pick_datas)
{
pick.is_update_stock = true;
- pick.last_update_time = DateTime.Now;
+ pick.last_update_time = now_time;
}
var saved = false;
int res = 0;
@@ -1319,7 +1435,7 @@ namespace ModernWMS.WMS.Services
{
return (false, "[202]" + _stringLocalizer["data_changed"]);
}
- proposedValues["last_update_time"] = DateTime.Now;
+ proposedValues["last_update_time"] = now_time;
}
else if (entry.Entity is StockEntity)
{
@@ -1331,7 +1447,7 @@ namespace ModernWMS.WMS.Services
return (false, "[202]" + _stringLocalizer["data_changed"]);
}
proposedValues["qty"] = UtilConvert.ObjToInt(databaseValues["qty"]) - t_p.picked_qty;
- proposedValues["last_update_time"] = DateTime.Now;
+ proposedValues["last_update_time"] = now_time;
// Refresh original values to bypass next concurrency check
entry.OriginalValues.SetValues(databaseValues);
}
@@ -1364,7 +1480,7 @@ namespace ModernWMS.WMS.Services
var freightfee_id_list = viewModels.Select(t => t.freightfee_id).Distinct().ToList();
var entities = await DBSet.Where(t => dispatchlist_id_list.Contains(t.id)).ToListAsync();
var freightfees = await _dBContext.GetDbSet<FreightfeeEntity>().Where(t => freightfee_id_list.Contains(t.id)).ToListAsync();
- var time = DateTime.Now;
+ var now_time = DateTime.Now;
foreach (var entity in entities)
{
var vm = viewModels.FirstOrDefault(t => t.id == entity.id);
@@ -1373,7 +1489,7 @@ namespace ModernWMS.WMS.Services
var freightfee = freightfees.FirstOrDefault(t => t.id == vm.freightfee_id);
if (freightfee != null)
{
- entity.last_update_time = time;
+ entity.last_update_time = now_time;
entity.carrier = freightfee.carrier;
entity.waybill_no = vm.waybill_no;
if (entity.weighing_no != "")
@@ -1408,6 +1524,7 @@ namespace ModernWMS.WMS.Services
var DBSet = _dBContext.GetDbSet<DispatchlistEntity>();
var dispatchlist_id_list = viewModels.Select(t => t.id).ToList();
var entities = await DBSet.Where(t => dispatchlist_id_list.Contains(t.id)).ToListAsync();
+ var now_time = DateTime.Now;
foreach (var entity in entities)
{
var vm = viewModels.FirstOrDefault(t => t.id == t.id && t.dispatch_status == entity.dispatch_status);
@@ -1417,7 +1534,7 @@ namespace ModernWMS.WMS.Services
}
entity.sign_qty = entity.actual_qty - vm.damage_qty;
entity.damage_qty = vm.damage_qty;
- entity.last_update_time = DateTime.Now;
+ entity.last_update_time = now_time;
entity.dispatch_status = 7;
}
var res = await _dBContext.SaveChangesAsync();
@@ -1481,8 +1598,9 @@ namespace ModernWMS.WMS.Services
var customer_list = await _dBContext.GetDbSet<CustomerEntity>().Where(t => t.tenant_id == currentUser.tenant_id && import_customer_name.Contains(t.customer_name)).ToListAsync();
var entities = new List<DispatchlistEntity>();
var groups = viewModels.Select(t => t.import_group).Distinct().ToList();
- var groups_code = await GetOrderCodeList(currentUser, groups.Count());
+ var groups_code = await _functionHelper.GetFormNoListAsync("Dispatchlist", groups.Count);
var group_code_dic = new Dictionary<int, string>();
+ var now_time = DateTime.Now;
for (int i = 0; i < groups.Count(); i++)
{
group_code_dic.Add(groups[i], groups_code[i]);
@@ -1506,8 +1624,8 @@ namespace ModernWMS.WMS.Services
sku_id = sku.id,
qty = vm.qty,
creator = currentUser.user_name,
- create_time = DateTime.Now,
- last_update_time = DateTime.Now,
+ create_time = now_time,
+ last_update_time = now_time,
tenant_id = currentUser.tenant_id,
dispatch_no = group_code_dic[vm.import_group],
});
@@ -1537,7 +1655,7 @@ namespace ModernWMS.WMS.Services
{
for (int i = 1; i <= cnt; i++)
{
- code.Add(date +"-"+ cnt.ToString("0000"));
+ code.Add(date + "-" + cnt.ToString("0000"));
}
}
else
@@ -1664,7 +1782,6 @@ namespace ModernWMS.WMS.Services
}
}*/
-
#endregion Api
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Services/Stock/StockService.cs b/backend/ModernWMS.WMS/Services/Stock/StockService.cs
index f2e07a7..83564bf 100644
--- a/backend/ModernWMS.WMS/Services/Stock/StockService.cs
+++ b/backend/ModernWMS.WMS/Services/Stock/StockService.cs
@@ -20,6 +20,9 @@ using System.Linq;
using ModernWMS.WMS.Entities.ViewModels.Stock;
using ModernWMS.Core.Utility;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
+using Pomelo.EntityFrameworkCore.MySql.Storage.Internal;
+using Pomelo.EntityFrameworkCore.MySql.Query.Internal;
+using Microsoft.Extensions.Configuration;
namespace ModernWMS.WMS.Services
{
@@ -40,6 +43,8 @@ namespace ModernWMS.WMS.Services
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+ public IConfiguration Configuration { get; }
+
#endregion Args
#region constructor
@@ -52,10 +57,12 @@ namespace ModernWMS.WMS.Services
public StockService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
+ , IConfiguration configuration
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this.Configuration = configuration;
}
#endregion constructor
@@ -204,7 +211,7 @@ namespace ModernWMS.WMS.Services
join gw in _dBContext.GetDbSet<GoodsownerEntity>().AsNoTracking() on stock.goods_owner_id equals gw.id into gw_left
from gw in gw_left.DefaultIfEmpty()
where stock.tenant_id == currentUser.tenant_id
- group new { stock, gw } by new { stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number, gw.goods_owner_name } into sg
+ group new { stock, gw } by new { stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number, gw.goods_owner_name, stock.expiry_date, stock.price, stock.putaway_date } into sg
select new
{
sku_id = sg.Key.sku_id,
@@ -212,6 +219,9 @@ namespace ModernWMS.WMS.Services
goods_owner_id = sg.Key.goods_owner_id,
goods_owner_name = sg.Key.goods_owner_name,
series_number = sg.Key.series_number,
+ sg.Key.expiry_date,
+ sg.Key.price,
+ sg.Key.putaway_date,
qty_frozen = sg.Where(t => t.stock.is_freeze == true).Sum(e => e.stock.qty),
qty = sg.Sum(t => t.stock.qty)
};
@@ -219,44 +229,53 @@ namespace ModernWMS.WMS.Services
var dispatch_group_datas = from dp in dispatch_DBSet.AsNoTracking()
join dpp in dispatchpick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number } into dg
+ group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number, dpp.expiry_date, dpp.price, dpp.putaway_date } into dg
select new
{
sku_id = dg.Key.sku_id,
goods_location_id = dg.Key.goods_location_id,
goods_owner_id = dg.Key.goods_owner_id,
series_number = dg.Key.series_number,
+ dg.Key.expiry_date,
+ dg.Key.price,
+ dg.Key.putaway_date,
qty_locked = dg.Sum(t => t.pick_qty)
};
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false && pd.is_source == true
- group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number } into pdg
+ group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number, pd.expiry_date, pd.price, pd.putaway_date } into pdg
select new
{
sku_id = pdg.Key.sku_id,
goods_location_id = pdg.Key.goods_location_id,
goods_owner_id = pdg.Key.goods_owner_id,
series_number = pdg.Key.series_number,
+ pdg.Key.expiry_date,
+ pdg.Key.price,
+ pdg.Key.putaway_date,
qty_locked = pdg.Sum(t => t.qty)
};
var move_locked_group_datas = from m in move_DBSet.AsNoTracking()
where m.move_status == 0
- group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number } into mg
+ group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into mg
select new
{
sku_id = mg.Key.sku_id,
goods_location_id = mg.Key.orig_goods_location_id,
goods_owner_id = mg.Key.goods_owner_id,
series_number = mg.Key.series_number,
+ mg.Key.expiry_date,
+ mg.Key.price,
+ mg.Key.putaway_date,
qty_locked = mg.Sum(t => t.qty)
};
var query = from sg in stock_group_datas
- join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number } into dp_left
+ join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number, dp.expiry_date, dp.price, dp.putaway_date } into dp_left
from dp in dp_left.DefaultIfEmpty()
- join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number } into pl_left
+ join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number, pl.expiry_date, pl.price, pl.putaway_date } into pl_left
from pl in pl_left.DefaultIfEmpty()
- join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number } into m_left
+ join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into m_left
from m in m_left.DefaultIfEmpty()
join sku in sku_DBSet on sg.sku_id equals sku.id
join spu in spu_DBSet on sku.spu_id equals spu.id
@@ -276,6 +295,9 @@ namespace ModernWMS.WMS.Services
location_name = gl.location_name,
warehouse_name = gl.warehouse_name,
series_number = sg.series_number,
+ expiry_date = sg.expiry_date,
+ price = sg.price,
+ putaway_date = sg.putaway_date,
};
query = query.Where(t => t.qty > 0).Where(queries.AsExpression<LocationStockManagementViewModel>());
int totals = await query.CountAsync();
@@ -420,43 +442,52 @@ namespace ModernWMS.WMS.Services
var dispatch_group_datas = from dp in dispatch_DBSet.AsNoTracking()
join dpp in dispatchpick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number } into dg
+ group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number, dpp.expiry_date, dpp.price, dpp.putaway_date } into dg
select new
{
goods_owner_id = dg.Key.goods_owner_id,
sku_id = dg.Key.sku_id,
goods_location_id = dg.Key.goods_location_id,
series_number = dg.Key.series_number,
+ dg.Key.expiry_date,
+ dg.Key.price,
+ dg.Key.putaway_date,
qty_locked = dg.Sum(t => t.pick_qty)
};
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false && pd.is_source == true
- group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number } into pdg
+ group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number, pd.expiry_date, pd.price, pd.putaway_date } into pdg
select new
{
goods_owner_id = pdg.Key.goods_owner_id,
sku_id = pdg.Key.sku_id,
goods_location_id = pdg.Key.goods_location_id,
series_number = pdg.Key.series_number,
+ pdg.Key.expiry_date,
+ pdg.Key.price,
+ pdg.Key.putaway_date,
qty_locked = pdg.Sum(t => t.qty)
};
var move_locked_group_datas = from m in move_DBSet.AsNoTracking()
where m.move_status == 0
- group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number } into mg
+ group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into mg
select new
{
goods_owner_id = mg.Key.goods_owner_id,
sku_id = mg.Key.sku_id,
goods_location_id = mg.Key.orig_goods_location_id,
series_number = mg.Key.series_number,
+ mg.Key.expiry_date,
+ mg.Key.price,
+ mg.Key.putaway_date,
qty_locked = mg.Sum(t => t.qty)
};
var query = from sg in DbSet.AsNoTracking()
- join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number } into dp_left
+ join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number, dp.expiry_date, dp.price, dp.putaway_date } into dp_left
from dp in dp_left.DefaultIfEmpty()
- join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number } into pl_left
+ join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number, pl.expiry_date, pl.price, pl.putaway_date } into pl_left
from pl in pl_left.DefaultIfEmpty()
- join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number } into m_left
+ join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into m_left
from m in m_left.DefaultIfEmpty()
join sku in sku_DBSet on sg.sku_id equals sku.id
join spu in spu_DBSet on sku.spu_id equals spu.id
@@ -481,6 +512,9 @@ namespace ModernWMS.WMS.Services
sg.id,
sku.unit,
sg.series_number,
+ sg.expiry_date,
+ sg.price,
+ sg.putaway_date,
sg.tenant_id
} into g
select new StockViewModel
@@ -497,6 +531,9 @@ namespace ModernWMS.WMS.Services
location_name = g.Key.location_name,
warehouse_name = g.Key.warehouse_name,
series_number = g.Key.series_number,
+ expiry_date = g.Key.expiry_date,
+ price = g.Key.price,
+ putaway_date = g.Key.putaway_date,
is_freeze = g.Key.is_freeze,
id = g.Key.id,
tenant_id = g.Key.tenant_id,
@@ -595,7 +632,8 @@ namespace ModernWMS.WMS.Services
&& (input.warehouse_id == 0 || gl.warehouse_id == input.warehouse_id)
&& (input.spu_name == "" || spu.spu_name.Contains(input.spu_name))
&& (input.location_name == "" || gl.location_name.Contains(input.location_name))
- group new { stock, gw } by new { stock.sku_id, stock.goods_location_id, stock.goods_owner_id, gw.goods_owner_name, stock.series_number } into sg
+ && (input.series_number == "" || stock.series_number == input.series_number)
+ group new { stock, gw } by new { stock.sku_id, stock.goods_location_id, stock.goods_owner_id, gw.goods_owner_name, stock.series_number, stock.expiry_date, stock.price, stock.putaway_date } into sg
select new
{
sku_id = sg.Key.sku_id,
@@ -603,6 +641,9 @@ namespace ModernWMS.WMS.Services
goods_owner_id = sg.Key.goods_owner_id,
goods_owner_name = sg.Key.goods_owner_name,
series_number = sg.Key.series_number,
+ sg.Key.expiry_date,
+ sg.Key.price,
+ sg.Key.putaway_date,
qty_frozen = sg.Where(t => t.stock.is_freeze == true).Sum(e => e.stock.qty),
qty = sg.Sum(t => t.stock.qty)
};
@@ -610,44 +651,53 @@ namespace ModernWMS.WMS.Services
var dispatch_group_datas = from dp in dispatch_DBSet.AsNoTracking()
join dpp in dispatchpick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number } into dg
+ group dpp by new { dpp.sku_id, dpp.goods_location_id, dpp.goods_owner_id, dpp.series_number, dpp.expiry_date, dpp.price, dpp.putaway_date } into dg
select new
{
sku_id = dg.Key.sku_id,
goods_location_id = dg.Key.goods_location_id,
goods_owner_id = dg.Key.goods_owner_id,
series_number = dg.Key.series_number,
+ dg.Key.expiry_date,
+ dg.Key.price,
+ dg.Key.putaway_date,
qty_locked = dg.Sum(t => t.pick_qty)
};
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false && pd.is_source == true
- group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number } into pdg
+ group pd by new { pd.sku_id, pd.goods_location_id, pd.goods_owner_id, pd.series_number, pd.expiry_date, pd.price, pd.putaway_date } into pdg
select new
{
sku_id = pdg.Key.sku_id,
goods_location_id = pdg.Key.goods_location_id,
goods_owner_id = pdg.Key.goods_owner_id,
series_number = pdg.Key.series_number,
+ pdg.Key.expiry_date,
+ pdg.Key.price,
+ pdg.Key.putaway_date,
qty_locked = pdg.Sum(t => t.qty)
};
var move_locked_group_datas = from m in move_DBSet.AsNoTracking()
where m.move_status == 0
- group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number } into mg
+ group m by new { m.sku_id, m.orig_goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into mg
select new
{
sku_id = mg.Key.sku_id,
goods_location_id = mg.Key.orig_goods_location_id,
goods_owner_id = mg.Key.goods_owner_id,
series_number = mg.Key.series_number,
+ mg.Key.expiry_date,
+ mg.Key.price,
+ mg.Key.putaway_date,
qty_locked = mg.Sum(t => t.qty)
};
var query = from sg in stock_group_datas
- join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number } into dp_left
+ join dp in dispatch_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { dp.sku_id, dp.goods_location_id, dp.goods_owner_id, dp.series_number, dp.expiry_date, dp.price, dp.putaway_date } into dp_left
from dp in dp_left.DefaultIfEmpty()
- join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number } into pl_left
+ join pl in process_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { pl.sku_id, pl.goods_location_id, pl.goods_owner_id, pl.series_number, pl.expiry_date, pl.price, pl.putaway_date } into pl_left
from pl in pl_left.DefaultIfEmpty()
- join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number } into m_left
+ join m in move_locked_group_datas on new { sg.sku_id, sg.goods_location_id, sg.goods_owner_id, sg.series_number, sg.expiry_date, sg.price, sg.putaway_date } equals new { m.sku_id, m.goods_location_id, m.goods_owner_id, m.series_number, m.expiry_date, m.price, m.putaway_date } into m_left
from m in m_left.DefaultIfEmpty()
join sku in sku_DBSet on sg.sku_id equals sku.id
join spu in spu_DBSet on sku.spu_id equals spu.id
@@ -667,6 +717,9 @@ namespace ModernWMS.WMS.Services
location_name = gl.location_name,
warehouse_name = gl.warehouse_name,
series_number = sg.series_number,
+ expiry_date = sg.expiry_date,
+ price = sg.price,
+ putaway_date = sg.putaway_date,
goods_location_id = sg.goods_location_id
};
@@ -713,12 +766,15 @@ namespace ModernWMS.WMS.Services
{
dp.dispatch_no,
wh.warehouse_name,
- location.location_name,
+ location_name = location.location_name,
spu.spu_name,
spu.spu_code,
sku.sku_name,
sku.sku_code,
dpp.series_number,
+ dpp.price,
+ dpp.expiry_date,
+ dpp.putaway_date,
dp.customer_name,
dp.create_time,
dpp.goods_owner_id,
@@ -735,6 +791,9 @@ namespace ModernWMS.WMS.Services
sku_name = dg.Key.sku_name,
sku_code = dg.Key.sku_code,
series_number = dg.Key.series_number,
+ expiry_date = dg.Key.expiry_date,
+ price = dg.Key.price,
+ putaway_date = dg.Key.putaway_date,
customer_name = dg.Key.customer_name,
delivery_date = dg.Key.create_time,
goods_owner_name = dg.Key.goods_owner_name,
@@ -748,6 +807,88 @@ namespace ModernWMS.WMS.Services
return (list, totals);
}
+ /// <summary>
+ /// stock age page search
+ /// </summary>
+ /// <param name="pageSearch">args</param>
+ /// <param name="currentUser">currentUser</param>
+ /// <returns></returns>
+ public async Task<(List<StockAgeViewModel> data, int totals)> StockAgePageAsync(StockAgeSearchViewModel input, CurrentUser currentUser)
+ {
+ var database_config = Configuration.GetSection("Database")["db"].ToUpper();
+ var DbSet = _dBContext.GetDbSet<StockEntity>().Where(t => t.tenant_id.Equals(currentUser.tenant_id));
+ var sku_DBSet = _dBContext.GetDbSet<SkuEntity>().AsNoTracking();
+ var spu_DBSet = _dBContext.GetDbSet<SpuEntity>().AsNoTracking();
+ var location_DBSet = _dBContext.GetDbSet<GoodslocationEntity>().AsNoTracking();
+ if (input.expiry_date_from > UtilConvert.MinDate)
+ {
+ DbSet = DbSet.Where(t => t.expiry_date >= input.expiry_date_from);
+ }
+ if (input.expiry_date_to > UtilConvert.MinDate)
+ {
+ DbSet = DbSet.Where(t => t.expiry_date <= input.expiry_date_to);
+ }
+ var stock_group_datas = from stock in DbSet.AsNoTracking()
+ join gw in _dBContext.GetDbSet<GoodsownerEntity>().AsNoTracking() on stock.goods_owner_id equals gw.id into gw_left
+ from gw in gw_left.DefaultIfEmpty()
+ where stock.tenant_id == currentUser.tenant_id
+ group new { stock, gw } by new { stock.sku_id, stock.goods_location_id, stock.goods_owner_id, stock.series_number, gw.goods_owner_name, stock.expiry_date, stock.price, stock.putaway_date } into sg
+ select new
+ {
+ sku_id = sg.Key.sku_id,
+ goods_location_id = sg.Key.goods_location_id,
+ goods_owner_id = sg.Key.goods_owner_id,
+ goods_owner_name = sg.Key.goods_owner_name,
+ series_number = sg.Key.series_number,
+ sg.Key.expiry_date,
+ sg.Key.price,
+ sg.Key.putaway_date,
+ qty_frozen = sg.Where(t => t.stock.is_freeze == true).Sum(e => e.stock.qty),
+ qty = sg.Sum(t => t.stock.qty)
+ };
+ var today = DateTime.Today;
+ var query = from sg in stock_group_datas
+ join sku in sku_DBSet on sg.sku_id equals sku.id
+ join spu in spu_DBSet on sku.spu_id equals spu.id
+ join gl in location_DBSet on sg.goods_location_id equals gl.id
+ where spu.spu_name.Contains(input.spu_name) && sku.sku_name.Contains(input.sku_name)
+ && sku.sku_code.Contains(input.sku_code) && spu.spu_code.Contains(input.spu_code)
+ && gl.warehouse_name.Contains(input.warehouse_name)
+ select new StockAgeViewModel
+ {
+ sku_id = sg.sku_id,
+ goods_owner_name = sg.goods_owner_name,
+ spu_name = spu.spu_name,
+ spu_code = spu.spu_code,
+ sku_code = sku.sku_code,
+ sku_name = sku.sku_name,
+ qty = sg.qty,
+ location_name = gl.location_name,
+ warehouse_name = gl.warehouse_name,
+ series_number = sg.series_number,
+ expiry_date = sg.expiry_date,
+ price = sg.price,
+ putaway_date = sg.putaway_date,
+ stock_age = sg.putaway_date == UtilConvert.MinDate ? 0 : database_config == "MYSQL" ? Microsoft.EntityFrameworkCore.MySqlDbFunctionsExtensions.DateDiffDay(EF.Functions, sg.putaway_date.Date, today) : Microsoft.EntityFrameworkCore.SqlServerDbFunctionsExtensions.DateDiffDay(EF.Functions, sg.putaway_date.Date, today),
+ };
+
+ if (input.stock_age_from > 0)
+ {
+ query = query.Where(t => t.stock_age >= input.stock_age_from);
+ }
+ if (input.stock_age_to > 0)
+ {
+ query = query.Where(t => t.stock_age <= input.stock_age_to);
+ }
+ query = query.Where(t => t.qty > 0);
+ int totals = await query.CountAsync();
+ var list = await query.OrderBy(t => t.sku_code)
+ .Skip((input.pageIndex - 1) * input.pageSize)
+ .Take(input.pageSize)
+ .ToListAsync();
+ return (list, totals);
+ }
+
#endregion Api
}
}
\ No newline at end of file
diff --git a/backend/ModernWMS.WMS/Services/Stockadjust/StockadjustService.cs b/backend/ModernWMS.WMS/Services/Stockadjust/StockadjustService.cs
index 49c2f96..fdd3772 100644
--- a/backend/ModernWMS.WMS/Services/Stockadjust/StockadjustService.cs
+++ b/backend/ModernWMS.WMS/Services/Stockadjust/StockadjustService.cs
@@ -108,6 +108,9 @@ namespace ModernWMS.WMS.Services
create_time = sj.create_time,
last_update_time = sj.last_update_time,
series_number = sj.series_number,
+ expiry_date = sj.expiry_date,
+ price = sj.price,
+ putaway_date = sj.putaway_date,
};
query = query.Where(queries.AsExpression<StockadjustViewModel>());
int totals = await query.CountAsync();
@@ -195,6 +198,9 @@ namespace ModernWMS.WMS.Services
entity.source_table_id = viewModel.source_table_id;
entity.last_update_time = DateTime.Now;
entity.series_number = viewModel.series_number;
+ entity.expiry_date = viewModel.expiry_date;
+ entity.price = viewModel.price;
+ entity.putaway_date = viewModel.putaway_date;
var qty = await _dBContext.SaveChangesAsync();
if (qty > 0)
{
@@ -255,7 +261,7 @@ namespace ModernWMS.WMS.Services
}
}
var stock_DBSet = _dBContext.GetDbSet<StockEntity>();
- var stock = await stock_DBSet.Where(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.goods_location_id && t.sku_id == entity.sku_id).FirstOrDefaultAsync();
+ var stock = await stock_DBSet.Where(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.goods_location_id && t.sku_id == entity.sku_id && t.expiry_date == entity.expiry_date && t.price == entity.price && t.putaway_date == entity.putaway_date).FirstOrDefaultAsync();
if (stock == null)
{
stock = new StockEntity
@@ -266,6 +272,9 @@ namespace ModernWMS.WMS.Services
qty = entity.qty,
goods_owner_id = entity.goods_owner_id,
series_number = entity.series_number,
+ expiry_date = entity.expiry_date,
+ price = entity.price,
+ putaway_date = entity.putaway_date,
is_freeze = false,
last_update_time = DateTime.Now,
tenant_id = entity.tenant_id,
diff --git a/backend/ModernWMS.WMS/Services/Stockfreeze/StockfreezeService.cs b/backend/ModernWMS.WMS/Services/Stockfreeze/StockfreezeService.cs
index 517fadd..6a54c2e 100644
--- a/backend/ModernWMS.WMS/Services/Stockfreeze/StockfreezeService.cs
+++ b/backend/ModernWMS.WMS/Services/Stockfreeze/StockfreezeService.cs
@@ -17,6 +17,7 @@ using ModernWMS.Core.DynamicSearch;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
+using ModernWMS.Core;
namespace ModernWMS.WMS.Services
{
@@ -37,6 +38,11 @@ namespace ModernWMS.WMS.Services
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+ /// <summary>
+ /// Function Helper
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
#endregion Args
#region constructor
@@ -49,10 +55,11 @@ namespace ModernWMS.WMS.Services
public StockfreezeService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
- )
+ , FunctionHelper functionHelper)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this._functionHelper = functionHelper;
}
#endregion constructor
@@ -104,7 +111,7 @@ namespace ModernWMS.WMS.Services
.Where(t => t.tenant_id.Equals(currentUser.tenant_id))
.Where(queries.AsExpression<StockfreezeViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderByDescending(t => t.handle_time)
+ var list = await query.OrderByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
@@ -153,10 +160,7 @@ namespace ModernWMS.WMS.Services
warehouse_name = location.warehouse_name,
series_number = m.series_number,
}).FirstOrDefaultAsync();
- if (data == null)
- {
- return null;
- }
+
return data;
}
@@ -175,9 +179,9 @@ namespace ModernWMS.WMS.Services
entity.handler = currentUser.user_name;
entity.last_update_time = DateTime.Now;
entity.tenant_id = currentUser.tenant_id;
- entity.job_code = await GetOrderCode(currentUser);
+ entity.job_code = await _functionHelper.GetFormNoAsync("Stockfreeze");
var stock_DBSet = _dBContext.GetDbSet<StockEntity>();
- var stocks = await stock_DBSet.Where(t => t.goods_location_id == entity.goods_location_id && t.goods_owner_id == entity.goods_owner_id && t.sku_id == entity.sku_id).ToListAsync();
+ var stocks = await stock_DBSet.Where(t => t.goods_location_id == entity.goods_location_id && t.goods_owner_id == entity.goods_owner_id && t.sku_id == entity.sku_id && t.series_number == entity.series_number ).ToListAsync();
foreach (var stock in stocks)
{
if (entity.job_type == true)
diff --git a/backend/ModernWMS.WMS/Services/Stockmove/StockmoveService.cs b/backend/ModernWMS.WMS/Services/Stockmove/StockmoveService.cs
index 374897c..92117f9 100644
--- a/backend/ModernWMS.WMS/Services/Stockmove/StockmoveService.cs
+++ b/backend/ModernWMS.WMS/Services/Stockmove/StockmoveService.cs
@@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Mvc;
using static System.Runtime.InteropServices.JavaScript.JSType;
using System;
using ModernWMS.Core.Utility;
+using ModernWMS.Core;
namespace ModernWMS.WMS.Services
{
@@ -38,6 +39,11 @@ namespace ModernWMS.WMS.Services
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+ /// <summary>
+ /// Function Helper
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
#endregion Args
#region constructor
@@ -50,10 +56,12 @@ namespace ModernWMS.WMS.Services
public StockmoveService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
+ , FunctionHelper functionHelper
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this._functionHelper = functionHelper;
}
#endregion constructor
@@ -108,11 +116,14 @@ namespace ModernWMS.WMS.Services
orig_goods_location_name = orig_location.location_name,
orig_goods_warehouse = orig_location.warehouse_name,
series_number = m.series_number,
+ expiry_date = m.expiry_date,
+ price = m.price,
+ putaway_date = m.putaway_date,
};
query = query.Where(t => t.tenant_id.Equals(currentUser.tenant_id))
.Where(queries.AsExpression<StockmoveViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderByDescending(t => t.create_time)
+ var list = await query.OrderByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
@@ -157,6 +168,9 @@ namespace ModernWMS.WMS.Services
orig_goods_location_name = orig_location.location_name,
orig_goods_warehouse = orig_location.warehouse_name,
series_number = m.series_number,
+ expiry_date = m.expiry_date,
+ price = m.price,
+ putaway_date = m.putaway_date,
}
).ToListAsync();
return data.Adapt<List<StockmoveViewModel>>();
@@ -201,11 +215,11 @@ namespace ModernWMS.WMS.Services
orig_goods_location_name = orig_location.location_name,
orig_goods_warehouse = orig_location.warehouse_name,
series_number = m.series_number,
+ expiry_date = m.expiry_date,
+ price = m.price,
+ putaway_date = m.putaway_date,
}).FirstOrDefaultAsync();
- if (data == null)
- {
- return null;
- }
+
return data;
}
@@ -226,7 +240,7 @@ namespace ModernWMS.WMS.Services
var dispatch_group_datas = from dp in dispatch_DBSet.AsNoTracking()
join dpp in dispatchpick_DBSet.AsNoTracking() on dp.id equals dpp.dispatchlist_id
where dp.dispatch_status > 1 && dp.dispatch_status < 6
- && dpp.goods_owner_id == entity.goods_owner_id && dpp.series_number == entity.series_number && dpp.goods_location_id == entity.orig_goods_location_id && dpp.sku_id == entity.sku_id
+ && dpp.goods_owner_id == entity.goods_owner_id && dpp.series_number == entity.series_number && dpp.goods_location_id == entity.orig_goods_location_id && dpp.sku_id == entity.sku_id && dpp.expiry_date == entity.expiry_date && dpp.price == entity.price && dpp.putaway_date == entity.putaway_date
group dpp by new { dpp.sku_id, dpp.goods_location_id } into dg
select new
{
@@ -237,7 +251,7 @@ namespace ModernWMS.WMS.Services
var process_locked_group_datas = from pd in processdetail_DBSet
where pd.is_update_stock == false
&& pd.sku_id == entity.sku_id && pd.goods_location_id == entity.orig_goods_location_id
- && pd.goods_owner_id == entity.goods_owner_id && pd.series_number == entity.series_number
+ && pd.goods_owner_id == entity.goods_owner_id && pd.series_number == entity.series_number && pd.expiry_date == entity.expiry_date && pd.price == entity.price && pd.putaway_date == entity.putaway_date
group pd by new { pd.sku_id, pd.goods_location_id } into pdg
select new
{
@@ -247,7 +261,7 @@ namespace ModernWMS.WMS.Services
};
var move_locked_group_datas = from sm in DbSet.AsNoTracking()
where sm.move_status == 0 && sm.sku_id == entity.sku_id && sm.orig_goods_location_id == entity.orig_goods_location_id
- && sm.goods_owner_id == entity.goods_owner_id && sm.series_number == entity.series_number
+ && sm.goods_owner_id == entity.goods_owner_id && sm.series_number == entity.series_number && sm.expiry_date == entity.expiry_date && sm.price == entity.price && sm.putaway_date == entity.putaway_date
group sm by new { sm.sku_id, goods_location_id = sm.orig_goods_location_id } into smg
select new
{
@@ -266,13 +280,14 @@ namespace ModernWMS.WMS.Services
from sm in sm_left.DefaultIfEmpty()
where sg.sku_id == entity.sku_id && sg.goods_location_id == entity.orig_goods_location_id
&& sg.goods_owner_id == entity.goods_owner_id && sg.series_number == entity.series_number
+ && sg.expiry_date == entity.expiry_date && sg.price == entity.price && sg.putaway_date == entity.putaway_date
select new
{
id = sg.id,
qty_available = sg.is_freeze ? 0 : (sg.qty - (dp.qty_locked == null ? 0 : dp.qty_locked) - (pl.qty_locked == null ? 0 : pl.qty_locked) - (sm.qty_locked == null ? 0 : sm.qty_locked)),
}
).FirstOrDefaultAsync();
- var dest_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.dest_googs_location_id && t.sku_id == entity.sku_id);
+ var dest_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.dest_googs_location_id && t.sku_id == entity.sku_id && t.expiry_date == entity.expiry_date && t.price == entity.price && t.putaway_date == entity.putaway_date);
if (orig_stock == null || orig_stock.qty_available < entity.qty)
{
return (0, _stringLocalizer["qty_not_available"]);
@@ -287,7 +302,7 @@ namespace ModernWMS.WMS.Services
entity.creator = currentUser.user_name;
entity.last_update_time = DateTime.Now;
entity.tenant_id = currentUser.tenant_id;
- entity.job_code = await GetOrderCode(currentUser);
+ entity.job_code = await _functionHelper.GetFormNoAsync("Stockmove");
await DbSet.AddAsync(entity);
await _dBContext.SaveChangesAsync();
if (entity.id > 0)
@@ -315,12 +330,13 @@ namespace ModernWMS.WMS.Services
{
return (false, _stringLocalizer["not_exists_entity"]);
}
+ var now_time = DateTime.Now;
entity.handler = currentUser.user_name;
- entity.handle_time = DateTime.Now;
+ entity.handle_time = now_time;
entity.move_status = 1;
- entity.last_update_time = DateTime.Now;
- var orig_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.orig_goods_location_id && t.sku_id == entity.sku_id);
- var dest_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.dest_googs_location_id && t.sku_id != entity.sku_id);
+ entity.last_update_time = now_time;
+ var orig_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.orig_goods_location_id && t.sku_id == entity.sku_id && t.expiry_date == entity.expiry_date && t.price == entity.price && t.putaway_date == entity.putaway_date);
+ var dest_stock = await stock_DBSet.FirstOrDefaultAsync(t => t.goods_owner_id == entity.goods_owner_id && t.series_number == entity.series_number && t.goods_location_id == entity.dest_googs_location_id && t.sku_id != entity.sku_id && t.expiry_date == entity.expiry_date && t.price == entity.price && t.putaway_date == entity.putaway_date);
if (orig_stock != null)
{
if (orig_stock.qty == entity.qty)
@@ -330,7 +346,7 @@ namespace ModernWMS.WMS.Services
else
{
orig_stock.qty -= entity.qty;
- orig_stock.last_update_time = DateTime.Now;
+ orig_stock.last_update_time = now_time;
}
}
if (dest_stock == null)
@@ -341,16 +357,20 @@ namespace ModernWMS.WMS.Services
sku_id = entity.sku_id,
goods_owner_id = entity.goods_owner_id,
is_freeze = false,
- last_update_time = DateTime.Now,
+ last_update_time = now_time,
qty = entity.qty,
tenant_id = entity.tenant_id,
+ series_number = entity.series_number,
+ expiry_date = entity.expiry_date,
+ price = entity.price,
+ putaway_date = entity.putaway_date,
};
await stock_DBSet.AddAsync(dest_stock);
}
else
{
dest_stock.qty += entity.qty;
- dest_stock.last_update_time = DateTime.Now;
+ dest_stock.last_update_time = now_time;
}
var saved = false;
int res = 0;
diff --git a/backend/ModernWMS.WMS/Services/Stockprocess/StockprocessService.cs b/backend/ModernWMS.WMS/Services/Stockprocess/StockprocessService.cs
index 0dd96cc..eccbcb3 100644
--- a/backend/ModernWMS.WMS/Services/Stockprocess/StockprocessService.cs
+++ b/backend/ModernWMS.WMS/Services/Stockprocess/StockprocessService.cs
@@ -20,6 +20,7 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Formatters.Xml;
using Microsoft.AspNetCore.SignalR.Protocol;
using System.Linq;
+using ModernWMS.Core;
namespace ModernWMS.WMS.Services
{
@@ -40,6 +41,11 @@ namespace ModernWMS.WMS.Services
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+ /// <summary>
+ /// Function Helper
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
#endregion Args
#region constructor
@@ -52,10 +58,12 @@ namespace ModernWMS.WMS.Services
public StockprocessService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
+ , FunctionHelper functionHelper
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ this._functionHelper = functionHelper;
}
#endregion constructor
@@ -109,7 +117,7 @@ namespace ModernWMS.WMS.Services
.Where(t => t.tenant_id.Equals(currentUser.tenant_id))
.Where(queries.AsExpression<StockprocessGetViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderByDescending(t => t.create_time)
+ var list = await query.OrderByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
@@ -157,6 +165,9 @@ namespace ModernWMS.WMS.Services
unit = sku.unit,
location_name = gl.location_name == null ? "" : gl.location_name,
series_number = spd.series_number,
+ expiry_date = spd.expiry_date,
+ price = spd.price,
+ putaway_date = spd.putaway_date,
}).ToListAsync();
if (entity == null)
{
@@ -207,6 +218,18 @@ namespace ModernWMS.WMS.Services
PropertyInfo t_prop_sn = typeof(StockEntity).GetProperty("series_number");
MemberExpression t_sn_exp = Expression.Property(parameterExpression, t_prop_sn);
BinaryExpression t_sn_full_exp = Expression.Equal(t_sn_exp, t_constan_sn);
+ ConstantExpression t_constan_expiry = Expression.Constant(entity.detailList[i].expiry_date);
+ PropertyInfo t_prop_expiry = typeof(StockEntity).GetProperty("expiry_date");
+ MemberExpression t_expiry_exp = Expression.Property(parameterExpression, t_prop_sn);
+ BinaryExpression t_expiry_full_exp = Expression.Equal(t_sn_exp, t_constan_sn);
+ ConstantExpression t_constan_price = Expression.Constant(entity.detailList[i].price);
+ PropertyInfo t_prop_price = typeof(StockEntity).GetProperty("price");
+ MemberExpression t_price_exp = Expression.Property(parameterExpression, t_prop_sn);
+ BinaryExpression t_price_full_exp = Expression.Equal(t_sn_exp, t_constan_sn);
+ ConstantExpression t_constan_putaway = Expression.Constant(entity.detailList[i].putaway_date);
+ PropertyInfo t_prop_putaway = typeof(StockEntity).GetProperty("putaway_date");
+ MemberExpression t_putaway_exp = Expression.Property(parameterExpression, t_prop_sn);
+ BinaryExpression t_putaway_full_exp = Expression.Equal(t_sn_exp, t_constan_sn);
var t_exp = Expression.And(t_location_full_exp, t_sku_full_exp);
t_exp = Expression.And(t_exp, t_owner_full_exp);
if (exp != null)
@@ -221,13 +244,16 @@ namespace ModernWMS.WMS.Services
var lockeds = await (from d in _dBContext.GetDbSet<StockprocessdetailEntity>().AsNoTracking()
where d.is_update_stock == false && goods_location_id_list.Contains(d.goods_location_id)
&& sku_id_list.Contains(d.sku_id)
- group d by new { d.goods_location_id, d.sku_id, d.goods_owner_id, d.series_number } into lg
+ group d by new { d.goods_location_id, d.sku_id, d.goods_owner_id, d.series_number, d.expiry_date, d.price,d.putaway_date } into lg
select new
{
sku_id = lg.Key.sku_id,
goods_location_id = lg.Key.goods_location_id,
goods_owner_id = lg.Key.goods_owner_id,
series_number = lg.Key.series_number,
+ lg.Key.expiry_date,
+ lg.Key.price,
+ lg.Key.putaway_date,
qty_locked = lg.Sum(e => e.qty)
}).ToListAsync();
entity.id = 0;
@@ -235,21 +261,21 @@ namespace ModernWMS.WMS.Services
entity.creator = currentUser.user_name;
entity.last_update_time = DateTime.Now;
entity.tenant_id = currentUser.tenant_id;
- entity.job_code = await GetOrderCode(currentUser);
+ entity.job_code = await _functionHelper.GetFormNoAsync("Stockprocess");
await DbSet.AddAsync(entity);
foreach (var d in entity.detailList)
{
d.tenant_id = currentUser.tenant_id;
d.last_update_time = DateTime.Now;
d.id = 0;
- var s = stocks.FirstOrDefault(t => t.sku_id == d.sku_id && t.goods_location_id == d.goods_location_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number);
+ var s = stocks.FirstOrDefault(t => t.sku_id == d.sku_id && t.goods_location_id == d.goods_location_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number && t.expiry_date == d.expiry_date && t.price == d.price && t.putaway_date == d.putaway_date);
if (d.is_source == true)
{
if (s == null)
{
return (0, _stringLocalizer["data_changed"]);
}
- var locked = lockeds.FirstOrDefault(t => t.sku_id == d.sku_id && t.goods_location_id == d.goods_location_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number);
+ var locked = lockeds.FirstOrDefault(t => t.sku_id == d.sku_id && t.goods_location_id == d.goods_location_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number && t.expiry_date == d.expiry_date && t.price == d.price && t.putaway_date == d.putaway_date);
if ((s.qty - (locked == null ? 0 : locked.qty_locked)) < d.qty)
{
return (0, _stringLocalizer["data_changed"]);
@@ -334,6 +360,7 @@ namespace ModernWMS.WMS.Services
var detail_DBSet = _dBContext.GetDbSet<StockprocessdetailEntity>();
var adjust_DBset = _dBContext.GetDbSet<StockadjustEntity>();
var entity = await DBSet.FirstOrDefaultAsync(t => t.id == id);
+ var now_time = DateTime.Now;
if (entity == null)
{
return (false, _stringLocalizer["not_exists_entity"]);
@@ -358,25 +385,28 @@ namespace ModernWMS.WMS.Services
job_type = 2,
goods_owner_id = d.goods_owner_id,
qty = d.is_source ? -d.qty : d.qty,
- create_time = DateTime.Now,
+ create_time = now_time,
creator = currentUser.user_name,
- last_update_time = DateTime.Now,
+ last_update_time = now_time,
tenant_id = currentUser.tenant_id,
series_number = d.series_number,
+ expiry_date = d.expiry_date,
+ price = d.price,
+ putaway_date = d.putaway_date,
}).ToList();
- entity.last_update_time = DateTime.Now;
+ entity.last_update_time = now_time;
var stock_DBSet = _dBContext.GetDbSet<StockEntity>();
if (entity == null)
{
return (false, _stringLocalizer["not_exists_entity"]);
}
- var stocks = await stock_DBSet.Where(s => detail_DBSet.Where(t => t.stock_process_id == id).Any(t => t.goods_location_id == s.goods_location_id && t.sku_id == s.sku_id && t.goods_owner_id == s.goods_owner_id && t.series_number == s.series_number)).ToListAsync();
+ var stocks = await stock_DBSet.Where(s => detail_DBSet.Where(t => t.stock_process_id == id).Any(t => t.goods_location_id == s.goods_location_id && t.sku_id == s.sku_id && t.goods_owner_id == s.goods_owner_id && t.series_number == s.series_number && t.expiry_date == s.expiry_date && t.price == s.price && t.putaway_date == s.putaway_date)).ToListAsync();
foreach (var d in details)
{
- var stock = stocks.FirstOrDefault(t => t.goods_location_id == d.goods_location_id && t.sku_id == d.sku_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number);
+ var stock = stocks.FirstOrDefault(t => t.goods_location_id == d.goods_location_id && t.sku_id == d.sku_id && t.goods_owner_id == d.goods_owner_id && t.series_number == d.series_number && t.expiry_date == d.expiry_date && t.price == d.price && t.putaway_date == d.putaway_date);
d.is_update_stock = true;
- d.last_update_time = DateTime.Now;
+ d.last_update_time = now_time;
if (d.is_source)
{
if (stock == null)
@@ -384,10 +414,11 @@ namespace ModernWMS.WMS.Services
return (false, _stringLocalizer["data_changed"]);
}
stock.qty -= d.qty;
- stock.last_update_time = DateTime.Now;
+ stock.last_update_time = now_time;
}
else
{
+ d.putaway_date = DateTime.Today;
if (stock == null)
{
await stock_DBSet.AddAsync(new StockEntity
@@ -396,8 +427,11 @@ namespace ModernWMS.WMS.Services
goods_location_id = d.goods_location_id,
goods_owner_id = d.goods_owner_id,
series_number = d.series_number,
+ expiry_date = d.expiry_date,
+ price = d.price,
+ putaway_date = d.putaway_date,
is_freeze = false,
- last_update_time = DateTime.Now,
+ last_update_time = now_time,
qty = d.qty,
tenant_id = currentUser.tenant_id
});
@@ -405,7 +439,7 @@ namespace ModernWMS.WMS.Services
else
{
stock.qty += d.qty;
- stock.last_update_time = DateTime.Now;
+ stock.last_update_time = now_time;
}
}
}
diff --git a/backend/ModernWMS.WMS/Services/Stocktaking/StocktakingService.cs b/backend/ModernWMS.WMS/Services/Stocktaking/StocktakingService.cs
index 35e01b9..ae67dd2 100644
--- a/backend/ModernWMS.WMS/Services/Stocktaking/StocktakingService.cs
+++ b/backend/ModernWMS.WMS/Services/Stocktaking/StocktakingService.cs
@@ -14,6 +14,8 @@
using ModernWMS.Core.Models;
using ModernWMS.Core.JWT;
using System.Linq;
+using ModernWMS.Core;
+using ModernWMS.Core.Utility;
namespace ModernWMS.WMS.Services
{
@@ -32,6 +34,12 @@ namespace ModernWMS.WMS.Services
/// Localizer Service
/// </summary>
private readonly IStringLocalizer<ModernWMS.Core.MultiLanguage> _stringLocalizer;
+
+ /// <summary>
+ /// functions
+ /// </summary>
+ private readonly FunctionHelper _functionHelper;
+
#endregion
#region constructor
@@ -40,13 +48,16 @@ namespace ModernWMS.WMS.Services
/// </summary>
/// <param name="dBContext">The DBContext</param>
/// <param name="stringLocalizer">Localizer</param>
+ /// <param name="functionHelper">functionHelper</param>
public StocktakingService(
SqlDBContext dBContext
, IStringLocalizer<ModernWMS.Core.MultiLanguage> stringLocalizer
+ , FunctionHelper functionHelper
)
{
this._dBContext = dBContext;
this._stringLocalizer = stringLocalizer;
+ _functionHelper = functionHelper;
}
#endregion
@@ -89,7 +100,7 @@ namespace ModernWMS.WMS.Services
id = st.id,
job_code = st.job_code,
job_status = st.job_status,
- adjust_status = adj.id == null ? false : true,
+ adjust_status = adj.id == null ? false : true,
sku_id = sku.id,
sku_code = sku.sku_code,
sku_name = sku.sku_name,
@@ -100,6 +111,10 @@ namespace ModernWMS.WMS.Services
location_name = gsl.location_name,
goods_owner_id = st.goods_owner_id,
goods_owner_name = gso.goods_owner_name == null ? string.Empty : gso.goods_owner_name,
+ expiry_date = st.expiry_date,
+ price = st.price,
+ putaway_date = st.putaway_date,
+ series_number = st.series_number,
book_qty = st.book_qty,
counted_qty = st.counted_qty,
difference_qty = st.difference_qty,
@@ -111,7 +126,7 @@ namespace ModernWMS.WMS.Services
};
query = query.Where(queries.AsExpression<StocktakingViewModel>());
int totals = await query.CountAsync();
- var list = await query.OrderByDescending(t => t.create_time)
+ var list = await query.OrderByDescending(t => t.last_update_time)
.Skip((pageSearch.pageIndex - 1) * pageSearch.pageSize)
.Take(pageSearch.pageSize)
.ToListAsync();
@@ -157,6 +172,10 @@ namespace ModernWMS.WMS.Services
location_name = gsl.location_name,
goods_owner_id = st.goods_owner_id,
goods_owner_name = gso.goods_owner_name == null ? string.Empty : gso.goods_owner_name,
+ expiry_date = st.expiry_date,
+ price = st.price,
+ putaway_date = st.putaway_date,
+ series_number = st.series_number,
book_qty = st.book_qty,
counted_qty = st.counted_qty,
difference_qty = st.difference_qty,
@@ -187,7 +206,7 @@ namespace ModernWMS.WMS.Services
var DbSet = _dBContext.GetDbSet<StocktakingEntity>();
var entity = viewModel.Adapt<StocktakingEntity>();
entity.id = 0;
- entity.job_code = await GetOrderCode(currentUser);
+ entity.job_code = await _functionHelper.GetFormNoAsync("Stocktaking");
entity.creator = currentUser.user_name;
entity.create_time = DateTime.Now;
entity.last_update_time = DateTime.Now;
@@ -293,7 +312,12 @@ namespace ModernWMS.WMS.Services
var Stocks = _dBContext.GetDbSet<StockEntity>();
var stockEntity = await Stocks.FirstOrDefaultAsync(t => t.sku_id.Equals(entity.sku_id)
&& t.goods_owner_id.Equals(entity.goods_owner_id)
- && t.goods_location_id.Equals(entity.goods_location_id));
+ && t.goods_location_id.Equals(entity.goods_location_id)
+ && t.series_number.Equals(entity.series_number)
+ && t.expiry_date.Equals(entity.expiry_date)
+ && t.price.Equals(entity.price)
+ && t.putaway_date.Equals(entity.putaway_date)
+ );
if (stockEntity == null)
{
await Stocks.AddAsync(new StockEntity
@@ -302,6 +326,10 @@ namespace ModernWMS.WMS.Services
goods_location_id = entity.goods_location_id,
qty = entity.difference_qty,
goods_owner_id = entity.goods_owner_id,
+ series_number = entity.series_number,
+ expiry_date = entity.expiry_date,
+ price = entity.price,
+ putaway_date = DateTime.Now.ToString("yyyy-MM-dd").ObjToDate(),
is_freeze = false,
last_update_time = DateTime.Now,
tenant_id = currentUser.tenant_id
@@ -320,6 +348,10 @@ namespace ModernWMS.WMS.Services
sku_id = entity.sku_id,
goods_location_id = entity.goods_location_id,
goods_owner_id = entity.goods_owner_id,
+ series_number = entity.series_number,
+ expiry_date = entity.expiry_date,
+ price = entity.price,
+ putaway_date = entity.putaway_date,
qty = entity.difference_qty,
creator = currentUser.user_name,
create_time = DateTime.Now,
diff --git a/backend/ModernWMS.WMS/Services/user/UserService.cs b/backend/ModernWMS.WMS/Services/user/UserService.cs
index 0eecce0..50c91a0 100644
--- a/backend/ModernWMS.WMS/Services/user/UserService.cs
+++ b/backend/ModernWMS.WMS/Services/user/UserService.cs
@@ -501,6 +501,15 @@ namespace ModernWMS.WMS.Services
sort = 6,
tenant_id = tenant_id
},new MenuEntity
+ {
+ menu_name = "stockageStatistic",
+ module = "statisticAnalysis ",
+ vue_path = "stockageStatistic",
+ vue_path_detail = "",
+ vue_directory = "statisticAnalysis/stockageStatistic",
+ sort = 7,
+ tenant_id = tenant_id
+ },new MenuEntity
{
menu_name = "warehouseProcessing",
module = "warehouseWorkingModule",
@@ -564,6 +573,16 @@ namespace ModernWMS.WMS.Services
sort = 5,
tenant_id = tenant_id
}
+ ,new MenuEntity
+ {
+ menu_name = "largeScreen",
+ module = "",
+ vue_path = "largeScreen",
+ vue_path_detail = "",
+ vue_directory = "largeScreen/largeScreen",
+ sort = 6,
+ tenant_id = tenant_id
+ }
};
#endregion menus