diff --git a/Infrastructure/CustomException/ResultCode.cs b/Infrastructure/CustomException/ResultCode.cs index 58739e4c..95ad884b 100644 --- a/Infrastructure/CustomException/ResultCode.cs +++ b/Infrastructure/CustomException/ResultCode.cs @@ -7,7 +7,7 @@ namespace Infrastructure [Description("success")] SUCCESS = 200, - [Description("没有更多数据")] + [Description("传入参数为空")] NO_DATA = 210, [Description("参数错误")] diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs index 0649afb6..fe61054f 100644 --- a/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/qc/FQC/FirstFQCController.cs @@ -298,11 +298,12 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC } - // 更改工单状态为完成态 + // 生成质量统计报表 [HttpGet("generateQualityStatisticsTable")] public IActionResult GenerateQualityStatisticsTable(string workorderID,string team, DateTime firstQuality_time) { - int result = fQCService.GenerateQualityStatisticsTable(workorderID, team, firstQuality_time); + + int result = fQCService.GenerateQualityStatisticsTable(workorderID, team, firstQuality_time.ToLocalTime()); return SUCCESS(result); } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMExitwarehouseController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMExitwarehouseController.cs new file mode 100644 index 00000000..7a0520d6 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMExitwarehouseController.cs @@ -0,0 +1,82 @@ +using Infrastructure.Extensions; +using JinianNet.JNTemplate; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; +using ZR.Admin.WebApi.Extensions; +using ZR.Model.Dto; +using ZR.Model.MES.qu; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.mes.wms; +using ZR.Service.mes.wms.IService; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace ZR.Admin.WebApi.Controllers.mes.wms +{ + + + /// + /// 退库模块 + /// + [Route("/mes/wm/exitwarehouse")] + public class WMExitwarehouseController : BaseController + { + private readonly IWMExitwarehouseService Exitwarehouse; + public WMExitwarehouseController(IWMExitwarehouseService Exitwarehouse) { + this.Exitwarehouse = Exitwarehouse; + } + + /// + /// 一般退库 + /// + /// + /// + [HttpGet("common")] + public IActionResult ExitwarehouseCommmon(string originalCode) + { + string msg = null; + bool data = Exitwarehouse.ExitwarehouseCommmon(originalCode); + if (data) + { + msg = "退库成功"; + } + else + { + msg = "箱子不在仓库中"; + } + return ToResponse(new ApiResult(200, msg, data)); + } + + /// + /// 7 判断箱子是否存在成品库仓库里 + /// + /// + /// + [HttpGet("is_existed_warehouse")] + public IActionResult IsExistedWarehouse(string originalCode = "") + { + if (string.IsNullOrEmpty(originalCode)) + { + + return ToResponse(new ApiResult(200, "传入为空", false)); + } + string msg = null; + bool data = this.Exitwarehouse.IsExistedWarehouse(originalCode); + if (data) + { + msg = "存在"; + + } + else + { + msg = "不存在"; + } + + return ToResponse(new ApiResult(200, msg, data)); + + } + + + } +} diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs index 9ab4a6c8..7aeaff95 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs @@ -1,10 +1,15 @@ using Infrastructure.Extensions; using JinianNet.JNTemplate; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; +using ZR.Admin.WebApi.Extensions; +using ZR.Model.Dto; using ZR.Model.MES.qu; using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; using ZR.Service.mes.wms.IService; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace ZR.Admin.WebApi.Controllers.mes.wms { @@ -18,7 +23,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms private readonly IWMentryWarehousing_productService wm_entryWarehousing_productService; public WMentryWarehousing_productController(IWMentryWarehousing_productService wm_entryWarehousing_productService) { - this.wm_entryWarehousing_productService = wm_entryWarehousing_productService; + this.wm_entryWarehousing_productService = wm_entryWarehousing_productService; } /// @@ -26,9 +31,14 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms /// /// [HttpGet("is_production_location")] + [Log(Title = "判断是否为库位码")] public IActionResult IsProductionLocation(string production_location_code = "") { + if (string.IsNullOrEmpty(production_location_code)) + { + return ToResponse(new ApiResult(200, "传入为空", false)); + } // 查询 wm_info 表,根据库位码,查询在表中是否存在,true false bool state = this.wm_entryWarehousing_productService.IsProductionLoacation(production_location_code); @@ -40,9 +50,27 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms /// /// [HttpGet("is_production_package")] + [Log(Title = "判断是否为成品库箱子码")] public IActionResult IsProductionPackage(string package_code = "") { - return ToResponse(new ApiResult(200, "success", true)); + if (string.IsNullOrEmpty(package_code)) + { + return ToResponse(new ApiResult(200, "传入为空", false)); + + } + int state = this.wm_entryWarehousing_productService.isProductionPackage(package_code); + string msg = null; + if (state == 0) + msg = "外箱标签码不存在"; + else if (state == 1) + msg = "success"; + + else if (state == 2) + msg = "误扫码,不是外箱标签码"; + + + return ToResponse(new ApiResult(200, msg, state)); + } /// @@ -50,10 +78,125 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms /// /// [HttpGet("is_full_package")] + [Log(Title = "判断是否为满箱")] public IActionResult IsFullPackage(string package_code = "") { - return ToResponse(new ApiResult(200, "success", true)); + + if (string.IsNullOrEmpty(package_code)) + { + return ToResponse(new ApiResult(200, "传入为空", false)); + + } + bool state = this.wm_entryWarehousing_productService.isFullPackage(package_code); + string msg = null; + if (state) + { + msg = "满箱"; + }else + { + msg = "零头箱"; + } + + return ToResponse(new ApiResult(200, msg, state)); } + /// + /// 4.入库 + /// + /// + /// + [HttpPost("into_product_warehouse")] + [Log(Title = "入库")] + public IActionResult IntoProductwarehouse([FromBody] WmgoodsDto wmgoodsDto) + { + if (wmgoodsDto == null) + { + return ToResponse(new ApiResult(200, "传入为空", false)); + } + string msg = ""; + + string createName = HttpContext.GetName(); + + int num = this.wm_entryWarehousing_productService.IntoProductwarehouse(wmgoodsDto, createName); + if (num == 0) + { + msg = "数据插入异常"; + + + } + else if (num >= 1) + { + msg = "成功入库"+num+"个"; + + + } + return ToResponse(new ApiResult(200, msg, num)); + } + /// + /// 获取库位已经存在箱子 + /// + /// + /// + [HttpGet("packagelist")] + [Log(Title = "获取库位已经存在箱子")] + public IActionResult Getpackagelist(string locationcode) + { + if (string.IsNullOrEmpty(locationcode)) + { + return ToResponse(new ApiResult(200, "传入为空", false)); + } + string msg = null; + + List productionList = this.wm_entryWarehousing_productService.Getpackagelist(locationcode); + + return ToResponse(new ApiResult(200, msg, productionList)); + } + /// + /// 解析外标签码 + /// + /// + /// + [HttpGet("resolution_package")] + public IActionResult ResolutionPackage(string code = "") + { + if (string.IsNullOrEmpty(code)) + { + + return ToResponse(new ApiResult(200, "传入为空", false)); + } + ResultionPackageCodeDto data = this.wm_entryWarehousing_productService.ResolutionPackage(code); + return ToResponse(new ApiResult(200, "success", data)); + + } + /// + /// 7 判断箱子是否存在成品库仓库里 + /// + /// + /// + [HttpGet("is_existed_warehouse")] + public IActionResult IsExistedWarehouse(string originalCode = "") + { + if (string.IsNullOrEmpty(originalCode)) + { + + return ToResponse(new ApiResult(200, "传入为空", false)); + } + string msg = null; + bool data = this.wm_entryWarehousing_productService.IsExistedWarehouse(originalCode); + if (data) + { + msg = "存在"; + + } + else + { + msg = "不存在"; + } + + return ToResponse(new ApiResult(200, msg, data)); + + } + + } - + } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs index 73062a85..f1bab376 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMlocationInfoController.cs @@ -5,6 +5,7 @@ using Microsoft.IdentityModel.Tokens; using ZR.Model.MES.qu; using ZR.Model.MES.wms; using ZR.Service.mes.wms.IService; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace ZR.Admin.WebApi.Controllers.mes.wms { @@ -13,7 +14,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms public class WMlocationInfoController : BaseController { - private readonly IWMlocationInfoService wm_locationInfoService; + private readonly IWMlocationInfoService wm_locationInfoService; public WMlocationInfoController(IWMlocationInfoService wm_locationInfoService) { this.wm_locationInfoService = wm_locationInfoService; @@ -25,11 +26,25 @@ 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 = 0, int pageNum = 0, int pageSize = 0) { (List, int) data = wm_locationInfoService.Getwminfo_product(shelf, layer, pageNum, pageSize); return ToResponse(new ApiResult(200, "success", data)); } + + /// + /// 获取库位信息 + /// + [HttpGet("get_location_info")] + public IActionResult Querylocationinfo(int warehouse_num, string locationcode = "") + { + + WmInfo wmInfo= wm_locationInfoService.Getlocationinfo(warehouse_num, locationcode); + return ToResponse(new ApiResult(200, "success", wmInfo)); + + + + } } } diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs new file mode 100644 index 00000000..340450d9 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs @@ -0,0 +1,111 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; + +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms.Dto; +using ZR.Model.MES.wms; + +//创建时间:2024-03-17 +namespace ZR.Admin.WebApi.Controllers.mes.wms +{ + /// + /// 客户信息 + /// + [Verify] + [Route("/mes/wm/WmCustom")] + public class WmCustomController : BaseController + { + /// + /// 客户信息接口 + /// + private readonly IWmCustomService _WmCustomService; + + public WmCustomController(IWmCustomService WmCustomService) + { + _WmCustomService = WmCustomService; + } + + /// + /// 查询客户信息列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:list")] + public IActionResult QueryWmCustom([FromQuery] WmCustomQueryDto parm) + { + var response = _WmCustomService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询客户信息详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:query")] + public IActionResult GetWmCustom(int Id) + { + var response = _WmCustomService.GetInfo(Id); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加客户信息 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:add")] + [Log(Title = "客户信息", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmCustom([FromBody] WmCustomDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmCustomService.AddWmCustom(modal); + + return SUCCESS(response); + } + + /// + /// 更新客户信息 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:edit")] + [Log(Title = "客户信息", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmCustom([FromBody] WmCustomDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmCustomService.UpdateWmCustom(modal); + + return ToResponse(response); + } + + /// + /// 删除客户信息 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "wmsManagement:wmcustom:delete")] + [Log(Title = "客户信息", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmCustom(string ids) + { + int[] idsArr = Tools.SpitIntArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + var response = _WmCustomService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs new file mode 100644 index 00000000..ec6ea1d0 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmMaterialController.cs @@ -0,0 +1,113 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; + +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms.Dto; +using ZR.Model.MES.wms; +using Org.BouncyCastle.Crypto; + +//创建时间:2024-03-16 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 物料记录表增删改查 + /// + [Verify] + [Route("/mes/wm/WmMaterial")] + public class WmMaterialController : BaseController + { + /// + /// 物料记录表接口 + /// + private readonly IWmMaterialService _WmMaterialService; + + public WmMaterialController(IWmMaterialService WmMaterialService) + { + _WmMaterialService = WmMaterialService; + } + + /// + /// 查询物料记录表列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "wms:wmmaterial:list")] + public IActionResult QueryWmMaterial([FromQuery] WmMaterialQueryDto parm) + { + var response = _WmMaterialService.GetList(parm); + return SUCCESS(response); + } + + + /// + /// 查询物料记录表详情 + /// + /// + /// + [HttpGet("{Id}")] + [ActionPermissionFilter(Permission = "wms:wmmaterial:query")] + public IActionResult GetWmMaterial(string Id) + { + var response = _WmMaterialService.GetInfo(Id); + + + return SUCCESS(response); + } + + /// + /// 添加物料记录表 + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "wms:wmmaterial:add")] + [Log(Title = "物料记录表", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmMaterial([FromBody] WmMaterialDto parm) + { + var modal = parm.Adapt().ToCreate(HttpContext); + + var response = _WmMaterialService.AddWmMaterial(modal); + + return SUCCESS(response); + } + + /// + /// 更新物料记录表 + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "wms:wmmaterial:edit")] + [Log(Title = "物料记录表", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmMaterial([FromBody] WmMaterialDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmMaterialService.UpdateWmMaterial(modal); + + return ToResponse(response); + } + + /// + /// 删除物料记录表 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "wms:wmmaterial:delete")] + [Log(Title = "物料记录表", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmMaterial(string ids) + { + long[] idsArr = Tools.SpitLongArrary(ids); + if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + + var response = _WmMaterialService.Delete(idsArr); + + return ToResponse(response); + } + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs new file mode 100644 index 00000000..bbb11512 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WmOutOrderController.cs @@ -0,0 +1,141 @@ +using Microsoft.AspNetCore.Mvc; +using ZR.Model.Dto; +using ZR.Admin.WebApi.Extensions; +using ZR.Admin.WebApi.Filters; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms.Dto; +using ZR.Model.MES.wms; +using ZR.Service.mes.wms; + +//创建时间:2024-03-18 +namespace ZR.Admin.WebApi.Controllers +{ + /// + /// 出货单(物料+客户) + /// + [Verify] + [Route("mes/wm/WmOutOrder")] + public class WmOutOrderController : BaseController + { + /// + /// 出货单(物料+客户)接口 + /// + private readonly IWmOutOrderService _WmOutOrderService; + + public WmOutOrderController(IWmOutOrderService WmOutOrderService) + { + _WmOutOrderService = WmOutOrderService; + } + + /// + /// 查询出货单(物料+客户)列表 + /// + /// + /// + [HttpGet("list")] + [ActionPermissionFilter(Permission = "business:wmoutorder:list")] + public IActionResult QueryWmOutOrder([FromQuery] WmOutOrderQueryDto parm) + { + var response = _WmOutOrderService.GetList(parm); + + return SUCCESS(response); + } + + + /// + /// 查询出货单(物料+客户)详情 + /// + /// + /// + [HttpGet("{ShipmentNum}")] + [ActionPermissionFilter(Permission = "business:wmoutorder:query")] + public IActionResult GetWmOutOrder(string ShipmentNum) + { + var response = _WmOutOrderService.GetInfo(ShipmentNum); + return SUCCESS(response); + } + + /// + /// 添加出货单(物料+客户) + /// + /// + [HttpPost] + [ActionPermissionFilter(Permission = "business:wmoutorder:add")] + [Log(Title = "出货单(物料+客户)", BusinessType = BusinessType.INSERT)] + public IActionResult AddWmOutOrder([FromBody] WmOutOrder_materialDto parm) + { + if(parm == null) + { + return SUCCESS(null); + } + var modal = parm.ToCreate(HttpContext); + + var response = _WmOutOrderService.AddWmOutOrder(modal); + + return SUCCESS(response); + } + + /// + /// 更新出货单(物料+客户) + /// + /// + [HttpPut] + [ActionPermissionFilter(Permission = "business:wmoutorder:edit")] + [Log(Title = "出货单(物料+客户)", BusinessType = BusinessType.UPDATE)] + public IActionResult UpdateWmOutOrder([FromBody] WmOutOrderDto parm) + { + var modal = parm.Adapt().ToUpdate(HttpContext); + var response = _WmOutOrderService.UpdateWmOutOrder(modal); + + return ToResponse(response); + } + + /// + /// 删除出货单(物料+客户) + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:wmoutorder:delete")] + [Log(Title = "出货单(物料+客户)", BusinessType = BusinessType.DELETE)] + public IActionResult DeleteWmOutOrder(string ids) + { + + if (string.IsNullOrEmpty(ids)) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); } + + + var response = _WmOutOrderService.Delete(ids.Split(",")); + + return ToResponse(response); + } + + /// + /// 获取客户信息 + /// + /// + [HttpGet("getcustom_list")] + public IActionResult GetWmOutOrder() + { + List customs= _WmOutOrderService.GetCustominfo(); + + return SUCCESS(customs); + } + + /// + /// 查询物料记录表列表 + /// + /// + /// + [HttpGet("getmaterial_list")] + + public IActionResult QueryWmMaterial([FromQuery] WmMaterialQueryDto parm) + { + var response = _WmOutOrderService.GetmaterialList(parm); + return SUCCESS(response); + } + + + + + + } +} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Extensions/LogoExtension.cs b/ZR.Admin.WebApi/Extensions/LogoExtension.cs index 704778fd..e9dc7421 100644 --- a/ZR.Admin.WebApi/Extensions/LogoExtension.cs +++ b/ZR.Admin.WebApi/Extensions/LogoExtension.cs @@ -1,4 +1,5 @@ using JinianNet.JNTemplate; +using System.Net.NetworkInformation; using ZR.Common; namespace ZR.Admin.WebApi.Extensions @@ -14,6 +15,29 @@ namespace ZR.Admin.WebApi.Extensions Console.WriteLine(content); Console.ForegroundColor = ConsoleColor.Blue; + // 获取本地计算机的所有网络接口信息 + NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces(); + + foreach (NetworkInterface networkInterface in networkInterfaces) + { + // 过滤出活动的网络接口 + if (networkInterface.OperationalStatus == OperationalStatus.Up) + { + // 获取网络接口的IP属性 + IPInterfaceProperties ipProperties = networkInterface.GetIPProperties(); + UnicastIPAddressInformationCollection ipAddresses = ipProperties.UnicastAddresses; + + foreach (UnicastIPAddressInformation ipAddress in ipAddresses) + { + // 输出IPv4地址 + if (ipAddress.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + Console.WriteLine("本机ip: "+ipAddress.Address.ToString()); + } + } + } + } + } } } diff --git a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj index 1661fd65..986c743b 100644 --- a/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj +++ b/ZR.Admin.WebApi/ZR.Admin.WebApi.csproj @@ -41,8 +41,6 @@ - - @@ -50,6 +48,7 @@ + diff --git a/ZR.Admin.WebApi/appsettings.development.json b/ZR.Admin.WebApi/appsettings.development.json index 0bf30f97..faf05d10 100644 --- a/ZR.Admin.WebApi/appsettings.development.json +++ b/ZR.Admin.WebApi/appsettings.development.json @@ -10,10 +10,13 @@ "dbConfigs": [ { + //外网连接服务器 + "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=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", //多租户唯一标识 @@ -24,7 +27,7 @@ //代码生成数据库配置 "CodeGenDbConfig": { //代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名 - "Conn": "Data Source=47.116.122.230;Port=3307;User ID=root;Password=123456;Initial Catalog={dbName};", + "Conn": "Data Source=127.0.0.1;Port=3306;User ID=root;Password=123456;Initial Catalog={dbName};", "DbType": 0, "IsAutoCloseConnection": true, "DbName": "ZrAdmin" //代码生成默认连接数据库 diff --git a/ZR.Admin.WebApi/appsettings.production.json b/ZR.Admin.WebApi/appsettings.production.json index 4910fb58..1b9d9ede 100644 --- a/ZR.Admin.WebApi/appsettings.production.json +++ b/ZR.Admin.WebApi/appsettings.production.json @@ -11,7 +11,7 @@ { //"Conn": "Data Source=147.116.122.230;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.0.36;Port=3306;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;", "DbType": 0, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4 "ConfigId": "0", //多租户唯一标识 "IsAutoCloseConnection": true diff --git a/ZR.Common/Tools.cs b/ZR.Common/Tools.cs index 70c9d855..c6d4532d 100644 --- a/ZR.Common/Tools.cs +++ b/ZR.Common/Tools.cs @@ -32,6 +32,8 @@ namespace ZR.Common return infoIdss; } + + /// /// 根据日期获取星期几 /// diff --git a/ZR.Common/ZR.Common.csproj b/ZR.Common/ZR.Common.csproj index 942ceb01..b890470b 100644 --- a/ZR.Common/ZR.Common.csproj +++ b/ZR.Common/ZR.Common.csproj @@ -11,6 +11,8 @@ + + diff --git a/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs new file mode 100644 index 00000000..a59d0d8a --- /dev/null +++ b/ZR.Model/MES/wms/Dto/ResultionPackageCodeDto.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.wms.Dto +{ + public class ResultionPackageCodeDto + { + /// + /// 原始码 + /// + public string originalCode { get; set; } + /// + /// 批次号 + /// + public string PatchCode { get; set; } + /// + /// 零件号 + /// + public string PartNumner { get; set; } + + /// + /// 工单号 + /// + public string WorkoderID { get; set; } + /// + /// 数量 + /// + public string Quantity { get; set; } + + /// + /// 生产时间 + /// + public string ProductionTime { get; set; } + + /// + /// 产品描述 + /// + public string ProductionDescribe { get; set; } + + + + } +} diff --git a/ZR.Model/MES/wms/Dto/WmCustomDto.cs b/ZR.Model/MES/wms/Dto/WmCustomDto.cs new file mode 100644 index 00000000..69fa44d8 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmCustomDto.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 客户信息查询对象 + /// + public class WmCustomQueryDto : PagerInfo + { + public string CustomNo { get; set; } + + public string CustomName { get; set; } + } + + /// + /// 客户信息输入输出对象 + /// + public class WmCustomDto + { + [Required(ErrorMessage = "主键不能为空")] + public int Id { get; set; } + + public string CustomNo { get; set; } + + public string CustomName { get; set; } + + public string CustomAddress { 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/WmMaterialDto.cs b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs new file mode 100644 index 00000000..5dfe2ab2 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs @@ -0,0 +1,133 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 物料记录表查询对象 + /// + public class WmMaterialQueryDto : PagerInfo + { + + + public string Id { get; set; } + + public string Partnumber { get; set; } + + public string U8InventoryCode { get; set; } + + public string BlankNum { get; set; } + + public string Unit { get; set; } + + public string ProductName { get; set; } + + public string Color { get; set; } + + public string Specification { get; set; } + + public string Description { get; set; } + + public string Version { get; set; } + + public string Remarks { get; set; } + + public int? Sort { get; set; } + + public string Search1 { get; set; } + + public string Search2 { get; set; } + + public int? Status { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + } + + /// + /// 带库存记录的物料库存表 + /// + public class WmMaterialQuery_stockQuantityDto : WmMaterialQueryDto + { + /// + /// 库存数量 + /// + public int stockQuantity { get; set; } + + /// + /// 需要出货数量 + /// + public int requireOutNum { get; set; } + + } + + /// + /// 带需要出货数量的物料库存表 + /// + public class WmMaterialQuery_stockQuantityDto2 : WmMaterialQueryDto + { + + + /// + /// 需要出货数量 + /// + public int requireOutNum { get; set; } + + } + + + /// + /// 物料记录表输入输出对象 + /// + public class WmMaterialDto + { + + public string Id { get; set; } + + public string Partnumber { get; set; } + + public string U8InventoryCode { get; set; } + + public string BlankNum { get; set; } + + public string Unit { get; set; } + + public string ProductName { get; set; } + + public string Color { get; set; } + + public string Specification { get; set; } + + public string Description { get; set; } + + public string Version { get; set; } + + public string Remarks { get; set; } + + public int? Sort { get; set; } + + public string Search1 { get; set; } + + public string Search2 { get; set; } + + public int? Status { 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/WmOutOrderDto.cs b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs new file mode 100644 index 00000000..71c71885 --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmOutOrderDto.cs @@ -0,0 +1,71 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 出货单(物料+客户)查询对象 + /// + public class WmOutOrderQueryDto : PagerInfo + { + } + + /// + /// 出货单(物料+客户)输入输出对象 + /// + public class WmOutOrderDto + { + + public string ShipmentNum { get; set; } + + public string CustomId { get; set; } + + public string CustomNo { get; set; } + + public string CustomName { get; set; } + + public string CustomAddress { get; set; } + + public string Remarks { get; set; } + + public int Type { get; set; } + + public int? Status { get; set; } + + public int? Year { get; set; } + + public int? Week { get; set; } + + public int? Date { get; set; } + + public string CreatedBy { get; set; } + + public DateTime? CreatedTime { get; set; } + + public string UpdatedBy { get; set; } + + public DateTime? UpdatedTime { get; set; } + + + + } + /// + /// 出货单(物料+客户)输入输出对象 + /// + public class WmOutOrder_materialDto : WmOutOrderDto + { + //带出货数量的物料表 + public List MaterialList { get; set; } + + + } + /// + /// 出货单_物料——数量 + /// + public class WmOutOrder_material_num : WmOutOrderDto + { + //带出货数量的物料表 + public List MaterialList { get; set; } + + + } +} \ No newline at end of file diff --git a/ZR.Model/MES/wms/Dto/WmgoodsDto.cs b/ZR.Model/MES/wms/Dto/WmgoodsDto.cs new file mode 100644 index 00000000..33eabfab --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmgoodsDto.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 待入库货物 + /// + public class WmgoodsDto + { + /// + /// 货架 + /// + public string location { set; get; } + /// + /// 箱子列表(原始外箱标签码) + /// + public string[] packagelist { set; get; } + } +} diff --git a/ZR.Model/MES/wms/WmCustom.cs b/ZR.Model/MES/wms/WmCustom.cs new file mode 100644 index 00000000..be91ec97 --- /dev/null +++ b/ZR.Model/MES/wms/WmCustom.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 客户信息 + /// + [SugarTable("wm_custom")] + public class WmCustom + { + /// + /// 主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 客户代码 + /// + [SugarColumn(ColumnName = "custom_no")] + public string CustomNo { get; set; } + + /// + /// 客户名称 + /// + [SugarColumn(ColumnName = "custom_name")] + public string CustomName { get; set; } + + /// + /// 客户地址 + /// + [SugarColumn(ColumnName = "custom_address")] + public string CustomAddress { 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/WmGoodsNowProduction.cs b/ZR.Model/MES/wms/WmGoodsNowProduction.cs new file mode 100644 index 00000000..38753efc --- /dev/null +++ b/ZR.Model/MES/wms/WmGoodsNowProduction.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 成品库当前货物表 + /// + [SugarTable("wm_goods_now_production")] + public class WmGoodsNowProduction + { + /// + /// 雪花id + /// + [SugarColumn(ColumnName = "id", IsPrimaryKey = true)] + public string Id { 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 = "partnumber")] + public string Partnumber { get; set; } + + + /// + /// 库位编号 + /// + [SugarColumn(ColumnName = "location_code")] + public string LocationCode { 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 = "remark")] + 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; } + } +} diff --git a/ZR.Model/MES/wms/WmInLog.cs b/ZR.Model/MES/wms/WmInLog.cs new file mode 100644 index 00000000..07471ebb --- /dev/null +++ b/ZR.Model/MES/wms/WmInLog.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 入库日志(U8上传) + /// + [SugarTable("wm_in_log")] + public class WmInLog + { + /// + /// 主键(雪花生产) + /// + [SugarColumn(ColumnName="id" )] + public string Id { get; set; } + /// + /// u8库存编码 + /// + [SugarColumn(ColumnName="u8_inventory_code" )] + public string U8InventoryCode { get; set; } + /// + /// 仓库编号 + /// + [SugarColumn(ColumnName="wm_info_id" )] + public string WmInfoId { get; set; } + /// + /// mes内码 + /// + [SugarColumn(ColumnName="package_code" )] + public string PackageCode { get; set; } + /// + /// 批次号 + /// + [SugarColumn(ColumnName="code" )] + public string Code { get; set; } + /// + /// 数量 + /// + [SugarColumn(ColumnName="number" )] + public string Number { 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; } + } +} diff --git a/ZR.Model/MES/wms/WmMaterial.cs b/ZR.Model/MES/wms/WmMaterial.cs new file mode 100644 index 00000000..dbbc3919 --- /dev/null +++ b/ZR.Model/MES/wms/WmMaterial.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 物料记录表 + /// + [SugarTable("wm_material")] + public class WmMaterial + { + /// + /// 主键G + /// + [SugarColumn(ColumnName="id" ,IsPrimaryKey = true )] + public string Id { get; set; } + /// + /// 物料号(零件号) + /// + [SugarColumn(ColumnName="partnumber")] + public string Partnumber { get; set; } + /// + /// U8库存编码 + /// + [SugarColumn(ColumnName="u8_inventory_code")] + public string U8InventoryCode { get; set; } + /// + /// 毛坯号 + /// + [SugarColumn(ColumnName="blank_num" )] + public string BlankNum { get; set; } + /// + /// 单位 + /// + [SugarColumn(ColumnName="unit" )] + public string Unit { get; set; } + /// + /// 产品描述(产品名称) + /// + [SugarColumn(ColumnName="product_name" )] + public string ProductName { get; set; } + /// + /// 产品颜色 + /// + [SugarColumn(ColumnName="color" )] + public string Color { get; set; } + /// + /// 规格(左右脚) + /// + [SugarColumn(ColumnName="specification" )] + public string Specification { get; set; } + /// + /// 显示描述(产品描述+颜色+规格) + /// + [SugarColumn(ColumnName="description" )] + public string Description { get; set; } + /// + /// 版本号 + /// + [SugarColumn(ColumnName="version" )] + public string Version { get; set; } + /// + /// 备注 + /// + [SugarColumn(ColumnName="remarks" )] + public string Remarks { get; set; } + /// + /// 排序(特殊排序) + /// + [SugarColumn(ColumnName="sort" )] + public int? Sort { get; set; } + /// + /// 便捷搜索字段1 + /// + [SugarColumn(ColumnName="search1" )] + public string Search1 { get; set; } + /// + /// 便捷搜索字段2 + /// + [SugarColumn(ColumnName="search2" )] + public string Search2 { get; set; } + /// + /// 状态(0-不可见 1-可见) + /// + [SugarColumn(ColumnName="status" )] + public int? Status { 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; } + } +} diff --git a/ZR.Model/MES/wms/WmMaterialOutorder.cs b/ZR.Model/MES/wms/WmMaterialOutorder.cs new file mode 100644 index 00000000..8451c663 --- /dev/null +++ b/ZR.Model/MES/wms/WmMaterialOutorder.cs @@ -0,0 +1,59 @@ +namespace ZR.Model.MES.wms +{ + /// + /// 物料表和出库单关联表 + /// + [SugarTable("wm_material_outorder")] + public class WmMaterialOutorder + { + /// + /// Id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + + /// + /// 物料表主键 + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_material_id")] + public string FkMaterialId { get; set; } + + /// + /// 出货单id + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_outorder_id")] + public string FkOutorderId { get; set; } + + + /// + /// 出货数量 + /// + [SugarColumn(ColumnName = "outhouse_num")] + public int OuthouseNum { 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; } + + } +} diff --git a/ZR.Model/MES/wms/WmOutOrder.cs b/ZR.Model/MES/wms/WmOutOrder.cs new file mode 100644 index 00000000..fb4e853e --- /dev/null +++ b/ZR.Model/MES/wms/WmOutOrder.cs @@ -0,0 +1,100 @@ + +namespace ZR.Model.MES.wms +{ + /// + /// 出货单(物料+客户) + /// + [SugarTable("wm_out_order")] + public class WmOutOrder + { + + //[Navigate(NavigateType.OneToMany, nameof(WmMaterialOutorder.FkOutorderId))]//BookA表中的studenId + //public List Books { get; set; }//注意禁止给books手动赋值 + + + /// + /// 出库单号(EG+时间) + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "shipment_num")] + public string ShipmentNum { get; set; } + + /// + /// 客户id + /// + [SugarColumn(ColumnName = "custom_id")] + public string CustomId { get; set; } + + /// + /// 客户代码 + /// + [SugarColumn(ColumnName = "custom_no")] + public string CustomNo { get; set; } + + /// + /// 客户名称 + /// + [SugarColumn(ColumnName = "custom_name")] + public string CustomName { get; set; } + + /// + /// 客户地址 + /// + [SugarColumn(ColumnName = "custom_address")] + public string CustomAddress { get; set; } + + /// + /// 备注 + /// + public string Remarks { get; set; } + + /// + /// 出库单状态(1-出库中 2-出库完成 3-弃用) + /// + public int Type { get; set; } + + /// + /// 状态(0-停用 1-启用) + /// + public int? Status { get; set; } + + /// + /// 年 + /// + public int? Year { get; set; } + + /// + /// 周 + /// + public int? Week { get; set; } + + /// + /// 日 + /// + public int? Date { 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/WmPackingrecord.cs b/ZR.Model/MES/wms/WmPackingrecord.cs new file mode 100644 index 00000000..fa3bc5b4 --- /dev/null +++ b/ZR.Model/MES/wms/WmPackingrecord.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; + +namespace ZR.Model.MES.wms +{ + /// + /// 包装记录 + /// + [SugarTable("wm_packingrecord")] + public class WmPackingrecord + { + /// + /// + /// + [SugarColumn(ColumnName = "ID", IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + /// + /// 零件号 + /// + [SugarColumn(ColumnName = "PartNum")] + public string PartNum { get; set; } + /// + /// 设备名称(ID) + /// + [SugarColumn(ColumnName = "Machine")] + public string Machine { get; set; } + /// + /// 产品条码 + /// + [SugarColumn(ColumnName = "ProductCode")] + public string ProductCode { get; set; } + /// + /// 箱条码 + /// + [SugarColumn(ColumnName = "PackingCode")] + public string PackingCode { get; set; } + /// + /// 扫码记录 + /// + [SugarColumn(ColumnName = "ScannerContent")] + public string ScannerContent { get; set; } + /// + /// 工单号 + /// + [SugarColumn(ColumnName = "WorkOrderNum")] + public string WorkOrderNum { get; set; } + /// + /// 备用3 + /// + [SugarColumn(ColumnName = "Standby3")] + public string Standby3 { get; set; } + /// + /// 备用4 + /// + [SugarColumn(ColumnName = "Standby4")] + public string Standby4 { get; set; } + /// + /// 备用5 + /// + [SugarColumn(ColumnName = "Standby5")] + public string Standby5 { get; set; } + /// + /// 指示是否满箱 + /// 默认值: b'0' + /// + [SugarColumn(ColumnName = "BFilled")] + public bool BFilled { get; set; } + /// + /// 创建时间 + /// + [SugarColumn(ColumnName = "CreateTime")] + public DateTime? CreateTime { get; set; } + } +} diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index 3488f23c..582a50fb 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -8,6 +8,10 @@ + + + + diff --git a/ZR.Service/mes/qc/QCStatisticsService.cs b/ZR.Service/mes/qc/QCStatisticsService.cs index b920b049..79a58754 100644 --- a/ZR.Service/mes/qc/QCStatisticsService.cs +++ b/ZR.Service/mes/qc/QCStatisticsService.cs @@ -31,6 +31,8 @@ namespace ZR.Service.mes.qc /// public (List, int) GetQualityStatisticsTable_first(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize) { + starttime = starttime.ToLocalTime(); + endTime = endTime.ToLocalTime(); int totalNum = 0; var predicate = Expressionable.Create() //XXX:修改查询日期查询的字段 @@ -65,6 +67,8 @@ namespace ZR.Service.mes.qc /// public (List, int) GetQualityStatisticsTable_again(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize) { + starttime = starttime.ToLocalTime(); + endTime = endTime.ToLocalTime(); int totalNum = 0; var predicate = Expressionable.Create() //XXX:修改查询日期查询的字段 @@ -98,6 +102,8 @@ namespace ZR.Service.mes.qc /// public (List, int) GetQualityStatisticsTable_final(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize) { + starttime = starttime.ToLocalTime(); + endTime = endTime.ToLocalTime(); int totalNum = 0; var predicate = Expressionable.Create() //XXX:修改查询日期查询的字段 @@ -132,6 +138,8 @@ namespace ZR.Service.mes.qc /// public (List, int) GetQualityStatisticsTable_total(DateTime starttime, DateTime endTime, string workorderid, string partnumber, string product_description, string team, int pageNum, int pageSize) { + starttime = starttime.ToLocalTime(); + endTime = endTime.ToLocalTime(); int totalNum = 0; var predicate = Expressionable.Create() //XXX:修改查询日期查询的字段 diff --git a/ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs b/ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs new file mode 100644 index 00000000..d329acc0 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWMExitwarehouseService.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Service.mes.wms.IService +{ + public interface IWMExitwarehouseService + { + /// + /// 一般退库 + /// + /// + /// + public bool ExitwarehouseCommmon(string original); + /// + /// 判断箱子是否存在陈平库中 + /// + /// + /// + + public bool IsExistedWarehouse(string originalCode); + + } +} diff --git a/ZR.Service/mes/wms/IService/IWMWarehousingService.cs b/ZR.Service/mes/wms/IService/IWMWarehousingService.cs deleted file mode 100644 index 8bef042d..00000000 --- a/ZR.Service/mes/wms/IService/IWMWarehousingService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using ZR.Model.MES.qc.DTO; -using ZR.Model.MES.wms; - -namespace ZR.Service.mes.wms.IService -{ - public interface IWMentryWarehousing_productService - { - - - // 获取库位列表 - public bool IsProductionLoacation(string production_location_code); - - - - } -} diff --git a/ZR.Service/mes/wms/IService/IWMentryWarehousing_productService.cs b/ZR.Service/mes/wms/IService/IWMentryWarehousing_productService.cs new file mode 100644 index 00000000..6f24bdb6 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWMentryWarehousing_productService.cs @@ -0,0 +1,41 @@ +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.qc.DTO; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using static Org.BouncyCastle.Crypto.Engines.SM2Engine; + +namespace ZR.Service.mes.wms.IService +{ + public interface IWMentryWarehousing_productService + { + + + // 获取库位列表 + public bool IsProductionLoacation(string production_location_code); + + // 判断是否为成品箱子码 + public int isProductionPackage(string production_packcode); + + //判断箱子是否满 + public bool isFullPackage(string production_packcode); + + // 货物入库 + public int IntoProductwarehouse(WmgoodsDto wmgoods, string createName); + + //获取库位已经存在的货物 + public List Getpackagelist(string location); + + //解析外箱标签码 + public ResultionPackageCodeDto ResolutionPackage(string code); + + public bool IsExistedWarehouse(string originalCode); + + + + } +} diff --git a/ZR.Service/mes/wms/IService/IWMlocationInfoService.cs b/ZR.Service/mes/wms/IService/IWMlocationInfoService.cs index 1fa833d3..c6a7ae14 100644 --- a/ZR.Service/mes/wms/IService/IWMlocationInfoService.cs +++ b/ZR.Service/mes/wms/IService/IWMlocationInfoService.cs @@ -15,7 +15,7 @@ namespace ZR.Service.mes.wms.IService // 获取成品库信息 public (List,int) Getwminfo_product(string shelf , int layer, int pageNum , int pageSize); - - + // 获取库位信息 + public WmInfo Getlocationinfo(int warehouse_num, string locationcode); } } diff --git a/ZR.Service/mes/wms/IService/IWmCustomService.cs b/ZR.Service/mes/wms/IService/IWmCustomService.cs new file mode 100644 index 00000000..af900888 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmCustomService.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 IWmCustomService : IBaseService + { + PagedInfo GetList(WmCustomQueryDto parm); + + WmCustom GetInfo(int Id); + + WmCustom AddWmCustom(WmCustom parm); + + int UpdateWmCustom(WmCustom parm); + + } +} diff --git a/ZR.Service/mes/wms/IService/IWmMaterialService.cs b/ZR.Service/mes/wms/IService/IWmMaterialService.cs new file mode 100644 index 00000000..0f745359 --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmMaterialService.cs @@ -0,0 +1,24 @@ +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 IWmMaterialService : IBaseService + { + PagedInfo GetList(WmMaterialQueryDto parm); + + WmMaterial GetInfo(string Id); + + WmMaterial AddWmMaterial(WmMaterial parm); + + int UpdateWmMaterial(WmMaterial parm); + + } +} diff --git a/ZR.Service/mes/wms/IService/IWmOutOrderService.cs b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs new file mode 100644 index 00000000..e7e2c98e --- /dev/null +++ b/ZR.Service/mes/wms/IService/IWmOutOrderService.cs @@ -0,0 +1,30 @@ +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 IWmOutOrderService : IBaseService + { + PagedInfo GetList(WmOutOrderQueryDto parm); + + WmOutOrder_material_num GetInfo(string ShipmentNum); + + WmOutOrder AddWmOutOrder(WmOutOrder_materialDto parm); + + int UpdateWmOutOrder(WmOutOrder parm); + + + List GetCustominfo(); + + (List, int) GetmaterialList(WmMaterialQueryDto parm); + + } +} diff --git a/ZR.Service/mes/wms/WMExitwarehouseService.cs b/ZR.Service/mes/wms/WMExitwarehouseService.cs new file mode 100644 index 00000000..2f4d1a36 --- /dev/null +++ b/ZR.Service/mes/wms/WMExitwarehouseService.cs @@ -0,0 +1,115 @@ +using Infrastructure.Attribute; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ZR.Model.MES.pro; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using ZR.Service.mes.wms.IService; + +namespace ZR.Service.mes.wms +{ + + [AppService(ServiceType = typeof(IWMExitwarehouseService), ServiceLifetime = LifeTime.Transient)] + public class WMExitwarehouseService : BaseService, IWMExitwarehouseService + { + private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + //普通入库 + public bool ExitwarehouseCommmon(string original) + { + ResultionPackageCodeDto packageCode = ResolutionPackagecode(original); + string patchCode = packageCode.PatchCode; + + + int result = Context.Deleteable().Where(it => it.PackageCodeClient == patchCode).ExecuteCommand(); + + if (result == 0) + { + return false; + } + return true; + + } + + /// + /// 判断箱子是否在成品库中 + /// + /// + /// + /// + public bool IsExistedWarehouse(string originalCode) + { + ResultionPackageCodeDto resultionPackage = ResolutionPackagecode(originalCode); + + return Context.Queryable().Where(it => it.PackageCodeClient == resultionPackage.PatchCode).Any(); + } + + + /// + /// 解析外箱标签码 + /// + /// + /// + private ResultionPackageCodeDto ResolutionPackagecode(string packagecode) + { + ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto(); + try + { + resultionPackageCode.originalCode = packagecode; + + // todo 解析外箱标签码 + string[] splitstr = packagecode.Split('^'); + resultionPackageCode.PatchCode = splitstr[0].Substring(5); + + //todo 解析零件号 + string partnumber = splitstr[1].Substring(11); + //int length = lingshi.Length - 2; + //string partnumber = lingshi.Substring(0, length); + resultionPackageCode.PartNumner = partnumber; + //todo 解析工单号 + string workoderidid = splitstr[2].Substring(7); + resultionPackageCode.WorkoderID = workoderidid; + //todo 生产描述 + resultionPackageCode.ProductionTime = "20" + workoderidid.Substring(0, 6); + //todo 解析箱子中产品数量 + string product_num = splitstr[3].Substring(4); + resultionPackageCode.Quantity = product_num; + //todo 产品描述 partnumber + // ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First(); + //if(plan != null) + // { + // resultionPackageCode.ProductionDescribe = plan.ProductName; + // } + // else + // { + // resultionPackageCode.ProductionDescribe = "生产计划无此零件号"; + // } + ProWorkorder_v2 workorder = Context.Queryable().Where(it => it.FinishedPartNumber == partnumber).First(); + + if (workorder != null) + { + resultionPackageCode.ProductionDescribe = workorder.ProductDescription; + } + else + { + resultionPackageCode.ProductionDescribe = "生产工单无此零件号"; + } + + + } + catch (Exception ex) + { + logger.Error($"外箱标签码,解析失败 {ex.Message}"); + + } + + return resultionPackageCode; + } + + } + + +} diff --git a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs index 3ab1952d..9cfc528f 100644 --- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs +++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs @@ -1,22 +1,180 @@ -using Infrastructure.Attribute; +using Aliyun.OSS; +using Infrastructure.Attribute; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; +using Model.DBModel; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; +using ZR.Model.mes.pro; +using ZR.Model.MES.pro; using ZR.Model.MES.qu; using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; using ZR.Service.mes.qc.IService; using ZR.Service.mes.wms.IService; +using static Org.BouncyCastle.Crypto.Engines.SM2Engine; namespace ZR.Service.mes.wms { [AppService(ServiceType = typeof(IWMentryWarehousing_productService), ServiceLifetime = LifeTime.Transient)] public class WMentryWarehousing_productService : BaseService, IWMentryWarehousing_productService { + + private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); + //货物入库 + public int IntoProductwarehouse(WmgoodsDto wmgoods, string createName) + { + List preparegoodsList = new List(); + + + + if (wmgoods.packagelist != null && wmgoods.packagelist.Count() > 0) + { + for (int i = 0; i < wmgoods.packagelist.Count(); i++) + { + + ResultionPackageCodeDto resultionPackage= ResolutionPackagecode(wmgoods.packagelist[i]); + WmGoodsNowProduction wmGood = new WmGoodsNowProduction(); + wmGood.Id = SnowFlakeSingle.Instance.NextId().ToString(); + + string flow = resultionPackage.PatchCode.Split('_')[1]; + int flow_num = 0; + try + { + flow_num = Convert.ToInt32(flow); + }catch(Exception ex) + { + flow_num = -1; + } + + wmGood.PackageCode = Getpack_no(resultionPackage.WorkoderID, flow_num.ToString("000")); + wmGood.PackageCodeClient = resultionPackage.PatchCode; + wmGood.Partnumber = resultionPackage.PartNumner; + wmGood.PackageCodeOriginal = resultionPackage.originalCode; + + wmGood.LocationCode = wmgoods.location; + + string workorder_id = resultionPackage.WorkoderID; + + + wmGood.GoodsNumLogic = Context.Queryable() + .Where(it => it.WorkOrderNum == workorder_id) + .Count(); + + wmGood.EntryWarehouseTime = DateTime.Now; + wmGood.CreatedBy = createName; + wmGood.CreatedTime = DateTime.Now; + + + preparegoodsList.Add(wmGood); + + + } + + } + + int result = Context.Insertable(preparegoodsList).ExecuteCommand(); + return result; + } + + + + /// + /// 获取mes的箱子码 + /// + /// 工单 + /// 序号 + /// + private string Getpack_no(string workordorid, string flow) + { + + + WmPackingrecord record = Context.Queryable() + .Where(it => it.WorkOrderNum == workordorid) + .Where(it => it.PackingCode.EndsWith(flow)) + .First(); + + + if (record == null) + { + return null; + } + + return record.ProductCode; + } + + //3 判断箱子是否满 + public bool isFullPackage(string production_packcode) + { + ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode); + if (Identity == null) + { + return false; + } + string packingCode = Identity.PatchCode.Split('_')[1]; + + + bool isExist = Context.Queryable() + .Where(it => it.WorkOrderNum == Identity.WorkoderID) + .Where(it => it.PackingCode.EndsWith(packingCode)) + .Where(it => it.BFilled == true) + .Any(); + + + + return isExist; + } + + /// + /// 2 判断是否为成品箱子码 + /// + /// + /// + public int isProductionPackage(string production_packcode) + { + + + Regex r = new Regex("Code=BNW\\d{9}_\\d{0,3}"); + + + //todo 不是箱子 + if (!r.IsMatch(production_packcode)) + { + return 2; + } + + + ResultionPackageCodeDto Identity = ResolutionPackagecode(production_packcode); + if (Identity == null) + { + return 0; + } + + + string packingCode = Identity.PatchCode.Split('_')[1]; + + + + + bool isExist = Context.Queryable() + .Where(it => it.WorkOrderNum == Identity.WorkoderID) + .Where(it => it.PackingCode.EndsWith(packingCode)) + .Any(); + if (!isExist) + { + return 0; + } + + + return 1; + + } + //1 判断是否为库位码 bool IWMentryWarehousing_productService.IsProductionLoacation(string production_location_code) { @@ -24,5 +182,96 @@ namespace ZR.Service.mes.wms .Where(it => it.Location.Equals(production_location_code)).Any(); } + + + //获取库位已经存在的货物 + public List Getpackagelist(string location) + { + return Context.Queryable().Where(it => it.LocationCode == location).ToList(); + + } + + /// + /// 解析外箱标签码 + /// + /// + /// + private ResultionPackageCodeDto ResolutionPackagecode(string packagecode) + { + ResultionPackageCodeDto resultionPackageCode = new ResultionPackageCodeDto(); + try + { + resultionPackageCode.originalCode= packagecode; + + // todo 解析外箱标签码 + string[] splitstr = packagecode.Split('^'); + resultionPackageCode.PatchCode = splitstr[0].Substring(5); + + //todo 解析零件号 + string partnumber = splitstr[1].Substring(11); + //int length = lingshi.Length - 2; + //string partnumber = lingshi.Substring(0, length); + resultionPackageCode.PartNumner = partnumber; + //todo 解析工单号 + string workoderidid = splitstr[2].Substring(7); + resultionPackageCode.WorkoderID = workoderidid; + //todo 生产描述 + resultionPackageCode.ProductionTime="20"+ workoderidid.Substring(0,6); + //todo 解析箱子中产品数量 + string product_num = splitstr[3].Substring(4); + resultionPackageCode.Quantity = product_num; + //todo 产品描述 partnumber + // ProWorklplan_v2 plan= Context.Queryable().Where(it => it.Partnumber == partnumber).First(); + //if(plan != null) + // { + // resultionPackageCode.ProductionDescribe = plan.ProductName; + // } + // else + // { + // resultionPackageCode.ProductionDescribe = "生产计划无此零件号"; + // } + ProWorkorder_v2 workorder= Context.Queryable().Where(it => it.FinishedPartNumber == partnumber).First(); + + if (workorder != null) + { + resultionPackageCode.ProductionDescribe = workorder.ProductDescription; + } + else + { + resultionPackageCode.ProductionDescribe = "生产工单无此零件号"; + } + + + } + catch (Exception ex) + { + logger.Error($"外箱标签码,解析失败 {ex.Message}"); + + } + + return resultionPackageCode; + } + + //解析外箱标签码 + public ResultionPackageCodeDto ResolutionPackage(string code) + { + + + return ResolutionPackagecode(code); + } + + + /// + /// 判断箱子是否在成品库中 + /// + /// + /// + /// + public bool IsExistedWarehouse(string originalCode) + { + ResultionPackageCodeDto resultionPackage= ResolutionPackagecode(originalCode); + + return Context.Queryable().Where(it => it.PackageCodeClient == resultionPackage.PatchCode).Any(); + } } } diff --git a/ZR.Service/mes/wms/WMlocationInfoService.cs b/ZR.Service/mes/wms/WMlocationInfoService.cs index 9480305f..fa759a8b 100644 --- a/ZR.Service/mes/wms/WMlocationInfoService.cs +++ b/ZR.Service/mes/wms/WMlocationInfoService.cs @@ -16,6 +16,18 @@ namespace ZR.Service.mes.wms [AppService(ServiceType = typeof(IWMlocationInfoService), ServiceLifetime = LifeTime.Transient)] public class WMlocationInfoService : BaseService, IWMlocationInfoService { + /// + /// 查询库位信息 + /// + /// + /// + /// + /// + public WmInfo Getlocationinfo(int warehouse_num, string locationcode) + { + return Context.Queryable().Where(it=>it.WarehouseNum== warehouse_num && it.Location==locationcode).First(); + } + /// /// 获取成品库库位信息 /// diff --git a/ZR.Service/mes/wms/WmCustomService.cs b/ZR.Service/mes/wms/WmCustomService.cs new file mode 100644 index 00000000..c466d777 --- /dev/null +++ b/ZR.Service/mes/wms/WmCustomService.cs @@ -0,0 +1,91 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; +using ZR.Model.Dto; + +using ZR.Repository; + +using System.Linq; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.mes.wms +{ + + /// + /// 客户信息Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmCustomService), ServiceLifetime = LifeTime.Transient)] + public class WmCustomService : BaseService, IWmCustomService + { + /// + /// 查询客户信息列表 + /// + /// + /// + public PagedInfo GetList(WmCustomQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(parm.CustomNo), it => it.CustomNo.Contains(parm.CustomNo)) + .AndIF(!string.IsNullOrEmpty(parm.CustomName), it => it.CustomName.Contains(parm.CustomName)); + + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmCustom GetInfo(int Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加客户信息 + /// + /// + /// + public WmCustom AddWmCustom(WmCustom model) + { + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改客户信息 + /// + /// + /// + public int UpdateWmCustom(WmCustom model) + { + //var response = Update(w => w.Id == model.Id, it => new WmCustom() + //{ + // CustomNo = model.CustomNo, + // CustomName = model.CustomName, + // CustomAddress = model.CustomAddress, + // 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/WmMaterialService.cs b/ZR.Service/mes/wms/WmMaterialService.cs new file mode 100644 index 00000000..e844ea36 --- /dev/null +++ b/ZR.Service/mes/wms/WmMaterialService.cs @@ -0,0 +1,108 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using Infrastructure.Extensions; +using ZR.Model; +using ZR.Model.Dto; + +using ZR.Repository; + +using System.Linq; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; + +namespace ZR.Service.mes.wms +{ + /// + /// 物料记录表Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmMaterialService), ServiceLifetime = LifeTime.Transient)] + public class WmMaterialService : BaseService, IWmMaterialService + { + /// + /// 查询物料记录表列表 + /// + /// + /// + public PagedInfo GetList(WmMaterialQueryDto parm) + { + var predicate = Expressionable.Create() + .AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber)) + .AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode)) + .AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName)) + .AndIF(parm.Color != null, it => it.Color.Contains(parm.Color)) + .AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification)) + .AndIF(parm.Description != null, it => it.Description.Contains(parm.Description)) + .AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1)) + .AndIF(parm.Status > -1, it => it.Status == parm.Status); + + + var response = Queryable() + .Where(predicate.ToExpression()).OrderByDescending(it=>it.CreatedTime) + .ToPage(parm); + + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmMaterial GetInfo(string Id) + { + var response = Queryable() + .Where(x => x.Id == Id) + .First(); + + return response; + } + + /// + /// 添加物料记录表 + /// + /// + /// + public WmMaterial AddWmMaterial(WmMaterial model) + { + model.Id= SnowFlakeSingle.Instance.NextId().ToString(); + return Context.Insertable(model).ExecuteReturnEntity(); + } + + /// + /// 修改物料记录表 + /// + /// + /// + public int UpdateWmMaterial(WmMaterial model) + { + //var response = Update(w => w.Id == model.Id, it => new WmMaterial() + //{ + // Partnumber = model.Partnumber, + // U8InventoryCode = model.U8InventoryCode, + // BlankNum = model.BlankNum, + // Unit = model.Unit, + // ProductName = model.ProductName, + // Color = model.Color, + // Specification = model.Specification, + // Description = model.Description, + // Version = model.Version, + // Remarks = model.Remarks, + // Sort = model.Sort, + // Search1 = model.Search1, + // Search2 = model.Search2, + // Status = model.Status, + // 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/WmOutOrderService.cs b/ZR.Service/mes/wms/WmOutOrderService.cs new file mode 100644 index 00000000..92d9850a --- /dev/null +++ b/ZR.Service/mes/wms/WmOutOrderService.cs @@ -0,0 +1,224 @@ +using System; +using SqlSugar; +using Infrastructure.Attribute; +using ZR.Model; +using ZR.Repository; +using ZR.Service.mes.wms.IService; +using ZR.Model.MES.wms; +using ZR.Model.MES.wms.Dto; +using Mapster; +using System.Collections.Generic; + +namespace ZR.Service.mes.wms +{ + /// + /// 出货单(物料+客户)Service业务层处理 + /// + [AppService(ServiceType = typeof(IWmOutOrderService), ServiceLifetime = LifeTime.Transient)] + public class WmOutOrderService : BaseService, IWmOutOrderService + { + /// + /// 查询出货单(物料+客户)列表 + /// + /// + /// + public PagedInfo GetList(WmOutOrderQueryDto parm) + { + var predicate = Expressionable.Create(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .ToPage(parm); + + return response; + } + + + /// + /// 获取详情 + /// + /// + /// + public WmOutOrder_material_num GetInfo(string ShipmentNum) + { + + WmOutOrder WmOutOrderList = Context.Queryable() + .Where(it => it.ShipmentNum == ShipmentNum) + .First(); + + WmOutOrder_material_num wmOutOrderItem = null; + + if (WmOutOrderList != null) + { + wmOutOrderItem = WmOutOrderList.Adapt(); + + List moList = Context.Queryable() + .Where(it => it.FkOutorderId == WmOutOrderList.ShipmentNum) + .ToList(); + + if (moList != null && moList.Count > 0) + { + List Material_stock = new List(); + + 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); + } + wmOutOrderItem.MaterialList = Material_stock; + } + } + + + + return wmOutOrderItem; + } + + /// + /// 添加出货单(物料+客户) + /// + /// + /// + public WmOutOrder AddWmOutOrder(WmOutOrder_materialDto model) + { + string today_id = "EG" + DateTime.Now.ToString("yyMMdd"); + string last_outorder_ShipmentNum = Context.Queryable().Where(it => it.ShipmentNum.StartsWith(today_id)).Max(it => it.ShipmentNum); + if (string.IsNullOrEmpty(last_outorder_ShipmentNum)) + { + model.ShipmentNum = today_id + "001"; + + } + else + { + int flow = int.Parse(last_outorder_ShipmentNum.Substring(last_outorder_ShipmentNum.Length - 3, 3)) + 1; + model.ShipmentNum = today_id + flow.ToString("000"); + + } + WmOutOrder wmOutOrder = model.Adapt(); + + // 关联表也要新增 + if (model.MaterialList != null) + { + if (model.MaterialList.Count > 0) + { + List materialOutorderList = new List(); + + foreach (var item in model.MaterialList) + { + WmMaterialOutorder materialOutorder = new WmMaterialOutorder(); + materialOutorder.FkMaterialId = item.Id; + materialOutorder.FkOutorderId = model.ShipmentNum; + materialOutorder.OuthouseNum = item.requireOutNum; + materialOutorder.CreatedBy = model.CreatedBy; + materialOutorder.CreatedTime = DateTime.Now; + materialOutorderList.Add(materialOutorder); + }; + int result = Context.Insertable(materialOutorderList).ExecuteCommand(); + } + + } + + return Context.Insertable(wmOutOrder).ExecuteReturnEntity(); + } + + /// + /// 修改出货单(物料+客户) + /// + /// + /// + public int UpdateWmOutOrder(WmOutOrder model) + { + //var response = Update(w => w.ShipmentNum == model.ShipmentNum, it => new WmOutOrder() + //{ + // CustomNo = model.CustomNo, + // CustomName = model.CustomName, + // CustomAddress = model.CustomAddress, + // Remarks = model.Remarks, + // Type = model.Type, + // Status = model.Status, + // Year = model.Year, + // Week = model.Week, + // Date = model.Date, + // CreatedBy = model.CreatedBy, + // CreatedTime = model.CreatedTime, + // UpdatedBy = model.UpdatedBy, + // UpdatedTime = model.UpdatedTime, + //}); + //return response; + return Update(model, true); + } + + + + + /// + /// 获取用户信息 + /// + /// + public List GetCustominfo() + { + + return Context.Queryable().ToList(); + + } + + /// + /// 查询物料记录表列表 + /// + /// + /// + public (List, int) GetmaterialList(WmMaterialQueryDto parm) + { + int total = 0; + var predicate = Expressionable.Create() + .AndIF(parm.Partnumber != null, it => it.Partnumber.Contains(parm.Partnumber)) + .AndIF(parm.U8InventoryCode != null, it => it.U8InventoryCode.Contains(parm.U8InventoryCode)) + .AndIF(parm.ProductName != null, it => it.ProductName.Contains(parm.ProductName)) + .AndIF(parm.Color != null, it => it.Color.Contains(parm.Color)) + .AndIF(parm.Specification != null, it => it.Specification.Contains(parm.Specification)) + .AndIF(parm.Description != null, it => it.Description.Contains(parm.Description)) + .AndIF(parm.Search1 != null, it => it.Search1.Contains(parm.Search1) || it.Search2.Contains(parm.Search1)) + .AndIF(parm.Status > -1, it => it.Status == parm.Status); + + + List materialList = Context.Queryable() + .Where(predicate.ToExpression()).OrderByDescending(it => it.CreatedTime) + .ToPageList(parm.PageNum, parm.PageSize, ref total); + + + List material_stockQuantity_list = new List(); + + + if (materialList.Count > 0) + { + foreach (WmMaterial item in materialList) + { + + WmMaterialQuery_stockQuantityDto wmMaterialQuery_Stock_item = item.Adapt(); + + int material_num = 0; + List productioList = Context + .Queryable() + .Where(it => it.Partnumber == item.Partnumber) + .ToList(); + + if (productioList.Count > 0) + { + foreach (var product in productioList) + { + material_num = material_num + (int)product.GoodsNumLogic; + } + } + wmMaterialQuery_Stock_item.stockQuantity = material_num; + material_stockQuantity_list.Add(wmMaterialQuery_Stock_item); + + + } + } + return (material_stockQuantity_list, total); + } + + } +} \ No newline at end of file diff --git a/ZR.Tasks/ZR.Tasks.csproj b/ZR.Tasks/ZR.Tasks.csproj index 92526344..19106ef8 100644 --- a/ZR.Tasks/ZR.Tasks.csproj +++ b/ZR.Tasks/ZR.Tasks.csproj @@ -6,7 +6,6 @@ -