去除引用common.props
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.VisualDev;
|
||||
@@ -16,7 +13,6 @@ using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -26,7 +22,7 @@ namespace Tnb.EquipMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class AppEqpRepairApplyService : IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
public class AppEqpRepairApplyService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "28621611210261";
|
||||
private readonly ISqlSugarRepository<EqpRepairApply> _repository;
|
||||
@@ -46,43 +42,43 @@ namespace Tnb.EquipMgr
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : "";
|
||||
string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";
|
||||
string userId = _userManager.UserId;
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.apply_user_id == c.Id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>a.status==e.EnCode && d.Id==e.DictionaryTypeId)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c, d) => d.EnCode == DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => a.status == e.EnCode && d.Id == e.DictionaryTypeId)
|
||||
.WhereIF(!string.IsNullOrEmpty("code"), (a, b, c) => a.code.Contains(code))
|
||||
.WhereIF(!string.IsNullOrEmpty("name"), (a, b, c) => a.name.Contains(name))
|
||||
.Where((a, b, c) => a.repairer_id == userId)
|
||||
.Where((a, b, c) => a.status == "2" || a.status=="3")
|
||||
.Select((a, b, c,d,e) => new PdaRepairApplyListOutput
|
||||
.Where((a, b, c) => a.status == "2" || a.status == "3")
|
||||
.Select((a, b, c, d, e) => new PdaRepairApplyListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
equip_id = b.code+"/"+b.name,
|
||||
equip_id = b.code + "/" + b.name,
|
||||
equip_id_id = a.equip_id,
|
||||
expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||
is_ugent = a.is_ugent==null ? "" : a.is_ugent==0 ? "否" : "是",
|
||||
expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||
is_ugent = a.is_ugent == null ? "" : a.is_ugent == 0 ? "否" : "是",
|
||||
description = a.description,
|
||||
status = e.FullName,
|
||||
apply_user_id = SqlFunc.IsNull(c.RealName,"异常停机"),
|
||||
apply_user_id = SqlFunc.IsNull(c.RealName, "异常停机"),
|
||||
apply_user_id_id = a.create_id,
|
||||
// repairer_id = c.RealName,
|
||||
// repairer_id_id = a.repairer_id,
|
||||
}).ToPagedListAsync(input.currentPage,input.pageSize);
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<PdaRepairApplyListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取维修相关信息
|
||||
@@ -90,7 +86,7 @@ namespace Tnb.EquipMgr
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetRepairInfoById(Dictionary<string,string> dic)
|
||||
public async Task<dynamic> GetRepairInfoById(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic.ContainsKey("id") ? dic["id"] : "";
|
||||
if (string.IsNullOrEmpty(id)) return null;
|
||||
@@ -106,7 +102,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = a.equip_id,
|
||||
equip_code = b.code,
|
||||
equip_name = b.name,
|
||||
expect_complete_time = a.expect_complete_time==null?"":a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||
expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"),
|
||||
is_ugent = a.is_ugent,
|
||||
description = a.description,
|
||||
status = a.status,
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.FriendlyException;
|
||||
using Mapster;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Mapster;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Extension;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -75,7 +68,7 @@ namespace Tnb.EquipMgr
|
||||
var itemIds = await _db.Queryable<TRelaction>().Where(masterFilterExp).Select(masterSelector).ToListAsync();
|
||||
if (itemIds?.Count > 0)
|
||||
{
|
||||
var items = await _db.Queryable<TDest>().Where(it=>itemIds.Contains(it.id)).ToListAsync();
|
||||
var items = await _db.Queryable<TDest>().Where(it => itemIds.Contains(it.id)).ToListAsync();
|
||||
list = items.Adapt<List<TOutput>>();
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -6,10 +6,10 @@ using JNPF.Systems.Entitys.Permission;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -34,29 +34,29 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string>? queryJson = new Dictionary<string, string>();
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpDaq>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.create_id==b.Id)
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("data_source"),a=>a.data_source==queryJson!["data_source"])
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_name"),a=>a.label_name.Contains(queryJson!["label_name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_point"),a=>a.label_point.Contains(queryJson!["label_point"]))
|
||||
.Select((a,b) => new EquipDaqQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||
.WhereIF(input != null, a => a.equip_id == input!.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("data_source"), a => a.data_source == queryJson!["data_source"])
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("label_name"), a => a.label_name.Contains(queryJson!["label_name"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("label_point"), a => a.label_point.Contains(queryJson!["label_point"]))
|
||||
.Select((a, b) => new EquipDaqQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
data_source = a.data_source,
|
||||
create_id = b.RealName,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
data_type = a.data_type,
|
||||
enabled = a.enabled==1 ? "是" : "否",
|
||||
enabled = a.enabled == 1 ? "是" : "否",
|
||||
equip_id = a.equip_id,
|
||||
label_name = a.label_name,
|
||||
label_point = a.label_point,
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EquipDaqQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Models;
|
||||
@@ -9,12 +8,6 @@ using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Common;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.Common;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
@@ -45,13 +38,13 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Upload([FromForm]string equip_id,[FromForm] ChunkModel input)
|
||||
public async Task<string> Upload([FromForm] string equip_id, [FromForm] ChunkModel input)
|
||||
{
|
||||
string msg = "";
|
||||
try
|
||||
{
|
||||
var attachment = await _fileService.Uploader("annexpic", input);
|
||||
|
||||
|
||||
EqpEquipFile eqpEquipFile = new EqpEquipFile()
|
||||
{
|
||||
file_name = input.file.FileName,
|
||||
@@ -85,21 +78,21 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpEquipFile>()
|
||||
.LeftJoin<UserEntity >((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("file_name"),(a,b,c,d)=>a.file_name.Contains(queryJson!["file_name"]))
|
||||
.Select((a, b, c,d) => new EquipFileQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
|
||||
.Where((a, b, c, d) => a.equip_id == input.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("file_name"), (a, b, c, d) => a.file_name.Contains(queryJson!["file_name"]))
|
||||
.Select((a, b, c, d) => new EquipFileQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_id = b.RealName,
|
||||
create_id_id = a.create_id,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id=d.name,
|
||||
equip_id_id= a.equip_id,
|
||||
file_name=a.file_name,
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id = d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
file_name = a.file_name,
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipFileQueryOutput>.SqlSugarPageResult(result);
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -51,10 +45,10 @@ namespace Tnb.EquipMgr
|
||||
await db.Updateable<EqpEquipment>().SetColumns(x => x.life == EquipmentLife.SCRAP)
|
||||
.Where(x => x.id == eqpEquipScrap.equip_id).ExecuteCommandAsync();
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
return result.IsSuccess ? "报废成功" : result.ErrorMessage;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@ using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
@@ -67,13 +66,13 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpEquipSpareParts>()
|
||||
.LeftJoin<EqpSpareParts>((a,b)=>a.spare_parts_id==b.id)
|
||||
.LeftJoin<EqpSpareParts>((a, b) => a.spare_parts_id == b.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b,c,d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>b.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>b.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c,d) => new EquipSparePartsQueryOutput
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode)
|
||||
.Where((a, b, c, d) => a.equip_id == input.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("code"), (a, b, c, d) => b.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("name"), (a, b, c, d) => b.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c, d) => new EquipSparePartsQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
type_code = d.EnCode,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -15,7 +14,7 @@ namespace Tnb.EquipMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient
|
||||
public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpMaintainTemEquipH> _repository;
|
||||
|
||||
@@ -29,7 +28,7 @@ namespace Tnb.EquipMgr
|
||||
public async Task Stop(Dictionary<string, string> parameters)
|
||||
{
|
||||
string id = parameters["id"];
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpMaintainTemEquipH()
|
||||
{
|
||||
@@ -40,13 +39,13 @@ namespace Tnb.EquipMgr
|
||||
.Select(x => x.id).ToListAsync();
|
||||
await _repository.AsSugarClient().Deleteable<EqpMaintainRecordH>()
|
||||
.Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync();
|
||||
|
||||
|
||||
await _repository.AsSugarClient().Deleteable<EqpMaintainRecordD>()
|
||||
.Where(x => ids.Contains(x.maintain_record_id)).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace Tnb.EquipMgr
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据模板id发布到设备
|
||||
/// </summary>
|
||||
@@ -37,10 +37,10 @@ namespace Tnb.EquipMgr
|
||||
public async Task<string> Publish(SpotInsTemPublishInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpMaintainTemH eqpMaintainTemH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
List<EqpMaintainTemD> eqpMaintainTemDs = await db.Queryable<EqpMaintainTemD>().Where(x=>x.maintain_tem_id==input.id).ToListAsync();
|
||||
List<EqpMaintainTemD> eqpMaintainTemDs = await db.Queryable<EqpMaintainTemD>().Where(x => x.maintain_tem_id == input.id).ToListAsync();
|
||||
|
||||
if (input.equipIds != null && input.equipIds.Length > 0)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = id,
|
||||
code = code,
|
||||
name = eqpMaintainTemH.name+equipId,
|
||||
name = eqpMaintainTemH.name + equipId,
|
||||
plan_cycle = eqpMaintainTemH.plan_cycle,
|
||||
plan_cycle_unit = eqpMaintainTemH.plan_cycle_unit,
|
||||
plan_run_notice = eqpMaintainTemH.plan_run_notice,
|
||||
@@ -92,26 +92,26 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
EqpMaintainTemEquipH oldMaintainTemEquipH = await db.Queryable<EqpMaintainTemEquipH>().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).FirstAsync();
|
||||
await db.Deleteable<EqpMaintainTemEquipH>().Where(x => x.maintain_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync();
|
||||
if(oldMaintainTemEquipH!=null)
|
||||
await db.Deleteable<EqpMaintainTemEquipD>().Where(x => x.maintain_tem_equip_id==oldMaintainTemEquipH.id).ExecuteCommandAsync();
|
||||
await db.Deleteable<EqpMaintainTemEquipH>().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync();
|
||||
if (oldMaintainTemEquipH != null)
|
||||
await db.Deleteable<EqpMaintainTemEquipD>().Where(x => x.maintain_tem_equip_id == oldMaintainTemEquipH.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (insertEqpMaintainTemEquipHs != null && insertEqpMaintainTemEquipHs.Count > 0)
|
||||
{
|
||||
await db.Insertable(insertEqpMaintainTemEquipHs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
if (insertEqpMaintainTemEquipDs != null && insertEqpMaintainTemEquipDs.Count > 0)
|
||||
{
|
||||
await db.Insertable(insertEqpMaintainTemEquipDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "发布成功" : result.ErrorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
@@ -10,9 +8,7 @@ using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
@@ -37,7 +33,7 @@ namespace Tnb.EquipMgr
|
||||
private readonly IRunService _runService;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||
@@ -53,45 +49,50 @@ namespace Tnb.EquipMgr
|
||||
_billRuleService = billRullService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
if (!input.data.ContainsKey("create_time"))
|
||||
{
|
||||
input.data.Add("create_time",DateTime.Now);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["create_time"]))
|
||||
input.data.Add("create_time", DateTime.Now);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["create_time"]))
|
||||
{
|
||||
input.data["create_time"] = DateTime.Now;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("create_id"))
|
||||
{
|
||||
input.data.Add("create_id",_userManager.UserId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["create_id"]))
|
||||
input.data.Add("create_id", _userManager.UserId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["create_id"]))
|
||||
{
|
||||
input.data["create_id"] = _userManager.UserId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("apply_user_id"))
|
||||
{
|
||||
input.data.Add("apply_user_id",_userManager.UserId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["apply_user_id"]))
|
||||
input.data.Add("apply_user_id", _userManager.UserId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["apply_user_id"]))
|
||||
{
|
||||
input.data["apply_user_id"] = _userManager.UserId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("org_id"))
|
||||
{
|
||||
input.data.Add("org_id",_userManager.GetUserInfo().Result.organizeId);
|
||||
}else if ( string.IsNullOrEmpty((string)input.data["org_id"]))
|
||||
input.data.Add("org_id", _userManager.GetUserInfo().Result.organizeId);
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["org_id"]))
|
||||
{
|
||||
input.data["org_id"] = _userManager.GetUserInfo().Result.organizeId;
|
||||
}
|
||||
|
||||
|
||||
if (!input.data.ContainsKey("code"))
|
||||
{
|
||||
input.data.Add("code",await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE));
|
||||
}else if (string.IsNullOrEmpty((string)input.data["code"]))
|
||||
input.data.Add("code", await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE));
|
||||
}
|
||||
else if (string.IsNullOrEmpty((string)input.data["code"]))
|
||||
{
|
||||
input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE);
|
||||
}
|
||||
@@ -100,7 +101,7 @@ namespace Tnb.EquipMgr
|
||||
eqpRepairApply.code = (string)input.data["code"];
|
||||
eqpRepairApply.name = (string)input.data["name"];
|
||||
eqpRepairApply.equip_id = (string)input.data["equip_id"];
|
||||
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"]!=null && input.data["expect_complete_time"].ToString()!="" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null;
|
||||
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null;
|
||||
eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"];
|
||||
eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null;
|
||||
eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"];
|
||||
@@ -111,7 +112,7 @@ namespace Tnb.EquipMgr
|
||||
eqpRepairApply.description = (string)input.data["description"];
|
||||
eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED;
|
||||
await _repository.InsertAsync(eqpRepairApply);
|
||||
|
||||
|
||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
// await _runService.Create(templateEntity, input);
|
||||
return await Task.FromResult(true);
|
||||
@@ -144,7 +145,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
string id = dic["id"];
|
||||
string repairerId = dic["repairerId"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED ||
|
||||
eqpRepairApply.status == RepairApplyStatus.REFUSE)
|
||||
{
|
||||
@@ -159,14 +160,14 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Receive(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
@@ -196,7 +197,7 @@ namespace Tnb.EquipMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
@@ -224,9 +225,9 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return "拒绝成功";
|
||||
}
|
||||
|
||||
@@ -236,17 +237,17 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyRegisterInput input)
|
||||
{
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.RECEIVED)
|
||||
{
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
{
|
||||
string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
fault_id = input.fault_id,
|
||||
@@ -272,7 +273,7 @@ namespace Tnb.EquipMgr
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -281,7 +282,7 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id);
|
||||
EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable<EqpRepairOutApply>().FirstAsync(x=>x.repair_apply_id==id);
|
||||
EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable<EqpRepairOutApply>().FirstAsync(x => x.repair_apply_id == id);
|
||||
|
||||
return new RepairApplyDetailOutput()
|
||||
{
|
||||
@@ -300,21 +301,21 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a,b,c) => new EquipRepairRecordQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.apply_user_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.repairer_id == c.Id)
|
||||
.Where(a => a.equip_id == input.equip_id)
|
||||
.OrderByDescending(a => a.create_time)
|
||||
.Select((a, b, c) => new EquipRepairRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
apply_user_id = b.RealName,
|
||||
is_ugent = a.is_ugent == 1 ? "是" : "否",
|
||||
description = a.description,
|
||||
repair_description = a.repair_description,
|
||||
complete_time = a.complete_time==null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM),
|
||||
complete_time = a.complete_time == null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM),
|
||||
repairer_id = c.RealName
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -332,11 +333,11 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
switch (input.status)
|
||||
{
|
||||
case "1" :
|
||||
case "1":
|
||||
statusList.Add(RepairApplyStatus.TOBEEXECUTED);
|
||||
statusList.Add(RepairApplyStatus.REFUSE);
|
||||
break;
|
||||
case "2" :
|
||||
case "2":
|
||||
statusList.Add(RepairApplyStatus.TOBERECEIVED);
|
||||
statusList.Add(RepairApplyStatus.RECEIVED);
|
||||
statusList.Add(RepairApplyStatus.OUTAPPLYAPPROVE);
|
||||
@@ -344,14 +345,14 @@ namespace Tnb.EquipMgr
|
||||
statusList.Add(RepairApplyStatus.APPROVENOTPASS);
|
||||
statusList.Add(RepairApplyStatus.TOBEOUTAPPLY);
|
||||
break;
|
||||
case "3" :
|
||||
case "3":
|
||||
statusList.Add(RepairApplyStatus.COMPLETED);
|
||||
statusList.Add(RepairApplyStatus.CLOSE);
|
||||
statusList.Add(RepairApplyStatus.REPEAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
@@ -361,40 +362,40 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d)=>a.equip_id==d.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c,d,e)=>e.EnCode==DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e,f)=>e.Id==f.DictionaryTypeId && a.status==f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info),(a,b,c,d)=>d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status),(a,b,c,d)=>statusList.Contains(a.status))
|
||||
.WhereIF(input.status=="3" && start_time!=null,a=>a.complete_time!=null && a.complete_time>=start_time)
|
||||
.WhereIF(input.status=="3" && end_time!=null,a=>a.complete_time!=null && a.complete_time<=end_time)
|
||||
.LeftJoin<UserEntity>((a, b) => a.apply_user_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.repairer_id == c.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c, d, e) => e.EnCode == DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => e.Id == f.DictionaryTypeId && a.status == f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info), (a, b, c, d) => d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status), (a, b, c, d) => statusList.Contains(a.status))
|
||||
.WhereIF(input.status == "3" && start_time != null, a => a.complete_time != null && a.complete_time >= start_time)
|
||||
.WhereIF(input.status == "3" && end_time != null, a => a.complete_time != null && a.complete_time <= end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a,b,c,d,e,f) => new PadRepairListOutput
|
||||
.Select((a, b, c, d, e, f) => new PadRepairListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = d.code+"/"+d.name,
|
||||
equip_id = d.code + "/" + d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
apply_user_id_id =b.Id,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
apply_user_id = b.RealName,
|
||||
apply_user_id_id = b.Id,
|
||||
is_ugent = a.is_ugent == 1 ? "是" : "否",
|
||||
description = a.description,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
complete_time = a.complete_time==null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
complete_time = a.complete_time == null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
repairer_id = c.RealName,
|
||||
repairer_id_id = c.Id,
|
||||
remark = a.remark,
|
||||
status = f.FullName
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||
|
||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<string> Delay(RepairDelayInput input)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x => x.id == input.repair_apply_id);
|
||||
EqpRepairDelay repairDelay = new EqpRepairDelay()
|
||||
@@ -59,7 +59,7 @@ namespace Tnb.EquipMgr
|
||||
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.WorkFlow.Interfaces.Service;
|
||||
using JNPF.WorkFlow.Service;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -45,19 +44,19 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
string id = dic["id"];
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x => x.id == id);
|
||||
return await _repository.GetSingleAsync(x => x.repair_apply_id==eqpRepairApply.id);
|
||||
return await _repository.GetSingleAsync(x => x.repair_apply_id == eqpRepairApply.id);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> OutApply(RepairOutApplyInput input)
|
||||
{
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x=>x.id==input.repair_apply_id);
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x => x.id == input.repair_apply_id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEOUTAPPLY ||
|
||||
eqpRepairApply.status == RepairApplyStatus.APPROVENOTPASS)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id;
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
@@ -94,14 +93,14 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
await db.Updateable<EqpRepairApply>()
|
||||
.SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
|
||||
.Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync();
|
||||
.SetColumns(x => x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
|
||||
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
@@ -125,20 +124,20 @@ namespace Tnb.EquipMgr
|
||||
{"remark",input.remark},
|
||||
{"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
var entity = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
if (entity != null)
|
||||
{
|
||||
|
||||
await _flowTaskService.Update("",new FlowTaskSubmitModel()
|
||||
|
||||
await _flowTaskService.Update("", new FlowTaskSubmitModel()
|
||||
{
|
||||
flowId = flowId,
|
||||
parentId = "0",
|
||||
id = entity?.flow_task_id??"",
|
||||
id = entity?.flow_task_id ?? "",
|
||||
formData = new JObject()
|
||||
{
|
||||
{"id",id},
|
||||
@@ -153,7 +152,7 @@ namespace Tnb.EquipMgr
|
||||
{"remark",input.remark},
|
||||
{"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -164,13 +163,13 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyOutRegisterInput input)
|
||||
{
|
||||
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
@@ -187,7 +186,7 @@ namespace Tnb.EquipMgr
|
||||
await db.Updateable<EqpRepairApply>().SetColumns(x => x.status == RepairApplyStatus.COMPLETED)
|
||||
.Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync();
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
return result.IsSuccess ? "登记成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using JNPF.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -7,7 +6,6 @@ using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -42,7 +40,8 @@ namespace Tnb.EquipMgr
|
||||
if (entity.warn_unit == "1")//月
|
||||
{
|
||||
entity.next_check_time = entity.end_time?.AddMonths(-entity.warm_time.Value);
|
||||
}else if (entity.warn_unit == "2")//天
|
||||
}
|
||||
else if (entity.warn_unit == "2")//天
|
||||
{
|
||||
entity.next_check_time = entity.end_time?.AddDays(-entity.warm_time.Value);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.ClearScript.Util.Web;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
@@ -24,7 +20,7 @@ namespace Tnb.EquipMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class EqpSparePartsRequisitionHService : IEqpSparePartsRequisitionHService, IOverideVisualDevService,IDynamicApiController, ITransient
|
||||
public class EqpSparePartsRequisitionHService : IEqpSparePartsRequisitionHService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "27338205223957";
|
||||
private readonly ISqlSugarRepository<EqpSparePartsRequisitionH> _repository;
|
||||
@@ -32,7 +28,7 @@ namespace Tnb.EquipMgr
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpSparePartsRequisitionHService(ISqlSugarRepository<EqpSparePartsRequisitionH> repository,
|
||||
@@ -43,12 +39,12 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRuleService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
@@ -73,15 +69,15 @@ namespace Tnb.EquipMgr
|
||||
|
||||
if (input.data.TryGetValue("tablefield120", out var value))
|
||||
{
|
||||
var details = value.ToObject<List<Dictionary<string,string>>>();
|
||||
var details = value.ToObject<List<Dictionary<string, string>>>();
|
||||
List<EqpEquipSpareParts> eqpSparePartsList = new List<EqpEquipSpareParts>();
|
||||
List<EqpSparePartsRequisitionD> eqpSparePartsRequisitionDs = new List<EqpSparePartsRequisitionD>(){};
|
||||
List<EqpSparePartsRequisitionD> eqpSparePartsRequisitionDs = new List<EqpSparePartsRequisitionD>() { };
|
||||
foreach (var detail in details)
|
||||
{
|
||||
string instockDetailId = detail.ContainsKey("instock_detail_id") ? detail["instock_detail_id"] : "";
|
||||
string sparePartsId = detail.ContainsKey("spare_parts_id") ? detail["spare_parts_id"] : "";
|
||||
int quantity = Convert.ToInt32(detail.ContainsKey("quantity") ? detail["quantity"] : "");
|
||||
|
||||
|
||||
eqpSparePartsRequisitionDs.Add(new EqpSparePartsRequisitionD
|
||||
{
|
||||
instock_detail_id = instockDetailId,
|
||||
@@ -90,7 +86,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = eqpSparePartsRequisitionH.equip_id,
|
||||
spare_parts_requisition_id = eqpSparePartsRequisitionH.id,
|
||||
});
|
||||
|
||||
|
||||
if (await db.Queryable<EqpSparePartsInstockD>()
|
||||
.AnyAsync(x => x.id == instockDetailId && (x.quantity - x.use_quantity - quantity) >= 0))
|
||||
{
|
||||
@@ -111,7 +107,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
throw new Exception("库存不够");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (eqpSparePartsRequisitionDs.Count > 0)
|
||||
@@ -124,7 +120,7 @@ namespace Tnb.EquipMgr
|
||||
await db.Insertable<EqpEquipSpareParts>(eqpSparePartsList).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
|
||||
@@ -4,12 +4,11 @@ using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -38,10 +37,10 @@ namespace Tnb.EquipMgr
|
||||
public async Task<string> Publish(SpotInsTemPublishInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpSpotInsTemH eqpSpotInsTemH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
List<EqpSpotInsTemD> eqpSpotInsTemDs = await db.Queryable<EqpSpotInsTemD>().Where(x=>x.spot_ins_tem_id==input.id).ToListAsync();
|
||||
List<EqpSpotInsTemD> eqpSpotInsTemDs = await db.Queryable<EqpSpotInsTemD>().Where(x => x.spot_ins_tem_id == input.id).ToListAsync();
|
||||
|
||||
if (input.equipIds != null && input.equipIds.Length > 0)
|
||||
{
|
||||
@@ -55,7 +54,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = id,
|
||||
code = code,
|
||||
name = eqpSpotInsTemH.name+equipId,
|
||||
name = eqpSpotInsTemH.name + equipId,
|
||||
plan_cycle = eqpSpotInsTemH.plan_cycle,
|
||||
plan_cycle_unit = eqpSpotInsTemH.plan_cycle_unit,
|
||||
plan_run_notice = eqpSpotInsTemH.plan_run_notice,
|
||||
@@ -93,26 +92,26 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
EqpSpotInsTemEquipH oldSpotInsTemEquipH = await db.Queryable<EqpSpotInsTemEquipH>().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).FirstAsync();
|
||||
await db.Deleteable<EqpSpotInsTemEquipH>().Where(x => x.spot_ins_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync();
|
||||
if(oldSpotInsTemEquipH!=null)
|
||||
await db.Deleteable<EqpSpotInsTemEquipD>().Where(x => x.spot_ins_tem_equip_id==oldSpotInsTemEquipH.id).ExecuteCommandAsync();
|
||||
await db.Deleteable<EqpSpotInsTemEquipH>().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync();
|
||||
if (oldSpotInsTemEquipH != null)
|
||||
await db.Deleteable<EqpSpotInsTemEquipD>().Where(x => x.spot_ins_tem_equip_id == oldSpotInsTemEquipH.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (insertEqpSpotInsTemEquipHs != null && insertEqpSpotInsTemEquipHs.Count > 0)
|
||||
{
|
||||
await db.Insertable(insertEqpSpotInsTemEquipHs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
if (insertEqpSpotInsTemEquipDs != null && insertEqpSpotInsTemEquipDs.Count > 0)
|
||||
{
|
||||
await db.Insertable(insertEqpSpotInsTemEquipDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "发布成功" : result.ErrorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,23 +39,23 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpSubEquip>()
|
||||
.LeftJoin<UserEntity >((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>a.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>a.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c,d) => new SubEquipQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.create_id == b.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c, d) => a.equip_id == d.id)
|
||||
.Where((a, b, c, d) => a.equip_id == input.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("code"), (a, b, c, d) => a.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("name"), (a, b, c, d) => a.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c, d) => new SubEquipQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
create_id = b.RealName,
|
||||
create_id_id = a.create_id,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id=d.name,
|
||||
equip_id_id= a.equip_id,
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
equip_id = d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
code = a.code,
|
||||
modify_id = c.RealName,
|
||||
modify_time = a.modify_time==null ? null : a.modify_time.Value.ToString("yyyy-MM-dd"),
|
||||
modify_time = a.modify_time == null ? null : a.modify_time.Value.ToString("yyyy-MM-dd"),
|
||||
name = a.name,
|
||||
org_id = a.org_id,
|
||||
specification = a.specification,
|
||||
|
||||
@@ -32,20 +32,20 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, string>? queryJson = new Dictionary<string, string>();
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input?.queryJson ?? "");
|
||||
}
|
||||
var result = await db.Queryable<EqpTechnologyParameter>()
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson!["name"]))
|
||||
.WhereIF(input != null, a => a.equip_id == input!.equip_id)
|
||||
.WhereIF(queryJson != null && queryJson.ContainsKey("name"), a => a.name.Contains(queryJson!["name"]))
|
||||
.Select(a => new EquipTechnologyParameterQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
name = a.name,
|
||||
definition = a.definition,
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EquipTechnologyParameterQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
@@ -40,11 +39,11 @@ namespace Tnb.EquipMgr
|
||||
// queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input?.queryJson ?? "");
|
||||
// }
|
||||
var result = await db.Queryable<EqpWorkshopChangeLog>()
|
||||
.LeftJoin<OrganizeEntity>((a,b)=>a.old_workshop_id==b.Id)
|
||||
.LeftJoin<OrganizeEntity>((a,b,c)=>a.new_workshop_id==c.Id)
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
.LeftJoin<OrganizeEntity>((a, b) => a.old_workshop_id == b.Id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.new_workshop_id == c.Id)
|
||||
.WhereIF(input != null, a => a.equip_id == input!.equip_id)
|
||||
//.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson["name"]))
|
||||
.Select((a,b,c) => new EquipWorkshopChangeQueryOutput
|
||||
.Select((a, b, c) => new EquipWorkshopChangeQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
old_workshop_id = b.FullName,
|
||||
@@ -52,8 +51,8 @@ namespace Tnb.EquipMgr
|
||||
old_installation_location = a.old_installation_location,
|
||||
new_installation_location = a.new_installation_location,
|
||||
remark = a.remark,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
}).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50));
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"),
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EquipWorkshopChangeQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
@@ -62,7 +61,7 @@ namespace Tnb.EquipMgr
|
||||
public async Task<dynamic> WorkshopChange(EquipWorkshopChangeInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpEquipment eqpEquipment = await db.Queryable<EqpEquipment>().SingleAsync(x => x.id == input.equip_id);
|
||||
|
||||
@@ -88,7 +87,7 @@ namespace Tnb.EquipMgr
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "迁移成功" : result.ErrorMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
@@ -9,7 +8,6 @@ using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -49,44 +47,45 @@ namespace Tnb.EquipMgr
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
|
||||
private async Task<object> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
Dictionary<string, object>? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : "";
|
||||
string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : "";
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
input.sort = "desc";
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
var list = await db.Queryable<EqpMaintainRecordH, EqpEquipment, UserEntity,UserEntity>((a, b, c,d) => new object[]
|
||||
|
||||
var list = await db.Queryable<EqpMaintainRecordH, EqpEquipment, UserEntity, UserEntity>((a, b, c, d) => new object[]
|
||||
{
|
||||
JoinType.Left, a.equip_id == b.id,
|
||||
JoinType.Left, a.execute_user_id == c.Id,
|
||||
JoinType.Left, a.repeat_user_id == d.Id,
|
||||
})
|
||||
.WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.execute_time>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.execute_time<=end_time)
|
||||
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo), (a, b, c) => b.code.Contains(equioInfo) || b.name.Contains(equioInfo))
|
||||
.WhereIF(status == "3" && start_time != null, a => a.execute_time >= start_time)
|
||||
.WhereIF(status == "3" && end_time != null, a => a.execute_time <= end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a, b, c,d) => new EqpMaintainRecordListOutput
|
||||
.Select((a, b, c, d) => new EqpMaintainRecordListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = b.code+"/"+b.name,
|
||||
equip_id = b.code + "/" + b.name,
|
||||
equip_id_id = a.equip_id,
|
||||
status = a.status,
|
||||
result = a.result=="1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result=="1" ? "合格" : "不合格",
|
||||
result = a.result == "1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result == "1" ? "合格" : "不合格",
|
||||
date_create_time = a.create_time,
|
||||
date_execute_time = a.execute_time,
|
||||
date_repeat_time = a.repeat_time,
|
||||
@@ -96,19 +95,19 @@ namespace Tnb.EquipMgr
|
||||
repeat_user_id_id = a.repeat_user_id,
|
||||
result_remark = a.result_remark,
|
||||
repeat_remark = a.repeat_remark,
|
||||
date_last_execute_time = SqlFunc.Subqueryable<EqpMaintainRecordH>().Where(x=>a.equip_id==x.equip_id && a.execute_time!=null).OrderByDesc(x=>x.execute_time).Select(x=>x.execute_time)
|
||||
date_last_execute_time = SqlFunc.Subqueryable<EqpMaintainRecordH>().Where(x => a.equip_id == x.equip_id && a.execute_time != null).OrderByDesc(x => x.execute_time).Select(x => x.execute_time)
|
||||
})
|
||||
.Mapper(a =>
|
||||
{
|
||||
a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成";
|
||||
a.status = a.status == "1" ? "待执行" : a.status == "2" ? "待复核" : "已完成";
|
||||
a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.execute_time = a.date_execute_time == null ? "" : a.date_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.last_execute_time = a.date_last_execute_time == null ? "" : a.date_last_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
})
|
||||
.ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EqpMaintainRecordListOutput>.SqlSugarPageResult(list);
|
||||
|
||||
return PageResult<EqpMaintainRecordListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,9 +117,9 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExecuteMaintain(SpotInsRecordExecuteInput input)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id);
|
||||
EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id);
|
||||
string status = "";
|
||||
if (eqpSpotInsRecordH.is_repeat == "1")
|
||||
{
|
||||
@@ -130,32 +129,32 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED;
|
||||
}
|
||||
await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
||||
{
|
||||
result = input.result,
|
||||
attachment = input.attachment,
|
||||
result_remark = input.result_remark,
|
||||
status = status,
|
||||
execute_time = DateTime.Now,
|
||||
execute_user_id = _userManager.UserId
|
||||
}, x => x.id == input.id);
|
||||
await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
||||
{
|
||||
result = input.result,
|
||||
attachment = input.attachment,
|
||||
result_remark = input.result_remark,
|
||||
status = status,
|
||||
execute_time = DateTime.Now,
|
||||
execute_user_id = _userManager.UserId
|
||||
}, x => x.id == input.id);
|
||||
|
||||
if (input != null && input.details != null)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpMaintainRecordD>()
|
||||
.SetColumns(x => x.result == item["result"])
|
||||
.SetColumnsIF(item.ContainsKey("maintain_descrip"), x => x.maintain_descrip == item["maintain_descrip"])
|
||||
.Where(x => x.id == item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
if (input != null && input.details != null)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpMaintainRecordD>()
|
||||
.SetColumns(x=>x.result==item["result"])
|
||||
.SetColumnsIF(item.ContainsKey("maintain_descrip"),x=>x.maintain_descrip==item["maintain_descrip"])
|
||||
.Where(x=>x.id==item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "执行成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -176,13 +175,14 @@ namespace Tnb.EquipMgr
|
||||
.Where((a, b) => a.EnCode == DictConst.EqpMaintainType)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
b.EnCode, b.FullName
|
||||
b.EnCode,
|
||||
b.FullName
|
||||
})
|
||||
.MergeTable()
|
||||
.ToDictionaryAsync(it => it.EnCode, it => it.FullName);
|
||||
eqpSpotInsRecordDs.ForEach(x =>
|
||||
{
|
||||
x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type]+"" : x.maintain_type;
|
||||
x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type] + "" : x.maintain_type;
|
||||
});
|
||||
MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput()
|
||||
{
|
||||
@@ -213,7 +213,7 @@ namespace Tnb.EquipMgr
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await db.Updateable<EqpMaintainRecordD>()
|
||||
.SetColumnsIF(item.ContainsKey("repeat_descrip"),x => x.repeat_descrip == item["repeat_descrip"])
|
||||
.SetColumnsIF(item.ContainsKey("repeat_descrip"), x => x.repeat_descrip == item["repeat_descrip"])
|
||||
.SetColumns(x => x.repeat_result == item["repeat_result"])
|
||||
.Where(x => x.id == item["id"]).ExecuteCommandAsync();
|
||||
}
|
||||
@@ -231,8 +231,8 @@ namespace Tnb.EquipMgr
|
||||
}, x => x.id == input.id);
|
||||
}
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "复核成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -246,44 +246,44 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpMaintainRecordH>()
|
||||
.LeftJoin<EqpEquipment>((a,b)=>a.equip_id==b.id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.execute_user_id==c.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c,d)=>a.repeat_user_id==d.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.Select((a,b,c,d) => new EquipMaintainRecordQueryOutput
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||
.LeftJoin<UserEntity>((a, b, c) => a.execute_user_id == c.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => a.repeat_user_id == d.Id)
|
||||
.Where(a => a.equip_id == input.equip_id)
|
||||
.Select((a, b, c, d) => new EquipMaintainRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = b.code,
|
||||
equip_id_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_result = a.repeat_result == "1" ? "合格" : "不合格",
|
||||
repeat_time = a.repeat_time == null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_user_id = d.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result = a.result == "1" ? "合格" : "不合格",
|
||||
result_remark = a.result_remark,
|
||||
maintain_tem_equip_id = a.maintain_tem_equip_id,
|
||||
execute_time = a.execute_time==null ? null : a.execute_time.Value.ToString(DbTimeFormat.MM),
|
||||
execute_time = a.execute_time == null ? null : a.execute_time.Value.ToString(DbTimeFormat.MM),
|
||||
execute_user_id = c.RealName,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipMaintainRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取保养相关信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEqpMaintainRecordInfoById(Dictionary<string,string> dic)
|
||||
public async Task<dynamic> GetEqpMaintainRecordInfoById(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic.ContainsKey("id") ? dic["id"] : "";
|
||||
if (string.IsNullOrEmpty(id)) return null;
|
||||
var db = _repository.AsSugarClient();
|
||||
return await db.Queryable<EqpMaintainRecordH>()
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id==b.id)
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||
.Where((a, b) => a.id == id)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
@@ -291,7 +291,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = a.equip_id,
|
||||
equip_code = b.code,
|
||||
equip_name = b.name,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
result_remark = a.result_remark,
|
||||
result = a.result,
|
||||
status = a.status,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
@@ -8,18 +7,15 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -54,11 +50,11 @@ namespace Tnb.EquipMgr
|
||||
private async Task<object> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
Dictionary<string, object>? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : "";
|
||||
string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : "";
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
string now = DateTime.Now.ToString("yyyy-MM-dd");
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
@@ -69,27 +65,27 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
var list = await db.Queryable<EqpSpotInsRecordH, EqpEquipment, UserEntity,UserEntity>((a, b, c,d) => new object[]
|
||||
|
||||
var list = await db.Queryable<EqpSpotInsRecordH, EqpEquipment, UserEntity, UserEntity>((a, b, c, d) => new object[]
|
||||
{
|
||||
JoinType.Left, a.equip_id == b.id,
|
||||
JoinType.Left, a.spot_record_user_id == c.Id,
|
||||
JoinType.Left, a.repeat_user_id == d.Id,
|
||||
})
|
||||
.WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.spot_record_date_time>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.spot_record_date_time<=end_time)
|
||||
.Where(a=>a.create_time.Value.ToString("yyyy-MM-dd")==now)
|
||||
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo), (a, b, c) => b.code.Contains(equioInfo) || b.name.Contains(equioInfo))
|
||||
.WhereIF(status == "3" && start_time != null, a => a.spot_record_date_time >= start_time)
|
||||
.WhereIF(status == "3" && end_time != null, a => a.spot_record_date_time <= end_time)
|
||||
.Where(a => a.create_time.Value.ToString("yyyy-MM-dd") == now)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a, b, c,d) => new EqpSpotInsRecordListOutput
|
||||
.Select((a, b, c, d) => new EqpSpotInsRecordListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = b.code+"/"+b.name,
|
||||
equip_id = b.code + "/" + b.name,
|
||||
equip_id_id = a.equip_id,
|
||||
status = a.status,
|
||||
result = a.result=="1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result=="1" ? "合格" : "不合格",
|
||||
result = a.result == "1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result == "1" ? "合格" : "不合格",
|
||||
date_create_time = a.create_time,
|
||||
date_spot_record_date_time = a.spot_record_date_time,
|
||||
date_repeat_time = a.repeat_time,
|
||||
@@ -100,14 +96,14 @@ namespace Tnb.EquipMgr
|
||||
})
|
||||
.Mapper(a =>
|
||||
{
|
||||
a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成";
|
||||
a.status = a.status == "1" ? "待执行" : a.status == "2" ? "待复核" : "已完成";
|
||||
a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.spot_record_date_time = a.date_spot_record_date_time == null ? "" : a.date_spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
})
|
||||
.ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EqpSpotInsRecordListOutput>.SqlSugarPageResult(list);
|
||||
|
||||
return PageResult<EqpSpotInsRecordListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,10 +113,10 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<dynamic> ExecuteSpotIns(SpotInsRecordExecuteInput input)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id);
|
||||
|
||||
EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id);
|
||||
|
||||
string status = "";
|
||||
if (eqpSpotInsRecordH.is_repeat == "1")
|
||||
{
|
||||
@@ -130,32 +126,32 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
status = SpotInsRecordExecutionStatus.COMPLETED;
|
||||
}
|
||||
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
{
|
||||
result = input.result,
|
||||
attachment = input.attachment,
|
||||
result_remark = input.result_remark,
|
||||
status = status,
|
||||
spot_record_date_time = DateTime.Now,
|
||||
spot_record_user_id = _userManager.UserId
|
||||
}, x => x.id == input.id);
|
||||
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||
{
|
||||
result = input.result,
|
||||
attachment = input.attachment,
|
||||
result_remark = input.result_remark,
|
||||
status = status,
|
||||
spot_record_date_time = DateTime.Now,
|
||||
spot_record_user_id = _userManager.UserId
|
||||
}, x => x.id == input.id);
|
||||
|
||||
if (input != null && input.details != null)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpSpotInsRecordD>().
|
||||
SetColumns(x => x.result == item["result"])
|
||||
.SetColumnsIF(item["judge_type"] == "1", x => x.real_value == Convert.ToDouble(item["real_value"]))
|
||||
.Where(x => x.id == item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
if(input!=null && input.details!=null)
|
||||
{
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpSpotInsRecordD>().
|
||||
SetColumns(x=>x.result==item["result"])
|
||||
.SetColumnsIF(item["judge_type"]=="1",x=>x.real_value==Convert.ToDouble(item["real_value"]))
|
||||
.Where(x=>x.id==item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "执行成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
@@ -211,41 +207,41 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||
}
|
||||
var result = await db.Queryable<EqpSpotInsRecordH>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.repeat_user_id==b.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.Select((a,b) => new EquipSpotInsRecordQueryOutput
|
||||
.LeftJoin<UserEntity>((a, b) => a.repeat_user_id == b.Id)
|
||||
.Where(a => a.equip_id == input.equip_id)
|
||||
.Select((a, b) => new EquipSpotInsRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_result = a.repeat_result == "1" ? "合格" : "不合格",
|
||||
repeat_time = a.repeat_time == null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_user_id = b.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result = a.result == "1" ? "合格" : "不合格",
|
||||
result_remark = a.result_remark,
|
||||
spot_ins_tem_equip_id = a.spot_ins_tem_equip_id,
|
||||
spot_record_date_time = a.spot_record_date_time==null ? null :a.spot_record_date_time.Value.ToString(DbTimeFormat.MM),
|
||||
spot_record_date_time = a.spot_record_date_time == null ? null : a.spot_record_date_time.Value.ToString(DbTimeFormat.MM),
|
||||
spot_record_user_id = a.spot_record_user_id,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipSpotInsRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据id获取点巡检相关信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEqpSpotInsRecordInfoById(Dictionary<string,string> dic)
|
||||
public async Task<dynamic> GetEqpSpotInsRecordInfoById(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic.ContainsKey("id") ? dic["id"] : "";
|
||||
if (string.IsNullOrEmpty(id)) return null;
|
||||
var db = _repository.AsSugarClient();
|
||||
return await db.Queryable<EqpSpotInsRecordH>()
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id==b.id)
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.equip_id == b.id)
|
||||
.Where((a, b) => a.id == id)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
@@ -253,7 +249,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = a.equip_id,
|
||||
equip_code = b.code,
|
||||
equip_name = b.name,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
result_remark = a.result_remark,
|
||||
result = a.result,
|
||||
status = a.status,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -15,7 +14,7 @@ namespace Tnb.EquipMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EquSpotInsTemEquipService : IEquSpotInsTemEquipService, IDynamicApiController, ITransient
|
||||
public class EquSpotInsTemEquipService : IEquSpotInsTemEquipService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<EqpSpotInsTemEquipH> _repository;
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace Tnb.EquipMgr
|
||||
public async Task Stop(Dictionary<string, string> parameters)
|
||||
{
|
||||
string id = parameters["id"];
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpSpotInsTemEquipH()
|
||||
{
|
||||
@@ -39,13 +38,13 @@ namespace Tnb.EquipMgr
|
||||
.Select(x => x.id).ToListAsync();
|
||||
await _repository.AsSugarClient().Deleteable<EqpSpotInsRecordH>()
|
||||
.Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync();
|
||||
|
||||
|
||||
await _repository.AsSugarClient().Deleteable<EqpSpotInsRecordD>()
|
||||
.Where(x => ids.Contains(x.spot_ins_record_id)).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,21 @@
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Models;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Senparc.NeuChar.ApiHandlers;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.BasicData.Entities;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -75,7 +68,7 @@ namespace Tnb.EquipMgr
|
||||
id = it.id,
|
||||
eqp_code = it.code,
|
||||
eqp_name = it.name,
|
||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(x=>x.id == it.equip_type_id).Select(x=>x.code),
|
||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(x => x.id == it.equip_type_id).Select(x => x.code),
|
||||
//accept_status = it.accept_status,
|
||||
//supplier_code = it.supplier_code,
|
||||
install_date = it.install_date,
|
||||
@@ -86,7 +79,7 @@ namespace Tnb.EquipMgr
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return pagedList;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"]?.ToString() : "";
|
||||
@@ -98,7 +91,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
|
||||
|
||||
string equipId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
@@ -117,18 +110,18 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
private async Task<dynamic> Update(string id,VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
|
||||
private async Task<dynamic> Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"]?.ToString() : "";
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id!=id))
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id))
|
||||
{
|
||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Update(id,templateEntity, visualDevModelDataUpInput);
|
||||
await _runService.Update(id, templateEntity, visualDevModelDataUpInput);
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
{
|
||||
@@ -157,7 +150,7 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpEquipment> GetEntityById(Dictionary<string,string> dic)
|
||||
public async Task<EqpEquipment> GetEntityById(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
return await _repository.GetSingleAsync(x => x.id == id);
|
||||
@@ -173,24 +166,24 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetWorklineAndEquipTree(Dictionary<string,string> dic)
|
||||
public async Task<dynamic> GetWorklineAndEquipTree(Dictionary<string, string> dic)
|
||||
{
|
||||
string equipTypes = dic.ContainsKey("equipTypes") ? dic["equipTypes"] : "";
|
||||
var db = _repository.AsSugarClient();
|
||||
var queryable1 = db.Queryable<OrganizeEntity>()
|
||||
.Where((a) => a.DeleteMark == null && a.Category==DictConst.RegionCategoryWorkshopCode)
|
||||
.Where((a) => a.DeleteMark == null && a.Category == DictConst.RegionCategoryWorkshopCode)
|
||||
.Select((a) => new WorklineAndEquipTreeOutput()
|
||||
{
|
||||
id = a.Id,
|
||||
title = a.EnCode+"/"+a.FullName,
|
||||
title = a.EnCode + "/" + a.FullName,
|
||||
parentId = "0",
|
||||
hasChildren = SqlFunc.Subqueryable<OrganizeEntity>().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).Any(),
|
||||
num = SqlFunc.Subqueryable<OrganizeEntity>().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).Count(),
|
||||
hasChildren = SqlFunc.Subqueryable<OrganizeEntity>().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).Any(),
|
||||
num = SqlFunc.Subqueryable<OrganizeEntity>().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).Count(),
|
||||
isLeaf = false,
|
||||
children = SqlFunc.Subqueryable<OrganizeEntity>().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).ToList(b=>new WorklineAndEquipTreeOutput()
|
||||
children = SqlFunc.Subqueryable<OrganizeEntity>().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).ToList(b => new WorklineAndEquipTreeOutput()
|
||||
{
|
||||
id = b.Id,
|
||||
title = b.EnCode+"/"+b.FullName,
|
||||
title = b.EnCode + "/" + b.FullName,
|
||||
parentId = b.ParentId,
|
||||
hasChildren = false,
|
||||
num = 0,
|
||||
@@ -209,31 +202,31 @@ namespace Tnb.EquipMgr
|
||||
id = a.id,
|
||||
title = a.name,
|
||||
parentId = "0",
|
||||
hasChildren = SqlFunc.Subqueryable<EqpEquipment>().Where(b=>b.equip_type_id==a.id).Any(),
|
||||
num = SqlFunc.Subqueryable<EqpEquipment>().Where(b=>b.equip_type_id==a.id).Count(),
|
||||
hasChildren = SqlFunc.Subqueryable<EqpEquipment>().Where(b => b.equip_type_id == a.id).Any(),
|
||||
num = SqlFunc.Subqueryable<EqpEquipment>().Where(b => b.equip_type_id == a.id).Count(),
|
||||
isLeaf = false,
|
||||
children = SqlFunc.Subqueryable<EqpEquipment>().Where(b=>b.equip_type_id==a.id).ToList(b=>new WorklineAndEquipTreeOutput()
|
||||
children = SqlFunc.Subqueryable<EqpEquipment>().Where(b => b.equip_type_id == a.id).ToList(b => new WorklineAndEquipTreeOutput()
|
||||
{
|
||||
id = b.id,
|
||||
title = b.code+"/"+b.name,
|
||||
title = b.code + "/" + b.name,
|
||||
parentId = b.equip_type_id,
|
||||
hasChildren = false,
|
||||
num = 0,
|
||||
isLeaf = true,
|
||||
})
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// var list = await db.UnionAll(queryable1, queryable2).ToListAsync();
|
||||
var list1 = await queryable1.ToListAsync();
|
||||
list1.AddRange(list2);
|
||||
return new AuthResponse(200, "", new Dictionary<string,object>()
|
||||
return new AuthResponse(200, "", new Dictionary<string, object>()
|
||||
{
|
||||
["list"] = list1,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<EqpEquipment> GetEntityByQrcode(Dictionary<string, string> dic)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
public class MoldMaintainBaseService
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.ClayObject.Extensions;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -26,7 +20,7 @@ namespace Tnb.EquipMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class ToolMoldLocationService : IToolMoldLocationService,IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
public class ToolMoldLocationService : IToolMoldLocationService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
private const string ModuleId = "27207685649173";
|
||||
@@ -50,7 +44,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
return await _db.Queryable<ToolLocation>().ToDictionaryAsync(x => x.id, x => x.location_code);
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : "";
|
||||
@@ -62,7 +56,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
|
||||
|
||||
string id = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
@@ -81,18 +75,18 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
private async Task<dynamic> Update(string id,VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
|
||||
private async Task<dynamic> Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput)
|
||||
{
|
||||
string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : "";
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id!=id))
|
||||
if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable<BasQrcode>().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id))
|
||||
{
|
||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||
}
|
||||
else
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Update(id,templateEntity, visualDevModelDataUpInput);
|
||||
await _runService.Update(id, templateEntity, visualDevModelDataUpInput);
|
||||
|
||||
if (!string.IsNullOrEmpty(qrcode))
|
||||
{
|
||||
|
||||
@@ -1,26 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using System.Linq.Expressions;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using JNPF.Common.Contracts;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Senparc.Weixin.MP.AdvancedAPIs.GroupMessage;
|
||||
using Aop.Api.Domain;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -14,7 +8,6 @@ using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Spire.Pdf.Widget;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
@@ -21,15 +11,10 @@ using JNPF.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys.Model;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -44,7 +29,7 @@ namespace Tnb.EquipMgr
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class ToolMoldMaintainRuleService : IOverideVisualDevService, IToolMoldMaintainRuleService, IDynamicApiController, ITransient
|
||||
{
|
||||
|
||||
|
||||
private const string ModuleId = "26164864904981";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
@@ -74,13 +59,13 @@ namespace Tnb.EquipMgr
|
||||
toolMoldMaintainRule.cycle = cycle;
|
||||
toolMoldMaintainRule.startandend_date = startTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
toolMoldMaintainRule.create_id = _userManager.UserId;
|
||||
toolMoldMaintainRule.create_time=DateTime.Now;
|
||||
toolMoldMaintainRule.create_time = DateTime.Now;
|
||||
await _db.Insertable(toolMoldMaintainRule).ExecuteCommandAsync();
|
||||
if (toolMoldMaintainRule.mode == "27118635748885")
|
||||
{
|
||||
string id = toolMoldMaintainRule.id;
|
||||
var comtentModel = new ContentModel();
|
||||
comtentModel.cron = "0 0 9 "+ startTime.Day + "/"+ toolMoldMaintainRule.cycle + " * ?";
|
||||
comtentModel.cron = "0 0 9 " + startTime.Day + "/" + toolMoldMaintainRule.cycle + " * ?";
|
||||
comtentModel.interfaceId = "";
|
||||
comtentModel.interfaceName = "";
|
||||
comtentModel.parameter = new List<InterfaceParameter>();
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reactive.Joins;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using Aspose.Words;
|
||||
using DingTalk.Api.Request;
|
||||
using System.Dynamic;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -21,9 +9,7 @@ using JNPF.Logging;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using StackExchange.Profiling.Internal;
|
||||
using Tnb.BasicData;
|
||||
@@ -65,13 +51,13 @@ namespace Tnb.EquipMgr
|
||||
var planMoldRelations = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)//ToolMoldMaintainPlan
|
||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||
.LeftJoin<ToolMoldMaintainRunRecord>((a, b, c,d) => d.plan_code == b.plan_code&&d.mold_code==c.mold_code)
|
||||
.LeftJoin<ToolMoldMaintainRunRecord>((a, b, c, d) => d.plan_code == b.plan_code && d.mold_code == c.mold_code)
|
||||
.Where(a => a.maintain_plan_id == planId)
|
||||
.Select((a, b, c,d) => new
|
||||
.Select((a, b, c, d) => new
|
||||
{
|
||||
mold_id = a.mold_id,
|
||||
plan_start_time = d.plan_start_time,
|
||||
designer=d.designer
|
||||
designer = d.designer
|
||||
})
|
||||
.ToListAsync();
|
||||
var moldids = planMoldRelations.Select(x => x.mold_id).ToList();
|
||||
@@ -117,7 +103,7 @@ namespace Tnb.EquipMgr
|
||||
var dic = await _db.Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == "26149299883285").ToListAsync();
|
||||
var users = await _db.Queryable<UserEntity>().ToListAsync();
|
||||
var records = _db.Queryable<ToolMoldMaintainItemRecord>().ToList();
|
||||
var runrecords = _db.Queryable<ToolMoldMaintainRunRecord>().ToList();
|
||||
var runrecords = _db.Queryable<ToolMoldMaintainRunRecord>().ToList();
|
||||
foreach (var plan in plans)
|
||||
{
|
||||
var planMoldRelations = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
@@ -154,14 +140,14 @@ namespace Tnb.EquipMgr
|
||||
info.maintain_qty = mold.maintain_qty;
|
||||
info.plan_start_time = plan.plan_start_date == null ? "" : ((DateTime)plan.plan_start_date!).ToString("yyyy-MM-dd");
|
||||
info.createtime = plan.create_time == null ? "" : ((DateTime)plan.create_time).ToString("yyyy-MM-dd");
|
||||
info.status = records.Where(p=>p.mold_id== mold.id&&p.plan_id== plan.id).Any()? "已完成" : "待保养";//plan.status == "UnMaintain" ? "待保养" : "已完成";
|
||||
info.status = records.Where(p => p.mold_id == mold.id && p.plan_id == plan.id).Any() ? "已完成" : "待保养";//plan.status == "UnMaintain" ? "待保养" : "已完成";
|
||||
info.createuser = string.IsNullOrEmpty(plan.create_id) ? "" : users.Where(p => p.Id == plan.create_id).First().RealName;
|
||||
info.plan_id = plan.id;
|
||||
info.starttime = "";
|
||||
if (runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).Any())
|
||||
{
|
||||
var run = runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).First();
|
||||
info.starttime = run.plan_start_time!=null? ((DateTime)run.plan_start_time).ToString("yyyy-MM-dd") : "";
|
||||
info.starttime = run.plan_start_time != null ? ((DateTime)run.plan_start_time).ToString("yyyy-MM-dd") : "";
|
||||
}
|
||||
var moldEqpRelation = ToolMoldsEquipments.Where(it => it.mold_id == mold.id).FirstOrDefault();
|
||||
if (moldEqpRelation != null)
|
||||
@@ -203,13 +189,13 @@ namespace Tnb.EquipMgr
|
||||
input.sidx = "b." + input.sidx;
|
||||
}
|
||||
var records = await _db.Queryable<ToolMoldMaintainItemRecord>().Select(p => p.plan_id + p.mold_id).ToListAsync();
|
||||
var result= await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
var result = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)
|
||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||
.LeftJoin<ToolMoldMaintainRunRecord>((a, b, c, d) => b.plan_code == d.plan_code && c.mold_code == d.mold_code)
|
||||
.LeftJoin<ToolMoldMaintainItemRecord>((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e, f) => b.create_id == f.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f,g) => c.mold_status == g.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g) => c.mold_status == g.Id)
|
||||
.Where((a, b, c, d, e, f) => b.create_time != null)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f, g) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info))
|
||||
.WhereIF(start_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time >= start_time)
|
||||
@@ -222,7 +208,7 @@ namespace Tnb.EquipMgr
|
||||
mold_id = c.id,
|
||||
mold_code = c.mold_code!,
|
||||
mold_name = c.mold_name!,
|
||||
mold_status=g.FullName!,
|
||||
mold_status = g.FullName!,
|
||||
status = input.status,
|
||||
createuser = f.RealName,
|
||||
createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
@@ -276,7 +262,7 @@ namespace Tnb.EquipMgr
|
||||
})
|
||||
.ToListAsync();
|
||||
//新增功能
|
||||
var ToolMoldMaintainPlanRelation= _db.Queryable<ToolMoldMaintainPlanRelation>().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id&& !string.IsNullOrEmpty(a.group_id)).First();
|
||||
var ToolMoldMaintainPlanRelation = _db.Queryable<ToolMoldMaintainPlanRelation>().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First();
|
||||
if (ToolMoldMaintainPlanRelation != null)
|
||||
items = items.Where(a => a.item_group_id == ToolMoldMaintainPlanRelation.group_id).ToList();
|
||||
var checkItems = await _db.Queryable<ToolMoldMaintainItemRecord>().Where(it => it.plan_id == input.plan_id && it.mold_id == input.mold_id).Select(it => new
|
||||
@@ -315,10 +301,10 @@ namespace Tnb.EquipMgr
|
||||
public async Task MaintainStart(MoldMaintainRunUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
var flag= _db.Queryable<ToolMoldMaintainRunRecord>()
|
||||
var flag = _db.Queryable<ToolMoldMaintainRunRecord>()
|
||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.plan_code == b.plan_code)
|
||||
.LeftJoin<ToolMolds>((a,b,c)=>a.mold_code==c.mold_code)
|
||||
.Where((a,b,c)=>b.id== input.plan_id&&c.id==input.mold_id).Any();
|
||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_code == c.mold_code)
|
||||
.Where((a, b, c) => b.id == input.plan_id && c.id == input.mold_id).Any();
|
||||
if (flag)
|
||||
{
|
||||
return;
|
||||
@@ -348,13 +334,13 @@ namespace Tnb.EquipMgr
|
||||
record.designer_time = DateTime.Now;
|
||||
record.mold_code = mold.mold_code;
|
||||
record.mold_name = mold.mold_name;
|
||||
record.plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now :DateTime.Parse(input.starttime);
|
||||
record.plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now : DateTime.Parse(input.starttime);
|
||||
var row = await _db.Insertable(record).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
|
||||
var groupids = _db.Queryable<ToolMoldMaintainPlanRelation>().Where(a => !string.IsNullOrEmpty(a.group_id) && a.mold_id == input.mold_id && a.maintain_plan_id == input.plan_id).ToList().Select(p => p.group_id);
|
||||
|
||||
|
||||
/*
|
||||
var maintainInfos = await _db.Queryable<ToolMoldMaintainGroupRelation>()
|
||||
.LeftJoin<ToolMoldMaintainGroup>((a, b) => a.item_group_id == b.id)
|
||||
@@ -500,7 +486,7 @@ namespace Tnb.EquipMgr
|
||||
}).ToListAsync();
|
||||
var dicCheckItems = checkItems.GroupBy(g => $"{g.plan_id}{g.mold_id}{g.item_group_id}{g.item_id}").ToDictionary(x => x.Key, x => x.FirstOrDefault());
|
||||
var maintainedItems = items.Where(it => dicCheckItems.ContainsKey($"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}") && dicCheckItems[$"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}"] != null).ToList();
|
||||
if ((items?.Count > 0 && maintainedItems?.Count > 0 )|| (maintainedItems == null || maintainedItems.Count < 1))
|
||||
if ((items?.Count > 0 && maintainedItems?.Count > 0) || (maintainedItems == null || maintainedItems.Count < 1))
|
||||
{
|
||||
if (maintainedItems.Count < items.Count || (maintainedItems == null || maintainedItems.Count < 1))
|
||||
{
|
||||
|
||||
@@ -1,11 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -15,9 +8,7 @@ using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Entities.Enums;
|
||||
@@ -69,11 +60,11 @@ namespace Tnb.EquipMgr
|
||||
var pair = row[nameof(ToolMoldMaintainTask.mold_id)];
|
||||
if (pair.IsNotEmptyOrNull())
|
||||
{
|
||||
if(_dicMold.TryGetValue(pair.ToString(),out var multi))
|
||||
if (_dicMold.TryGetValue(pair.ToString(), out var multi))
|
||||
{
|
||||
row[nameof(ToolMoldMaintainTask.mold_id)] = $"{multi.code}/{multi.name}";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
@@ -33,13 +27,12 @@ namespace Tnb.EquipMgr
|
||||
/// <summary>
|
||||
/// 根据模具id获取物料集合
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<MaterialListOutput>> GetMaterialLists(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var list = await db.Queryable<BasMaterial, ToolMoldsMaterial>((a, b) => new object[]
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
List<MaterialListOutput> list = await db.Queryable<BasMaterial, ToolMoldsMaterial>((a, b) => new object[]
|
||||
{
|
||||
JoinType.Inner, a.id == b.material_id,
|
||||
})
|
||||
@@ -49,7 +42,7 @@ namespace Tnb.EquipMgr
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
material_group=b.material_group,
|
||||
material_group = b.material_group,
|
||||
real_cavity_qty = b.real_cavity_qty.HasValue ? b.real_cavity_qty.Value : 0
|
||||
}).ToListAsync();
|
||||
return list;
|
||||
@@ -57,105 +50,93 @@ namespace Tnb.EquipMgr
|
||||
/// <summary>
|
||||
/// 增加模具物料绑定
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productid"></param>
|
||||
/// <param name="real_cavity_qty"></param>
|
||||
/// <param name="ToolMoldInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveData(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var ToolMoldsProduct= await _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(p=>p.mold_id== ToolMoldInput.mold&&p.material_id== ToolMoldInput.materialid).FirstAsync();
|
||||
ToolMoldsMaterial ToolMoldsProduct = await _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(p => p.mold_id == ToolMoldInput.mold && p.material_id == ToolMoldInput.materialid).FirstAsync();
|
||||
if (ToolMoldsProduct == null)
|
||||
{
|
||||
var entity = new ToolMoldsMaterial();
|
||||
entity.id = SnowflakeIdHelper.NextId();
|
||||
entity.mold_id = ToolMoldInput.mold;
|
||||
entity.material_id = ToolMoldInput.materialid;
|
||||
entity.real_cavity_qty = ToolMoldInput.real_cavity_qty;
|
||||
entity.create_time = DateTime.Now;
|
||||
entity.create_id = _userManager.UserId;
|
||||
await _repository.AsSugarClient().Insertable<ToolMoldsMaterial>(entity).ExecuteCommandAsync();
|
||||
ToolMoldsMaterial entity = new()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
mold_id = ToolMoldInput.mold,
|
||||
material_id = ToolMoldInput.materialid,
|
||||
real_cavity_qty = ToolMoldInput.real_cavity_qty,
|
||||
create_time = DateTime.Now,
|
||||
create_id = _userManager.UserId
|
||||
};
|
||||
_ = await _repository.AsSugarClient().Insertable<ToolMoldsMaterial>(entity).ExecuteCommandAsync();
|
||||
}
|
||||
else {
|
||||
ToolMoldsProduct.real_cavity_qty= ToolMoldInput.real_cavity_qty;
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(ToolMoldsProduct).ExecuteCommandAsync();
|
||||
else
|
||||
{
|
||||
ToolMoldsProduct.real_cavity_qty = ToolMoldInput.real_cavity_qty;
|
||||
_ = await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(ToolMoldsProduct).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||
|
||||
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量删除模具物料绑定
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> DetachMoldData(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
List<ToolMoldsMaterial> arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
_ = await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// 物料同组
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveMaterialGroup(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
var sign = SnowflakeIdHelper.NextId();
|
||||
List<ToolMoldsMaterial> arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
string sign = SnowflakeIdHelper.NextId();
|
||||
arr.ForEach(p => { p.material_group = sign; });
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消物料同组
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> CancelMaterialGroup(ToolMoldInput ToolMoldInput)
|
||||
public async Task<dynamic> CancelMaterialGroup(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
List<ToolMoldsMaterial> arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
arr.ForEach(p => { p.material_group = string.Empty; });
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据物料id获取模具集合
|
||||
/// </summary>
|
||||
/// <param name="productid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<MoldListOutput>> GetMoldLists(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var list = await db.Queryable<ToolMolds, ToolMoldsMaterial>((a, b) => new object[]
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
List<MoldListOutput> list = await db.Queryable<ToolMolds, ToolMoldsMaterial>((a, b) => new object[]
|
||||
{
|
||||
JoinType.Inner, a.id == b.mold_id,
|
||||
})
|
||||
@@ -173,19 +154,17 @@ namespace Tnb.EquipMgr
|
||||
/// <summary>
|
||||
/// 批量删除物料模具绑定
|
||||
/// </summary>
|
||||
/// <param name="molds"></param>
|
||||
/// <param name="productid"></param>
|
||||
/// <param name="ToolMoldInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> DetachMaterialData(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
List<ToolMoldsMaterial> arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList();
|
||||
_ = await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Dynamic;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
@@ -15,7 +14,6 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -57,42 +55,42 @@ namespace Tnb.EquipMgr
|
||||
string? requisitionCode = "";
|
||||
DateTime[] requisitionTimeArr = null;
|
||||
DateTime[] estimatedReturnArr = null;
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
if (input != null && !string.IsNullOrEmpty(input.queryJson))
|
||||
{
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
|
||||
if (queryJson!.TryGetValue("requisition_code", out var value))
|
||||
{
|
||||
requisitionCode = value.ToString();
|
||||
}
|
||||
if (queryJson!.TryGetValue("requisition_time", out var value1))
|
||||
{
|
||||
requisitionTimeArr = value1.ToObject<long[]>().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray();
|
||||
requisitionTimeArr = value1.ToObject<long[]>().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
if (queryJson!.TryGetValue("estimated_return_time", out var value2))
|
||||
{
|
||||
estimatedReturnArr = value2.ToObject<long[]>().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray();
|
||||
estimatedReturnArr = value2.ToObject<long[]>().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
|
||||
var result = await _db.Queryable<ToolMoldRequisition>()
|
||||
.LeftJoin<PrdMoTask>((a, b) => a.mo_task_id == b.id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c) => a.equip_id == c.id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d) => a.recipient_id == d.Id)
|
||||
.LeftJoin<ToolMolds>((a,b,c,d,e)=>a.mold_id==e.id)
|
||||
.LeftJoin<ToolMolds>((a, b, c, d, e) => a.mold_id == e.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(requisitionCode), (a, b, c, d) => a.code.Contains(requisitionCode))
|
||||
.WhereIF(requisitionTimeArr!=null, (a, b, c, d) => a.requisition_time>=requisitionTimeArr[0] && a.requisition_time<=requisitionTimeArr[1])
|
||||
.WhereIF(estimatedReturnArr!=null, (a, b, c, d) => a.estimated_return_time>=estimatedReturnArr[0] && a.estimated_return_time<=estimatedReturnArr[1])
|
||||
.Select((a, b, c, d,e) => new ToolMoldRequisitionListOutput
|
||||
.WhereIF(requisitionTimeArr != null, (a, b, c, d) => a.requisition_time >= requisitionTimeArr[0] && a.requisition_time <= requisitionTimeArr[1])
|
||||
.WhereIF(estimatedReturnArr != null, (a, b, c, d) => a.estimated_return_time >= estimatedReturnArr[0] && a.estimated_return_time <= estimatedReturnArr[1])
|
||||
.Select((a, b, c, d, e) => new ToolMoldRequisitionListOutput
|
||||
{
|
||||
id = a.id,
|
||||
code = a.code,
|
||||
mold_id = e.mold_code,
|
||||
mo_task_id = b.mo_task_code,
|
||||
equip_id = c.code+"/"+c.name,
|
||||
equip_id = c.code + "/" + c.name,
|
||||
recipient_id = d.RealName,
|
||||
estimated_return_time = a.estimated_return_time==null ? "" : a.estimated_return_time.Value.ToString("yyyy-MM-dd"),
|
||||
requisition_time = a.requisition_time==null ? "" : a.requisition_time.Value.ToString("yyyy-MM-dd"),
|
||||
estimated_return_time = a.estimated_return_time == null ? "" : a.estimated_return_time.Value.ToString("yyyy-MM-dd"),
|
||||
requisition_time = a.requisition_time == null ? "" : a.requisition_time.Value.ToString("yyyy-MM-dd"),
|
||||
remark = a.remark
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -127,8 +125,8 @@ namespace Tnb.EquipMgr
|
||||
List<dynamic> result = new();
|
||||
var BasLocations = await _db.Queryable<ToolLocation>().ToListAsync();
|
||||
var ToolMolds = await _db.Queryable<ToolMolds>()
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.keyword),p=>p.mold_code!.Contains(toolinput.keyword!)|| p.mold_name!.Contains(toolinput.keyword!))
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status== dic.Where(p=>p.Value== toolinput.status).First().Key)
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.keyword), p => p.mold_code!.Contains(toolinput.keyword!) || p.mold_name!.Contains(toolinput.keyword!))
|
||||
.WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status == dic.Where(p => p.Value == toolinput.status).First().Key)
|
||||
.ToListAsync();
|
||||
if (string.IsNullOrEmpty(toolinput.sort))
|
||||
{
|
||||
@@ -138,12 +136,12 @@ namespace Tnb.EquipMgr
|
||||
foreach (var tool in ToolMolds)
|
||||
{
|
||||
dynamic info = new ExpandoObject();
|
||||
info.id=tool.id;
|
||||
info.mold_code=tool.mold_code;
|
||||
info.id = tool.id;
|
||||
info.mold_code = tool.mold_code;
|
||||
info.mold_name = tool.mold_name;
|
||||
info.mold_status= dic.Where(p=>p.Key==tool.mold_status).Any()? dic.Where(p => p.Key == tool.mold_status).First().Value:"";
|
||||
info.warehosue_id=tool.warehosue_id;
|
||||
info.location_id= BasLocations.Where(p => p.id == tool.location_id).Any() ? BasLocations.Where(p => p.id == tool.location_id).First().location_code : "";
|
||||
info.mold_status = dic.Where(p => p.Key == tool.mold_status).Any() ? dic.Where(p => p.Key == tool.mold_status).First().Value : "";
|
||||
info.warehosue_id = tool.warehosue_id;
|
||||
info.location_id = BasLocations.Where(p => p.id == tool.location_id).Any() ? BasLocations.Where(p => p.id == tool.location_id).First().location_code : "";
|
||||
result.Add(info);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -9,9 +9,7 @@ using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -21,7 +19,7 @@ namespace Tnb.EquipMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class ToolMoldReturnService : IOverideVisualDevService, IToolMoldReturnService,IDynamicApiController, ITransient
|
||||
public class ToolMoldReturnService : IOverideVisualDevService, IToolMoldReturnService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "27275901607701";
|
||||
private readonly ISqlSugarClient _db;
|
||||
@@ -40,7 +38,7 @@ namespace Tnb.EquipMgr
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
DbResult<bool> result = await _db.Ado.UseTranAsync(async () =>
|
||||
@@ -60,7 +58,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
await _db.Updateable<ToolMolds>()
|
||||
.SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.ZKTypeId)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(locationId),x=>x.location_id==locationId)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(locationId), x => x.location_id == locationId)
|
||||
.Where(X => X.id == moldId).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -17,15 +8,12 @@ using JNPF.FriendlyException;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{ /// <summary>
|
||||
|
||||
Reference in New Issue
Block a user