仓库管理_客户信息:init
This commit is contained in:
parent
d193f3fc52
commit
741ec8ade4
111
ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs
Normal file
111
ZR.Admin.WebApi/Controllers/mes/wms/WmCustomController.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("/mes/wm/WmCustom")]
|
||||
public class WmCustomController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息接口
|
||||
/// </summary>
|
||||
private readonly IWmCustomService _WmCustomService;
|
||||
|
||||
public WmCustomController(IWmCustomService WmCustomService)
|
||||
{
|
||||
_WmCustomService = WmCustomService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询客户信息列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[ActionPermissionFilter(Permission = "wmsManagement:wmcustom:list")]
|
||||
public IActionResult QueryWmCustom([FromQuery] WmCustomQueryDto parm)
|
||||
{
|
||||
var response = _WmCustomService.GetList(parm);
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询客户信息详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
[ActionPermissionFilter(Permission = "wmsManagement:wmcustom:query")]
|
||||
public IActionResult GetWmCustom(int Id)
|
||||
{
|
||||
var response = _WmCustomService.GetInfo(Id);
|
||||
|
||||
var info = response.Adapt<WmCustom>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加客户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "wmsManagement:wmcustom:add")]
|
||||
[Log(Title = "客户信息", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddWmCustom([FromBody] WmCustomDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmCustom>().ToCreate(HttpContext);
|
||||
|
||||
var response = _WmCustomService.AddWmCustom(modal);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新客户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "wmsManagement:wmcustom:edit")]
|
||||
[Log(Title = "客户信息", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateWmCustom([FromBody] WmCustomDto parm)
|
||||
{
|
||||
var modal = parm.Adapt<WmCustom>().ToUpdate(HttpContext);
|
||||
var response = _WmCustomService.UpdateWmCustom(modal);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除客户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
42
ZR.Model/MES/wms/Dto/WmCustomDto.cs
Normal file
42
ZR.Model/MES/wms/Dto/WmCustomDto.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ZR.Model.MES.wms.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息查询对象
|
||||
/// </summary>
|
||||
public class WmCustomQueryDto : PagerInfo
|
||||
{
|
||||
public string CustomNo { get; set; }
|
||||
|
||||
public string CustomName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 客户信息输入输出对象
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -5,8 +5,47 @@ namespace ZR.Model.MES.wms.Dto
|
||||
/// <summary>
|
||||
/// 物料记录表查询对象
|
||||
/// </summary>
|
||||
public class WmMaterialQueryDto : PagerInfo
|
||||
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; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SqlSugar;
|
||||
@ -6,54 +6,62 @@ namespace ZR.Model.MES.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息
|
||||
///</summary>
|
||||
/// </summary>
|
||||
[SugarTable("wm_custom")]
|
||||
public class WmCustom
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="id" ,IsPrimaryKey = true ,IsIdentity = true )]
|
||||
public int Id { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户代码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="custom_no" )]
|
||||
public string CustomNo { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "custom_no")]
|
||||
public string CustomNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="custom_name" )]
|
||||
public string CustomName { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "custom_name")]
|
||||
public string CustomName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户地址
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="custom_address" )]
|
||||
public string CustomAddress { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "custom_address")]
|
||||
public string CustomAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="remark" )]
|
||||
public string Remark { get; set; }
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="CREATED_BY" )]
|
||||
public string CreatedBy { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_BY")]
|
||||
public string CreatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="CREATED_TIME" )]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "cREATED_TIME")]
|
||||
public DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="UPDATED_BY" )]
|
||||
public string UpdatedBy { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_BY")]
|
||||
public string UpdatedBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="UPDATED_TIME" )]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "uPDATED_TIME")]
|
||||
public DateTime? UpdatedTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
25
ZR.Service/mes/wms/IService/IWmCustomService.cs
Normal file
25
ZR.Service/mes/wms/IService/IWmCustomService.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户信息service接口
|
||||
/// </summary>
|
||||
public interface IWmCustomService : IBaseService<WmCustom>
|
||||
{
|
||||
PagedInfo<WmCustomDto> GetList(WmCustomQueryDto parm);
|
||||
|
||||
WmCustom GetInfo(int Id);
|
||||
|
||||
WmCustom AddWmCustom(WmCustom parm);
|
||||
|
||||
int UpdateWmCustom(WmCustom parm);
|
||||
|
||||
}
|
||||
}
|
||||
91
ZR.Service/mes/wms/WmCustomService.cs
Normal file
91
ZR.Service/mes/wms/WmCustomService.cs
Normal file
@ -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
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 客户信息Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IWmCustomService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class WmCustomService : BaseService<WmCustom>, IWmCustomService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询客户信息列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmCustomDto> GetList(WmCustomQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmCustom>()
|
||||
.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<WmCustom, WmCustomDto>(parm);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmCustom GetInfo(int Id)
|
||||
{
|
||||
var response = Queryable()
|
||||
.Where(x => x.Id == Id)
|
||||
.First();
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加客户信息
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmCustom AddWmCustom(WmCustom model)
|
||||
{
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改客户信息
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -27,11 +27,21 @@ namespace ZR.Service.mes.wms
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmMaterialDto> GetList(WmMaterialQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<WmMaterial>();
|
||||
var predicate = Expressionable.Create<WmMaterial>()
|
||||
.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())
|
||||
.Where(predicate.ToExpression()).OrderByDescending(it=>it.CreatedTime)
|
||||
.ToPage<WmMaterial, WmMaterialDto>(parm);
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user