1.生产管理的crud

This commit is contained in:
syc_zhaoqianyan 2025-06-24 18:26:51 +08:00
parent 7602503cde
commit eee9129bae
12 changed files with 261 additions and 16 deletions

View File

@ -18,5 +18,6 @@ namespace Syc.Basic.Web.WMS.Dto
public double? Length { get; set; } public double? Length { get; set; }
public DateTime? Dom_Time { get; set; } public DateTime? Dom_Time { get; set; }
public DateTime? Exp_Time { get; set; } public DateTime? Exp_Time { get; set; }
public int IsDelete { get; set; }
} }
} }

View File

@ -0,0 +1,23 @@
using Microsoft.AspNetCore.Mvc.Razor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Syc.Basic.Web.WMS.Dto
{
public class ProduceDto
{
public int Id { get; set; }
public string Type { get; set; }
public string Spec { get; set; }
public double Length { get; set; }
public string Lot_No { get; set; }
public string Name { get; set; }
public int? Qty { get; set; }
public DateTime? Exp_Time { get; set; }
public int IfUse { get; set; }
public int IsDelete { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Syc.Basic.Web.WMS.Dto
{
public class ProduceInput:BoxInput
{
}
}

View File

@ -16,5 +16,6 @@ namespace Syc.Basic.Web.WMS.Dto
public double? Length { get; set; } public double? Length { get; set; }
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
public string? Lot_No { get; set; } public string? Lot_No { get; set; }
public int IsDelete { get; set; }
} }
} }

View File

@ -33,6 +33,7 @@ namespace Syc.Basic.Web.WMS.Service
public async Task<PageOutput<BoxDto>> GetBoxList(BoxDto input) public async Task<PageOutput<BoxDto>> GetBoxList(BoxDto input)
{ {
var boxlist = await boxRepository.GetQueryableAsync(); var boxlist = await boxRepository.GetQueryableAsync();
boxlist = boxlist.Where(x => x.IsDelete == 0);
if (input.Name != null) if (input.Name != null)
boxlist = boxlist.Where(x => x.Name.Contains(input.Name)); boxlist = boxlist.Where(x => x.Name.Contains(input.Name));
if (input.Spec != null) if (input.Spec != null)
@ -75,7 +76,8 @@ namespace Syc.Basic.Web.WMS.Service
Lot_No = input.Lot_No, Lot_No = input.Lot_No,
Code = input.Code, Code = input.Code,
Net_Weight = input.Net_Weight, Net_Weight = input.Net_Weight,
Spec = input.Spec Spec = input.Spec,
IsDelete = 0
}; };
await boxRepository.InsertAsync(box); await boxRepository.InsertAsync(box);
} }
@ -98,7 +100,6 @@ namespace Syc.Basic.Web.WMS.Service
box.Qty = input.Qty; box.Qty = input.Qty;
box.Name = input.Name; box.Name = input.Name;
box.Exp_Time = input.Exp_Time; box.Exp_Time = input.Exp_Time;
await boxRepository.UpdateAsync(box); await boxRepository.UpdateAsync(box);
} }
/// <summary> /// <summary>
@ -107,12 +108,13 @@ namespace Syc.Basic.Web.WMS.Service
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task DeleteSilkList(BoxInput input) public async Task DeleteBox(BoxInput input)
{ {
var silk = await boxRepository.FirstOrDefaultAsync(x => x.Id == input.id); var box = await boxRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (silk == null) if (box == null)
throw Oops.Oh("删除失败,数据为空"); throw Oops.Oh("删除失败,数据为空");
await boxRepository.DeleteAsync(silk); box.IsDelete = 1;
await boxRepository.UpdateAsync(box);
} }
/// <summary> /// <summary>
@ -121,12 +123,16 @@ namespace Syc.Basic.Web.WMS.Service
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task DeletesSilkList(BoxInput input) public async Task DeletesBoxs(BoxInput input)
{ {
var silks = await boxRepository.GetListAsync(x => input.ids.Contains(x.Id)); var boxs = await boxRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (silks == null) if (boxs.Count == 0)
throw Oops.Oh("删除失败,数据为空"); throw Oops.Oh("删除失败,数据为空");
await boxRepository.DeleteManyAsync(silks); for(var i = 0; i < boxs.Count; i++)
{
boxs[i].IsDelete = 1;
}
await boxRepository.UpdateManyAsync(boxs);
} }
} }
} }

View File

@ -0,0 +1,133 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Syc.Basic.Web.WMS.Dto;
using Syc.Basic.Web.WMS.Entitys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace Syc.Basic.Web.WMS.Service
{
public class ProduceService:ApiService
{
private readonly IRepository<Produce> produceRepository;
private readonly ILogger<ProduceService> logger;
public ProduceService(IRepository<Produce> produceRepository, ILogger<ProduceService> logger)
{
this.produceRepository = produceRepository;
this.logger = logger;
}
/// <summary>
/// 查询丝锭
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task<PageOutput<ProduceDto>> GetProduceList(ProduceDto input)
{
var list = await produceRepository.GetQueryableAsync();
list = list.Where(x => x.IsDelete == 0);
var data = list.Select(x => new ProduceDto()
{
Spec = x.Spec,
Lot_No = x.Lot_No,
Id = x.Id,
Length = x.Length,
Type = x.Type,
Exp_Time = x.Exp_Time,
IfUse = x.IfUse,
Name = x.Name,
Qty = x.Qty
});
PageOutput<ProduceDto> pageOutput = new PageOutput<ProduceDto>();
pageOutput.Total = list.Count();
pageOutput.Data = data;
return pageOutput;
}
/// <summary>
/// 添加丝锭
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task InsertProduce(ProduceDto input)
{
foreach (var item in await produceRepository.GetListAsync())
{
item.IfUse = 0;
}
var produce = new Produce()
{
Length = input.Length,
Lot_No = input.Lot_No,
Spec = input.Spec,
Type = input.Type,
Qty=input.Qty,
Exp_Time = input.Exp_Time,
IfUse = 1,
Name = input.Name,
IsDelete = 0
};
await produceRepository.InsertAsync(produce);
}
/// <summary>
/// 修改丝锭
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task UpdateProduce(ProduceDto input)
{
var produce = await produceRepository.FirstOrDefaultAsync(x => x.Id == input.Id);
produce.Spec = input.Spec;
produce.Type = input.Type;
produce.Length = input.Length;
produce.Lot_No = input.Lot_No;
produce.Qty = input.Qty;
produce.Exp_Time = input.Exp_Time;
produce.IfUse = input.IfUse;
await produceRepository.UpdateAsync(produce);
}
/// <summary>
/// 删除丝锭
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task DeleteProduce(ProduceInput input)
{
var produce = await produceRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (produce == null)
throw Oops.Oh("删除失败,数据为空");
produce.IsDelete = 1;
await produceRepository.UpdateAsync(produce);
}
/// <summary>
/// 批量删除丝锭
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost]
public async Task DeletesProduces(ProduceInput input)
{
var produces = await produceRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (produces.Count==0)
throw Oops.Oh("删除失败,数据为空");
foreach (var produce in produces)
{
produce.IsDelete = 1;
}
await produceRepository.UpdateManyAsync(produces);
}
}
}

View File

@ -33,6 +33,7 @@ namespace Syc.Basic.Web.WMS.Service
public async Task<PageOutput<SilkDto>> GetSilkList(SilkDto input) public async Task<PageOutput<SilkDto>> GetSilkList(SilkDto input)
{ {
var silklist = await silkRepository.GetQueryableAsync(); var silklist = await silkRepository.GetQueryableAsync();
silklist = silklist.Where(x => x.IsDelete == 0);
if (input.Type != null) if (input.Type != null)
silklist = silklist.Where(x => x.Type.Contains(input.Type)); silklist = silklist.Where(x => x.Type.Contains(input.Type));
@ -69,7 +70,8 @@ namespace Syc.Basic.Web.WMS.Service
Code = input.Code, Code = input.Code,
Net_Weight = input.Net_Weight, Net_Weight = input.Net_Weight,
Spec = input.Spec, Spec = input.Spec,
Type = input.Type Type = input.Type,
IsDelete = 0
}; };
await silkRepository.InsertAsync(silk); await silkRepository.InsertAsync(silk);
} }
@ -103,7 +105,8 @@ namespace Syc.Basic.Web.WMS.Service
var silk = await silkRepository.FirstOrDefaultAsync(x => x.Id == input.id); var silk = await silkRepository.FirstOrDefaultAsync(x => x.Id == input.id);
if (silk == null) if (silk == null)
throw Oops.Oh("删除失败,数据为空"); throw Oops.Oh("删除失败,数据为空");
await silkRepository.DeleteAsync(silk); silk.IsDelete = 1;
await silkRepository.UpdateAsync(silk);
} }
/// <summary> /// <summary>
@ -115,9 +118,13 @@ namespace Syc.Basic.Web.WMS.Service
public async Task DeletesSilks(SilkInput input) public async Task DeletesSilks(SilkInput input)
{ {
var silks = await silkRepository.GetListAsync(x => input.ids.Contains(x.Id)); var silks = await silkRepository.GetListAsync(x => input.ids.Contains(x.Id));
if (silks == null) if (silks.Count == 0)
throw Oops.Oh("删除失败,数据为空"); throw Oops.Oh("删除失败,数据为空");
await silkRepository.DeleteManyAsync(silks); foreach (var silk in silks)
{
silk.IsDelete = 1;
}
await silkRepository.UpdateManyAsync(silks);
} }
} }
} }

View File

@ -57,20 +57,55 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Syc.Basic.Web.WMS.Service.BoxService.DeleteSilkList(Syc.Basic.Web.WMS.Dto.BoxInput)"> <member name="M:Syc.Basic.Web.WMS.Service.BoxService.DeleteBox(Syc.Basic.Web.WMS.Dto.BoxInput)">
<summary> <summary>
删除纸箱 删除纸箱
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Syc.Basic.Web.WMS.Service.BoxService.DeletesSilkList(Syc.Basic.Web.WMS.Dto.BoxInput)"> <member name="M:Syc.Basic.Web.WMS.Service.BoxService.DeletesBoxs(Syc.Basic.Web.WMS.Dto.BoxInput)">
<summary> <summary>
批量删除纸箱 批量删除纸箱
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Syc.Basic.Web.WMS.Service.ProduceService.GetProduceList(Syc.Basic.Web.WMS.Dto.ProduceDto)">
<summary>
查询丝锭
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Syc.Basic.Web.WMS.Service.ProduceService.InsertProduce(Syc.Basic.Web.WMS.Dto.ProduceDto)">
<summary>
添加丝锭
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Syc.Basic.Web.WMS.Service.ProduceService.UpdateProduce(Syc.Basic.Web.WMS.Dto.ProduceDto)">
<summary>
修改丝锭
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Syc.Basic.Web.WMS.Service.ProduceService.DeleteProduce(Syc.Basic.Web.WMS.Dto.ProduceInput)">
<summary>
删除丝锭
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Syc.Basic.Web.WMS.Service.ProduceService.DeletesProduces(Syc.Basic.Web.WMS.Dto.ProduceInput)">
<summary>
批量删除丝锭
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Syc.Basic.Web.WMS.Service.SilkService.GetSilkList(Syc.Basic.Web.WMS.Dto.SilkDto)"> <member name="M:Syc.Basic.Web.WMS.Service.SilkService.GetSilkList(Syc.Basic.Web.WMS.Dto.SilkDto)">
<summary> <summary>
查询丝锭 查询丝锭

View File

@ -20,6 +20,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\share\Seyounth.Auto.Hs.Runtime\Seyounth.Auto.Hs.Runtime.csproj" />
<ProjectReference Include="..\..\share\Seyounth.Auto.Plc\Seyounth.Auto.Plc.csproj" /> <ProjectReference Include="..\..\share\Seyounth.Auto.Plc\Seyounth.Auto.Plc.csproj" />
<ProjectReference Include="..\..\share\Syc.Abp.Caching\Syc.Abp.Caching.csproj" /> <ProjectReference Include="..\..\share\Syc.Abp.Caching\Syc.Abp.Caching.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -18,5 +18,6 @@ namespace Syc.Basic.Web.WMS.Entitys
public double? Length { get; set; } public double? Length { get; set; }
public DateTime? Dom_Time { get; set; } public DateTime? Dom_Time { get; set; }
public DateTime? Exp_Time { get; set; } public DateTime? Exp_Time { get; set; }
public int IsDelete { get; set; }
} }
} }

View File

@ -0,0 +1,23 @@
using Nito.AsyncEx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;
namespace Syc.Basic.Web.WMS.Entitys
{
public class Produce:Entity<int>
{
public string Type { get; set; }
public string Spec { get; set; }
public double Length { get; set; }
public string Lot_No { get; set; }
public string Name { get; set; }
public int? Qty { get; set; }
public DateTime? Exp_Time { get; set; }
public int IfUse { get; set; }
public int IsDelete { get; set; }
}
}

View File

@ -16,5 +16,6 @@ namespace Syc.Basic.Web.WMS.Entitys
public double? Length { get; set; } public double? Length { get; set; }
public DateTime? Date { get; set; } public DateTime? Date { get; set; }
public string? Lot_No { get; set; } public string? Lot_No { get; set; }
public int IsDelete { get; set; }
} }
} }