@@ -915,6 +915,36 @@ | |||
排序 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.FinalMaterialEntity"> | |||
<summary> | |||
成品配方 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.FinalMaterialEntity.MaterialId"> | |||
<summary> | |||
物料Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.FinalMaterialEntity.FinalId"> | |||
<summary> | |||
配方Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.FinalMaterialEntity.Weight"> | |||
<summary> | |||
重量 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.FinalMaterialEntity.Describe"> | |||
<summary> | |||
描述 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.FinalMaterialEntity.ErrorWeight"> | |||
<summary> | |||
误差 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.GroupInfoEntity"> | |||
<summary> | |||
名 称 :分组信息 | |||
@@ -4687,6 +4717,104 @@ | |||
<param name="Id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialDto"> | |||
<summary> | |||
名 称 :配方物料Dto类 | |||
创 建 人 :yangxiao | |||
创建时间 :2023/3/2 16:12:06 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDto.MaterialId"> | |||
<summary> | |||
物料Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDto.FinalId"> | |||
<summary> | |||
成品Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDto.Weight"> | |||
<summary> | |||
重量 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDto.Describe"> | |||
<summary> | |||
描述 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDto.ErrorWeight"> | |||
<summary> | |||
误差 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialAddInput"> | |||
<summary> | |||
增加 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialUpdateInput"> | |||
<summary> | |||
更新 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialUpdateInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialDelInput"> | |||
<summary> | |||
删除 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialDelInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialQueryInput"> | |||
<summary> | |||
不分页 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialQueryInput.FinalId"> | |||
<summary> | |||
配方Id | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialQueryPageInput"> | |||
<summary> | |||
分页 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialOutput"> | |||
<summary> | |||
输出 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialOutput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialOutput.RecipesName"> | |||
<summary> | |||
配方名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialOutput.MaterialName"> | |||
<summary> | |||
物料名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Services.FinalMaterialOutput.MaterialCode"> | |||
<summary> | |||
物料编码 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalsInfoDto"> | |||
<summary> | |||
名 称 :成品管理 | |||
@@ -4775,6 +4903,67 @@ | |||
工艺名称 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalMaterialService"> | |||
<summary> | |||
名 称 :配方物料服务 | |||
创 建 人 :yangxiao | |||
创建时间 :2023/3/2 16:11:04 | |||
描 述 :配方物料数据维护 | |||
</summary> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.Add(BPA.MES.Base.Application.Services.FinalMaterialAddInput)"> | |||
<summary> | |||
增加 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.BatchAdd(System.Collections.Generic.List{BPA.MES.Base.Application.Services.FinalMaterialAddInput})"> | |||
<summary> | |||
批量增加 | |||
</summary> | |||
<param name="inputs"></param> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.Del(BPA.MES.Base.Application.Services.FinalMaterialDelInput)"> | |||
<summary> | |||
删除 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.Detail(System.String)"> | |||
<summary> | |||
详情 | |||
</summary> | |||
<param name="Id"></param> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.List(BPA.MES.Base.Application.Services.FinalMaterialQueryInput)"> | |||
<summary> | |||
列表 | |||
</summary> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.PagedList(BPA.MES.Base.Application.Services.FinalMaterialQueryPageInput)"> | |||
<summary> | |||
分页 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.FinalMaterialService.Update(BPA.MES.Base.Application.Services.FinalMaterialUpdateInput)"> | |||
<summary> | |||
更新 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.FinalsInfoService"> | |||
<summary> | |||
名 称 :成品管理服务 | |||
@@ -4835,6 +5024,58 @@ | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.IFinalMaterialService"> | |||
<summary> | |||
名 称 :成品配方物料服务 | |||
创 建 人 :yangxiao | |||
创建时间 :2023/3/2 18:33:18 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.Add(BPA.MES.Base.Application.Services.FinalMaterialAddInput)"> | |||
<summary> | |||
增加 | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.BatchAdd(System.Collections.Generic.List{BPA.MES.Base.Application.Services.FinalMaterialAddInput})"> | |||
<summary> | |||
批量增加 | |||
</summary> | |||
<param name="inputs"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.Del(BPA.MES.Base.Application.Services.FinalMaterialDelInput)"> | |||
<summary> | |||
移除 | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.Update(BPA.MES.Base.Application.Services.FinalMaterialUpdateInput)"> | |||
<summary> | |||
更新 | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.List(BPA.MES.Base.Application.Services.FinalMaterialQueryInput)"> | |||
<summary> | |||
不分页列表 | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.PagedList(BPA.MES.Base.Application.Services.FinalMaterialQueryPageInput)"> | |||
<summary> | |||
分页列表 | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.Services.IFinalMaterialService.Detail(System.String)"> | |||
<summary> | |||
查询单条 | |||
</summary> | |||
<param name="Id"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Services.IFinalsInfoService"> | |||
<summary> | |||
名 称 :成品信息管理 | |||
@@ -0,0 +1,39 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 成品配方 | |||
/// </summary> | |||
[SugarTable("final_material")] | |||
public class FinalMaterialEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 物料Id | |||
/// </summary> | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 配方Id | |||
/// </summary> | |||
public string FinalId { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Weight { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Describe { get; set; } | |||
/// <summary> | |||
/// 误差 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string ErrorWeight { get; set; } | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
namespace BPA.MES.Base.Application.Services | |||
{ | |||
/// <summary> | |||
/// 名 称 :配方物料Dto类 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 :2023/3/2 16:12:06 | |||
/// 描 述 : | |||
/// </summary> | |||
public class FinalMaterialDto | |||
{ | |||
/// <summary> | |||
/// 物料Id | |||
/// </summary> | |||
public string MaterialId { get; set; } | |||
/// <summary> | |||
/// 成品Id | |||
/// </summary> | |||
public string FinalId { get; set; } | |||
/// <summary> | |||
/// 重量 | |||
/// </summary> | |||
public string Weight { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Describe { get; set; } | |||
/// <summary> | |||
/// 误差 | |||
/// </summary> | |||
public string ErrorWeight { get; set; } | |||
} | |||
/// <summary> | |||
/// 增加 | |||
/// </summary> | |||
public class FinalMaterialAddInput : FinalMaterialDto | |||
{ | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
public class FinalMaterialUpdateInput : FinalMaterialDto | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
public class FinalMaterialDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
} | |||
/// <summary> | |||
/// 不分页 | |||
/// </summary> | |||
public class FinalMaterialQueryInput | |||
{ | |||
/// <summary> | |||
/// 配方Id | |||
/// </summary> | |||
public string FinalId { get; set; } | |||
} | |||
/// <summary> | |||
/// 分页 | |||
/// </summary> | |||
public class FinalMaterialQueryPageInput : RequestPage | |||
{ | |||
} | |||
/// <summary> | |||
/// 输出 | |||
/// </summary> | |||
public class FinalMaterialOutput : FinalMaterialDto | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 配方名称 | |||
/// </summary> | |||
public string RecipesName { get; set; } | |||
/// <summary> | |||
/// 物料名称 | |||
/// </summary> | |||
public string MaterialName { get; set; } | |||
/// <summary> | |||
/// 物料编码 | |||
/// </summary> | |||
public string MaterialCode { get; set; } | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
namespace BPA.MES.Base.Application.Services | |||
{ | |||
/// <summary> | |||
/// 名 称 :配方物料服务 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 :2023/3/2 16:11:04 | |||
/// 描 述 :配方物料数据维护 | |||
/// </summary> | |||
[ApiDescriptionSettings("配方工艺管理", Name = "FinalMaterial", Tag = "配方物料服务", KeepName = true, SplitCamelCase = true, KeepVerb = true)] | |||
public class FinalMaterialService : IFinalMaterialService, ITransient, IDynamicApiController | |||
{ | |||
private readonly ISqlSugarClient _dbContext; | |||
public FinalMaterialService(ISqlSugarClient db) | |||
{ | |||
_dbContext = db; | |||
} | |||
/// <summary> | |||
/// 增加 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<bool> Add(FinalMaterialAddInput input) | |||
{ | |||
FinalMaterialEntity entity = input.Adapt<FinalMaterialEntity>(); | |||
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync(); | |||
} | |||
/// <summary> | |||
/// 批量增加 | |||
/// </summary> | |||
/// <param name="inputs"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
public async Task<bool> BatchAdd(List<FinalMaterialAddInput> inputs) | |||
{ | |||
bool result = false; | |||
List<FinalMaterialEntity> entitys = inputs.Adapt<List<FinalMaterialEntity>>(); | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<FinalMaterialEntity>().Where(x => x.FinalId == inputs[0].FinalId).ExecuteCommandAsync(); | |||
await _dbContext.Insertable(entitys).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
result = true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
_dbContext.Ado.RollbackTran(); | |||
throw Oops.Bah("保存失败!"); | |||
} | |||
return result; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpPost] | |||
public async Task<bool> Del(FinalMaterialDelInput input) | |||
{ | |||
var res = await _dbContext.Deleteable<FinalMaterialEntity>().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
/// 详情 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpGet] | |||
public async Task<FinalMaterialOutput> Detail(string Id) | |||
{ | |||
var entity = await _dbContext.Queryable<FinalMaterialEntity>().FirstAsync(x => x.Id == Id); | |||
FinalMaterialOutput output = entity.Adapt<FinalMaterialOutput>(); | |||
return output; | |||
} | |||
/// <summary> | |||
/// 列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpPost,AllowAnonymous] | |||
public async Task<List<FinalMaterialOutput>> List(FinalMaterialQueryInput input) | |||
{ | |||
var output = await _dbContext.Queryable<FinalMaterialEntity>() | |||
.LeftJoin<Pztj_MaterialsInfoEntity>((a,b)=>a.MaterialId==b.Id) | |||
.WhereIF(!string.IsNullOrEmpty(input.FinalId),(a,b)=>a.FinalId==input.FinalId) | |||
.Select((a,b)=>new FinalMaterialOutput | |||
{ | |||
Id = a.Id, | |||
MaterialName = b.Name, | |||
MaterialCode = b.Code, | |||
MaterialId = b.Id, | |||
FinalId = a.FinalId, | |||
RecipesName = b.Name, | |||
ErrorWeight = a.ErrorWeight, | |||
Weight = a.Weight | |||
}) | |||
.ToListAsync(); | |||
return output; | |||
} | |||
/// <summary> | |||
/// 分页 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<SqlSugarPagedList<FinalMaterialOutput>> PagedList(FinalMaterialQueryPageInput input) | |||
{ | |||
var entity = await _dbContext.Queryable<FinalMaterialEntity>() | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
SqlSugarPagedList<FinalMaterialOutput> output = entity.Adapt<SqlSugarPagedList<FinalMaterialOutput>>(); | |||
return output; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpPost] | |||
public async Task<bool> Update(FinalMaterialUpdateInput input) | |||
{ | |||
var res = await _dbContext.Updateable<FinalMaterialEntity>().ExecuteCommandHasChangeAsync(); | |||
return res; | |||
} | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
namespace BPA.MES.Base.Application.Services | |||
{ | |||
/// <summary> | |||
/// 名 称 :成品配方物料服务 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 :2023/3/2 18:33:18 | |||
/// 描 述 : | |||
/// </summary> | |||
public interface IFinalMaterialService | |||
{ | |||
/// <summary> | |||
/// 增加 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<bool> Add(FinalMaterialAddInput input); | |||
/// <summary> | |||
/// 批量增加 | |||
/// </summary> | |||
/// <param name="inputs"></param> | |||
/// <returns></returns> | |||
Task<bool> BatchAdd(List<FinalMaterialAddInput> inputs); | |||
/// <summary> | |||
/// 移除 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<bool> Del(FinalMaterialDelInput input); | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<bool> Update(FinalMaterialUpdateInput input); | |||
/// <summary> | |||
/// 不分页列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<FinalMaterialOutput>> List(FinalMaterialQueryInput input); | |||
/// <summary> | |||
/// 分页列表 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<SqlSugarPagedList<FinalMaterialOutput>> PagedList(FinalMaterialQueryPageInput input); | |||
/// <summary> | |||
/// 查询单条 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
Task<FinalMaterialOutput> Detail(string Id); | |||
} | |||
} |
@@ -107,7 +107,7 @@ | |||
[HttpPost] | |||
public async Task<bool> Update(ProductLineUpdateInput input) | |||
{ | |||
var isExit =await _dbContext.Queryable<ProductLineEntity>().Where(x => x.Id != input.Id && (x.Name == input.Name || x.Code == input.Code)).FirstAsync(); | |||
var isExit =await _dbContext.Queryable<ProductLineEntity>().Where(x => x.Id != input.Id && (x.Name == input.Name)).FirstAsync(); | |||
if (isExit != null) | |||
{ | |||
throw Oops.Bah("名称或编码已存在!"); | |||
@@ -114,7 +114,7 @@ namespace BPA.MES.Base.Application.Services | |||
// throw Oops.Bah("名称已存在!"); | |||
//} | |||
var entity = input.Adapt<ProductLineStepsEntity>(); | |||
var res = await _dbContext.Updateable(entity).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||
var res = await _dbContext.Updateable(entity).IgnoreColumns(it=>it.Step).IgnoreColumns(true).ExecuteCommandHasChangeAsync(); | |||
return res; | |||
} | |||
/// <summary> | |||
@@ -0,0 +1,303 @@ | |||
declare namespace finalMaterialTypes { | |||
/** | |||
* 基类 | |||
*/ | |||
type base_dto = { | |||
materialId: string, | |||
finalId: string, | |||
weight: string, | |||
} | |||
/** | |||
* 增加输入参数 | |||
*/ | |||
type addInput = base_dto | |||
/** | |||
* 更新输入参数 | |||
*/ | |||
interface updateInput extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 删除输入参数 | |||
*/ | |||
interface delInput { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 查询输入参数 | |||
*/ | |||
interface queryParms { | |||
/** | |||
* 名称 | |||
*/ | |||
name?: null | string; | |||
finalId: string, | |||
} | |||
/** | |||
* 查询分页输入参数 | |||
*/ | |||
interface queryPage { | |||
pageIndex: number, | |||
pageSize: number, | |||
/** | |||
* 报警信息 | |||
*/ | |||
msgInfo?: null | string; | |||
/** | |||
* 报警值 | |||
*/ | |||
value?: null | string; | |||
/** | |||
* 报警等级 | |||
*/ | |||
grade?: null | string; | |||
/** | |||
* 设备名称 | |||
*/ | |||
deviceName?: null | string; | |||
startTime?: Date | null | |||
endTime?: Date | null, | |||
} | |||
/** | |||
* 查询输出参数 | |||
*/ | |||
interface output extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
} | |||
declare namespace programlog { | |||
/** | |||
* 基类 | |||
*/ | |||
type base_dto = { | |||
/** | |||
* 类型 | |||
*/ | |||
logType?: null | number; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
createDate: string; | |||
} | |||
/** | |||
* 增加输入参数 | |||
*/ | |||
type addInput = base_dto | |||
/** | |||
* 更新输入参数 | |||
*/ | |||
interface updateInput extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 删除输入参数 | |||
*/ | |||
interface delInput { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 查询输入参数 | |||
*/ | |||
interface queryParms { | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
} | |||
/** | |||
* 查询分页输入参数 | |||
*/ | |||
interface queryPage { | |||
pageIndex: number, | |||
pageSize: number, | |||
/** | |||
* 编码 | |||
*/ | |||
logType?: null | number; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
startTime?: Date | null; | |||
endTime?: Date | null | |||
} | |||
/** | |||
* 查询输出参数 | |||
*/ | |||
interface output extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
} | |||
declare namespace userlog { | |||
/** | |||
* 基类 | |||
*/ | |||
type base_dto = { | |||
/** | |||
* 权限 | |||
*/ | |||
permission?: null | string; | |||
/** | |||
* 用户名 | |||
*/ | |||
userName?: null | string; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
createDate: string; | |||
} | |||
/** | |||
* 增加输入参数 | |||
*/ | |||
type addInput = base_dto | |||
/** | |||
* 更新输入参数 | |||
*/ | |||
interface updateInput extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
typeId: string | |||
} | |||
/** | |||
* 删除输入参数 | |||
*/ | |||
interface delInput { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 查询输入参数 | |||
*/ | |||
interface queryParms { | |||
/** | |||
* 名称 | |||
*/ | |||
name?: null | string; | |||
} | |||
/** | |||
* 查询分页输入参数 | |||
*/ | |||
interface queryPage { | |||
pageIndex: number, | |||
pageSize: number, | |||
/** | |||
* 用户名 | |||
*/ | |||
userName?: null | string; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
} | |||
/** | |||
* 查询输出参数 | |||
*/ | |||
interface output extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
} | |||
declare namespace runlog { | |||
/** | |||
* 基类 | |||
*/ | |||
type base_dto = { | |||
/** | |||
* 日志类别 | |||
*/ | |||
logType?: null | string; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
createDate: string | |||
} | |||
/** | |||
* 增加输入参数 | |||
*/ | |||
type addInput = base_dto | |||
/** | |||
* 更新输入参数 | |||
*/ | |||
interface updateInput extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
typeId: string | |||
} | |||
/** | |||
* 删除输入参数 | |||
*/ | |||
interface delInput { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
/** | |||
* 查询输入参数 | |||
*/ | |||
interface queryParms { | |||
/** | |||
* 名称 | |||
*/ | |||
name?: null | string; | |||
} | |||
/** | |||
* 查询分页输入参数 | |||
*/ | |||
interface queryPage { | |||
pageIndex: number, | |||
pageSize: number, | |||
/** | |||
* 日志类别 | |||
*/ | |||
logType?: null | string; | |||
/** | |||
* 日志消息 | |||
*/ | |||
msgInfo?: null | string; | |||
startTime?: Date | null; | |||
endTime?: Date | null | |||
} | |||
/** | |||
* 查询输出参数 | |||
*/ | |||
interface output extends base_dto { | |||
/** | |||
* 主键 | |||
*/ | |||
id: string | |||
} | |||
} |
@@ -0,0 +1,89 @@ | |||
import { request } from '@umijs/max'; | |||
export default { | |||
/** | |||
* 新增 | |||
* @param parms | |||
* @returns | |||
*/ | |||
Add(parms: finalMaterialTypes.addInput) { | |||
return request('/api/finalmaterial/add', { | |||
method: 'POST', | |||
data: { | |||
...parms, | |||
}, | |||
}); | |||
}, | |||
/** | |||
* 删除 | |||
* @param parms | |||
* @returns | |||
*/ | |||
Del(parms: finalMaterialTypes.delInput) { | |||
return request(`/api/finalmaterial/del`, { | |||
method: 'POST', | |||
data: { | |||
...parms, | |||
}, | |||
}); | |||
}, | |||
/** | |||
* 修改 | |||
* @param parms | |||
* @returns | |||
*/ | |||
Update(parms: finalMaterialTypes.updateInput) { | |||
return request('/api/finalmaterial/update', { | |||
method: 'POST', | |||
data: { | |||
...parms, | |||
}, | |||
}); | |||
}, | |||
/** | |||
* 详情 | |||
* @param parms | |||
* @returns | |||
*/ | |||
Detail(id: string) { | |||
return request(`/api/finalmaterial/detail?id=${id}`, { | |||
method: 'GET' | |||
}); | |||
}, | |||
/** | |||
* 获取列表 | |||
* @param parms | |||
* @returns | |||
*/ | |||
List(parms: finalMaterialTypes.queryParms) { | |||
return request('/api/finalmaterial/list', { | |||
method: 'POST', | |||
data: { | |||
...parms, | |||
}, | |||
}); | |||
}, | |||
/** | |||
* 分页查询 | |||
* @param parms | |||
* @returns | |||
*/ | |||
PagedList(parms: finalMaterialTypes.queryPage) { | |||
return request('/api/finalmaterial/pagedlist', { | |||
method: 'POST', | |||
data: { | |||
...parms, | |||
}, | |||
}); | |||
}, | |||
//批量创建物料信息 | |||
BatchAdd(parms: finalMaterialTypes.addInput[]){ | |||
return request('/api/finalmaterial/batchadd', { | |||
method: 'POST', | |||
data: parms | |||
}); | |||
}, | |||
} | |||
@@ -1,20 +1,24 @@ | |||
// 成品管理 | |||
import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |||
import { ProTable } from '@ant-design/pro-components'; | |||
import { Button, Modal, Form, Input, message, Popconfirm, TreeSelect, Select, Tag, Dropdown, Space, MenuProps } from 'antd'; | |||
import type { ActionType, EditableFormInstance, ProColumns } from '@ant-design/pro-components'; | |||
import { EditableProTable, ProCard, ProTable } from '@ant-design/pro-components'; | |||
import { Button, Modal, Form, Input, message, Popconfirm, TreeSelect, Select, Tag, Dropdown, Space, MenuProps, Spin } from 'antd'; | |||
import { useEffect, useRef, useState } from 'react'; | |||
import finalInfoAPI from '@/api/finalService'; | |||
import { DownOutlined } from '@ant-design/icons'; | |||
import FormItem from 'antd/lib/form/FormItem'; | |||
import { ItemType } from 'rc-menu/lib/interface'; | |||
// 工艺服务 | |||
import craftsinfoAPI from '@/api/craftsinfo'; | |||
// 配方服务 | |||
import recipeAPI from '@/api/recipeService'; | |||
import finalMaterialAPI from '@/api/finalMaterial/service'; | |||
// 无聊服务 | |||
import MaterialsInfoAPI from '@/api/materialService' | |||
const final = () => { | |||
const [formRef] = Form.useForm(); | |||
const [spinStatus, setSpinStatus] = useState(false); | |||
const [isEditModalOpen, setIsEditModalOpen] = useState(false); | |||
const editactionformRef = useRef<EditableFormInstance>(); | |||
const editactionRef = useRef<ActionType>(); | |||
const [materiallist, setMateriallist] = useState<finalMaterialTypes.output[]>([]); | |||
const [selectMateriallist, setSelectMateriallist] = useState<finalMaterialTypes.output[]>([]); | |||
const [selectRowItem, setSelectRowItem] = useState<any>(); | |||
//定于表单 | |||
// eslint-disable-next-line react-hooks/rules-of-hooks | |||
const [typeForm] = Form.useForm(); | |||
@@ -37,7 +41,6 @@ const final = () => { | |||
{ | |||
title: 'id', | |||
dataIndex: 'id', | |||
tip: '规则名称是唯一的 key', | |||
hideInSearch: true, | |||
hideInTable: true, | |||
}, | |||
@@ -54,19 +57,6 @@ const final = () => { | |||
hideInSearch: false, | |||
ellipsis: true, | |||
}, | |||
{ | |||
title: '成品配方', | |||
dataIndex: 'recipeName', | |||
ellipsis: true, | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '成品工艺', | |||
dataIndex: 'craftName', | |||
ellipsis: true, | |||
hideInSearch: true, | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
@@ -91,12 +81,32 @@ const final = () => { | |||
type="primary" ghost | |||
onClick={async () => { | |||
setPeifangOpen(true); | |||
setSpinStatus(true); | |||
const jsonData: finalMaterialTypes.queryParms = { | |||
finalId: record.id!, | |||
}; | |||
setSelectRowItem(record); | |||
//根据工艺列表查询功能值 | |||
finalMaterialAPI.List(jsonData) | |||
.then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
setMateriallist(res.data) | |||
setPeifangOpen(true); | |||
} | |||
setSpinStatus(false) | |||
}) | |||
.catch(() => { | |||
setPeifangOpen(false); | |||
setSpinStatus(false) | |||
}); | |||
// const copyFormData = JSON.parse(JSON.stringify(record)); | |||
// copyFormData.state = copyFormData.state === '0'; | |||
// typeForm.setFieldsValue(copyFormData); | |||
}}> | |||
配方设置 | |||
</Button> | |||
, | |||
<Popconfirm | |||
@@ -129,37 +139,6 @@ const final = () => { | |||
}, | |||
]; | |||
// eslint-disable-next-line react-hooks/rules-of-hooks | |||
useEffect(() => { | |||
if (isModalOpen) { | |||
// 下拉工艺列表信息 | |||
const formulaList = async () => { | |||
const crafts = await craftsinfoAPI.selectlist(); | |||
// console.log(crafts); | |||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | |||
setformula(crafts.data); | |||
}; | |||
formulaList(); | |||
// 下拉列表信息 | |||
const areasList = async () => { | |||
const recipe = await recipeAPI.selectlist(); | |||
// console.log(recipe); | |||
// eslint-disable-next-line @typescript-eslint/no-use-before-define | |||
setareas(recipe.data); | |||
}; | |||
areasList(); | |||
} | |||
}, [isModalOpen]); | |||
const OnSubmit = async (values: FinalTypes.Info) => { | |||
@@ -304,66 +283,152 @@ const final = () => { | |||
<Form.Item name="name" label="成品名称" rules={[{ required: true, message: 'Missing area' }]}> | |||
<Input /> | |||
</Form.Item> | |||
{/* 工艺列表 */} | |||
<Form.Item name="craftId" label="成品工艺" rules={[{ required: true, message: 'Missing area' }]}> | |||
{/* <Select options={areas} /> */} | |||
<Select placeholder="请选择工艺" | |||
// options={formula} | |||
> | |||
{ | |||
formula.map((item: MySelectType.Select) => { | |||
return <Select.Option value={item.key} key={item.key}> | |||
<span>{item.value}</span> | |||
</Select.Option> | |||
}) | |||
} | |||
</Select> | |||
</Form.Item> | |||
{/* 配方列表 */} | |||
<Form.Item name="recipeId" label="成品配方" rules={[{ required: true, message: 'Missing area' }]}> | |||
{/* <Select options={formula} /> */} | |||
<Select placeholder="请选择成品配方" | |||
// options={areas} | |||
> | |||
{ | |||
areas.map((item: MySelectType.Select) => { | |||
return <Select.Option value={item.key} key={item.key}> | |||
<span>{item.value}</span> | |||
</Select.Option> | |||
}) | |||
} | |||
</Select> | |||
</Form.Item> | |||
</Form> | |||
</Modal> | |||
<Modal | |||
maskClosable={false} | |||
key="01" | |||
width={800} | |||
title={'配方设置'} | |||
key="02" | |||
width={1200} | |||
title="配置物料" | |||
open={peifangOpen} | |||
destroyOnClose | |||
onCancel={() => { | |||
setPeifangOpen(false); | |||
setMateriallist([]); | |||
}} | |||
footer={[ | |||
<Button | |||
key="back" | |||
onClick={() => { | |||
onOk={() => { | |||
const list: finalMaterialTypes.addInput[] = JSON.parse(JSON.stringify(materiallist)); | |||
list.map((item) => { | |||
item.finalId = selectRowItem.id; | |||
}) | |||
finalMaterialAPI.BatchAdd(list).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.success("保存成功!"); | |||
setPeifangOpen(false); | |||
}} | |||
> | |||
返回 | |||
</Button>, | |||
<Button key="submit" form="finalForm" type="primary" htmlType="submit"> | |||
提交 | |||
</Button>, | |||
]} | |||
} else { | |||
message.error("保存失败!"); | |||
} | |||
}); | |||
}} | |||
> | |||
</Modal> | |||
<Spin spinning={spinStatus}> | |||
<ProCard> | |||
<div | |||
style={{ | |||
maxWidth: 1200, | |||
margin: 'auto', | |||
}} | |||
> | |||
<EditableProTable<finalMaterialTypes.output> | |||
rowKey="id" | |||
controlled | |||
editableFormRef={editactionformRef} | |||
actionRef={editactionRef} | |||
columns={[ | |||
{ | |||
title: '物料名称', | |||
dataIndex: 'materialId', | |||
valueType: 'select', | |||
ellipsis: true, | |||
request: async () => { | |||
const res: MyResponse.Content = await MaterialsInfoAPI.List(); | |||
const myData: any[] = []; | |||
if (res.statusCode === 200) { | |||
setSelectMateriallist(res.data) | |||
res.data.map((item: MaterialsTypes.Info) => ( | |||
myData.push({ | |||
label: `${item.name}[${item.unit}]`, | |||
value: item.id, | |||
}) | |||
)) | |||
} | |||
return myData; | |||
}, | |||
formItemProps: () => { | |||
return { | |||
rules: [{ required: true, message: '此项为必填项' }] | |||
}; | |||
}, | |||
}, | |||
{ | |||
title: '重量', | |||
dataIndex: 'weight', | |||
valueType: 'text', | |||
ellipsis: true, | |||
formItemProps: () => { | |||
return { | |||
rules: [{ required: true, message: '此项为必填项' }], | |||
}; | |||
}, | |||
}, | |||
{ | |||
title: '重量误差(±)', | |||
dataIndex: 'errorWeight', | |||
valueType: 'text', | |||
ellipsis: true, | |||
formItemProps: () => { | |||
return { | |||
rules: [{ required: true, message: '此项为必填项' }], | |||
}; | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
render: (_, row) => [ | |||
<Button | |||
type='primary' ghost | |||
key="edit" | |||
onClick={() => { | |||
console.log(row); | |||
editactionRef.current?.startEditable(row.id); | |||
}} | |||
> | |||
编辑原料 | |||
</Button>, | |||
], | |||
}, | |||
]} | |||
value={materiallist} | |||
recordCreatorProps={{ | |||
record: () => ( | |||
{ | |||
id: Date.now().toString(), | |||
materialId: '', | |||
finalId: '', | |||
weight: '', | |||
}) | |||
, | |||
} | |||
} | |||
editable={{ | |||
form: formRef, | |||
type: 'single', | |||
onValuesChange: (record, recordList: finalMaterialTypes.output[]) => { | |||
console.log(selectMateriallist); | |||
if (!recordList) { | |||
materiallist.push(record); | |||
setMateriallist(materiallist); | |||
} else { | |||
setMateriallist(recordList); | |||
} | |||
console.log('materiallist', materiallist); | |||
}, | |||
actionRender: (row, _, dom) => { | |||
return [dom.delete, dom.save, dom.cancel]; | |||
}, | |||
}} | |||
/> | |||
</div> | |||
</ProCard> | |||
</Spin> | |||
</Modal> | |||
</> | |||
@@ -20,39 +20,39 @@ import { v4 as uuid } from 'uuid' | |||
import productlineInfoAPI from '@/api/productlineInfo/service' | |||
import processAPI from '@/api/process/service'; | |||
import productlineInfoStepsAPI from '@/api/productlinesteps/service' | |||
import { edges, nodes as newnodes } from './data'; | |||
import { edges, nodes as newnodes } from './data'; | |||
export default () => { | |||
const [fromType, setFromType] = useState<any>('table') | |||
const ref = useRef<ProFormInstance>(); | |||
const actionRef = useRef<ActionType>(); | |||
const Reolod = () =>{ | |||
const Reolod = () => { | |||
ref.current?.resetFields() | |||
actionRef.current?.reload() | |||
} | |||
const [flowOpen,setFlowOpen] = useState<boolean>(false) | |||
const [flowItemOpen,setFlowItemOpen] = useState<boolean>(false) | |||
const [flowOpen, setFlowOpen] = useState<boolean>(false) | |||
const [flowItemOpen, setFlowItemOpen] = useState<boolean>(false) | |||
const columns: ProColumns<productlineInfoTypes.output>[] = [ | |||
{ | |||
title: '主键', | |||
dataIndex: 'id', | |||
width: 160, | |||
formItemProps: { | |||
hidden:true | |||
formItemProps: { | |||
hidden: true | |||
}, | |||
hideInSearch:true | |||
hideInSearch: true | |||
}, | |||
{ | |||
title: '名称', | |||
dataIndex: 'name', | |||
ellipsis: true, | |||
width: 120, | |||
formItemProps:{ | |||
rules:[{ required: true, message: '此项为必填项!' }] | |||
formItemProps: { | |||
rules: [{ required: true, message: '此项为必填项!' }] | |||
} | |||
}, | |||
// { | |||
@@ -64,11 +64,11 @@ export default () => { | |||
// valueEnum:{ | |||
// 0: { | |||
// text: '人工', | |||
// }, | |||
// 1: { | |||
// text: '设备', | |||
// }, | |||
// }, | |||
// formItemProps:{ | |||
@@ -78,7 +78,7 @@ export default () => { | |||
{ | |||
title: '描述', | |||
dataIndex: 'describe', | |||
search: false, | |||
}, | |||
{ | |||
@@ -88,48 +88,54 @@ export default () => { | |||
return <>{dayjs(record.createTime).format("YYYY-MM-DD HH:mm:ss")}</> | |||
}, | |||
search: false, | |||
hideInForm:true | |||
hideInForm: true | |||
}, | |||
{ | |||
title: '操作', | |||
valueType: 'option', | |||
render: (text, row) => [ | |||
<Space key={+new Date() + Math.random()}> | |||
<a onClick={() => { | |||
setFromType('form') | |||
<a onClick={() => { | |||
setFromType('form') | |||
ref.current?.setFieldsValue(row) | |||
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> | |||
编辑 | |||
</a> | |||
<a onClick={() => { | |||
<a onClick={() => { | |||
setFlowOpen(true) | |||
setStepparams({ lineId: row.id }) | |||
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> | |||
配置工艺流程 | |||
</a> | |||
<Popconfirm | |||
key="del" | |||
title="确定要删除此条数据吗?" | |||
onConfirm={() => { | |||
productlineInfoAPI.Del(row).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("删除成功!"); | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
}} | |||
onCancel={() => { | |||
message.info('已取消删除'); | |||
}} | |||
okText="确认" | |||
cancelText="关闭" | |||
> | |||
<a> | |||
删除 | |||
<a onClick={() => { | |||
// setFlowOpen(true) | |||
// setStepparams({ lineId: row.id }) | |||
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer"> | |||
配置设备 | |||
</a> | |||
<Popconfirm | |||
key="del" | |||
title="确定要删除此条数据吗?" | |||
onConfirm={() => { | |||
productlineInfoAPI.Del(row).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("删除成功!"); | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
}} | |||
onCancel={() => { | |||
message.info('已取消删除'); | |||
}} | |||
okText="确认" | |||
cancelText="关闭" | |||
> | |||
<a> | |||
删除 | |||
</a> | |||
</Popconfirm> | |||
</Space> | |||
], | |||
@@ -143,8 +149,8 @@ export default () => { | |||
}, | |||
}; | |||
}); | |||
const [selectLineItem,setSelectLineItem] = useState<any>(); | |||
const [processList,setProcessList] = useState<any[]>(); | |||
const [selectLineItem, setSelectLineItem] = useState<any>(); | |||
const [processList, setProcessList] = useState<any[]>(); | |||
const [stepparams, setStepparams] = useState<any>(); | |||
const [dongtaiformRef] = Form.useForm(); | |||
const { styles } = useStyles(); | |||
@@ -152,312 +158,343 @@ export default () => { | |||
const [nodes, , onNodesChange] = useNodesState(newnodes); | |||
const [node, setNode] = useState(null); | |||
const sortActionRef = useRef<ActionType>(); | |||
const [proList,setProList] = useState<any[]>([]); | |||
const [proList, setProList] = useState<any[]>([]); | |||
const [form] = Form.useForm(); | |||
useEffect(() => { | |||
processAPI.Selectlist().then((v:MyResponse.Content)=>{ | |||
if (v.statusCode===200) { | |||
console.log('v.data',v.data); | |||
processAPI.Selectlist().then((v: MyResponse.Content) => { | |||
if (v.statusCode === 200) { | |||
console.log('v.data', v.data); | |||
setProList(v.data) | |||
} | |||
}) | |||
}, []) | |||
return ( | |||
<> | |||
<ProTable<productlineInfoTypes.output> | |||
columns={columns} | |||
type={fromType as 'table'} | |||
formRef={ref} | |||
actionRef={actionRef} | |||
onSubmit={(params: any) => { | |||
console.log(params); | |||
if (fromType === 'form') { | |||
if (params.id) { | |||
productlineInfoAPI.Update(params).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("更新成功!"); | |||
setFromType('table') | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
} else { | |||
productlineInfoAPI.Add(params).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("新增成功!"); | |||
setFromType('table') | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
} | |||
} | |||
}} | |||
form={{ignoreRules:true,// 自定义提交按钮的属性 | |||
submitter: { | |||
onReset:()=>{ | |||
ref.current?.resetFields() | |||
setFromType("table") | |||
}, | |||
searchConfig: { resetText: fromType === 'form' ? '返回': '重置',submitText: fromType === 'form' ? '提交': '查询'}, } | |||
}} | |||
request={async (params = {}) => { | |||
const jsonData: productlineInfoTypes.queryPage = { | |||
pageIndex: params.current || 1, | |||
pageSize: params.pageSize || 10, | |||
name: params.name || '', | |||
}; | |||
const response = await productlineInfoAPI.PagedList(jsonData); | |||
if (response.statusCode === 200) { | |||
return { | |||
data: response.data.items, | |||
success: true, | |||
total: response.data.total, | |||
}; | |||
<ProTable<productlineInfoTypes.output> | |||
columns={columns} | |||
type={fromType as 'table'} | |||
formRef={ref} | |||
actionRef={actionRef} | |||
onSubmit={(params: any) => { | |||
console.log(params); | |||
if (fromType === 'form') { | |||
if (params.id) { | |||
productlineInfoAPI.Update(params).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("更新成功!"); | |||
setFromType('table') | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
} else { | |||
return { | |||
data: [], | |||
success: false, | |||
total: 0, | |||
}; | |||
productlineInfoAPI.Add(params).then((res: MyResponse.Content) => { | |||
if (res.statusCode === 200) { | |||
message.info("新增成功!"); | |||
setFromType('table') | |||
Reolod() | |||
} else { | |||
message.error(res.errors); | |||
} | |||
}) | |||
} | |||
}} | |||
pagination={{ | |||
pageSize: 10, | |||
showSizeChanger:false | |||
}} | |||
rowKey="id" | |||
dateFormatter="string" | |||
headerTitle="列表" | |||
toolBarRender={() => [ | |||
<Button key="3" type="primary" onClick={() => { | |||
setFromType('form'); | |||
}}> | |||
<PlusOutlined /> | |||
新建 | |||
</Button>, | |||
]} | |||
/> | |||
<Modal open={flowOpen} maskClosable={false} footer={null} width={1000} height={1000} title='配置工艺流程' onOk={() => { setFlowOpen(false) }} onCancel={_ => setFlowOpen(false)}> | |||
<Flex vertical={false} justify='space-between' > | |||
<div style={{width:'300px',margin:'auto'}}> | |||
<Steps | |||
progressDot | |||
direction="vertical" | |||
items={ | |||
processList?.map((element:any) => { | |||
return {...element,title : proList.find((x)=>x.key==element.processId)?.value,status: 'finish', } | |||
}) | |||
} | |||
} | |||
}} | |||
form={{ | |||
ignoreRules: true,// 自定义提交按钮的属性 | |||
submitter: { | |||
onReset: () => { | |||
ref.current?.resetFields() | |||
setFromType("table") | |||
}, | |||
searchConfig: { resetText: fromType === 'form' ? '返回' : '重置', submitText: fromType === 'form' ? '提交' : '查询' }, | |||
} | |||
}} | |||
request={async (params = {}) => { | |||
const jsonData: productlineInfoTypes.queryPage = { | |||
pageIndex: params.current || 1, | |||
pageSize: params.pageSize || 10, | |||
name: params.name || '', | |||
}; | |||
const response = await productlineInfoAPI.PagedList(jsonData); | |||
if (response.statusCode === 200) { | |||
return { | |||
data: response.data.items, | |||
success: true, | |||
total: response.data.total, | |||
}; | |||
} else { | |||
return { | |||
data: [], | |||
success: false, | |||
total: 0, | |||
}; | |||
} | |||
}} | |||
pagination={{ | |||
pageSize: 10, | |||
showSizeChanger: false | |||
}} | |||
rowKey="id" | |||
dateFormatter="string" | |||
headerTitle="列表" | |||
toolBarRender={() => [ | |||
<Button key="3" type="primary" onClick={() => { | |||
setFromType('form'); | |||
}}> | |||
<PlusOutlined /> | |||
新建 | |||
</Button>, | |||
]} | |||
/> | |||
<Modal open={flowOpen} maskClosable={false} footer={null} width={"50%"} height={"50%"} title='配置工艺流程' onOk={() => { setFlowOpen(false) }} onCancel={_ => setFlowOpen(false)}> | |||
<Flex vertical={false} > | |||
<div style={{ width: '300px', margin: 'auto' }}> | |||
<Steps | |||
progressDot | |||
direction="vertical" | |||
items={ | |||
processList?.map((element: any) => { | |||
return { ...element, title: proList.find((x) => x.key == element.processId)?.value, status: 'finish', } | |||
}) | |||
} | |||
/> | |||
</div> | |||
<div style={{margin:"auto"}}> | |||
<DragSortTable<productlinestepsTypes.base_dto> | |||
style={{width:'600px'}} | |||
toolBarRender={() => [ | |||
<Button | |||
key={new Date().toDateString()} | |||
type="primary" | |||
onClick={() => { | |||
// typeForm.resetFields(); | |||
<div style={{ margin: "auto" }}> | |||
<DragSortTable<productlinestepsTypes.base_dto> | |||
style={{ width: '600px' }} | |||
toolBarRender={() => [ | |||
<Button | |||
key={new Date().toDateString()} | |||
type="primary" | |||
onClick={() => { | |||
form.resetFields(); | |||
setFlowItemOpen(true) | |||
}} | |||
> | |||
添加步骤 | |||
</Button>, | |||
]} | |||
actionRef={sortActionRef} | |||
columns={[ | |||
{ | |||
title: '工序', | |||
dataIndex: 'step', | |||
align: 'center', | |||
hideInSearch: true, | |||
render: (dom, rowData, index) => { | |||
return ( | |||
<span className="customRender">{`${index + 1}`}</span> | |||
); | |||
setFlowItemOpen(true) | |||
}} | |||
> | |||
添加步骤 | |||
</Button>, | |||
]} | |||
actionRef={sortActionRef} | |||
columns={[ | |||
{ | |||
title: '工序', | |||
dataIndex: 'step', | |||
align: 'center', | |||
hideInSearch: true, | |||
render: (dom, rowData, index) => { | |||
return ( | |||
<span className="customRender">{`${index + 1}`}</span> | |||
); | |||
}, | |||
}, | |||
}, | |||
{ | |||
title: '工艺名称', | |||
dataIndex: 'processId', | |||
align: 'center', | |||
hideInSearch: true, | |||
render(dom, entity, index, action, schema) { | |||
return <>{proList.find((x)=>x.key==entity.processId)?.value}</> | |||
{ | |||
title: 'Id', | |||
dataIndex: 'id', | |||
align: 'center', | |||
hideInSearch: true, | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
align: 'center', | |||
{ | |||
title: '工艺名称', | |||
dataIndex: 'processId', | |||
align: 'center', | |||
hideInSearch: true, | |||
render(dom, entity, index, action, schema) { | |||
return <>{proList.find((x) => x.key == entity.processId)?.value}</> | |||
}, | |||
}, | |||
{ | |||
title: '操作', | |||
align: 'center', | |||
valueType: 'option', | |||
valueType: 'option', | |||
key: 'option', | |||
render: (_, record, index, action) => [ | |||
<Space key={uuid()} size="middle"> | |||
<Button | |||
key={uuid()} | |||
type='primary' ghost | |||
onClick={async () => { | |||
// setIsModalOpen(true) | |||
const copyFormData = JSON.parse(JSON.stringify(record)); | |||
console.log('copyFormData', copyFormData); | |||
key: 'option', | |||
render: (_, record, index, action) => [ | |||
<Space key={uuid()} size="middle"> | |||
<Button | |||
key={uuid()} | |||
type='primary' ghost | |||
onClick={async () => { | |||
// setIsModalOpen(true) | |||
const copyFormData = JSON.parse(JSON.stringify(record)); | |||
form.setFieldsValue(copyFormData); | |||
setFlowItemOpen(true) | |||
// setIsSetpModalOpen(true); | |||
}} | |||
> | |||
编辑 | |||
</Button> | |||
// typeForm.setFieldsValue(copyFormData); | |||
// setIsSetpModalOpen(true); | |||
}} | |||
> | |||
编辑 | |||
</Button> | |||
<Popconfirm | |||
key={uuid()} | |||
title="确定要删除此条数据吗?" | |||
onConfirm={() => { | |||
const delData: productlinestepsTypes.delInput = { | |||
id: record.id, | |||
}; | |||
productlineInfoStepsAPI.Del(delData).then((r) => { | |||
if (r.statusCode === 200) { | |||
message.success(r.statusCode === 200 ? '删除成功' : r.message); | |||
action?.reload(); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { | |||
message.info('已取消删除'); | |||
}} | |||
okText="确认" | |||
cancelText="关闭" | |||
> | |||
<Button type='primary' danger ghost>删除</Button> | |||
</Popconfirm> | |||
</Space> | |||
], | |||
}, | |||
]} | |||
rowKey="step" | |||
search={false} | |||
pagination={{ pageSize: 100,showSizeChanger:false }} | |||
params={stepparams} | |||
request={async (params = {}) => { | |||
// if (!params.lineId) { | |||
// return { | |||
// data: [], | |||
// success: false, | |||
// total: 0, | |||
// }; | |||
// } | |||
const jsonData: productlinestepsTypes.queryParms = { | |||
lineId: params.lineId | |||
}; | |||
const response = await productlineInfoStepsAPI.List(jsonData); | |||
if (response.statusCode === 200) { | |||
setProcessList(response.data) | |||
return { | |||
data: response.data, | |||
success: true, | |||
}; | |||
} else { | |||
return { | |||
data: [], | |||
success: false, | |||
total: 0, | |||
<Popconfirm | |||
key={uuid()} | |||
title="确定要删除此条数据吗?" | |||
onConfirm={() => { | |||
const delData: productlinestepsTypes.delInput = { | |||
id: record.id, | |||
}; | |||
productlineInfoStepsAPI.Del(delData).then((r) => { | |||
if (r.statusCode === 200) { | |||
message.success(r.statusCode === 200 ? '删除成功' : r.message); | |||
action?.reload(); | |||
} | |||
}); | |||
}} | |||
onCancel={() => { | |||
message.info('已取消删除'); | |||
}} | |||
okText="确认" | |||
cancelText="关闭" | |||
> | |||
<Button type='primary' danger ghost>删除</Button> | |||
</Popconfirm> | |||
</Space> | |||
], | |||
}, | |||
]} | |||
rowKey="step" | |||
search={false} | |||
pagination={{ pageSize: 100, showSizeChanger: false }} | |||
params={stepparams} | |||
request={async (params = {}) => { | |||
// if (!params.lineId) { | |||
// return { | |||
// data: [], | |||
// success: false, | |||
// total: 0, | |||
// }; | |||
// } | |||
const jsonData: productlinestepsTypes.queryParms = { | |||
lineId: params.lineId | |||
}; | |||
} | |||
}} | |||
dragSortKey="step" | |||
onDragSortEnd={(beforeIndex: number, afterIndex: number,newDataSource: any[]) => { | |||
const response = await productlineInfoStepsAPI.List(jsonData); | |||
if (response.statusCode === 200) { | |||
setProcessList(response.data) | |||
console.log('newDataSource',newDataSource); | |||
// 模拟将排序后数据发送到服务器的场景 | |||
// remoteData = newDataSource; | |||
// 请求成功之后刷新列表 | |||
newDataSource.map((item, index) => { | |||
item.step = index + 1; | |||
}) | |||
console.log('排序后的数据', newDataSource); | |||
productlineInfoStepsAPI.BatchUpdateStep(newDataSource).then((res: MyResponse.Content) => { | |||
if (res.data) { | |||
sortActionRef.current?.reload(); | |||
message.success('修改列表排序成功'); | |||
return { | |||
data: response.data, | |||
success: true, | |||
}; | |||
} else { | |||
return { | |||
data: [], | |||
success: false, | |||
total: 0, | |||
}; | |||
} | |||
}); | |||
}} | |||
dragSortKey="step" | |||
onDragSortEnd={(beforeIndex: number, afterIndex: number, newDataSource: any[]) => { | |||
}} | |||
/> | |||
console.log('newDataSource', newDataSource); | |||
// 模拟将排序后数据发送到服务器的场景 | |||
// remoteData = newDataSource; | |||
// 请求成功之后刷新列表 | |||
newDataSource.map((item, index) => { | |||
item.step = index + 1; | |||
}) | |||
console.log('排序后的数据', newDataSource); | |||
productlineInfoStepsAPI.BatchUpdateStep(newDataSource).then((res: MyResponse.Content) => { | |||
if (res.data) { | |||
sortActionRef.current?.reload(); | |||
message.success('修改列表排序成功'); | |||
} | |||
}); | |||
}} | |||
/> | |||
</div> | |||
</Flex> | |||
</Modal> | |||
<Modal open={flowItemOpen} maskClosable={false} width={500} title='添加步骤' | |||
<Modal open={flowItemOpen} maskClosable={false} width={500} title='添加步骤' | |||
footer={[ | |||
<Button | |||
key="back" | |||
onClick={() => { | |||
setFlowItemOpen(false) | |||
}} | |||
key="back" | |||
onClick={() => { | |||
setFlowItemOpen(false) | |||
}} | |||
> | |||
返回 | |||
返回 | |||
</Button>, | |||
<Button key="submit" form="addprocessForm" type="primary" htmlType="submit"> | |||
提交 | |||
提交 | |||
</Button>, | |||
]} | |||
onOk={() => { setFlowItemOpen(false) }} onCancel={_ => setFlowItemOpen(false)}> | |||
<Form | |||
id='addprocessForm' | |||
form={form} | |||
onFinish={(v)=>{ | |||
console.log(v); | |||
const jsonData:productlinestepsTypes.addInput = { | |||
step: 0, | |||
processId: v.processId, | |||
id: '', | |||
lineId: stepparams.lineId, | |||
processName: '' | |||
} | |||
productlineInfoStepsAPI.Add(jsonData).then((v:MyResponse.Content)=>{ | |||
if (v.statusCode===200) { | |||
setFlowItemOpen(false) | |||
sortActionRef.current?.reload(); | |||
} | |||
}) | |||
}}> | |||
<Form.Item label="主键" | |||
name="id" | |||
hidden={true}> | |||
</Form.Item> | |||
<Form.Item label="工艺" | |||
name="processId" rules={[{ required: true, message: '此项为必填项!' }]} > | |||
<Select placeholder='请选择工艺' style={{ width: 375 }}> | |||
{ | |||
proList.map((item: MySelectType.Select) => { | |||
return <Select.Option value={item.key} key={item.key}> | |||
<span>{item.value}</span> | |||
</Select.Option> | |||
}) | |||
} | |||
</Select> | |||
</Form.Item> | |||
</Form> | |||
]} | |||
onOk={() => { setFlowItemOpen(false) }} onCancel={_ => setFlowItemOpen(false)}> | |||
<Form | |||
id='addprocessForm' | |||
form={form} | |||
onFinish={(v) => { | |||
console.log(v); | |||
if (v.id) { | |||
const jsonData: productlinestepsTypes.addInput = { | |||
step: 0, | |||
processId: v.processId, | |||
id: v.id, | |||
lineId: stepparams.lineId, | |||
processName: '' | |||
} | |||
productlineInfoStepsAPI.Update(jsonData).then((v: MyResponse.Content) => { | |||
if (v.statusCode === 200) { | |||
setFlowItemOpen(false) | |||
sortActionRef.current?.reload(); | |||
} | |||
}) | |||
} else { | |||
const jsonData: productlinestepsTypes.addInput = { | |||
step: 0, | |||
processId: v.processId, | |||
id: '', | |||
lineId: stepparams.lineId, | |||
processName: '' | |||
} | |||
productlineInfoStepsAPI.Add(jsonData).then((v: MyResponse.Content) => { | |||
if (v.statusCode === 200) { | |||
setFlowItemOpen(false) | |||
sortActionRef.current?.reload(); | |||
} | |||
}) | |||
} | |||
}}> | |||
<Form.Item label="主键" | |||
name="id" | |||
hidden={true}> | |||
</Form.Item> | |||
<Form.Item label="步骤" | |||
name="step" | |||
hidden={true}> | |||
</Form.Item> | |||
<Form.Item label="工艺" | |||
name="processId" rules={[{ required: true, message: '此项为必填项!' }]} > | |||
<Select placeholder='请选择工艺' style={{ width: 375 }}> | |||
{ | |||
proList.map((item: MySelectType.Select) => { | |||
return <Select.Option value={item.key} key={item.key}> | |||
<span>{item.value}</span> | |||
</Select.Option> | |||
}) | |||
} | |||
</Select> | |||
</Form.Item> | |||
</Form> | |||
</Modal > | |||
</> | |||
); |