mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-03-02 15:50:54 +08:00
Compare commits
11 Commits
fc5779225e
...
sqlsugar-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c86d7dcbf | ||
|
|
191ccd0dbe | ||
|
|
27ca377762 | ||
|
|
8077450be0 | ||
|
|
36c113398d | ||
|
|
d73324ea90 | ||
|
|
aed0b8c2e5 | ||
|
|
4ff771b8a6 | ||
|
|
898be6c733 | ||
|
|
fd018555fa | ||
|
|
f4280298af |
BIN
Readme/代码生成.gif
BIN
Readme/代码生成.gif
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 MiB |
BIN
Readme/用户管理.png
BIN
Readme/用户管理.png
Binary file not shown.
|
Before Width: | Height: | Size: 79 KiB |
BIN
Readme/菜单管理.png
BIN
Readme/菜单管理.png
Binary file not shown.
|
Before Width: | Height: | Size: 153 KiB |
@@ -181,7 +181,7 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.PageList(Yi.Framework.DtoModel.ERP.Material.MaterialCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.MaterialController.PageList(Yi.Framework.DtoModel.ERP.Material.MaterialGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
@@ -249,7 +249,19 @@
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.PageList(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Receipt(Yi.Framework.DtoModel.ERP.Purchase.ReceiptInput)">
|
||||
<summary>
|
||||
收获
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseController.Collection(Yi.Framework.DtoModel.ERP.Purchase.CollectionInput)">
|
||||
<summary>
|
||||
回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.PurchaseDetailsController.PageList(Yi.Framework.DtoModel.ERP.PurchaseDetails.PurchaseDetailsGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
@@ -283,7 +295,56 @@
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.PageList(Yi.Framework.DtoModel.ERP.Supplier.SupplierCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.PageList(Yi.Framework.DtoModel.ERP.Stock.StockGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.GetById(System.Int64)">
|
||||
<summary>
|
||||
单查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.InputStock(Yi.Framework.DtoModel.ERP.Stock.StockCreateUpdateInput)">
|
||||
<summary>
|
||||
入库
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockController.OutputStock(Yi.Framework.DtoModel.ERP.Stock.StockCreateUpdateInput)">
|
||||
<summary>
|
||||
出库
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.PageList(Yi.Framework.DtoModel.ERP.StockDetails.StockDetailsGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.GetById(System.Int64)">
|
||||
<summary>
|
||||
单查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.StockDetailsController.Del(System.Collections.Generic.List{System.Int64})">
|
||||
<summary>
|
||||
删
|
||||
</summary>
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.GetList">
|
||||
<summary>
|
||||
全查
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.SupplierController.PageList(Yi.Framework.DtoModel.ERP.Supplier.SupplierGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
@@ -317,7 +378,7 @@
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.PageList(Yi.Framework.DtoModel.ERP.Unit.UnitCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.UnitController.PageList(Yi.Framework.DtoModel.ERP.Unit.UnitGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
@@ -357,7 +418,7 @@
|
||||
<param name="ids"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.PageList(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseCreateUpdateInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<member name="M:Yi.Framework.ApiMicroservice.Controllers.ERP.WarehouseController.PageList(Yi.Framework.DtoModel.ERP.Warehouse.WarehouseGetListInput,Yi.Framework.Common.Models.PageParModel)">
|
||||
<summary>
|
||||
分页查
|
||||
</summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Org.BouncyCastle.Asn1.IsisMtt.X509;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] MaterialCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] MaterialGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _materialService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
@@ -79,5 +79,25 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
await _purchaseService.DeleteAsync(ids);
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 收获
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> Receipt(ReceiptInput input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> Collection(CollectionInput input)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,24 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] PurchaseDetailsCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] PurchaseDetailsGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _purchaseDetailsService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
public async Task<Result> GetListByPurchaseId(long id)
|
||||
{
|
||||
var result = await _purchaseDetailsService.GetListByPurchaseIdAsync(id);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Stock;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class StockController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<StockController> _logger;
|
||||
private readonly IStockService _stockService;
|
||||
public StockController(ILogger<StockController> logger, IStockService stockService)
|
||||
{
|
||||
_logger = logger;
|
||||
_stockService = stockService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] StockGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _stockService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
public async Task<Result> GetById(long id)
|
||||
{
|
||||
var result = await _stockService.GetByIdAsync(id);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 入库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> InputStock(StockCreateUpdateInput input)
|
||||
{
|
||||
var result = await _stockService.InputStockAsync(input);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Result> OutputStock(StockCreateUpdateInput input)
|
||||
{
|
||||
var result = await _stockService.OutputStockAsync(input);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.StockDetails;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
{
|
||||
[ApiController]
|
||||
[Route("api/[controller]/[action]")]
|
||||
public class StockDetailsController : ControllerBase
|
||||
{
|
||||
private readonly ILogger<StockDetailsController> _logger;
|
||||
private readonly IStockDetailsService _stockDetailsService;
|
||||
public StockDetailsController(ILogger<StockDetailsController> logger, IStockDetailsService stockDetailsService)
|
||||
{
|
||||
_logger = logger;
|
||||
_stockDetailsService = stockDetailsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] StockDetailsGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _stockDetailsService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("{id}")]
|
||||
public async Task<Result> GetById(long id)
|
||||
{
|
||||
var result = await _stockDetailsService.GetByIdAsync(id);
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpDelete]
|
||||
public async Task<Result> Del(List<long> ids)
|
||||
{
|
||||
await _stockDetailsService.DeleteAsync(ids);
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Supplier;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
using Yi.Framework.Service.ERP;
|
||||
|
||||
namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
{
|
||||
@@ -17,12 +18,24 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
_supplierService = supplierService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 全查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> GetList()
|
||||
{
|
||||
var result = await _supplierService.GetListAsync();
|
||||
return Result.Success().SetData(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分页查
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] SupplierCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] SupplierGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _supplierService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] UnitCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] UnitGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _unitService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] WarehouseCreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] WarehouseGetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _warehouseService.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"DbConn": {
|
||||
"WriteUrl": "DataSource=yi-sqlsugar-dev.db",
|
||||
"ReadUrl": [
|
||||
"DataSource=[xxxx]",//sqlite
|
||||
"DataSource=[xxxx]", //sqlite
|
||||
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql
|
||||
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver
|
||||
]
|
||||
@@ -47,6 +47,11 @@
|
||||
"CacheList": [ "Redis", "MemoryCache" ],
|
||||
//选择缓存
|
||||
"CacheSelect": "MemoryCache",
|
||||
|
||||
//缓存Aop
|
||||
"CacheAOP_Enabled": false,
|
||||
|
||||
|
||||
//缓存种子数据是否开启
|
||||
"CacheSeed_Enabled": false,
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.Common.Attribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
|
||||
public class CachingAttribute : System.Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存绝对过期时间(分钟)
|
||||
/// </summary>
|
||||
public int AbsoluteExpiration { get; set; } = 30;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -110,6 +110,11 @@ namespace Yi.Framework.Common.Base
|
||||
|
||||
}
|
||||
|
||||
public static string TryStringNull(this object value)
|
||||
{
|
||||
return value == null ? "" : value.ToString()!.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Object类型无值判断
|
||||
/// </summary>
|
||||
|
||||
@@ -47,6 +47,63 @@ namespace Yi.Framework.Common.Helper
|
||||
|
||||
return ConvertEx.ToUrlBase64String(bRet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 16位MD5加密
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public static string MD5Encrypt16(string password)
|
||||
{
|
||||
var md5 = MD5.Create();
|
||||
string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)), 4, 8);
|
||||
t2 = t2.Replace("-", string.Empty);
|
||||
return t2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 32位MD5加密
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public static string MD5Encrypt32(string password = "")
|
||||
{
|
||||
string pwd = string.Empty;
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(password) && !string.IsNullOrWhiteSpace(password))
|
||||
{
|
||||
MD5 md5 = MD5.Create(); //实例化一个md5对像
|
||||
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
||||
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
||||
// 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
|
||||
foreach (var item in s)
|
||||
{
|
||||
// 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
|
||||
pwd = string.Concat(pwd, item.ToString("X2"));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new Exception($"错误的 password 字符串:【{password}】");
|
||||
}
|
||||
return pwd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 64位MD5加密
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public static string MD5Encrypt64(string password)
|
||||
{
|
||||
// 实例化一个md5对像
|
||||
// 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择
|
||||
MD5 md5 = MD5.Create();
|
||||
byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
||||
return Convert.ToBase64String(s);
|
||||
}
|
||||
}
|
||||
public class ConvertEx
|
||||
{
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
using Castle.DynamicProxy;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Base;
|
||||
using Yi.Framework.Common.Helper;
|
||||
|
||||
namespace Yi.Framework.Core.Cache.Aop
|
||||
{
|
||||
public abstract class CacheAOPbase : IInterceptor
|
||||
{
|
||||
/// <summary>
|
||||
/// AOP的拦截方法
|
||||
/// </summary>
|
||||
/// <param name="invocation"></param>
|
||||
public abstract void Intercept(IInvocation invocation);
|
||||
|
||||
/// <summary>
|
||||
/// 自定义缓存的key
|
||||
/// </summary>
|
||||
/// <param name="invocation"></param>
|
||||
/// <returns></returns>
|
||||
protected string CustomCacheKey(IInvocation invocation)
|
||||
{
|
||||
var typeName = invocation.TargetType.Name;
|
||||
var methodName = invocation.Method.Name;
|
||||
var methodArguments = invocation.Arguments.Select(GetArgumentValue).Take(3).ToList();//获取参数列表,最多三个
|
||||
|
||||
string key = $"{typeName}:{methodName}:";
|
||||
foreach (var param in methodArguments)
|
||||
{
|
||||
key = $"{key}{param}:";
|
||||
}
|
||||
|
||||
return key.TrimEnd(':');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// object 转 string
|
||||
/// </summary>
|
||||
/// <param name="arg"></param>
|
||||
/// <returns></returns>
|
||||
protected static string GetArgumentValue(object arg)
|
||||
{
|
||||
if (arg is DateTime)
|
||||
return ((DateTime)arg).ToString("yyyyMMddHHmmss");
|
||||
|
||||
if (!arg.IsNotNull())
|
||||
return arg.TryStringNull();
|
||||
|
||||
if (arg != null)
|
||||
{
|
||||
if (arg is Expression)
|
||||
{
|
||||
var obj = arg as Expression;
|
||||
var result = Resolve(obj);
|
||||
return MD5Helper.MD5Encrypt16(result);
|
||||
}
|
||||
else if (arg.GetType().IsClass)
|
||||
{
|
||||
return MD5Helper.MD5Encrypt16(JsonConvert.SerializeObject(arg));
|
||||
}
|
||||
|
||||
return $"value:{arg.TryStringNull()}";
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string Resolve(Expression expression)
|
||||
{
|
||||
ExpressionContext expContext = new ExpressionContext();
|
||||
expContext.Resolve(expression, ResolveExpressType.WhereSingle);
|
||||
var value = expContext.Result.GetString();
|
||||
var pars = expContext.Parameters;
|
||||
|
||||
pars.ForEach(s =>
|
||||
{
|
||||
value = value.Replace(s.ParameterName, s.Value.TryStringNull());
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using Castle.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Attribute;
|
||||
using Yi.Framework.Core.Cache;
|
||||
|
||||
namespace Yi.Framework.Core.Cache.Aop
|
||||
{
|
||||
public class MemoryCacheAOP : CacheAOPbase
|
||||
{
|
||||
private CacheInvoker _cache;
|
||||
public MemoryCacheAOP(CacheInvoker cache)
|
||||
{
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
public override void Intercept(IInvocation invocation)
|
||||
{
|
||||
var method = invocation.MethodInvocationTarget ?? invocation.Method;
|
||||
|
||||
var cachingAttribute = method.GetCustomAttributes(true).FirstOrDefault(x => x.GetType() == typeof(CachingAttribute));
|
||||
if (cachingAttribute is CachingAttribute qCachingAttribute)
|
||||
{
|
||||
//获取自定义缓存键
|
||||
var cacheKey = CustomCacheKey(invocation);
|
||||
//根据key获取相应的缓存值
|
||||
var cacheValue = _cache.Get<string>(cacheKey);
|
||||
if (cacheValue != null)
|
||||
{
|
||||
//将当前获取到的缓存值,赋值给当前执行方法
|
||||
invocation.ReturnValue = cacheValue;
|
||||
return;
|
||||
}
|
||||
//去执行当前的方法
|
||||
invocation.Proceed();
|
||||
//存入缓存
|
||||
if (!string.IsNullOrWhiteSpace(cacheKey))
|
||||
{
|
||||
_cache.Set(cacheKey, invocation.ReturnValue, TimeSpan.FromMinutes(qCachingAttribute.AbsoluteExpiration));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invocation.Proceed();//直接执行被拦截方法
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using Castle.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Cache;
|
||||
using Yi.Framework.Common.Attribute;
|
||||
|
||||
namespace Yi.Framework.Core.Cache.Aop
|
||||
{
|
||||
public class RedisCacheAOP : CacheAOPbase
|
||||
{
|
||||
private CacheInvoker _cacheDb;
|
||||
public RedisCacheAOP(CacheInvoker cacheInvoker)
|
||||
{
|
||||
_cacheDb = cacheInvoker;
|
||||
}
|
||||
|
||||
public override void Intercept(IInvocation invocation)
|
||||
{
|
||||
var method = invocation.MethodInvocationTarget ?? invocation.Method;
|
||||
if (method.ReturnType == typeof(void) || method.ReturnType == typeof(Task))
|
||||
{
|
||||
invocation.Proceed();
|
||||
return;
|
||||
}
|
||||
|
||||
var qCachingAttribute = method.GetCustomAttributes(true).FirstOrDefault(x => x.GetType() == typeof(CachingAttribute)) as CachingAttribute;
|
||||
|
||||
if (qCachingAttribute != null)
|
||||
{
|
||||
//获取自定义缓存键
|
||||
var cacheKey = CustomCacheKey(invocation);
|
||||
//注意是 string 类型,方法GetValue
|
||||
var cacheValue = _cacheDb.Get<string>(cacheKey);
|
||||
if (cacheValue != null)
|
||||
{
|
||||
//将当前获取到的缓存值,赋值给当前执行方法
|
||||
Type returnType;
|
||||
if (typeof(Task).IsAssignableFrom(method.ReturnType))
|
||||
{
|
||||
returnType = method.ReturnType.GenericTypeArguments.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnType = method.ReturnType;
|
||||
}
|
||||
|
||||
dynamic _result = Newtonsoft.Json.JsonConvert.DeserializeObject(cacheValue, returnType);
|
||||
invocation.ReturnValue = (typeof(Task).IsAssignableFrom(method.ReturnType)) ? Task.FromResult(_result) : _result;
|
||||
return;
|
||||
}
|
||||
//去执行当前的方法
|
||||
invocation.Proceed();
|
||||
|
||||
//存入缓存
|
||||
if (!string.IsNullOrWhiteSpace(cacheKey))
|
||||
{
|
||||
object response;
|
||||
|
||||
//Type type = invocation.ReturnValue?.GetType();
|
||||
var type = invocation.Method.ReturnType;
|
||||
if (typeof(Task).IsAssignableFrom(type))
|
||||
{
|
||||
var resultProperty = type.GetProperty("Result");
|
||||
response = resultProperty.GetValue(invocation.ReturnValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = invocation.ReturnValue;
|
||||
}
|
||||
if (response == null) response = string.Empty;
|
||||
|
||||
_cacheDb.Set(cacheKey, response, TimeSpan.FromMinutes(qCachingAttribute.AbsoluteExpiration));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invocation.Proceed();//直接执行被拦截方法
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="2.0.8" />
|
||||
<PackageReference Include="Castle.Core" Version="5.1.1" />
|
||||
<PackageReference Include="Consul" Version="1.6.10.3" />
|
||||
<PackageReference Include="CSRedisCore" Version="3.6.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
/// <summary>
|
||||
/// 回款
|
||||
/// </summary>
|
||||
public class CollectionInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购订单id
|
||||
/// </summary>
|
||||
public long PurchaseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///回款钱
|
||||
/// </summary>
|
||||
public float CollectionMoney { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.DtoModel.ERP.PurchaseDetails;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
public class PurchaseCreateInput
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public DateTime? NeedTime { get; set; }
|
||||
public string Buyer { get; set; } = string.Empty;
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
public long SupplierId { get; set; }
|
||||
|
||||
public List<PurchaseDetailsCreateUpdateInput>? PurchaseDetails { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
public class PurchaseGetListInput
|
||||
{
|
||||
public string? Code { get; set; }
|
||||
public DateTime? NeedTime { get; set; }
|
||||
public string? Buyer { get; set; }
|
||||
public PurchaseStateEnum? PurchaseState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
public string Buyer { get; set; } = string.Empty;
|
||||
public long TotalMoney { get; set; }
|
||||
public long PaidMoney { get; set; }
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
public string SupplierName { get; set; } = string.Empty;
|
||||
public PurchaseStateEnum PurchaseState { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
public class PurchaseUpdateInput : EntityDto<long>
|
||||
{
|
||||
public string? Code { get; set; }
|
||||
public DateTime NeedTime { get; set; }
|
||||
public string? Buyer { get; set; }
|
||||
public long TotalMoney { get; set; }
|
||||
public long PaidMoney { get; set; }
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
public PurchaseStateEnum PurchaseState { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
/// <summary>
|
||||
/// 收货
|
||||
/// </summary>
|
||||
public class ReceiptInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购订单id
|
||||
/// </summary>
|
||||
public long PurchaseId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ReceiptDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单子表id
|
||||
/// </summary>
|
||||
public long PurchaseDatilesId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收货数量
|
||||
/// </summary>
|
||||
public long Number { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.PurchaseDetails
|
||||
{
|
||||
@@ -16,5 +17,17 @@ namespace Yi.Framework.DtoModel.ERP.PurchaseDetails
|
||||
public long TotalNumber { get; set; }
|
||||
public long CompleteNumber { get; set; }
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
public long PurchaseId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public static class PurchaseDetailsCreateUpdateInputExtensions
|
||||
{
|
||||
public static List<PurchaseDetailsCreateUpdateInput> SetPurchaseId(this List<PurchaseDetailsCreateUpdateInput> purchaseDetailsEntities, long purchaseId)
|
||||
{
|
||||
purchaseDetailsEntities.ForEach(u => u.PurchaseId = purchaseId);
|
||||
return purchaseDetailsEntities;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock.ConstConfig
|
||||
{
|
||||
public class StockConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock.MapperConfig
|
||||
{
|
||||
public class SuppliERProfile:Profile
|
||||
{
|
||||
public SuppliERProfile()
|
||||
{
|
||||
CreateMap<StockCreateUpdateInput, StockEntity>();
|
||||
CreateMap<StockEntity, StockGetListOutput>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockCreateUpdateInput : EntityDto<long>
|
||||
{
|
||||
public long WarehouseId { get; set; }
|
||||
public long MaterialId { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockGetListInput
|
||||
{
|
||||
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockGetListOutput: EntityDto<long>
|
||||
{
|
||||
public string MaterialName { get; set; } = string.Empty;
|
||||
public string UnitName { get; set; } = string.Empty;
|
||||
public string WarehouseName { get; set; } = string.Empty;
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails.ConstConfig
|
||||
{
|
||||
public class StockDetailsConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails.MapperConfig
|
||||
{
|
||||
public class SuppliERProfile:Profile
|
||||
{
|
||||
public SuppliERProfile()
|
||||
{
|
||||
CreateMap<StockDetailsCreateUpdateInput, StockDetailsEntity>();
|
||||
CreateMap<StockDetailsEntity, StockDetailsGetListOutput>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsCreateUpdateInput : EntityDto<long>
|
||||
{
|
||||
public long WarehouseId { get; set; }
|
||||
public long MaterialId { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsGetListInput
|
||||
{
|
||||
public long WarehouseName { get; set; }
|
||||
public long MaterialName { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsGetListOutput: EntityDto<long>
|
||||
{
|
||||
public long WarehouseName { get; set; }
|
||||
public long MaterialName { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public DateTime StockDetailsTime { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Supplier.ConstConfig
|
||||
{
|
||||
public class SupplierConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Supplier.MapperConfig
|
||||
{
|
||||
public class SupplierProfile:Profile
|
||||
{
|
||||
public SupplierProfile()
|
||||
{
|
||||
CreateMap<SupplierCreateUpdateInput, SupplierEntity>();
|
||||
CreateMap<SupplierEntity, SupplierGetListOutput>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Supplier
|
||||
{
|
||||
public class SupplierCreateUpdateInput : EntityDto<long>
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Name { get; set; }= string.Empty;
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Fax { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Supplier
|
||||
{
|
||||
public class SupplierGetListOutput: EntityDto<long>
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public string Name { get; set; }= string.Empty;
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Fax { get; set; }
|
||||
public string? Email { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
/// <summary>
|
||||
/// 回款
|
||||
/// </summary>
|
||||
public class CollectionInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购订单id
|
||||
/// </summary>
|
||||
public long PurchaseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///回款钱
|
||||
/// </summary>
|
||||
public float CollectionMoney { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,10 @@ namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
public DateTime? NeedTime { get; set; }
|
||||
public string Buyer { get; set; } = string.Empty;
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
public long SupplierId { get; set; }
|
||||
|
||||
public List<PurchaseDetailsCreateUpdateInput>? PurchaseDetails { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
public string? Buyer { get; set; }
|
||||
public long TotalMoney { get; set; }
|
||||
public long PaidMoney { get; set; }
|
||||
|
||||
public string? Remarks { get; set; }
|
||||
public PurchaseStateEnum PurchaseState { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Purchase
|
||||
{
|
||||
/// <summary>
|
||||
/// 收货
|
||||
/// </summary>
|
||||
public class ReceiptInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 采购订单id
|
||||
/// </summary>
|
||||
public long PurchaseId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ReceiptDetails
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单子表id
|
||||
/// </summary>
|
||||
public long PurchaseDatilesId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收货数量
|
||||
/// </summary>
|
||||
public long Number { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock.ConstConfig
|
||||
{
|
||||
public class StockConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock.MapperConfig
|
||||
{
|
||||
public class SuppliERProfile:Profile
|
||||
{
|
||||
public SuppliERProfile()
|
||||
{
|
||||
CreateMap<StockCreateUpdateInput, StockEntity>();
|
||||
CreateMap<StockEntity, StockGetListOutput>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockCreateUpdateInput : EntityDto<long>
|
||||
{
|
||||
public long WarehouseId { get; set; }
|
||||
public long MaterialId { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockGetListInput
|
||||
{
|
||||
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.Stock
|
||||
{
|
||||
public class StockGetListOutput: EntityDto<long>
|
||||
{
|
||||
public string MaterialName { get; set; } = string.Empty;
|
||||
public string UnitName { get; set; } = string.Empty;
|
||||
public string WarehouseName { get; set; } = string.Empty;
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails.ConstConfig
|
||||
{
|
||||
public class StockDetailsConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails.MapperConfig
|
||||
{
|
||||
public class SuppliERProfile:Profile
|
||||
{
|
||||
public SuppliERProfile()
|
||||
{
|
||||
CreateMap<StockDetailsCreateUpdateInput, StockDetailsEntity>();
|
||||
CreateMap<StockDetailsEntity, StockDetailsGetListOutput>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsCreateUpdateInput : EntityDto<long>
|
||||
{
|
||||
public long WarehouseId { get; set; }
|
||||
public long MaterialId { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsGetListInput
|
||||
{
|
||||
public long WarehouseName { get; set; }
|
||||
public long MaterialName { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
|
||||
namespace Yi.Framework.DtoModel.ERP.StockDetails
|
||||
{
|
||||
public class StockDetailsGetListOutput: EntityDto<long>
|
||||
{
|
||||
public long WarehouseName { get; set; }
|
||||
public long MaterialName { get; set; }
|
||||
public long Number { get; set; }
|
||||
public string? Quality { get; set; }
|
||||
public DateTime StockDetailsTime { get; set; }
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,6 @@ namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IMaterialService : ICrudAppService<MaterialGetListOutput, long, MaterialCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<MaterialGetListOutput>>> PageListAsync(MaterialCreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<MaterialGetListOutput>>> PageListAsync(MaterialGetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IPurchaseDetailsService : ICrudAppService<PurchaseDetailsGetListOutput, long, PurchaseDetailsCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<PurchaseDetailsGetListOutput>>> PageListAsync(PurchaseDetailsCreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<PurchaseDetailsGetListOutput>>> PageListAsync(PurchaseDetailsGetListInput input, PageParModel page);
|
||||
|
||||
Task<List<PurchaseDetailsGetListOutput>> GetListByPurchaseIdAsync(long purchaseId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.StockDetails;
|
||||
using Yi.Framework.Interface.Base.Crud;
|
||||
|
||||
namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IStockDetailsService : ICrudAppService<StockDetailsGetListOutput, long, StockDetailsCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<StockDetailsGetListOutput>>> PageListAsync(StockDetailsGetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Stock;
|
||||
using Yi.Framework.Interface.Base.Crud;
|
||||
|
||||
namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IStockService : ICrudAppService<StockGetListOutput, long, StockCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<StockGetListOutput>>> PageListAsync(StockGetListInput input, PageParModel page);
|
||||
|
||||
/// <summary>
|
||||
/// Èë¿â
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<StockGetListOutput> InputStockAsync(StockCreateUpdateInput input);
|
||||
|
||||
/// <summary>
|
||||
/// ³ö¿â
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
Task<StockGetListOutput> OutputStockAsync(StockCreateUpdateInput input);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -11,6 +11,6 @@ namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface ISupplierService : ICrudAppService<SupplierGetListOutput, long, SupplierCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierGetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IUnitService : ICrudAppService<UnitGetListOutput, long, UnitCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitCreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitGetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace Yi.Framework.Interface.ERP
|
||||
{
|
||||
public interface IWarehouseService : ICrudAppService<WarehouseGetListOutput, long, WarehouseCreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<WarehouseGetListOutput>>> PageListAsync(WarehouseCreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<WarehouseGetListOutput>>> PageListAsync(WarehouseGetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Yi.Framework.Model.ERP.Entitys
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
@@ -35,28 +35,28 @@ namespace Yi.Framework.Model.ERP.Entitys
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public long MaterialId { get; set; }
|
||||
public long MaterialId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string MaterialName { get; set; }=string.Empty;
|
||||
public string MaterialName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料单位
|
||||
/// </summary>
|
||||
public string MaterialUnit { get; set; }=string.Empty ;
|
||||
public string MaterialUnit { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 单价
|
||||
/// </summary>
|
||||
public float UnitPrice { get; set; }
|
||||
public float UnitPrice { get; set; }
|
||||
/// <summary>
|
||||
/// 总数量
|
||||
/// </summary>
|
||||
public long TotalNumber { get; set; }
|
||||
public long TotalNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 已完成数量
|
||||
/// </summary>
|
||||
@@ -65,5 +65,9 @@ namespace Yi.Framework.Model.ERP.Entitys
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace Yi.Framework.Model.ERP.Entitys
|
||||
/// </summary>
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商id
|
||||
/// </summary>
|
||||
public long SupplierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购单号
|
||||
/// </summary>
|
||||
@@ -52,6 +57,11 @@ namespace Yi.Framework.Model.ERP.Entitys
|
||||
/// </summary>
|
||||
public float PaidMoney { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remarks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采购状态
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.Model.ERP.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存明细,像这种记录型的表,需要进行冗余字段保存历史记录
|
||||
/// </summary>
|
||||
[SugarTable("StockDetails")]
|
||||
public class StockDetailsEntity : IEntity<long>, IMultiTenant
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
/// </summary>
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库存id
|
||||
/// </summary>
|
||||
public long StockId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库id
|
||||
/// </summary>
|
||||
public long WarehouseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库名称
|
||||
/// </summary>
|
||||
public string WarehouseName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public long MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string MaterialName { get; set; }=string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public long Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品质
|
||||
/// </summary>
|
||||
public string? Quality { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 入库或者出库时间
|
||||
/// </summary>
|
||||
public DateTime StockDetailsTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细类别
|
||||
/// </summary>
|
||||
public StockDetailsTypeEnum StockDetailsType { get; set; }
|
||||
}
|
||||
public enum StockDetailsTypeEnum
|
||||
{
|
||||
Input = 0,//入库
|
||||
Output = 1//出库
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Model.Base;
|
||||
|
||||
namespace Yi.Framework.Model.ERP.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 库存
|
||||
/// </summary>
|
||||
[SugarTable("Stock")]
|
||||
public class StockEntity : IEntity<long>, IMultiTenant
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 租户id
|
||||
/// </summary>
|
||||
public Guid? TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓库id
|
||||
/// </summary>
|
||||
public long WarehouseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料id
|
||||
/// </summary>
|
||||
public long MaterialId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public long Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品质
|
||||
/// </summary>
|
||||
public string? Quality { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Yi.Framework.Model.RABC.Entitys
|
||||
{
|
||||
public ConfigEntity()
|
||||
{
|
||||
CreateTime = DateTime.Now;
|
||||
//CreateTime = DateTime.Now;
|
||||
}
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NEST" Version="7.16.0" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.3.30" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.3.43-preview04" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -31,14 +31,14 @@ namespace Yi.Framework.Service.Base.Crud
|
||||
public IRepository<TEntity> Repository { get; set; }
|
||||
|
||||
|
||||
public async Task<List<TGetListOutputDto>> GetListAsync()
|
||||
public virtual async Task<List<TGetListOutputDto>> GetListAsync()
|
||||
{
|
||||
var entitys = await Repository.GetListAsync();
|
||||
var entityDtos = await MapToGetListOutputDtosAsync(entitys);
|
||||
return entityDtos;
|
||||
}
|
||||
|
||||
public async Task<TGetOutputDto> GetByIdAsync(TKey id)
|
||||
public virtual async Task<TGetOutputDto> GetByIdAsync(TKey id)
|
||||
{
|
||||
var entity = await GetEntityByIdAsync(id);
|
||||
if (entity is null)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class MaterialService : CrudAppService<MaterialEntity, MaterialGetListOutput, long, MaterialCreateUpdateInput>, IMaterialService
|
||||
{
|
||||
public async Task<PageModel<List<MaterialGetListOutput>>> PageListAsync(MaterialCreateUpdateInput input, PageParModel page)
|
||||
public async Task<PageModel<List<MaterialGetListOutput>>> PageListAsync(MaterialGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
|
||||
@@ -16,12 +16,17 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class PurchaseDetailsService : CrudAppService<PurchaseDetailsEntity, PurchaseDetailsGetListOutput, long, PurchaseDetailsCreateUpdateInput>, IPurchaseDetailsService
|
||||
{
|
||||
public async Task<PageModel<List<PurchaseDetailsGetListOutput>>> PageListAsync(PurchaseDetailsCreateUpdateInput input, PageParModel page)
|
||||
public async Task<List<PurchaseDetailsGetListOutput>> GetListByPurchaseIdAsync(long purchaseId)
|
||||
{
|
||||
var data= await Repository._DbQueryable.Where(u => u.PurchaseId == purchaseId).ToListAsync();
|
||||
return await MapToGetListOutputDtos(data);
|
||||
}
|
||||
|
||||
public async Task<PageModel<List<PurchaseDetailsGetListOutput>>> PageListAsync(PurchaseDetailsGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
//.WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code))
|
||||
//.WhereIF(input.Name is not null, u => u.Name.Contains(input.Name))
|
||||
|
||||
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||
return new PageModel<List<PurchaseDetailsGetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Attribute;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Purchase;
|
||||
using Yi.Framework.DtoModel.ERP.PurchaseDetails;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
using Yi.Framework.Model.Base;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
@@ -30,10 +31,11 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
//.WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code))
|
||||
//.WhereIF(input.Name is not null, u => u.Name.Contains(input.Name))
|
||||
.LeftJoin<SupplierEntity>((p, s) => p.SupplierId == s.Id)
|
||||
.WhereIF(input.Code is not null, u => u.Code.Contains(input.Code))
|
||||
.Select((p, s) => new PurchaseGetListOutput { SupplierName = s.Name },true)
|
||||
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||
return new PageModel<List<PurchaseGetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
|
||||
return new PageModel<List<PurchaseGetListOutput>> { Total = totalNumber.Value, Data = data };
|
||||
}
|
||||
|
||||
public override async Task<PurchaseGetListOutput> CreateAsync(PurchaseCreateInput input)
|
||||
@@ -48,7 +50,9 @@ namespace Yi.Framework.Service.ERP
|
||||
TryToSetTenantId(entity);
|
||||
var purchaseId = await Repository.InsertReturnSnowflakeIdAsync(entity);
|
||||
entity.Id = purchaseId;
|
||||
await _purchaseDetailsService.CreateAsync(input.PurchaseDetails);
|
||||
|
||||
|
||||
await _purchaseDetailsService.CreateAsync(input.PurchaseDetails.SetPurchaseId(purchaseId));
|
||||
uow.Commit();
|
||||
}
|
||||
return await MapToGetListOutputDtoAsync(entity); ;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using AutoMapper;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.StockDetails;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Service.Base.Crud;
|
||||
|
||||
namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class StockDetailsService : CrudAppService<StockDetailsEntity, StockDetailsGetListOutput, long, StockDetailsCreateUpdateInput>, IStockDetailsService
|
||||
{
|
||||
public async Task<PageModel<List<StockDetailsGetListOutput>>> PageListAsync(StockDetailsGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
.Where(u => u.StockDetailsType == input.StockDetailsType)
|
||||
.WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.StockDetailsTime >= page.StartTime && u.StockDetailsTime <= page.EndTime)
|
||||
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||
return new PageModel<List<StockDetailsGetListOutput>> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
|
||||
}
|
||||
}
|
||||
}
|
||||
188
Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs
Normal file
188
Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using AutoMapper;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Exceptions;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.DtoModel.ERP.Stock;
|
||||
using Yi.Framework.Interface.ERP;
|
||||
using Yi.Framework.Model.ERP.Entitys;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Service.Base.Crud;
|
||||
|
||||
namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class StockService : CrudAppService<StockEntity, StockGetListOutput, long, StockCreateUpdateInput>, IStockService
|
||||
{
|
||||
private IRepository<StockDetailsEntity> _detailsRepository;
|
||||
private ISugarUnitOfWork<UnitOfWork> _unitOfWork;
|
||||
public StockService(IRepository<StockDetailsEntity> detailsRepository, ISugarUnitOfWork<UnitOfWork> unitOfWork)
|
||||
{
|
||||
_detailsRepository = detailsRepository;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
public async Task<PageModel<List<StockGetListOutput>>> PageListAsync(StockGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
.LeftJoin<WarehouseEntity>((stock, warehouse) => stock.WarehouseId == warehouse.Id)
|
||||
.LeftJoin<MaterialEntity>((stock, warehouse, material) => stock.MaterialId == material.Id)
|
||||
.Select((stock, warehouse, material) => new StockGetListOutput
|
||||
{
|
||||
MaterialName = material.Name,
|
||||
WarehouseName = warehouse.Name,
|
||||
UnitName = material.UnitName
|
||||
}, true)
|
||||
.ToPageListAsync(page.PageNum, page.PageSize, totalNumber);
|
||||
return new PageModel<List<StockGetListOutput>> { Total = totalNumber.Value, Data = data };
|
||||
}
|
||||
|
||||
public override async Task<StockGetListOutput> GetByIdAsync(long id)
|
||||
{
|
||||
return await Repository._DbQueryable
|
||||
.LeftJoin<WarehouseEntity>((stock, warehouse) => stock.WarehouseId == warehouse.Id)
|
||||
.LeftJoin<MaterialEntity>((stock, warehouse, material) => stock.MaterialId == material.Id)
|
||||
.Select((stock, warehouse, material) => new StockGetListOutput
|
||||
{
|
||||
MaterialName = material.Name,
|
||||
WarehouseName = warehouse.Name,
|
||||
UnitName = material.UnitName
|
||||
}, true)
|
||||
.FirstAsync(stock => stock.Id==id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 入库操作,需要工作单元事务操作
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<StockGetListOutput> InputStockAsync(StockCreateUpdateInput input)
|
||||
{
|
||||
StockGetListOutput result = new();
|
||||
using (var uow = _unitOfWork.CreateContext())
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
//先判断是否存在该物料,如果存在,直接添加数量
|
||||
var entityData = await Repository.GetFirstAsync(u => u.MaterialId == entity.MaterialId);
|
||||
if (entityData is not null)
|
||||
{
|
||||
entityData.Number += input.Number;
|
||||
await Repository.UpdateIgnoreNullAsync(entityData);
|
||||
}
|
||||
//添加一条库存数据
|
||||
else
|
||||
{
|
||||
await Repository.InsertReturnSnowflakeIdAsync(entity);
|
||||
}
|
||||
|
||||
result = await Repository._DbQueryable
|
||||
.LeftJoin<WarehouseEntity>((stock, warehouse) => stock.WarehouseId == warehouse.Id)
|
||||
.LeftJoin<MaterialEntity>((stock, warehouse, material) => stock.MaterialId == material.Id)
|
||||
.Select((stock, warehouse, material) => new StockGetListOutput
|
||||
{
|
||||
MaterialName = material.Name,
|
||||
WarehouseName = warehouse.Name,
|
||||
UnitName = material.UnitName
|
||||
}, true).FirstAsync();
|
||||
|
||||
//还需要进行入库明细的插入
|
||||
StockDetailsEntity stockDetailsEntity = new();
|
||||
stockDetailsEntity.StockId = result.Id;
|
||||
stockDetailsEntity.WarehouseId = input.WarehouseId;
|
||||
stockDetailsEntity.MaterialId = input.MaterialId;
|
||||
stockDetailsEntity.WarehouseName = result.WarehouseName;
|
||||
stockDetailsEntity.MaterialName = result.MaterialName;
|
||||
stockDetailsEntity.StockDetailsTime = DateTime.Now;
|
||||
stockDetailsEntity.Quality = input.Quality;
|
||||
stockDetailsEntity.Number = input.Number;
|
||||
stockDetailsEntity.StockDetailsType = StockDetailsTypeEnum.Input;
|
||||
|
||||
await _detailsRepository.InsertReturnSnowflakeIdAsync(stockDetailsEntity);
|
||||
|
||||
uow.Commit();
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库操作,需要工作单元事务操作
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<StockGetListOutput> OutputStockAsync(StockCreateUpdateInput input)
|
||||
{
|
||||
StockGetListOutput result = new();
|
||||
using (var uow = _unitOfWork.CreateContext())
|
||||
{
|
||||
var entity = await Repository.GetByIdAsync(input.Id);
|
||||
|
||||
if (entity is null)
|
||||
{
|
||||
throw new ApplicationException("出库失败,该库存不存在");
|
||||
}
|
||||
|
||||
|
||||
//先判断是否存在该物料,如果存在,直接减去数量,如果减完数量=0,直接删除该条数据,如果小于零,库存不足
|
||||
var entityData = await Repository.GetFirstAsync(u => u.MaterialId == entity.MaterialId);
|
||||
if (entityData is not null)
|
||||
{
|
||||
entityData.Number -= input.Number;
|
||||
|
||||
if (entityData.Number < 0)
|
||||
{
|
||||
throw new UserFriendlyException("库存不足");
|
||||
}
|
||||
else if (entityData.Number == 0)
|
||||
{
|
||||
await Repository.DeleteAsync(u => u.MaterialId == input.MaterialId);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Repository.UpdateIgnoreNullAsync(entityData);
|
||||
}
|
||||
|
||||
}
|
||||
//不存在该物料
|
||||
else
|
||||
{
|
||||
throw new UserFriendlyException("库存未发现该物料");
|
||||
}
|
||||
result = await Repository._DbQueryable
|
||||
.LeftJoin<WarehouseEntity>((stock, warehouse) => stock.WarehouseId == warehouse.Id)
|
||||
.LeftJoin<MaterialEntity>((stock, warehouse, material) => stock.MaterialId == material.Id)
|
||||
.Select((stock, warehouse, material) => new StockGetListOutput
|
||||
{
|
||||
MaterialName = material.Name,
|
||||
WarehouseName = warehouse.Name,
|
||||
UnitName = material.UnitName
|
||||
}, true).FirstAsync();
|
||||
|
||||
//还需要进行入库明细的插入
|
||||
StockDetailsEntity stockDetailsEntity = new();
|
||||
stockDetailsEntity.StockId = result.Id;
|
||||
stockDetailsEntity.WarehouseId = input.WarehouseId;
|
||||
stockDetailsEntity.MaterialId = input.MaterialId;
|
||||
stockDetailsEntity.WarehouseName = result.WarehouseName;
|
||||
stockDetailsEntity.MaterialName = result.MaterialName;
|
||||
stockDetailsEntity.StockDetailsTime = DateTime.Now;
|
||||
stockDetailsEntity.Quality = input.Quality;
|
||||
stockDetailsEntity.Number = input.Number;
|
||||
stockDetailsEntity.StockDetailsType = StockDetailsTypeEnum.Output;
|
||||
await _detailsRepository.InsertReturnSnowflakeIdAsync(stockDetailsEntity);
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using AutoMapper;
|
||||
using AutoMapper;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class SupplierService : CrudAppService<SupplierEntity, SupplierGetListOutput, long, SupplierCreateUpdateInput>, ISupplierService
|
||||
{
|
||||
public async Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page)
|
||||
public async Task<PageModel<List<SupplierGetListOutput>>> PageListAsync(SupplierGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class UnitService : CrudAppService<UnitEntity, UnitGetListOutput, long, UnitCreateUpdateInput>, IUnitService
|
||||
{
|
||||
public async Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitCreateUpdateInput input, PageParModel page)
|
||||
public async Task<PageModel<List<UnitGetListOutput>>> PageListAsync(UnitGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Service.ERP
|
||||
{
|
||||
public class WarehouseService : CrudAppService<WarehouseEntity, WarehouseGetListOutput, long, WarehouseCreateUpdateInput>, IWarehouseService
|
||||
{
|
||||
public async Task<PageModel<List<WarehouseGetListOutput>>> PageListAsync(WarehouseCreateUpdateInput input, PageParModel page)
|
||||
public async Task<PageModel<List<WarehouseGetListOutput>>> PageListAsync(WarehouseGetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Attribute;
|
||||
using Yi.Framework.Common.Models;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Interface.RABC;
|
||||
@@ -15,6 +16,8 @@ namespace Yi.Framework.Service.RABC
|
||||
public ConfigService(IRepository<ConfigEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
[Caching(AbsoluteExpiration = 10)]
|
||||
public async Task<PageModel<List<ConfigEntity>>> SelctPageList(ConfigEntity config, PageParModel page)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers.#ModelName#
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<Result> PageList([FromQuery] #EntityName#CreateUpdateInput input, [FromQuery] PageParModel page)
|
||||
public async Task<Result> PageList([FromQuery] #EntityName#GetListInput input, [FromQuery] PageParModel page)
|
||||
{
|
||||
var result = await _#LowerEntityName#Service.PageListAsync(input, page);
|
||||
return Result.Success().SetData(result);
|
||||
|
||||
@@ -11,6 +11,6 @@ namespace Yi.Framework.Interface.#ModelName#
|
||||
{
|
||||
public interface I#EntityName#Service : ICrudAppService<#EntityName#GetListOutput, long, #EntityName#CreateUpdateInput>
|
||||
{
|
||||
Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#CreateUpdateInput input, PageParModel page);
|
||||
Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#GetListInput input, PageParModel page);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Yi.Framework.Service.#ModelName#
|
||||
{
|
||||
public class #EntityName#Service : CrudAppService<#EntityName#Entity, #EntityName#GetListOutput, long, #EntityName#CreateUpdateInput>, I#EntityName#Service
|
||||
{
|
||||
public async Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#CreateUpdateInput input, PageParModel page)
|
||||
public async Task<PageModel<List<#EntityName#GetListOutput>>> PageListAsync(#EntityName#GetListInput input, PageParModel page)
|
||||
{
|
||||
RefAsync<int> totalNumber = 0;
|
||||
var data = await Repository._DbQueryable
|
||||
|
||||
@@ -92,6 +92,10 @@ namespace Yi.Framework.WebCore.AspNetCoreExtensions
|
||||
{
|
||||
//entityInfo.SetValue(new Guid(httpcontext.Request.Headers["TenantId"].ToString()));
|
||||
}
|
||||
if (entityInfo.PropertyName == "CreateTime")
|
||||
{
|
||||
entityInfo.SetValue(DateTime.Now);
|
||||
}
|
||||
break;
|
||||
case DataFilterType.UpdateByObject:
|
||||
if (entityInfo.PropertyName == "ModifyTime")
|
||||
|
||||
@@ -12,11 +12,13 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Common.Abstract;
|
||||
using Yi.Framework.Core.Cache.Aop;
|
||||
using Yi.Framework.Interface;
|
||||
using Yi.Framework.Job;
|
||||
using Yi.Framework.Repository;
|
||||
using Yi.Framework.Service;
|
||||
using Yi.Framework.WebCore.AutoFacExtend;
|
||||
using Yi.Framework.WebCore.CommonExtend;
|
||||
using Yi.Framework.WebCore.Impl;
|
||||
using Module = Autofac.Module;
|
||||
|
||||
@@ -43,14 +45,36 @@ namespace Yi.Framework.WebCore.AutoFacExtend
|
||||
|
||||
containerBuilder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>().SingleInstance();
|
||||
|
||||
var cacheType = new List<Type>();
|
||||
|
||||
//containerBuilder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>)).InstancePerLifetimeScope();
|
||||
//containerBuilder.RegisterGeneric(typeof(BaseService<>)).As(typeof(IBaseService<>)).InstancePerLifetimeScope();
|
||||
///反射注入服务层及接口层
|
||||
var assemblysServices = GetDll("Yi.Framework.Service.dll");
|
||||
containerBuilder.RegisterAssemblyTypes(assemblysServices).PropertiesAutowired(new AutowiredPropertySelector())
|
||||
.AsImplementedInterfaces()
|
||||
.InstancePerLifetimeScope()
|
||||
.EnableInterfaceInterceptors();
|
||||
var regContainerBuilder = containerBuilder.RegisterAssemblyTypes(assemblysServices).PropertiesAutowired(new AutowiredPropertySelector())
|
||||
.AsImplementedInterfaces()
|
||||
.InstancePerLifetimeScope()
|
||||
.EnableInterfaceInterceptors();
|
||||
|
||||
if (Appsettings.appBool("CacheAOP_Enabled"))
|
||||
{
|
||||
var cacheSelect = Appsettings.app("CacheSelect");
|
||||
|
||||
switch (cacheSelect)
|
||||
{
|
||||
case "Redis":
|
||||
containerBuilder.RegisterType<RedisCacheAOP>();
|
||||
cacheType.Add(typeof(RedisCacheAOP));
|
||||
break;
|
||||
case "MemoryCache":
|
||||
containerBuilder.RegisterType<MemoryCacheAOP>();
|
||||
cacheType.Add(typeof(MemoryCacheAOP));
|
||||
break;
|
||||
default: throw new ArgumentException("CacheSelect配置填的是什么东西?俺不认得");
|
||||
}
|
||||
regContainerBuilder.InterceptedBy(cacheType.ToArray());
|
||||
}
|
||||
|
||||
//开启工作单元拦截
|
||||
//.InterceptedBy(typeof(UnitOfWorkInterceptor));
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using Ubiety.Dns.Core.Common;
|
||||
|
||||
namespace Yi.Framework.WebCore.CommonExtend
|
||||
{
|
||||
|
||||
45
Yi.Vue3.X.RuoYi/src/api/bbs/articleApi.js
Normal file
45
Yi.Vue3.X.RuoYi/src/api/bbs/articleApi.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/article/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/article/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/article/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(data) {
|
||||
return request({
|
||||
url: '/article/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/article/delList',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
45
Yi.Vue3.X.RuoYi/src/api/erp/materialApi.js
Normal file
45
Yi.Vue3.X.RuoYi/src/api/erp/materialApi.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/material/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/material/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/material/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/material/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/material/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
45
Yi.Vue3.X.RuoYi/src/api/erp/purchaseApi.js
Normal file
45
Yi.Vue3.X.RuoYi/src/api/erp/purchaseApi.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/purchase/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/purchase/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/purchase/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/purchase/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/purchase/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
51
Yi.Vue3.X.RuoYi/src/api/erp/purchaseDetailsApi.js
Normal file
51
Yi.Vue3.X.RuoYi/src/api/erp/purchaseDetailsApi.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import request from '@/utils/request'
|
||||
export function getListByPurchaseId(id){
|
||||
return request({
|
||||
url: `/purchaseDetails/getListByPurchaseId/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/purchaseDetails/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/purchaseDetails/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/purchaseDetails/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/purchaseDetails/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/purchaseDetails/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
45
Yi.Vue3.X.RuoYi/src/api/erp/stockDetailsApi.js
Normal file
45
Yi.Vue3.X.RuoYi/src/api/erp/stockDetailsApi.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/stockDetails/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/stockDetails/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/stockDetails/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/stockDetails/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/stockDetails/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
53
Yi.Vue3.X.RuoYi/src/api/erp/supplierApi.js
Normal file
53
Yi.Vue3.X.RuoYi/src/api/erp/supplierApi.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 全查询
|
||||
export function allData() {
|
||||
return request({
|
||||
url: '/supplier/getList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/supplier/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/supplier/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/supplier/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/supplier/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/supplier/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
53
Yi.Vue3.X.RuoYi/src/api/erp/unitApi.js
Normal file
53
Yi.Vue3.X.RuoYi/src/api/erp/unitApi.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 全查询
|
||||
export function allData() {
|
||||
return request({
|
||||
url: '/unit/getList',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/unit/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/unit/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/unit/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/unit/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/unit/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
45
Yi.Vue3.X.RuoYi/src/api/erp/warehouseApi.js
Normal file
45
Yi.Vue3.X.RuoYi/src/api/erp/warehouseApi.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 分页查询
|
||||
export function listData(query) {
|
||||
return request({
|
||||
url: '/warehouse/pageList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// id查询
|
||||
export function getData(code) {
|
||||
return request({
|
||||
url: '/warehouse/getById/' + code,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增
|
||||
export function addData(data) {
|
||||
return request({
|
||||
url: '/warehouse/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改
|
||||
export function updateData(id,data) {
|
||||
return request({
|
||||
url: `/warehouse/update/${id}`,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除
|
||||
export function delData(code) {
|
||||
return request({
|
||||
url: '/warehouse/del',
|
||||
method: 'delete',
|
||||
data:"string"==typeof(code)?[code]:code
|
||||
})
|
||||
}
|
||||
11
Yi.Vue3.X.RuoYi/src/api/file.js
Normal file
11
Yi.Vue3.X.RuoYi/src/api/file.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function
|
||||
upload(type,data){
|
||||
return request({
|
||||
url: `/file/upload/${type}`,
|
||||
headers:{"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"},
|
||||
method: 'POST',
|
||||
data:data
|
||||
});
|
||||
}
|
||||
402
Yi.Vue3.X.RuoYi/src/views/ERP/material/index.vue
Normal file
402
Yi.Vue3.X.RuoYi/src/views/ERP/material/index.vue
Normal file
@@ -0,0 +1,402 @@
|
||||
<template>
|
||||
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="物料名称" prop="name" >
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入物料名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="name"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编号" prop="code" >
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入物料编号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="code"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-select
|
||||
v-model="queryParams.isDeleted"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="创建时间" style="width: 308px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['erp:material:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['erp:material:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['erp:material:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['erp:material:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<!-----------------------这里开始就是数据表单的全部列------------------------>
|
||||
<el-table-column label="物料编号" align="center" prop="code" />
|
||||
|
||||
<el-table-column label="物料名称" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="单位" align="center" prop="unitName" :show-overflow-tooltip="true">
|
||||
<template #default="scope">
|
||||
<el-tag>{{ scope.row.unitName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
|
||||
<!-- <el-table-column label="状态" align="center" prop="isDeleted">
|
||||
<template #default="scope">
|
||||
<dict-tag
|
||||
:options="sys_normal_disable"
|
||||
:value="scope.row.isDeleted"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:article:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['business:article:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- ---------------------这里是新增和更新的对话框--------------------- -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="dataRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="物料编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物料名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物料单位" prop="unitName">
|
||||
<el-select v-model="form.unitName" filterable placeholder="请选择单位">
|
||||
<el-option
|
||||
v-for="item in unitList"
|
||||
:key="item.name"
|
||||
:label="item.name"
|
||||
:value="item.name"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-radio-group v-model="form.isDeleted">
|
||||
<el-radio
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="JSON.parse(dict.value)"
|
||||
>{{ dict.label }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
listData,
|
||||
getData,
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/erp/materialApi";
|
||||
|
||||
import {
|
||||
allData as allUnitData,
|
||||
} from "@/api/erp/unitApi";
|
||||
import { ref } from "@vue/reactivity";
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const unitList=ref([]);
|
||||
const dataList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
code: undefined
|
||||
},
|
||||
rules: {
|
||||
code: [{ required: true, message: "物料编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "物料名称不能为空", trigger: "blur" }],
|
||||
unitName: [{ required: true, message: "物料单位不能为空", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listData(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||
(response) => {
|
||||
dataList.value = response.data.data;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
/**查询全部单位列表*/
|
||||
function getUnitList() {
|
||||
allUnitData().then(
|
||||
(response) => {
|
||||
unitList.value = response.data;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: undefined,
|
||||
isDeleted: false,
|
||||
remark: undefined,
|
||||
};
|
||||
proxy.resetForm("dataRef");
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
const queryRef=ref(null);
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加物料";
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const id = row.id || ids.value;
|
||||
getData(id).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改物料";
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["dataRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
updateData(form.value.id,form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addData(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const delIds = row.id || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除编号为"' + delIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delData(delIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {}
|
||||
|
||||
getList();
|
||||
getUnitList();
|
||||
</script>
|
||||
775
Yi.Vue3.X.RuoYi/src/views/ERP/purchase/index.vue
Normal file
775
Yi.Vue3.X.RuoYi/src/views/ERP/purchase/index.vue
Normal file
@@ -0,0 +1,775 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="供应商名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入供应商名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="name"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="采购单编号" prop="code">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入采购单编号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="code"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="采购员" prop="buyer">
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入采购员"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="buyer"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-select
|
||||
v-model="queryParams.isDeleted"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="创建时间" style="width: 308px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['erp:purchase:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['erp:purchase:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['erp:purchase:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['erp:purchase:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<!-----------------------这里开始就是数据表单的全部列------------------------>
|
||||
<el-table-column label="采购单号" align="center" prop="code" />
|
||||
|
||||
<el-table-column
|
||||
label="供应商"
|
||||
align="center"
|
||||
prop="supplierName"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="需求时间"
|
||||
align="center"
|
||||
prop="needTime"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="采购员"
|
||||
align="center"
|
||||
prop="buyer"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="总共金额"
|
||||
align="center"
|
||||
prop="totalMoney"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="已支付金额"
|
||||
align="center"
|
||||
prop="paidMoney"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<el-table-column
|
||||
label="采购状态"
|
||||
align="center"
|
||||
prop="purchaseState"
|
||||
:show-overflow-tooltip="true"
|
||||
>
|
||||
|
||||
<template #default="scope">
|
||||
<el-tag>{{purchaseStateComputed(scope.row.purchaseState)}}</el-tag>
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remarks"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<!-- <el-table-column label="状态" align="center" prop="isDeleted">
|
||||
<template #default="scope">
|
||||
<dict-tag
|
||||
:options="sys_normal_disable"
|
||||
:value="scope.row.isDeleted"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleGet(scope.row)"
|
||||
v-hasPermi="['erp:purchase:edit']"
|
||||
>查看</el-button
|
||||
>
|
||||
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['erp:purchase:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['erp:purchase:remove']"
|
||||
>结束</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['erp:purchase:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- ---------------------这里是新增和更新的对话框--------------------- -->
|
||||
<el-dialog :title="title" v-model="open" width="1200px" append-to-body>
|
||||
<el-form ref="dataRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="采购单编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入采购单编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="供应商" prop="supplierName">
|
||||
<el-select
|
||||
v-model="form.supplierId"
|
||||
filterable
|
||||
placeholder="请选择供应商"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in supplierList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="采购单员" prop="buyer">
|
||||
<el-input v-model="form.buyer" placeholder="请输入采购单员" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="需求时间" prop="needTime">
|
||||
<el-date-picker
|
||||
v-model="form.needTime"
|
||||
type="date"
|
||||
placeholder="选择一个日期"
|
||||
size="default"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :offset="8" :span="8">
|
||||
<el-form-item label="总金额">
|
||||
{{ showTotalMoney }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="物料信息">
|
||||
<el-table :data="form.purchaseDetails" border style="width: 100%">
|
||||
<el-table-column width="90">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
@click="delMaterialRow(scope.$index)"
|
||||
icon="Delete"
|
||||
type="danger"
|
||||
size="small"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="序号" width="60" />
|
||||
<el-table-column prop="materialName" label="物料" width="180" />
|
||||
<el-table-column prop="materialUnit" label="单位" width="180" />
|
||||
<el-table-column prop="unitPrice" label="单价" width="180">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.unitPrice" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="totalNumber"
|
||||
label="采购数量"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.totalNumber" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remarks" label="备注">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.remarks" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-button
|
||||
class="form-add-btn"
|
||||
type="primary"
|
||||
icon="CirclePlus"
|
||||
plain
|
||||
@click="materialHandleAdd"
|
||||
>添加物料</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
:rows="5"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- ---------------------这里是新增物料的对话框--------------------- -->
|
||||
<el-dialog
|
||||
title="添加物料"
|
||||
v-model="openMaterial"
|
||||
width="800px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
:model="queryMaterialParams"
|
||||
ref="queryMaterialRef"
|
||||
:inline="true"
|
||||
label-width="70px"
|
||||
>
|
||||
<el-form-item label="物料名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryMaterialParams.name"
|
||||
placeholder="请输入物料名称"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
@keyup.enter="handleMaterialQuery"
|
||||
prop="name"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="code">
|
||||
<el-input
|
||||
v-model="queryMaterialParams.code"
|
||||
placeholder="请输入物料编码"
|
||||
clearable
|
||||
style="width: 150px"
|
||||
@keyup.enter="handleMaterialQuery"
|
||||
prop="code"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleMaterialQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetMaterialQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
<!-- 物料表单 -->
|
||||
<el-table
|
||||
style="width: 100%"
|
||||
:data="materialList"
|
||||
@selection-change="materialHandleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column property="code" label="物料编码" />
|
||||
<el-table-column property="name" label="物料信息" />
|
||||
<el-table-column property="unitName" label="物料单位" />
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="materialTotal > 0"
|
||||
:total="materialTotal"
|
||||
v-model:page="queryMaterialParams.pageNum"
|
||||
v-model:limit="queryMaterialParams.pageSize"
|
||||
@pagination="getMaterialList"
|
||||
/>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitMaterialForm"
|
||||
>确 定</el-button
|
||||
>
|
||||
<el-button @click="materialCancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- ---------------------这里是采购订单详情对话框--------------------- -->
|
||||
<el-dialog
|
||||
title="订单详情"
|
||||
v-model="openDetails"
|
||||
width="1200px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form
|
||||
ref="dataDetailsRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料" prop="code">
|
||||
<el-input placeholder="请输入物料" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="创建时间" style="width: 308px">
|
||||
<el-date-picker
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search"
|
||||
>查询</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="物料信息">
|
||||
<el-table :data="form.purchaseDetails" border style="width: 100%" >
|
||||
<el-table-column type="index" label="序号" width="60" align="center" />
|
||||
<el-table-column prop="materialName" label="物料" width="180" align="center" />
|
||||
<el-table-column prop="materialUnit" label="单位" width="180" align="center" />
|
||||
<el-table-column prop="unitPrice" label="单价" width="180" align="center">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="totalNumber"
|
||||
label="采购数量"
|
||||
width="180"
|
||||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remarks" label="备注" >
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="订单备注" prop="remarks">
|
||||
{{ form.remarks }}
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
listData,
|
||||
getData,
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/erp/purchaseApi";
|
||||
import { allData as supplierlAllData } from "@/api/erp/supplierApi";
|
||||
import { listData as materialListData } from "@/api/erp/materialApi";
|
||||
import { getListByPurchaseId } from "@/api/erp/purchaseDetailsApi";
|
||||
|
||||
import { ref } from "@vue/reactivity";
|
||||
import { computed } from "@vue/runtime-core";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
//详情物料对话框
|
||||
const openDetails = ref(false);
|
||||
|
||||
//添加物料对话框
|
||||
const openMaterial = ref(false);
|
||||
const materialList = ref([]);
|
||||
const materialTotal = ref(0);
|
||||
const materialMultipleSelection = ref([]);
|
||||
|
||||
//选择框供应商
|
||||
const supplierList = ref([]);
|
||||
|
||||
const dataList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const data = reactive({
|
||||
form: {
|
||||
supplierId: undefined,
|
||||
totalMoney: 0,
|
||||
purchaseDetails: [],
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
buyer: undefined,
|
||||
},
|
||||
queryMaterialParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
},
|
||||
rules: {
|
||||
code: [{ required: true, message: "采购单编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "采购单名称不能为空", trigger: "blur" }],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, queryMaterialParams, rules } = toRefs(data);
|
||||
/** 查询列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listData(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||
(response) => {
|
||||
dataList.value = response.data.data;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
proxy.resetForm("dataRef");
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加采购单";
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const id = row.id || ids.value;
|
||||
getData(id).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改采购单";
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["dataRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
updateData(form.value.id, form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addData(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const delIds = row.id || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除编号为"' + delIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delData(delIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {}
|
||||
|
||||
/** 查看详情 */
|
||||
function handleGet(row) {
|
||||
getListByPurchaseId(row.id).then((response) => {
|
||||
form.value.purchaseDetails = response.data;
|
||||
});
|
||||
form.value.remarks=row.remarks;
|
||||
openDetails.value = true;
|
||||
}
|
||||
|
||||
//-------------这里开始是物料对话框的数据-----------
|
||||
/** 物料查询列表 */
|
||||
function getMaterialList() {
|
||||
materialListData(
|
||||
proxy.addDateRange(queryMaterialParams.value, dateRange.value)
|
||||
).then((response) => {
|
||||
materialList.value = response.data.data;
|
||||
materialTotal.value = response.data.total;
|
||||
});
|
||||
}
|
||||
/** 表单改变选择 */
|
||||
function materialHandleSelectionChange(select) {
|
||||
materialMultipleSelection.value = select;
|
||||
}
|
||||
/** 打开对话框 */
|
||||
function materialHandleAdd() {
|
||||
getMaterialList();
|
||||
openMaterial.value = true;
|
||||
}
|
||||
/** 搜索 */
|
||||
function handleMaterialQuery() {
|
||||
getMaterialList();
|
||||
}
|
||||
/**重置表单 */
|
||||
function resetMaterialQuery() {
|
||||
proxy.resetForm("queryMaterialRef");
|
||||
handleMaterialQuery();
|
||||
}
|
||||
/** 提交物料表单 */
|
||||
function submitMaterialForm() {
|
||||
if (materialMultipleSelection.value.length > 0) {
|
||||
const purchaseDetailsList = materialMultipleSelection.value.map((u) => {
|
||||
return { materialName: u.name, materialUnit: u.unitName };
|
||||
});
|
||||
|
||||
form.value.purchaseDetails.push(...purchaseDetailsList);
|
||||
materialCancel();
|
||||
} else {
|
||||
proxy.$modal.msgError("请选择至少一个物料");
|
||||
}
|
||||
}
|
||||
/** 取消对话框 */
|
||||
function materialCancel() {
|
||||
openMaterial.value = false;
|
||||
}
|
||||
|
||||
/** 删除物料行 */
|
||||
function delMaterialRow(index) {
|
||||
form.value.purchaseDetails.splice(index, 1);
|
||||
}
|
||||
// watch(data.form, (newValue, oldValue) => {
|
||||
// console.log(newValue.purchaseDetails,999)
|
||||
// }
|
||||
// , { immdiate: true })
|
||||
/** 计算属性:实时计算展示的价格 */
|
||||
const showTotalMoney = computed(() => {
|
||||
let res = 0;
|
||||
form.value.purchaseDetails.forEach((details) => {
|
||||
if (details.unitPrice != undefined && details.totalNumber != undefined) {
|
||||
res += details.unitPrice * details.totalNumber;
|
||||
}
|
||||
});
|
||||
return res;
|
||||
});
|
||||
|
||||
const purchaseStateEnum=[
|
||||
|
||||
{key:"build",name:"新建"},
|
||||
{key:"run",name:"进行中"},
|
||||
{key:"complete",name:"已完成"},
|
||||
{key:"end",name:"已结束"},
|
||||
]
|
||||
/** 计算属性:采购订单状态 */
|
||||
const purchaseStateComputed= computed(()=>
|
||||
(purchaseState) => {
|
||||
return purchaseStateEnum[purchaseState].name
|
||||
});
|
||||
//-------------这里开始是供货商的数据-----------
|
||||
/** 供货商查询列表 */
|
||||
function getSupplierList() {
|
||||
supplierlAllData().then((response) => {
|
||||
supplierList.value = response.data;
|
||||
});
|
||||
}
|
||||
getList();
|
||||
getSupplierList();
|
||||
</script>
|
||||
<style scoped>
|
||||
.form-add-btn {
|
||||
width: 100%;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
363
Yi.Vue3.X.RuoYi/src/views/ERP/stock/index.vue
Normal file
363
Yi.Vue3.X.RuoYi/src/views/ERP/stock/index.vue
Normal file
@@ -0,0 +1,363 @@
|
||||
<template>
|
||||
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="库存名称" prop="name" >
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入库存名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="name"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="库存编号" prop="code" >
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入库存编号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="code"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-select
|
||||
v-model="queryParams.isDeleted"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="创建时间" style="width: 308px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['erp:stock:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['erp:stock:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['erp:stock:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['erp:stock:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<!-----------------------这里开始就是数据表单的全部列------------------------>
|
||||
<el-table-column label="库存编号" align="center" prop="code" />
|
||||
|
||||
<el-table-column label="库存名称" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
|
||||
<!-- <el-table-column label="状态" align="center" prop="isDeleted">
|
||||
<template #default="scope">
|
||||
<dict-tag
|
||||
:options="sys_normal_disable"
|
||||
:value="scope.row.isDeleted"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:article:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['business:article:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- ---------------------这里是新增和更新的对话框--------------------- -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="dataRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="库存编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入库存编码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="库存名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入库存名称" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-radio-group v-model="form.isDeleted">
|
||||
<el-radio
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="JSON.parse(dict.value)"
|
||||
>{{ dict.label }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
listData,
|
||||
getData,
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/erp/stockApi";
|
||||
import { ref } from "@vue/reactivity";
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const dataList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
},
|
||||
rules: {
|
||||
code: [{ required: true, message: "库存编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "库存名称不能为空", trigger: "blur" }],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listData(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||
(response) => {
|
||||
dataList.value = response.data.data;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
proxy.resetForm("dataRef");
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加库存";
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const id = row.id || ids.value;
|
||||
getData(id).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改库存";
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["dataRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
updateData(form.value.id,form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addData(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const delIds = row.id || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除编号为"' + delIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delData(delIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
390
Yi.Vue3.X.RuoYi/src/views/ERP/supplier/index.vue
Normal file
390
Yi.Vue3.X.RuoYi/src/views/ERP/supplier/index.vue
Normal file
@@ -0,0 +1,390 @@
|
||||
<template>
|
||||
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryRef"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="供应商名称" prop="name" >
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入供应商名称"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="name"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="供应商编号" prop="code" >
|
||||
<el-input
|
||||
v-model="queryParams.code"
|
||||
placeholder="请输入供应商编号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
prop="code"
|
||||
/>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-select
|
||||
v-model="queryParams.isDeleted"
|
||||
placeholder="状态"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="创建时间" style="width: 308px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
></el-date-picker>
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery"
|
||||
>搜索</el-button
|
||||
>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['erp:supplier:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['erp:supplier:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['erp:supplier:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['erp:supplier:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
v-model:showSearch="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="dataList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
|
||||
<!-----------------------这里开始就是数据表单的全部列------------------------>
|
||||
<el-table-column label="供应商编号" align="center" prop="code" />
|
||||
|
||||
<el-table-column label="供应商名称" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="详细地址" align="center" prop="address" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="联系人" align="center" prop="name" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="联系电话" align="center" prop="phone" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="传真" align="center" prop="fax" :show-overflow-tooltip="true"/>
|
||||
|
||||
<el-table-column label="邮箱" align="center" prop="email" :show-overflow-tooltip="true"/>
|
||||
<!-- <el-table-column label="状态" align="center" prop="isDeleted">
|
||||
<template #default="scope">
|
||||
<dict-tag
|
||||
:options="sys_normal_disable"
|
||||
:value="scope.row.isDeleted"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column
|
||||
label="备注"
|
||||
align="center"
|
||||
prop="remark"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="180"
|
||||
>
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column
|
||||
label="操作"
|
||||
align="center"
|
||||
class-name="small-padding fixed-width"
|
||||
>
|
||||
<template #default="scope">
|
||||
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['business:article:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['business:article:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- ---------------------这里是新增和更新的对话框--------------------- -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="dataRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="供应商编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入供应商编码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="供应商名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入供应商名称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="供应商编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入供应商编码" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入联系电话" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="传真" prop="fax">
|
||||
<el-input v-model="form.fax" placeholder="请输入传真" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model="form.email" placeholder="请输入邮箱" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="状态" prop="isDeleted">
|
||||
<el-radio-group v-model="form.isDeleted">
|
||||
<el-radio
|
||||
v-for="dict in sys_normal_disable"
|
||||
:key="dict.value"
|
||||
:label="JSON.parse(dict.value)"
|
||||
>{{ dict.label }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remarks">
|
||||
<el-input
|
||||
v-model="form.remarks"
|
||||
type="textarea"
|
||||
placeholder="请输入内容"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
listData,
|
||||
getData,
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/erp/supplierApi";
|
||||
import { ref } from "@vue/reactivity";
|
||||
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
const dataList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const dateRange = ref([]);
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
},
|
||||
rules: {
|
||||
code: [{ required: true, message: "供应商编号不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "供应商名称不能为空", trigger: "blur" }],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listData(proxy.addDateRange(queryParams.value, dateRange.value)).then(
|
||||
(response) => {
|
||||
dataList.value = response.data.data;
|
||||
total.value = response.data.total;
|
||||
loading.value = false;
|
||||
}
|
||||
);
|
||||
}
|
||||
/** 取消按钮 */
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
/** 表单重置 */
|
||||
function reset() {
|
||||
proxy.resetForm("dataRef");
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
dateRange.value = [];
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加供应商";
|
||||
}
|
||||
/** 多选框选中数据 */
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const id = row.id || ids.value;
|
||||
getData(id).then((response) => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改供应商";
|
||||
});
|
||||
}
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["dataRef"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (form.value.id != undefined) {
|
||||
updateData(form.value.id,form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addData(form.value).then((response) => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const delIds = row.id || ids.value;
|
||||
proxy.$modal
|
||||
.confirm('是否确认删除编号为"' + delIds + '"的数据项?')
|
||||
.then(function () {
|
||||
return delData(delIds);
|
||||
})
|
||||
.then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user