diff --git a/Infrastructure/Enums/BusinessType.cs b/Infrastructure/Enums/BusinessType.cs index a4f09e1c..d8ad67c3 100644 --- a/Infrastructure/Enums/BusinessType.cs +++ b/Infrastructure/Enums/BusinessType.cs @@ -54,5 +54,9 @@ /// 清空数据 /// CLEAN = 9, + /// + /// 查询 + /// + QUERY = 10, } } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs index f1bab376..9360fa52 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs @@ -26,9 +26,9 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms /// /// [HttpGet("production_warehouse_info")] - public IActionResult Queryproduction_warehouse_info(string shelf = "", int layer = 0, int pageNum = 0, int pageSize = 0) + public IActionResult Queryproduction_warehouse_info(string shelf , int? layer , int pageNum = 0, int pageSize = 0) { - (List, int) data = wm_locationInfoService.Getwminfo_product(shelf, layer, pageNum, pageSize); + (List, int) data = wm_locationInfoService.Getwminfo_product(shelf, layer??0, pageNum, pageSize); return ToResponse(new ApiResult(200, "success", data)); } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs new file mode 100644 index 00000000..0b47c870 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmCheckLogController.cs @@ -0,0 +1,110 @@ +using Microsoft.AspNetCore.Mvc; + +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.Business.IBusinessService; + +//创建时间:2024-03-26 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 盘点记录 + /// + [Verify] + [Route("/mes/wm//WmCheckLog")] + public class WmCheckLogController : BaseController + { + /// + /// 盘点记录接口 + /// + private readonly IWmCheckLogService _WmCheckLogService; + + public WmCheckLogController(IWmCheckLogService WmCheckLogService) + { + _WmCheckLogService = WmCheckLogService; + } + + /// + /// 查询盘点记录列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:wmchecklog:list")] + public IActionResult QueryWmCheckLog([FromQuery] WmCheckLogQueryDto parm) + { + var response = _WmCheckLogService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询盘点记录详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "business:wmchecklog:query")] + public IActionResult GetWmCheckLog(int Id) + { + var response = _WmCheckLogService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加盘点记录 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:wmchecklog:add")] + [Log(Title = "盘点记录", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmCheckLog([FromBody] WmCheckLogDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmCheckLogService.AddWmCheckLog(modal); + + return SUCCESS(response); + } + + /// + /// 更新盘点记录 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:wmchecklog:edit")] + [Log(Title = "盘点记录", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmCheckLog([FromBody] WmCheckLogDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmCheckLogService.UpdateWmCheckLog(modal); + + return ToResponse(response); + } + + /// + /// 删除盘点记录 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:wmchecklog:delete")] + [Log(Title = "盘点记录", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmCheckLog(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _WmCheckLogService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs new file mode 100644 index 00000000..9cc54e90 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsNowProductionController.cs @@ -0,0 +1,110 @@ +using Microsoft.AspNetCore.Mvc; + +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.mes.wms.IService; + +//创建时间:2024-03-22 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 成品库当前货物表 + /// + [Verify] + [Route("/mes/wm/WmGoodsNowProduction")] + public class WmGoodsNowProductionController : BaseController + { + /// + /// 成品库当前货物表接口 + /// + private readonly IWmGoodsNowProductionService _WmGoodsNowProductionService; + + public WmGoodsNowProductionController(IWmGoodsNowProductionService WmGoodsNowProductionService) + { + _WmGoodsNowProductionService = WmGoodsNowProductionService; + } + + /// + /// 查询成品库当前货物表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:list")] + public IActionResult QueryWmGoodsNowProduction([FromQuery] WmGoodsNowProductionQueryDto parm) + { + var response = _WmGoodsNowProductionService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询成品库当前货物表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:query")] + public IActionResult GetWmGoodsNowProduction(string Id) + { + var response = _WmGoodsNowProductionService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加成品库当前货物表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:add")] + [Log(Title = "成品库当前货物表", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmGoodsNowProduction([FromBody] WmGoodsNowProductionDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmGoodsNowProductionService.AddWmGoodsNowProduction(modal); + + return SUCCESS(response); + } + + /// + /// 更新成品库当前货物表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:edit")] + [Log(Title = "成品库当前货物表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmGoodsNowProduction([FromBody] WmGoodsNowProductionDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmGoodsNowProductionService.UpdateWmGoodsNowProduction(modal); + + return ToResponse(response); + } + + /// + /// 删除成品库当前货物表 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsnowproduction:delete")] + [Log(Title = "成品库当前货物表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmGoodsNowProduction(string ids) + { + long[] idsArr = Tools.SpitLongArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _WmGoodsNowProductionService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs index 0a366b0b..adfe188e 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmGoodsOutProductionController.cs @@ -33,7 +33,7 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpGet("list")] - [ActionPermissionFilter(Permission = "business:wmgoodsoutproduction:list")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsoutproduction:list")] public IActionResult QueryWmGoodsOutProduction([FromQuery] WmGoodsOutProductionQueryDto parm) { var response = _WmGoodsOutProductionService.GetList(parm); @@ -47,12 +47,12 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpGet("{Id}")] - [ActionPermissionFilter(Permission = "business:wmgoodsoutproduction:query")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsoutproduction:query")] public IActionResult GetWmGoodsOutProduction(string Id) { var response = _WmGoodsOutProductionService.GetInfo(Id); - var info = response.Adapt(); + var info = response.Adapt(); return SUCCESS(info); } @@ -61,11 +61,11 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpPost] - [ActionPermissionFilter(Permission = "business:wmgoodsoutproduction:add")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsoutproduction:add")] [Log(Title = "出库货物记录表", BusinessType = BusinessType.INSERT)] public IActionResult AddWmGoodsOutProduction([FromBody] WmGoodsOutProductionDto parm) { - var modal = parm.Adapt().ToCreate(HttpContext); + var modal = parm.Adapt().ToCreate(HttpContext); var response = _WmGoodsOutProductionService.AddWmGoodsOutProduction(modal); @@ -77,11 +77,11 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpPut] - [ActionPermissionFilter(Permission = "business:wmgoodsoutproduction:edit")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsoutproduction:edit")] [Log(Title = "出库货物记录表", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateWmGoodsOutProduction([FromBody] WmGoodsOutProductionDto parm) { - var modal = parm.Adapt().ToUpdate(HttpContext); + var modal = parm.Adapt().ToUpdate(HttpContext); var response = _WmGoodsOutProductionService.UpdateWmGoodsOutProduction(modal); return ToResponse(response); @@ -92,11 +92,11 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpDelete("{ids}")] - [ActionPermissionFilter(Permission = "business:wmgoodsoutproduction:delete")] + [ActionPermissionFilter(Permission = "wmsManagement:wmgoodsoutproduction:delete")] [Log(Title = "出库货物记录表", BusinessType = BusinessType.DELETE)] public IActionResult DeleteWmGoodsOutProduction(string ids) { - int[] idsArr = Tools.SpitIntArrary(ids); + long[] idsArr = Tools.SpitLongArrary(ids); if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } var response = _WmGoodsOutProductionService.Delete(idsArr); diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs index ec6ea1d0..fddfb89f 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs @@ -107,6 +107,20 @@ namespace ZR.Admin.WebApi.Controllers } + [HttpGet("getInfoByPatchCode")] + [Log(Title = "物料记录表", BusinessType = BusinessType.QUERY)] + public IActionResult GetInfoByPatchCode(string patchCode) + { + if (string.IsNullOrEmpty(patchCode)) + { + return SUCCESS(null); + } + WmGoodsNowProduction nowProduction= _WmMaterialService.GetInfoByPatchCode(patchCode); + return SUCCESS(nowProduction); + } + + + } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs index 95c6631d..bc903795 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs @@ -6,6 +6,7 @@ using ZR.Service.mes.wms.IService; using ZR.Model.MES.wms.Dto; using ZR.Model.MES.wms; using ZR.Service.mes.wms; +using static System.Runtime.InteropServices.JavaScript.JSType; //创建时间:2024-03-18 namespace ZR.Admin.WebApi.Controllers @@ -150,6 +151,8 @@ namespace ZR.Admin.WebApi.Controllers List data = _WmOutOrderService.Queryoutoder_matrials(shipment_num); return SUCCESS(data); } + + /// /// 生成出货单的出货计划 /// @@ -162,11 +165,48 @@ namespace ZR.Admin.WebApi.Controllers { return SUCCESS(null); } - List WmOutOrderPlanList= _WmOutOrderService.Generate_outorderplan(shipment_num); + // TODO 1.返回值修改为 对象 返回是否可生成计划,计划结果:{canPlan:true,resultList:[]} + List WmOutOrderPlanList = _WmOutOrderService.Generate_outorderplan(shipment_num); return SUCCESS(WmOutOrderPlanList); } + /// + /// 5 成品出库 + /// + /// + /// + /// + /// + [HttpPost("doMaterialOut")] + public IActionResult DoMaterialOut([FromBody] WmDoMaterialOut_Dto doMaterialOut) + { + if(doMaterialOut == null||doMaterialOut.ShipmentNum==null) + { + return SUCCESS(null); + } + (int,int) data= _WmOutOrderService.DoMaterialOut(doMaterialOut, HttpContext.GetName()); + + return SUCCESS(data); + } + + + /// + /// 6 出库单完成 + /// + /// + /// + [HttpGet("over_outorderplan")] + public IActionResult OverOutorderplan(string shipment_num) + { + if (shipment_num == null) + { + return SUCCESS(null); + } + + bool status = _WmOutOrderService.OverOutorderplan(shipment_num); + return SUCCESS(status); + } } } \ No newline at end of file diff --git a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs index aa55e686..b5740f70 100644 --- a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs +++ b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs @@ -34,9 +34,16 @@ namespace ZR.Admin.WebApi.Filters { ApiResult response = new(); response.Code = (int)ResultCode.PARAM_ERROR; - + // todo 模型校验 + /* + 在.Net Core的时代中,框架会帮你自动验证model的state,也就是ModelState。 + 框架会为你自动注册ModelStateInvalidFilter, + 这个会运行在OnActionExecuting事件里面。 + */ var values = context.ModelState.Values; - //todo 在干啥??? + + // return next(); + foreach (var item in values) { foreach (var err in item.Errors) @@ -64,7 +71,8 @@ namespace ZR.Admin.WebApi.Filters } /// - /// OnActionExecuted是在Action中的代码执行之后运行的方法。 + /// 写入操作日志 + /// OnActionExecuted是在Action中的代码执行之后运行的方法。 /// /// public override void OnResultExecuted(ResultExecutedContext context) diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index c0b0a795..ddc59da6 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -2,6 +2,7 @@ using AspNetCoreRateLimit; using Infrastructure; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.DataProtection; +using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; using System.Text.Json.Serialization; using ZR.Admin.WebApi.AutoMapperProfile; @@ -92,7 +93,11 @@ builder.Services.AddMvc(options => builder.Services.AddSwaggerConfig(); builder.Services.AddAutoMapper(typeof(AutoMapperProfile)); - +//关闭参数自动校验,我们需要返回自定义的格式 +builder.Services.Configure((o) => +{ + o.SuppressModelStateInvalidFilter = true; +}); var app = builder.Build(); InternalApp.ServiceProvider = app.Services; InternalApp.Configuration = builder.Configuration; diff --git a/ZR.Admin.WebApi/appsettings.development.json b/ZR.Admin.WebApi/appsettings.development.json index e18bf0be..b54b2ff5 100644 --- a/ZR.Admin.WebApi/appsettings.development.json +++ b/ZR.Admin.WebApi/appsettings.development.json @@ -11,12 +11,14 @@ { //本地连接服务器 - // "Conn": "Data Source=localhost;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", + // "Conn": "Data Source=localhost;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", //外网连接服务器 - //"Conn": "Data Source=47.116.122.230;Port=3307;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", + "Conn": "Data Source=47.116.122.230;Port=3307;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", + // 干巷服务器 + // "Conn": "Data Source=192.168.60.251;Port=3306;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", //内网连接服务器 - "Conn": "Data Source=192.168.0.36;Port=3306;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", + //"Conn": "Data Source=192.168.0.36;Port=3306;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", // "Conn": "Data Source=127.0.0.1;Port=3306;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", "Type": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4, "ConfigId": "0", //多租户唯一标识 @@ -27,7 +29,7 @@ //代码生成数据库配置 "CodeGenDbConfig": { //代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名 - "Conn": "Data Source=192.168.0.36;Port=3306;User ID=root;Password=123456;Initial Catalog={dbName};", + "Conn": "Data Source=47.116.122.230;Port=3307;User ID=root;Password=123456;Initial Catalog={dbName};", "DbType": 0, "IsAutoCloseConnection": true, "DbName": "ZrAdmin" //代码生成默认连接数据库 diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-出库货物记录表-0322091020.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-出库货物记录表-0322091020.zip new file mode 100644 index 00000000..8e473e96 Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-出库货物记录表-0322091020.zip differ diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-成品库当前货物表-0322091432.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-成品库当前货物表-0322091432.zip new file mode 100644 index 00000000..ced6fcf0 Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-成品库当前货物表-0322091432.zip differ diff --git a/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-盘点记录-0326150209.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-盘点记录-0326150209.zip new file mode 100644 index 00000000..f51977ea Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-盘点记录-0326150209.zip differ diff --git a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs index 2c8d30de..fc2658de 100644 --- a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs +++ b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs @@ -28,7 +28,7 @@ namespace ZR.Model.MES.wms.Dto /// /// 数量 /// - public string Quantity { get; set; } + public int? Quantity { get; set; } /// /// 生产时间 diff --git a/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs b/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs new file mode 100644 index 00000000..de222317 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmCheckLogDto.cs @@ -0,0 +1,46 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 盘点记录查询对象 + /// + public class WmCheckLogQueryDto : PagerInfo + { + } + + /// + /// 盘点记录输入输出对象 + /// + public class WmCheckLogDto + { + public int? Id { get; set; } + + public string FkGoodsNowProduction { get; set; } + + public string Partnumber { get; set; } + + public string PackageCodeClient { get; set; } + + public decimal OldValue { get; set; } + + public decimal NewValue { get; set; } + + public int? Type { get; set; } + + public decimal Value { get; set; } + + public string Remark { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs new file mode 100644 index 00000000..26b84106 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmGoodsNowProductionDto.cs @@ -0,0 +1,82 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 成品库当前货物表查询对象 + /// + public class WmGoodsNowProductionQueryDto : PagerInfo + { + public string Id { get; set; } + + + public string PackageCode { get; set; } + + + public string PackageCodeClient { get; set; } + + public string PackageCodeOriginal { get; set; } + + + public string LocationCode { get; set; } + + public string Partnumber { get; set; } + + public int? GoodsNumLogic { get; set; } + + public int? GoodsNumAction { get; set; } + + public DateTime? EntryWarehouseTime { get; set; } + + public string Remark { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + } + + /// + /// 成品库当前货物表输入输出对象 + /// + public class WmGoodsNowProductionDto + { + + public string Id { get; set; } + + + public string PackageCode { get; set; } + + + public string PackageCodeClient { get; set; } + + public string PackageCodeOriginal { get; set; } + + + public string LocationCode { get; set; } + + public string Partnumber { get; set; } + + public int? GoodsNumLogic { get; set; } + + public int? GoodsNumAction { get; set; } + + public DateTime? EntryWarehouseTime { get; set; } + + public string Remark { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs index 8094957d..a12160a8 100644 --- a/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs +++ b/ZR.Model/MES/wms/Dto/WmGoodsOutProductionDto.cs @@ -7,6 +7,41 @@ namespace ZR.Model.MES.wms.Dto /// public class WmGoodsOutProductionQueryDto : PagerInfo { + + public string Id { get; set; } + + public string FkNowProductionId { get; set; } + + public string FkOutOrderId { get; set; } + + public string PackageCode { get; set; } + + + public string PackageCodeClient { get; set; } + + public string PackageCodeOriginal { get; set; } + + public string LocationCode { get; set; } + + public string Partnumber { get; set; } + + public int? GoodsNumLogic { get; set; } + + public int? GoodsNumAction { get; set; } + + public DateTime? EntryWarehouseTime { get; set; } + + public DateTime? OutTime { get; set; } + + public string Remark { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } } /// @@ -14,22 +49,22 @@ namespace ZR.Model.MES.wms.Dto /// public class WmGoodsOutProductionDto { - [Required(ErrorMessage = "雪花id不能为空")] + public string Id { get; set; } public string FkNowProductionId { get; set; } public string FkOutOrderId { get; set; } - [Required(ErrorMessage = "箱子编号(MES)不能为空")] + public string PackageCode { get; set; } - [Required(ErrorMessage = "箱子编号(客户)不能为空")] + public string PackageCodeClient { get; set; } public string PackageCodeOriginal { get; set; } - [Required(ErrorMessage = "库位编号不能为空")] + public string LocationCode { get; set; } public string Partnumber { get; set; } diff --git a/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs index ba220f43..981312d1 100644 --- a/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs +++ b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs @@ -68,6 +68,23 @@ namespace ZR.Model.MES.wms.Dto } + // 出货到出货记录表 + public class WmDoMaterialOut_Dto + { + /// + /// 出库单号 + /// + public string ShipmentNum { get; set; } + + /// + /// 批次号 + /// + public string[] PatchCode { get; set; } + + + } + + + - } \ No newline at end of file diff --git a/ZR.Model/MES/wms/WmCheckLog.cs b/ZR.Model/MES/wms/WmCheckLog.cs new file mode 100644 index 00000000..3048eedd --- /dev/null +++ b/ZR.Model/MES/wms/WmCheckLog.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 盘点记录 + /// + [SugarTable("wm_check_log")] + public class WmCheckLog + { + /// + /// 主键 + /// + public int? Id { get; set; } + + /// + /// 成品库主键id + /// + [SugarColumn(ColumnName = "fk_goods_now_production")] + public string FkGoodsNowProduction { get; set; } + + /// + /// 零件号 + /// + public string Partnumber { get; set; } + + /// + /// 批次号 + /// + [SugarColumn(ColumnName = "package_code_client")] + public string PackageCodeClient { get; set; } + + /// + /// 原数值 + /// + [SugarColumn(ColumnName = "old_value")] + public decimal OldValue { get; set; } + + /// + /// 修改后 + /// + [SugarColumn(ColumnName = "new_value")] + public decimal NewValue { get; set; } + + /// + /// 修改类型;1-添加2-减少 + /// + public int? Type { get; set; } + + /// + /// 修改数值 + /// + public decimal Value { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "cREATED_BY")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "cREATED_TIME")] + public DateTime? CreatedTime { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "uPDATED_BY")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "uPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/WmCustom.cs b/ZR.Model/MES/wms/WmCustom.cs index be91ec97..76cb175d 100644 --- a/ZR.Model/MES/wms/WmCustom.cs +++ b/ZR.Model/MES/wms/WmCustom.cs @@ -37,6 +37,7 @@ namespace ZR.Model.MES.wms /// /// 备注 /// + [SugarColumn(ColumnName = "remark")] public string Remark { get; set; } /// diff --git a/ZR.Model/MES/wms/WmGoodsOutRecord.cs b/ZR.Model/MES/wms/WmGoodsOutRecord.cs new file mode 100644 index 00000000..49c51062 --- /dev/null +++ b/ZR.Model/MES/wms/WmGoodsOutRecord.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 出库货物记录表 + /// + [SugarTable("wm_goods_out_record")] + public class WmGoodsOutRecord + { + /// + /// 雪花id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false)] + public string Id { get; set; } + + /// + /// 成品库当前货物表主键 + /// + [SugarColumn(ColumnName = "fk_now_production_id")] + public string FkNowProductionId { get; set; } + + /// + /// 出库单号 + /// + [SugarColumn(ColumnName = "fk_out_order_id")] + public string FkOutOrderId { get; set; } + + /// + /// 箱子编号(MES) + /// + [SugarColumn(ColumnName = "package_code")] + public string PackageCode { get; set; } + + /// + /// 箱子编号(客户) + /// + [SugarColumn(ColumnName = "package_code_client")] + public string PackageCodeClient { get; set; } + + /// + /// 箱子编号(原始码) + /// + [SugarColumn(ColumnName = "package_code_original")] + public string PackageCodeOriginal { get; set; } + + /// + /// 库位编号 + /// + [SugarColumn(ColumnName = "location_code")] + public string LocationCode { get; set; } + + /// + /// 零件号 + /// + public string Partnumber { get; set; } + + /// + /// 箱子中货物数量(理论) + /// + [SugarColumn(ColumnName = "goods_num_logic")] + public int? GoodsNumLogic { get; set; } + + /// + /// 箱子中货物数量(实际) + /// + [SugarColumn(ColumnName = "goods_num_action")] + public int? GoodsNumAction { get; set; } + + /// + /// 入库时间 + /// + [SugarColumn(ColumnName = "entry_warehouse_time")] + public DateTime? EntryWarehouseTime { get; set; } + + /// + /// 出库时间 + /// + [SugarColumn(ColumnName = "out_time")] + public DateTime? OutTime { get; set; } + + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 更新人 + /// + [SugarColumn(ColumnName = "uPDATED_BY")] + public string UpdatedBy { get; set; } + + /// + /// 更新时间 + /// + [SugarColumn(ColumnName = "uPDATED_TIME")] + public DateTime? UpdatedTime { get; set; } + + /// + /// 创建人 + /// + [SugarColumn(ColumnName = "cREATED_BY")] + public string CreatedBy { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "cREATED_TIME")] + public DateTime? CreatedTime { get; set; } + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/WmInfo.cs b/ZR.Model/MES/wms/WmInfo.cs index 0164207b..33f2e16a 100644 --- a/ZR.Model/MES/wms/WmInfo.cs +++ b/ZR.Model/MES/wms/WmInfo.cs @@ -40,6 +40,16 @@ namespace ZR.Model.MES.wms /// [SugarColumn(ColumnName = "location")] public string Location { get; set; } + + + /// + /// 备注 + /// + [SugarColumn(ColumnName = "remark")] + public string Remark { get; set; } + + + /// /// 创建人 /// diff --git a/ZR.Model/MES/wms/WmOutOrderPlan.cs b/ZR.Model/MES/wms/WmOutOrderPlan.cs index a82e0b7b..d79c7522 100644 --- a/ZR.Model/MES/wms/WmOutOrderPlan.cs +++ b/ZR.Model/MES/wms/WmOutOrderPlan.cs @@ -27,6 +27,11 @@ namespace ZR.Model.MES.wms /// [SugarColumn(ColumnName = "patchcode")] public string Patchcode { get; set; } + + /// + /// 短批次号 + /// + public string Patchcode_short { get; set; } /// /// 物料号 /// diff --git a/ZR.Service/mes/wms/IService/IWmCheckLogService.cs b/ZR.Service/mes/wms/IService/IWmCheckLogService.cs new file mode 100644 index 00000000..2bc42c6f --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmCheckLogService.cs @@ -0,0 +1,24 @@ +using System; +using ZR.Model; + +using System.Collections.Generic; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.Business.IBusinessService +{ + /// + /// 盘点记录service接口 + /// + public interface IWmCheckLogService : IBaseService + { + PagedInfo GetList(WmCheckLogQueryDto parm); + + WmCheckLog GetInfo(int Id); + + WmCheckLog AddWmCheckLog(WmCheckLog parm); + + int UpdateWmCheckLog(WmCheckLog parm); + + } +} diff --git a/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs b/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs new file mode 100644 index 00000000..a9027a61 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmGoodsNowProductionService.cs @@ -0,0 +1,25 @@ +using System; +using ZR.Model; +using ZR.Model.Dto; + +using System.Collections.Generic; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.mes.wms.IService +{ + /// + /// 成品库当前货物表service接口 + /// + public interface IWmGoodsNowProductionService : IBaseService + { + PagedInfo GetList(WmGoodsNowProductionQueryDto parm); + + WmGoodsNowProduction GetInfo(string Id); + + WmGoodsNowProduction AddWmGoodsNowProduction(WmGoodsNowProduction parm); + + int UpdateWmGoodsNowProduction(WmGoodsNowProduction parm); + + } +} diff --git a/ZR.Service/mes/wms/IService/IWmGoodsOutProductionService.cs b/ZR.Service/mes/wms/IService/IWmGoodsOutProductionService.cs index 7b119d3a..e64c0d81 100644 --- a/ZR.Service/mes/wms/IService/IWmGoodsOutProductionService.cs +++ b/ZR.Service/mes/wms/IService/IWmGoodsOutProductionService.cs @@ -10,15 +10,15 @@ namespace ZR.Service.mes.wms.IService /// /// 出库货物记录表service接口 /// - public interface IWmGoodsOutProductionService : IBaseService + public interface IWmGoodsOutProductionService : IBaseService { PagedInfo GetList(WmGoodsOutProductionQueryDto parm); - WmGoodsOutProduction GetInfo(string Id); + WmGoodsOutRecord GetInfo(string Id); - WmGoodsOutProduction AddWmGoodsOutProduction(WmGoodsOutProduction parm); + WmGoodsOutRecord AddWmGoodsOutProduction(WmGoodsOutRecord parm); - int UpdateWmGoodsOutProduction(WmGoodsOutProduction parm); + int UpdateWmGoodsOutProduction(WmGoodsOutRecord parm); } } diff --git a/ZR.Service/mes/wms/IService/IWmMaterialService.cs b/ZR.Service/mes/wms/IService/IWmMaterialService.cs index 0f745359..7d981b76 100644 --- a/ZR.Service/mes/wms/IService/IWmMaterialService.cs +++ b/ZR.Service/mes/wms/IService/IWmMaterialService.cs @@ -20,5 +20,7 @@ namespace ZR.Service.mes.wms.IService int UpdateWmMaterial(WmMaterial parm); + WmGoodsNowProduction GetInfoByPatchCode(string patchCode); + } } diff --git a/ZR.Service/mes/wms/IService/IWmOutOrderService.cs b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs index fe5045fb..6e26ca1f 100644 --- a/ZR.Service/mes/wms/IService/IWmOutOrderService.cs +++ b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs @@ -31,5 +31,10 @@ namespace ZR.Service.mes.wms.IService List Generate_outorderplan(string shipment_num); + (int, int) DoMaterialOut(WmDoMaterialOut_Dto doMaterialOut, string Createby); + + + bool OverOutorderplan(string shipment_num); + } } diff --git a/ZR.Service/mes/wms/WMExitwarehouseService.cs b/ZR.Service/mes/wms/WMExitwarehouseService.cs index 2f4d1a36..c5de5806 100644 --- a/ZR.Service/mes/wms/WMExitwarehouseService.cs +++ b/ZR.Service/mes/wms/WMExitwarehouseService.cs @@ -76,7 +76,7 @@ namespace ZR.Service.mes.wms resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6); //todo 解析箱子中产品数量 string product_num = splitstr[3].Substring(4); - resultionPackageCode.Quantity = product_num; + resultionPackageCode.Quantity = int.Parse(product_num); //todo 产品描述 partnumber // ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First(); //if(plan != null) diff --git a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs index 74427e2d..ad804ecd 100644 --- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs +++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs @@ -62,15 +62,15 @@ namespace ZR.Service.mes.wms string workorder_id = resultionPackage.WorkoderID; - wmGood.GoodsNumLogic = Context.Queryable() - .Where(it => it.WorkOrderNum == workorder_id) - .Count(); + //wmGood.GoodsNumLogic = Context.Queryable() + // .Where(it => it.WorkOrderNum == workorder_id) + // .Count(); + wmGood.GoodsNumLogic = (resultionPackage.Quantity)??0; + wmGood.GoodsNumAction= wmGood.GoodsNumLogic; wmGood.EntryWarehouseTime = DateTime.Now; wmGood.CreatedBy = createName; wmGood.CreatedTime = DateTime.Now; - - preparegoodsList.Add(wmGood); @@ -219,7 +219,7 @@ namespace ZR.Service.mes.wms resultionPackageCode.ProductionTime="20"+ workoderidid.Substring(0,6); //todo 解析箱子中产品数量 string product_num = splitstr[3].Substring(4); - resultionPackageCode.Quantity = product_num; + resultionPackageCode.Quantity = int.Parse(product_num); //todo 产品描述 partnumber // ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First(); //if(plan != null) @@ -230,7 +230,9 @@ namespace ZR.Service.mes.wms // { // resultionPackageCode.ProductionDescribe = "生产计划无此零件号"; // } - ProWorkorder_v2 workorder= Context.Queryable().Where(it => it.FinishedPartNumber == partnumber).First(); + ProWorkorder_v2 workorder= Context.Queryable() + .Where(it => it.FinishedPartNumber == partnumber) + .First(); if (workorder != null) { diff --git a/ZR.Service/mes/wms/WMlocationInfoService.cs b/ZR.Service/mes/wms/WMlocationInfoService.cs index fa759a8b..dfed8e5d 100644 --- a/ZR.Service/mes/wms/WMlocationInfoService.cs +++ b/ZR.Service/mes/wms/WMlocationInfoService.cs @@ -40,7 +40,7 @@ namespace ZR.Service.mes.wms { int totalNum = 0; var predicate = Expressionable.Create() - .AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf == shelf) + .AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf.Contains(shelf)) .AndIF(layer > 0, it => it.Layer == layer) .ToExpression(); List product_wminfoList = Context.Queryable().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum); diff --git a/ZR.Service/mes/wms/WmCheckLogService.cs b/ZR.Service/mes/wms/WmCheckLogService.cs new file mode 100644 index 00000000..46b6c819 --- /dev/null +++ b/ZR.Service/mes/wms/WmCheckLogService.cs @@ -0,0 +1,89 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; + +using ZR.Repository; +using ZR.Service.Business.IBusinessService; +using System.Linq; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.Business +{ + /// + /// 盘点记录Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmCheckLogService), ServiceLifetime = LifeTime.Transient)] + public class WmCheckLogService : BaseService, IWmCheckLogService + { + /// + /// 查询盘点记录列表 + /// + /// + /// + public PagedInfo GetList(WmCheckLogQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmCheckLog GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加盘点记录 + /// + /// + /// + public WmCheckLog AddWmCheckLog(WmCheckLog model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改盘点记录 + /// + /// + /// + public int UpdateWmCheckLog(WmCheckLog model) + { + //var response = Update(w => w.Id == model.Id, it => new WmCheckLog() + //{ + // FkGoodsNowProduction = model.FkGoodsNowProduction, + // Partnumber = model.Partnumber, + // PackageCodeClient = model.PackageCodeClient, + // OldValue = model.OldValue, + // NewValue = model.NewValue, + // Type = model.Type, + // Value = model.Value, + // Remark = model.Remark, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/wms/WmGoodsNowProductionService.cs b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs new file mode 100644 index 00000000..0819f86f --- /dev/null +++ b/ZR.Service/mes/wms/WmGoodsNowProductionService.cs @@ -0,0 +1,98 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; +using ZR.Repository; + +using System.Linq; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.mes.wms.IService; + +namespace ZR.Service.mes.wms +{ + /// + /// 成品库当前货物表Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmGoodsNowProductionService), ServiceLifetime = LifeTime.Transient)] + public class WmGoodsNowProductionService : BaseService, IWmGoodsNowProductionService + { + /// + /// 查询成品库当前货物表列表 + /// + /// + /// + public PagedInfo GetList(WmGoodsNowProductionQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber)) + .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient)) + .AndIF(!string.IsNullOrEmpty(parm.LocationCode), it => it.LocationCode.Contains(parm.LocationCode)) + ; + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmGoodsNowProduction GetInfo(string Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加成品库当前货物表 + /// + /// + /// + public WmGoodsNowProduction AddWmGoodsNowProduction(WmGoodsNowProduction model) + { + if (string.IsNullOrEmpty(model.Id)) + { + model.Id = SnowFlakeSingle.Instance.NextId().ToString();//也可以在程序中直接获取ID + } + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改成品库当前货物表 + /// + /// + /// + public int UpdateWmGoodsNowProduction(WmGoodsNowProduction model) + { + //var response = Update(w => w.Id == model.Id, it => new WmGoodsNowProduction() + //{ + // PackageCode = model.PackageCode, + // PackageCodeClient = model.PackageCodeClient, + // PackageCodeOriginal = model.PackageCodeOriginal, + // LocationCode = model.LocationCode, + // Partnumber = model.Partnumber, + // GoodsNumLogic = model.GoodsNumLogic, + // GoodsNumAction = model.GoodsNumAction, + // EntryWarehouseTime = model.EntryWarehouseTime, + // Remark = model.Remark, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + //}); + //return response; + return Update(model, true); + } + + } +} \ No newline at end of file diff --git a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs index d062e0ee..ffe0c5b3 100644 --- a/ZR.Service/mes/wms/WmGoodsOutProductionService.cs +++ b/ZR.Service/mes/wms/WmGoodsOutProductionService.cs @@ -11,13 +11,13 @@ using ZR.Service.mes.wms.IService; using ZR.Model.MES.wms; using ZR.Model.MES.wms.Dto; -namespace ZR.Service.Business +namespace ZR.Service.mes.wms { /// /// 出库货物记录表Service业务层处理 /// [AppService(ServiceType = typeof(IWmGoodsOutProductionService), ServiceLifetime = LifeTime.Transient)] - public class WmGoodsOutProductionService : BaseService, IWmGoodsOutProductionService + public class WmGoodsOutProductionService : BaseService, IWmGoodsOutProductionService { /// /// 查询出库货物记录表列表 @@ -26,11 +26,16 @@ namespace ZR.Service.Business /// public PagedInfo GetList(WmGoodsOutProductionQueryDto parm) { - var predicate = Expressionable.Create(); + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.Partnumber),it=>it.Partnumber.Contains(parm.Partnumber)) + .AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient),it=>it.PackageCodeClient.Contains(parm.PackageCodeClient)) + .AndIF(!string.IsNullOrEmpty(parm.LocationCode),it=>it.LocationCode.Contains(parm.LocationCode)) + .AndIF(!string.IsNullOrEmpty(parm.FkOutOrderId),it=>it.FkOutOrderId.Contains(parm.FkOutOrderId)) + ; var response = Queryable() .Where(predicate.ToExpression()) - .ToPage(parm); + .ToPage(parm); return response; } @@ -41,7 +46,7 @@ namespace ZR.Service.Business /// /// /// - public WmGoodsOutProduction GetInfo(string Id) + public WmGoodsOutRecord GetInfo(string Id) { var response = Queryable() .Where(x => x.Id == Id) @@ -55,8 +60,12 @@ namespace ZR.Service.Business /// /// /// - public WmGoodsOutProduction AddWmGoodsOutProduction(WmGoodsOutProduction model) + public WmGoodsOutRecord AddWmGoodsOutProduction(WmGoodsOutRecord model) { + if (string.IsNullOrEmpty(model.Id)) + { + model.Id= SnowFlakeSingle.Instance.NextId().ToString();//也可以在程序中直接获取ID + } return Context.Insertable(model).ExecuteReturnEntity(); } @@ -65,7 +74,7 @@ namespace ZR.Service.Business /// /// /// - public int UpdateWmGoodsOutProduction(WmGoodsOutProduction model) + public int UpdateWmGoodsOutProduction(WmGoodsOutRecord model) { //var response = Update(w => w.Id == model.Id, it => new WmGoodsOutProduction() //{ diff --git a/ZR.Service/mes/wms/WmMaterialService.cs b/ZR.Service/mes/wms/WmMaterialService.cs index e844ea36..0ccc5caf 100644 --- a/ZR.Service/mes/wms/WmMaterialService.cs +++ b/ZR.Service/mes/wms/WmMaterialService.cs @@ -104,5 +104,17 @@ namespace ZR.Service.mes.wms return Update(model, true); } + /// + /// 通过外箱标签解析后得到的批次号,获取货物仓库内的货物信息 + /// + /// + /// + /// + public WmGoodsNowProduction GetInfoByPatchCode(string patchCode) + { + return Context.Queryable() + .Where(it => it.PackageCodeClient == patchCode).First(); + + } } } \ No newline at end of file diff --git a/ZR.Service/mes/wms/WmOutOrderService.cs b/ZR.Service/mes/wms/WmOutOrderService.cs index c59db9fe..2bebd353 100644 --- a/ZR.Service/mes/wms/WmOutOrderService.cs +++ b/ZR.Service/mes/wms/WmOutOrderService.cs @@ -10,6 +10,9 @@ using Mapster; using System.Collections.Generic; using System.Data; using JinianNet.JNTemplate.Dynamic; +using System.Linq; +using System.Security.Cryptography.Xml; +using System.Collections; namespace ZR.Service.mes.wms { @@ -65,9 +68,13 @@ namespace ZR.Service.mes.wms foreach (var moItem in moList) { WmMaterial material = Context.Queryable().Where(it => it.Id == moItem.FkMaterialId).First(); - WmMaterialQuery_stockQuantityDto2 dto2 = material.Adapt(); - dto2.requireOutNum = moItem.OuthouseNum; - Material_stock.Add(dto2); + if (material != null) + { + WmMaterialQuery_stockQuantityDto2 dto2 = material.Adapt(); + dto2.requireOutNum = moItem.OuthouseNum; + Material_stock.Add(dto2); + } + } wmOutOrderItem.MaterialList = Material_stock; } @@ -244,19 +251,17 @@ namespace ZR.Service.mes.wms ProductName = m.ProductName, //需求零件数 RequireOutNum = mo.OuthouseNum - - }).ToList(); if (stockList != null && stockList.Count > 0) { foreach (var stock in stockList) { //现有箱数 - stock.PackageNum = Context.Queryable().Where(it => it.Partnumber == shipment_num).Count(); + stock.PackageNum = Context.Queryable().Where(it => it.Partnumber == stock.Partnumber).Count(); //现有零件数 - int? num = Context.Queryable().Where(it => it.Partnumber == shipment_num).Sum(it => it.GoodsNumLogic); - stock.PackageNum = num ?? 0; + int? num = Context.Queryable().Where(it => it.Partnumber == stock.Partnumber).Sum(it => it.GoodsNumLogic); + stock.ItemNum = num ?? 0; } } @@ -276,11 +281,15 @@ namespace ZR.Service.mes.wms public List Generate_outorderplan(string shipment_num) { - List wmOutOrderPlans = new List(); + List wmOutOrderPlans = new List(); // 获取当前出货单下的物料信息 List materialQuery_Prints = this.Queryoutoder_matrials(shipment_num); if (materialQuery_Prints != null && materialQuery_Prints.Count > 0) { + // TODO 1.判断能否完整出货 + + // TODO 2.生成出货单 + foreach (var material in materialQuery_Prints) { //todo 判断要出多少货 按照最早工单和批次号 进行出货(重要算法) @@ -289,68 +298,24 @@ namespace ZR.Service.mes.wms // 物料号 string partnumber = material.Partnumber; + // 原始编号 + + // 该物料下 ,现有货物列表 + + List wmGoodsNowsList = Context.Queryable() + .Where(it => it.Partnumber == partnumber) + .OrderByDescending(it => it.PackageCodeClient) + .ToList(); + // TODO 1.根据入库时间,进行排序 + + // TODO 2.根据排序结果,检查数量是否达标(require_num<=accumulation_num)向最终结果数组进行添加 + List< WmGoodsNowProduction > planList = new List(); - /*此物料下的最早列表 - List wmGoodsNows = Context.Queryable().Where(it => it.Partnumber == partnumber) - .OrderByDescending(it => it.EntryWarehouseTime).ToList(); - if (wmGoodsNows != null && wmGoodsNows.Count > 0) - { - - foreach (var witem in wmGoodsNows) - { - if (require_num >= witem.GoodsNumLogic) - { // 取出同一批次下列表 - string patchcode = witem.PackageCodeClient.Split("_")[0]; - List Samebatch_wmGoodsNows = Context.Queryable() - .Where(it => it.Partnumber == partnumber) - .Where(it => it.PackageCodeClient.StartsWith(patchcode)).ToList(); - 出货计划 - WmOutOrderPlan orderPlan = new WmOutOrderPlan(); - - orderPlan.FkOutOrderId = shipment_num; - - orderPlan.Patchcode = witem.PackageCodeClient; - orderPlan.MaterialCode = witem.Partnumber; - orderPlan.WarehouseCode = witem.LocationCode; - orderPlan.PackageNum = 1; - orderPlan.RequireNum = require_num; - orderPlan.Patchtime = Resolution_bath(witem.PackageCodeClient); - - - - wmOutOrderPlans.Add(orderPlan); - - - - } - else - { - 一个箱子就可以做一个出货计划 - WmOutOrderPlan orderPlan = new WmOutOrderPlan(); - - orderPlan.FkOutOrderId = shipment_num; - - orderPlan.Patchcode = witem.PackageCodeClient; - orderPlan.MaterialCode = witem.Partnumber; - orderPlan.WarehouseCode = witem.LocationCode; - orderPlan.PackageNum = 1; - orderPlan.RequireNum = require_num; - orderPlan.Patchtime = Resolution_bath(witem.PackageCodeClient); - - - - } - - } - }*/ - - List wmGoodsNowsList = Context.Queryable().Where(it => it.Partnumber == partnumber) - .OrderByDescending(it => it.PackageCodeClient).ToList(); - foreach(var witem in wmGoodsNowsList) + foreach (var witem in wmGoodsNowsList) { int accumulation_num = 0; - if (require_num>= accumulation_num) + if (require_num >= accumulation_num) { WmOutOrderPlan orderPlan = new WmOutOrderPlan(); orderPlan.FkOutOrderId = shipment_num; @@ -358,32 +323,61 @@ namespace ZR.Service.mes.wms orderPlan.Patchcode = witem.PackageCodeClient; orderPlan.MaterialCode = witem.Partnumber; orderPlan.WarehouseCode = witem.LocationCode; - orderPlan.PackageNum =int.Parse( witem.PackageCodeClient.Split("_")[1] ); + orderPlan.PackageNum = int.Parse(witem.PackageCodeClient.Split("_")[1]); orderPlan.RequireNum = require_num; orderPlan.Patchtime = Resolution_bath(witem.PackageCodeClient); wmOutOrderPlans.Add(orderPlan); - - accumulation_num = accumulation_num+ witem.GoodsNumLogic??0; - + // 实际值计算 + accumulation_num = accumulation_num + witem.GoodsNumAction ?? 0; } else - { //超了 + { + // 超过要用零头箱 + if (require_num - accumulation_num <= witem.GoodsNumAction) + { + WmOutOrderPlan orderPlan = new WmOutOrderPlan(); + orderPlan.FkOutOrderId = shipment_num; + + orderPlan.Patchcode = witem.PackageCodeClient; + orderPlan.Patchcode_short = witem.PackageCodeClient.Split("_")[0]; + orderPlan.MaterialCode = witem.Partnumber; + orderPlan.WarehouseCode = witem.LocationCode; + orderPlan.PackageNum = 1; //短批次需求累加 + orderPlan.RequireNum = require_num; //总需求 + orderPlan.Patchtime = Resolution_bath(witem.PackageCodeClient); + wmOutOrderPlans.Add(orderPlan); + + accumulation_num = accumulation_num + witem.GoodsNumAction ?? 0; + + } + break; } } - - - + // todo 把该物料下的箱子 按照短批次号 进行分组聚合 + + if (wmOutOrderPlans.Count > 0) + { + var item = wmOutOrderPlans.GroupBy(it => it.Patchcode_short).Select(g => new + { + FkOutOrderId = g.Max(p => p.FkOutOrderId), + Patchcode = g.Max(p => p.Patchcode), + Patchcode_short = g.Max(p => p.Patchcode_short), + WarehouseCode = g.Max(p => p.WarehouseCode), + PackageNum = g.Count(), + RequireNum = g.Max(p => p.RequireNum), + Patchtime = g.Max(p => p.Patchtime), + }); + wmOutOrderPlans.Clear(); + wmOutOrderPlans.Add(item.Adapt()); + } } - - - } foreach (var witem in wmOutOrderPlans) { - witem.Outorder = wmOutOrderPlans.IndexOf(witem); + witem.Outorder = wmOutOrderPlans.IndexOf(witem) + 1; } @@ -391,6 +385,71 @@ namespace ZR.Service.mes.wms } + /// + /// 根据出库单号与货物批次号,向出库记录添加数据,并且成品库表数据删除 + /// + /// + /// + public (int, int) DoMaterialOut(WmDoMaterialOut_Dto doMaterialOut, string Createby) + { + int sum_delete = 0; + int sum_insert = 0; + string shipnumber = doMaterialOut.ShipmentNum; + if (doMaterialOut.PatchCode != null && doMaterialOut.PatchCode.Length > 0) + { + foreach (var item in doMaterialOut.PatchCode) + { + UseTran2(() => + { + WmGoodsOutRecord record = new WmGoodsOutRecord(); + record.Id = SnowFlakeSingle.Instance.NextId().ToString(); + WmGoodsNowProduction nowProduction = Context.Queryable() + .Where(it => it.PackageCodeClient == item).First(); + + if (nowProduction != null) + { + record.FkNowProductionId = nowProduction.Id; + record.PackageCodeClient = nowProduction.PackageCodeClient; + record.PackageCode = nowProduction.PackageCode; + record.PackageCodeOriginal = nowProduction.PackageCodeOriginal; + record.LocationCode = nowProduction.LocationCode; + record.Partnumber = nowProduction.Partnumber; + record.GoodsNumLogic = nowProduction.GoodsNumLogic; + record.GoodsNumAction = nowProduction.GoodsNumAction; + record.EntryWarehouseTime = nowProduction.EntryWarehouseTime; + record.OutTime = DateTime.Now; + record.CreatedTime = DateTime.Now; + record.CreatedBy = Createby; + record.FkOutOrderId = shipnumber; + sum_insert = Context.Insertable(record).ExecuteCommand(); + sum_delete += Context.Deleteable() + .Where(it => it.PackageCodeClient == item) + .ExecuteCommand(); + } + + + }); + + } + } + return (sum_delete, sum_insert); + } + + public bool OverOutorderplan(string shipment_num) + { + int reult = Context.Updateable().Where(it => it.ShipmentNum == shipment_num) + .SetColumns(it => it.Type == 2) + .ExecuteCommand(); + if (reult > 0) + { + return true; + } + else + { + return false; + } + } + /// /// 传入批次号 解析出时间 BNW240318007_105 ///