From 27ca37776237b61513568ac8725594f29893f1f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Sun, 8 Jan 2023 21:52:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BA=93=E5=AD=98=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=EF=BC=8C=E5=85=A5=E5=BA=93=E3=80=81=E5=87=BA=E5=BA=93?=
=?UTF-8?q?=EF=BC=8C=E6=94=B6=E6=AC=BE=E3=80=81=E5=9B=9E=E6=AC=BE=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Config/SwaggerDoc.xml | 55 +++
.../Controllers/ERP/PurchaseController.cs | 20 +
.../Controllers/ERP/StockController.cs | 66 ++++
.../Controllers/ERP/StockDetailsController.cs | 55 +++
.../yi-sqlsugar-dev.db | Bin 286720 -> 303104 bytes
.../ERP/Purchase/CollectionInput.cs | 25 ++
.../ERP/Purchase/ReceiptInput.cs | 33 ++
.../ERP/Stock/ConstConfig/StockConst.cs | 12 +
.../ERP/Stock/MapperConfig/StockProfile.cs | 20 +
.../ERP/Stock/StockCreateUpdateInput.cs | 18 +
.../ERP/Stock/StockGetListInput.cs | 16 +
.../ERP/Stock/StockGetListOutput.cs | 18 +
.../ConstConfig/StockDetailsConst.cs | 12 +
.../MapperConfig/StockDetailsProfile.cs | 20 +
.../StockDetailsCreateUpdateInput.cs | 20 +
.../StockDetails/StockDetailsGetListInput.cs | 18 +
.../StockDetails/StockDetailsGetListOutput.cs | 20 +
.../ERP/IStockDetailsService.cs | 16 +
.../ERP/IStockService.cs | 30 ++
.../ERP/Entitys/StockDetailsEntity.cs | 81 ++++
.../ERP/Entitys/StockEntity.cs | 50 +++
.../Crud/AbstractKeyReadOnlyAppService.cs | 4 +-
.../ERP/StockDetailsService.cs | 29 ++
.../Yi.Framework.Service/ERP/StockService.cs | 188 +++++++++
.../Yi.Framework.Template/Program.cs | 16 +-
Yi.Vue3.x.RuoYi/src/api/erp/stockApi.js | 45 +++
.../src/api/erp/stockDetailsApi.js | 45 +++
Yi.Vue3.x.RuoYi/src/views/erp/stock/index.vue | 363 ++++++++++++++++++
28 files changed, 1285 insertions(+), 10 deletions(-)
create mode 100644 Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockController.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockDetailsController.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/CollectionInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/ReceiptInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/ConstConfig/StockConst.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/MapperConfig/StockProfile.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockCreateUpdateInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListOutput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/ConstConfig/StockDetailsConst.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/MapperConfig/StockDetailsProfile.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsCreateUpdateInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListInput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListOutput.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockDetailsService.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockService.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockDetailsEntity.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockEntity.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Service/ERP/StockDetailsService.cs
create mode 100644 Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs
create mode 100644 Yi.Vue3.x.RuoYi/src/api/erp/stockApi.js
create mode 100644 Yi.Vue3.x.RuoYi/src/api/erp/stockDetailsApi.js
create mode 100644 Yi.Vue3.x.RuoYi/src/views/erp/stock/index.vue
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
index 8651f6b6..41724383 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml
@@ -249,6 +249,18 @@
+
+
+ 收获
+
+
+
+
+
+ 回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
+
+
+
分页查
@@ -283,6 +295,49 @@
+
+
+ 分页查
+
+
+
+
+
+ 单查
+
+
+
+
+
+ 入库
+
+
+
+
+
+ 出库
+
+
+
+
+
+ 分页查
+
+
+
+
+
+ 单查
+
+
+
+
+
+ 删
+
+
+
+
全查
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs
index 985c356e..efd22208 100644
--- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/PurchaseController.cs
@@ -79,5 +79,25 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP
await _purchaseService.DeleteAsync(ids);
return Result.Success();
}
+
+ ///
+ /// 收获
+ ///
+ ///
+ [HttpPost]
+ public async Task Receipt(ReceiptInput input)
+ {
+ throw new NotImplementedException();
+ }
+
+ ///
+ /// 回款?????甲方主动给乙方钱,乙方给货物。应该不叫回款。。。。想想叫啥优雅的名字
+ ///
+ ///
+ [HttpPost]
+ public async Task Collection(CollectionInput input)
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockController.cs
new file mode 100644
index 00000000..05cfa46f
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockController.cs
@@ -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 _logger;
+ private readonly IStockService _stockService;
+ public StockController(ILogger logger, IStockService stockService)
+ {
+ _logger = logger;
+ _stockService = stockService;
+ }
+
+ ///
+ /// 分页查
+ ///
+ ///
+ [HttpGet]
+ public async Task PageList([FromQuery] StockGetListInput input, [FromQuery] PageParModel page)
+ {
+ var result = await _stockService.PageListAsync(input, page);
+ return Result.Success().SetData(result);
+ }
+
+ ///
+ /// 单查
+ ///
+ ///
+ [HttpGet]
+ [Route("{id}")]
+ public async Task GetById(long id)
+ {
+ var result = await _stockService.GetByIdAsync(id);
+ return Result.Success().SetData(result);
+ }
+
+
+ ///
+ /// 入库
+ ///
+ ///
+ [HttpPost]
+ public async Task InputStock(StockCreateUpdateInput input)
+ {
+ var result = await _stockService.InputStockAsync(input);
+ return Result.Success().SetData(result);
+ }
+
+ ///
+ /// 出库
+ ///
+ ///
+ [HttpPost]
+ public async Task OutputStock(StockCreateUpdateInput input)
+ {
+ var result = await _stockService.OutputStockAsync(input);
+ return Result.Success().SetData(result);
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockDetailsController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockDetailsController.cs
new file mode 100644
index 00000000..1d0d39f2
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/StockDetailsController.cs
@@ -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 _logger;
+ private readonly IStockDetailsService _stockDetailsService;
+ public StockDetailsController(ILogger logger, IStockDetailsService stockDetailsService)
+ {
+ _logger = logger;
+ _stockDetailsService = stockDetailsService;
+ }
+
+ ///
+ /// 分页查
+ ///
+ ///
+ [HttpGet]
+ public async Task PageList([FromQuery] StockDetailsGetListInput input, [FromQuery] PageParModel page)
+ {
+ var result = await _stockDetailsService.PageListAsync(input, page);
+ return Result.Success().SetData(result);
+ }
+
+ ///
+ /// 单查
+ ///
+ ///
+ [HttpGet]
+ [Route("{id}")]
+ public async Task GetById(long id)
+ {
+ var result = await _stockDetailsService.GetByIdAsync(id);
+ return Result.Success().SetData(result);
+ }
+
+ ///
+ /// 删
+ ///
+ ///
+ ///
+ [HttpDelete]
+ public async Task Del(List ids)
+ {
+ await _stockDetailsService.DeleteAsync(ids);
+ return Result.Success();
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db
index 44d722e3cbbbffc4b57ff513c6d7e35a89e0b6f7..61576d3a07c114d2ee89b54dc0bbe4029d727d89 100644
GIT binary patch
delta 918
zcmZvaUr19?9LLW&ciuluLc2^|84-OylNaSo^elk|Qm#SY}Rmhm&_W$Or`*umV`jbTWCANdHKoDGqs5
zpVT927yAY|zzRDH!XO;cY0u)Y2rK0+5r!ZtG~%@yXk=Ucfnb+4z8;W0Rq*~+A$t{Q
zffs1bFrS%4x``PhU(!6WOirR~VnS_9`^v7dPkAKp#lJgk%I1iZ=lQCw#TbwuK-$J>L!*_xhcR+J=1B&IjIMxk$@x*lLlz0rn9Z`y7y41>9NtCHxiG@%k;
Fe*o!m4ru@Y
delta 371
zcmXw!y-UMT6vgkmFE)v35^E_A{h%(^K{VP$h}5dBU37A37b((3bP)UmMT-%ngQAvl
zLFg)og9^ecA`}9cL
z`Vw9i3OnDX_%@kpb@{Ob8mZH2r<_*4S`^vDlJu;X^_=zq?{K4?fdfu8&{iNP%|^(v
zF+v+D)TQmEs4VtUxX46ll-1u8{0RIQ27YW*jJ*1)UMrJo#doX3dDBQ3i_pH%f^0+=a^3J
zEDyE=NY*docDhgQh(_7Yl(;MMK}PBvANXxt(eNC%5m)KW#(V6GQ6T5duB0&d_kY*>
z?=kS@PH!s&E|`x-)tJ%qdO}+xrO0C*`Mz+AywNJ=Ej(x9!p2jiY7(uJ1^)R1a-v_@
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/CollectionInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/CollectionInput.cs
new file mode 100644
index 00000000..fb81c3b8
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/CollectionInput.cs
@@ -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
+{
+ ///
+ /// 回款
+ ///
+ public class CollectionInput
+ {
+ ///
+ /// 采购订单id
+ ///
+ public long PurchaseId { get; set; }
+
+ ///
+ ///回款钱
+ ///
+ public float CollectionMoney { get; set; }
+ }
+
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/ReceiptInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/ReceiptInput.cs
new file mode 100644
index 00000000..c3927de0
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Purchase/ReceiptInput.cs
@@ -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
+{
+ ///
+ /// 收货
+ ///
+ public class ReceiptInput
+ {
+ ///
+ /// 采购订单id
+ ///
+ public long PurchaseId { get; set; }
+
+ }
+
+ public class ReceiptDetails
+ {
+ ///
+ /// 订单子表id
+ ///
+ public long PurchaseDatilesId { get; set; }
+
+ ///
+ /// 收货数量
+ ///
+ public long Number { get; set; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/ConstConfig/StockConst.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/ConstConfig/StockConst.cs
new file mode 100644
index 00000000..6b9402eb
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/ConstConfig/StockConst.cs
@@ -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
+ {
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/MapperConfig/StockProfile.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/MapperConfig/StockProfile.cs
new file mode 100644
index 00000000..5ba0bf58
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/MapperConfig/StockProfile.cs
@@ -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();
+ CreateMap();
+
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockCreateUpdateInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockCreateUpdateInput.cs
new file mode 100644
index 00000000..d4010b5a
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockCreateUpdateInput.cs
@@ -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
+ {
+ public long WarehouseId { get; set; }
+ public long MaterialId { get; set; }
+ public long Number { get; set; }
+ public string? Quality { get; set; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListInput.cs
new file mode 100644
index 00000000..725cfcad
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListInput.cs
@@ -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; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListOutput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListOutput.cs
new file mode 100644
index 00000000..9b62c5bc
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/Stock/StockGetListOutput.cs
@@ -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
+ {
+ 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; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/ConstConfig/StockDetailsConst.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/ConstConfig/StockDetailsConst.cs
new file mode 100644
index 00000000..cbcb436e
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/ConstConfig/StockDetailsConst.cs
@@ -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
+ {
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/MapperConfig/StockDetailsProfile.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/MapperConfig/StockDetailsProfile.cs
new file mode 100644
index 00000000..7c5c6466
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/MapperConfig/StockDetailsProfile.cs
@@ -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();
+ CreateMap();
+
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsCreateUpdateInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsCreateUpdateInput.cs
new file mode 100644
index 00000000..1afd5ce1
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsCreateUpdateInput.cs
@@ -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
+ {
+ 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; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListInput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListInput.cs
new file mode 100644
index 00000000..67e9ba53
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListInput.cs
@@ -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; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListOutput.cs b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListOutput.cs
new file mode 100644
index 00000000..1597a5cf
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.DtoModel/ERP/StockDetails/StockDetailsGetListOutput.cs
@@ -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
+ {
+ 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; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockDetailsService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockDetailsService.cs
new file mode 100644
index 00000000..d5427ed1
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockDetailsService.cs
@@ -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
+ {
+ Task>> PageListAsync(StockDetailsGetListInput input, PageParModel page);
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockService.cs
new file mode 100644
index 00000000..aeee3f19
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/IStockService.cs
@@ -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
+ {
+ Task>> PageListAsync(StockGetListInput input, PageParModel page);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task InputStockAsync(StockCreateUpdateInput input);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ Task OutputStockAsync(StockCreateUpdateInput input);
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockDetailsEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockDetailsEntity.cs
new file mode 100644
index 00000000..fb4a3a9b
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockDetailsEntity.cs
@@ -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
+{
+ ///
+ /// 库存明细,像这种记录型的表,需要进行冗余字段保存历史记录
+ ///
+ [SugarTable("StockDetails")]
+ public class StockDetailsEntity : IEntity, IMultiTenant
+ {
+ ///
+ /// 主键
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(IsPrimaryKey = true)]
+ public long Id { get; set; }
+
+ ///
+ /// 租户id
+ ///
+ public Guid? TenantId { get; set; }
+
+ ///
+ /// 库存id
+ ///
+ public long StockId { get; set; }
+ ///
+ /// 仓库id
+ ///
+ public long WarehouseId { get; set; }
+
+ ///
+ /// 仓库名称
+ ///
+ public string WarehouseName { get; set; } = string.Empty;
+
+ ///
+ /// 物料id
+ ///
+ public long MaterialId { get; set; }
+
+ ///
+ /// 物料名称
+ ///
+ public string MaterialName { get; set; }=string.Empty;
+
+
+ ///
+ /// 数量
+ ///
+ public long Number { get; set; }
+
+ ///
+ /// 品质
+ ///
+ public string? Quality { get; set; }
+
+
+ ///
+ /// 入库或者出库时间
+ ///
+ public DateTime StockDetailsTime { get; set; }
+
+ ///
+ /// 明细类别
+ ///
+ public StockDetailsTypeEnum StockDetailsType { get; set; }
+ }
+ public enum StockDetailsTypeEnum
+ {
+ Input = 0,//入库
+ Output = 1//出库
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockEntity.cs
new file mode 100644
index 00000000..00f97f74
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Model/ERP/Entitys/StockEntity.cs
@@ -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
+{
+ ///
+ /// 库存
+ ///
+ [SugarTable("Stock")]
+ public class StockEntity : IEntity, IMultiTenant
+ {
+ ///
+ /// 主键
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(IsPrimaryKey = true)]
+ public long Id { get; set; }
+
+ ///
+ /// 租户id
+ ///
+ public Guid? TenantId { get; set; }
+
+ ///
+ /// 仓库id
+ ///
+ public long WarehouseId { get; set; }
+
+ ///
+ /// 物料id
+ ///
+ public long MaterialId { get; set; }
+
+ ///
+ /// 数量
+ ///
+ public long Number { get; set; }
+
+ ///
+ /// 品质
+ ///
+ public string? Quality { get; set; }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyReadOnlyAppService.cs b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyReadOnlyAppService.cs
index 852eec53..dab4ae2c 100644
--- a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyReadOnlyAppService.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyReadOnlyAppService.cs
@@ -31,14 +31,14 @@ namespace Yi.Framework.Service.Base.Crud
public IRepository Repository { get; set; }
- public async Task> GetListAsync()
+ public virtual async Task> GetListAsync()
{
var entitys = await Repository.GetListAsync();
var entityDtos = await MapToGetListOutputDtosAsync(entitys);
return entityDtos;
}
- public async Task GetByIdAsync(TKey id)
+ public virtual async Task GetByIdAsync(TKey id)
{
var entity = await GetEntityByIdAsync(id);
if (entity is null)
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockDetailsService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockDetailsService.cs
new file mode 100644
index 00000000..eaa5bfb1
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockDetailsService.cs
@@ -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, IStockDetailsService
+ {
+ public async Task>> PageListAsync(StockDetailsGetListInput input, PageParModel page)
+ {
+ RefAsync 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> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) };
+ }
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs
new file mode 100644
index 00000000..79d62b9f
--- /dev/null
+++ b/Yi.Framework.Net6/Yi.Framework.Service/ERP/StockService.cs
@@ -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, IStockService
+ {
+ private IRepository _detailsRepository;
+ private ISugarUnitOfWork _unitOfWork;
+ public StockService(IRepository detailsRepository, ISugarUnitOfWork unitOfWork)
+ {
+ _detailsRepository = detailsRepository;
+ _unitOfWork = unitOfWork;
+ }
+ public async Task>> PageListAsync(StockGetListInput input, PageParModel page)
+ {
+ RefAsync totalNumber = 0;
+ var data = await Repository._DbQueryable
+ .LeftJoin((stock, warehouse) => stock.WarehouseId == warehouse.Id)
+ .LeftJoin((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> { Total = totalNumber.Value, Data = data };
+ }
+
+ public override async Task GetByIdAsync(long id)
+ {
+ return await Repository._DbQueryable
+ .LeftJoin((stock, warehouse) => stock.WarehouseId == warehouse.Id)
+ .LeftJoin((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);
+ }
+
+
+
+
+
+ ///
+ /// ,ҪԪ
+ ///
+ ///
+ ///
+ public async Task 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((stock, warehouse) => stock.WarehouseId == warehouse.Id)
+ .LeftJoin((stock, warehouse, material) => stock.MaterialId == material.Id)
+ .Select((stock, warehouse, material) => new StockGetListOutput
+ {
+ MaterialName = material.Name,
+ WarehouseName = warehouse.Name,
+ UnitName = material.UnitName
+ }, true).FirstAsync();
+
+ //ҪϸIJ
+ 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;
+ }
+
+ ///
+ /// ,ҪԪ
+ ///
+ ///
+ ///
+ public async Task 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((stock, warehouse) => stock.WarehouseId == warehouse.Id)
+ .LeftJoin((stock, warehouse, material) => stock.MaterialId == material.Id)
+ .Select((stock, warehouse, material) => new StockGetListOutput
+ {
+ MaterialName = material.Name,
+ WarehouseName = warehouse.Name,
+ UnitName = material.UnitName
+ }, true).FirstAsync();
+
+ //ҪϸIJ
+ 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;
+ }
+
+ }
+}
diff --git a/Yi.Framework.Net6/Yi.Framework.Template/Program.cs b/Yi.Framework.Net6/Yi.Framework.Template/Program.cs
index 0006e0ca..156ae451 100644
--- a/Yi.Framework.Net6/Yi.Framework.Template/Program.cs
+++ b/Yi.Framework.Net6/Yi.Framework.Template/Program.cs
@@ -13,15 +13,15 @@ foreach (var entityName in entityNames)
{
templateFactory.CreateTemplateProviders((option) =>
{
- //option.Add(new ServceTemplateProvider(modelName, entityName));
- //option.Add(new IServceTemplateProvider(modelName, entityName));
- //option.Add(new CreateUpdateInputTemplateProvider(modelName, entityName));
- //option.Add(new GetListOutputTemplateProvider(modelName, entityName));
- //option.Add(new GetListInputTemplateProvider(modelName, entityName));
- //option.Add(new ConstTemplateProvider(modelName, entityName));
- //option.Add(new ProfileTemplateProvider(modelName, entityName));
+ option.Add(new ServceTemplateProvider(modelName, entityName));
+ option.Add(new IServceTemplateProvider(modelName, entityName));
+ option.Add(new CreateUpdateInputTemplateProvider(modelName, entityName));
+ option.Add(new GetListOutputTemplateProvider(modelName, entityName));
+ option.Add(new GetListInputTemplateProvider(modelName, entityName));
+ option.Add(new ConstTemplateProvider(modelName, entityName));
+ option.Add(new ProfileTemplateProvider(modelName, entityName));
option.Add(new ControllerTemplateProvider(modelName, entityName));
- //option.Add(new ApiTemplateProvider(modelName, entityName));
+ option.Add(new ApiTemplateProvider(modelName, entityName));
});
//开始构建模板
templateFactory.BuildTemplate();
diff --git a/Yi.Vue3.x.RuoYi/src/api/erp/stockApi.js b/Yi.Vue3.x.RuoYi/src/api/erp/stockApi.js
new file mode 100644
index 00000000..b18394a0
--- /dev/null
+++ b/Yi.Vue3.x.RuoYi/src/api/erp/stockApi.js
@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 分页查询
+export function listData(query) {
+ return request({
+ url: '/stock/pageList',
+ method: 'get',
+ params: query
+ })
+}
+
+// id查询
+export function getData(code) {
+ return request({
+ url: '/stock/getById/' + code,
+ method: 'get'
+ })
+}
+
+// 新增
+export function addData(data) {
+ return request({
+ url: '/stock/create',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改
+export function updateData(id,data) {
+ return request({
+ url: `/stock/update/${id}`,
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除
+export function delData(code) {
+ return request({
+ url: '/stock/del',
+ method: 'delete',
+ data:"string"==typeof(code)?[code]:code
+ })
+}
diff --git a/Yi.Vue3.x.RuoYi/src/api/erp/stockDetailsApi.js b/Yi.Vue3.x.RuoYi/src/api/erp/stockDetailsApi.js
new file mode 100644
index 00000000..cfda0c22
--- /dev/null
+++ b/Yi.Vue3.x.RuoYi/src/api/erp/stockDetailsApi.js
@@ -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
+ })
+}
diff --git a/Yi.Vue3.x.RuoYi/src/views/erp/stock/index.vue b/Yi.Vue3.x.RuoYi/src/views/erp/stock/index.vue
new file mode 100644
index 00000000..70ae29ae
--- /dev/null
+++ b/Yi.Vue3.x.RuoYi/src/views/erp/stock/index.vue
@@ -0,0 +1,363 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file