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 6047f6ea..7aeaff95 100644 --- a/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/wms/WMentryWarehousing_productController.cs @@ -113,23 +113,23 @@ namespace ZR.Admin.WebApi.Controllers.mes.wms return ToResponse(new ApiResult(200, "传入为空", false)); } string msg = ""; - bool data = false; + string createName = HttpContext.GetName(); - int status = this.wm_entryWarehousing_productService.IntoProductwarehouse(wmgoodsDto, createName); - if (status == 0) + int num = this.wm_entryWarehousing_productService.IntoProductwarehouse(wmgoodsDto, createName); + if (num == 0) { msg = "数据插入异常"; - data = false; + } - else if (status == 1) + else if (num >= 1) { - msg = "success"; - data = true; + msg = "成功入库"+num+"个"; + } - return ToResponse(new ApiResult(200, msg, data)); + return ToResponse(new ApiResult(200, msg, num)); } /// /// 获取库位已经存在箱子 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..7164cd19 --- /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); + + var info = response.Adapt(); + return SUCCESS(info); + } + + /// + /// 添加物料记录表 + /// + /// + [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/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/appsettings.development.json b/ZR.Admin.WebApi/appsettings.development.json index 1be1a9b5..16cd819c 100644 --- a/ZR.Admin.WebApi/appsettings.development.json +++ b/ZR.Admin.WebApi/appsettings.development.json @@ -11,7 +11,7 @@ { //外网连接服务器 - "Conn": "Data Source=127.0.0.01;User ID=root;Password=123456;Initial Catalog=ZrAdmin;", + "Conn": "Data Source=127.0.0.1;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;", @@ -26,7 +26,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/wwwroot/Generatecode/ZrAdmin.NET-物料记录表-0316162215.zip b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-物料记录表-0316162215.zip new file mode 100644 index 00000000..154e8f26 Binary files /dev/null and b/ZR.Admin.WebApi/wwwroot/Generatecode/ZrAdmin.NET-物料记录表-0316162215.zip differ 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.Model/MES/wms/Dto/WmMaterialDto.cs b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs new file mode 100644 index 00000000..b007e34d --- /dev/null +++ b/ZR.Model/MES/wms/Dto/WmMaterialDto.cs @@ -0,0 +1,59 @@ +using System.ComponentModel.DataAnnotations; + +namespace ZR.Model.MES.wms.Dto +{ + /// + /// 物料记录表查询对象 + /// + public class WmMaterialQueryDto : PagerInfo + { + } + + /// + /// 物料记录表输入输出对象 + /// + 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/WmCustom.cs b/ZR.Model/MES/wms/WmCustom.cs new file mode 100644 index 00000000..8ae834c5 --- /dev/null +++ b/ZR.Model/MES/wms/WmCustom.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 客户信息 + /// + [SugarTable("wm_custom")] + public class WmCustom + { + /// + /// 主键 + /// + [SugarColumn(ColumnName="id" ,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; } + /// + /// 备注 + /// + [SugarColumn(ColumnName="remark" )] + 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; } + } +} 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/WmOutOrder.cs b/ZR.Model/MES/wms/WmOutOrder.cs new file mode 100644 index 00000000..8facbd8b --- /dev/null +++ b/ZR.Model/MES/wms/WmOutOrder.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace ZR.Model.MES.wms +{ + /// + /// 出货单(物料+客户) + /// + [SugarTable("wm_out_order")] + public class WmOutOrder + { + /// + /// 主键G + /// + [SugarColumn(ColumnName="id" ,IsPrimaryKey = true )] + public string Id { get; set; } + /// + /// 出货单号(雪花算法) + /// + [SugarColumn(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; } + /// + /// 物料号(零件号) + /// + [SugarColumn(ColumnName="partnumber" )] + public string Partnumber { 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; } + /// + /// 状态(0-不可见 1-可见) + /// + [SugarColumn(ColumnName="status" )] + public int? Status { get; set; } + /// + /// 年 + /// + [SugarColumn(ColumnName="year" )] + public int? Year { get; set; } + /// + /// 周 + /// + [SugarColumn(ColumnName="week" )] + public int? Week { get; set; } + /// + /// 日 + /// + [SugarColumn(ColumnName="date" )] + public int? Date { get; set; } + /// + /// 要货数量 + /// + [SugarColumn(ColumnName="number" )] + public int? 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.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/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/IWMentryWarehousing_productService.cs similarity index 100% rename from ZR.Service/mes/wms/IService/IWMWarehousingService.cs rename to ZR.Service/mes/wms/IService/IWMentryWarehousing_productService.cs 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/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 05cf9ef9..85e55f47 100644 --- a/ZR.Service/mes/wms/WMentryWarehousing_productService.cs +++ b/ZR.Service/mes/wms/WMentryWarehousing_productService.cs @@ -10,6 +10,8 @@ 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; @@ -218,17 +220,25 @@ namespace ZR.Service.mes.wms 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) + // 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 = plan.ProductName; + resultionPackageCode.ProductionDescribe = workorder.ProductDescription; } else { - resultionPackageCode.ProductionDescribe = "生产计划无此零件号"; + resultionPackageCode.ProductionDescribe = "生产工单无此零件号"; } - - } diff --git a/ZR.Service/mes/wms/WmMaterialService.cs b/ZR.Service/mes/wms/WmMaterialService.cs new file mode 100644 index 00000000..bcecf225 --- /dev/null +++ b/ZR.Service/mes/wms/WmMaterialService.cs @@ -0,0 +1,98 @@ +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(); + + var response = Queryable() + .Where(predicate.ToExpression()) + .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