Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -12,6 +12,7 @@ using JNPF.Systems.Interfaces.System;
|
|||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using JNPF.VisualDev.Entitys;
|
using JNPF.VisualDev.Entitys;
|
||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
@@ -58,29 +59,61 @@ namespace Tnb.EquipMgr
|
|||||||
if (!input.data.ContainsKey("create_time"))
|
if (!input.data.ContainsKey("create_time"))
|
||||||
{
|
{
|
||||||
input.data.Add("create_time",DateTime.Now);
|
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"))
|
if (!input.data.ContainsKey("create_id"))
|
||||||
{
|
{
|
||||||
input.data.Add("create_id",_userManager.UserId);
|
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"))
|
if (!input.data.ContainsKey("apply_user_id"))
|
||||||
{
|
{
|
||||||
input.data.Add("apply_user_id",_userManager.UserId);
|
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"))
|
if (!input.data.ContainsKey("org_id"))
|
||||||
{
|
{
|
||||||
input.data.Add("org_id",_userManager.GetUserInfo().Result.organizeId);
|
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"))
|
if (!input.data.ContainsKey("code"))
|
||||||
{
|
{
|
||||||
input.data.Add("code",await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_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);
|
||||||
}
|
}
|
||||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
|
||||||
await _runService.Create(templateEntity, input);
|
EqpRepairApply eqpRepairApply = new EqpRepairApply();
|
||||||
|
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.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"];
|
||||||
|
eqpRepairApply.create_id = (string)input.data["create_id"];
|
||||||
|
eqpRepairApply.create_time = DateTime.Now;
|
||||||
|
eqpRepairApply.org_id = (string)input.data["org_id"];
|
||||||
|
eqpRepairApply.remark = (string)input.data["remark"];
|
||||||
|
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);
|
return await Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +242,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
|
|
||||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id);
|
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
if (eqpRepairApply.status == RepairApplyStatus.RECEIVED)
|
||||||
{
|
{
|
||||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -200,6 +200,11 @@ namespace Tnb.EquipMgr
|
|||||||
public async Task<string> RepeatMaintain(MaintainRecordRepeatInput input)
|
public async Task<string> RepeatMaintain(MaintainRecordRepeatInput input)
|
||||||
{
|
{
|
||||||
var db = _repository.AsSugarClient();
|
var db = _repository.AsSugarClient();
|
||||||
|
EqpMaintainRecordH eqpMaintainRecordH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||||
|
if (eqpMaintainRecordH.status == "1")
|
||||||
|
{
|
||||||
|
throw Oops.Bah("状态错误");
|
||||||
|
}
|
||||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace Tnb.EquipMgr
|
|||||||
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 = "";
|
string status = "";
|
||||||
if (eqpSpotInsRecordH.is_repeat == "1")
|
if (eqpSpotInsRecordH.is_repeat == "1")
|
||||||
{
|
{
|
||||||
@@ -184,6 +185,11 @@ namespace Tnb.EquipMgr
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task RepeatSpotIns(SpotInsRecordRepeatInput input)
|
public async Task RepeatSpotIns(SpotInsRecordRepeatInput input)
|
||||||
{
|
{
|
||||||
|
EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||||
|
if (eqpSpotInsRecordH.status == "1")
|
||||||
|
{
|
||||||
|
throw Oops.Bah("状态错误");
|
||||||
|
}
|
||||||
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
await _repository.UpdateAsync(x => new EqpSpotInsRecordH()
|
||||||
{
|
{
|
||||||
repeat_result = input.repeat_result,
|
repeat_result = input.repeat_result,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace Tnb.EquipMgr
|
|||||||
|
|
||||||
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
private async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||||
{
|
{
|
||||||
string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : "";
|
string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"]?.ToString() : "";
|
||||||
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == qrcode))
|
if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable<BasQrcode>().AnyAsync(x => x.code == qrcode))
|
||||||
{
|
{
|
||||||
throw Oops.Bah("二维码总表中已存在该二维码");
|
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||||
@@ -120,7 +120,7 @@ namespace Tnb.EquipMgr
|
|||||||
|
|
||||||
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() : "";
|
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("二维码总表中已存在该二维码");
|
throw Oops.Bah("二维码总表中已存在该二维码");
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Tnb.QcMgr.Entities
|
|||||||
public object[]? checkbox { get; set; }
|
public object[]? checkbox { get; set; }
|
||||||
public string? errorcause { get; set; }
|
public string? errorcause { get; set; }
|
||||||
public string? errorlevel { get; set; }
|
public string? errorlevel { get; set; }
|
||||||
public object? measuredValue { get; set; }
|
public string? measuredValue { get; set; }
|
||||||
public string? radio { get; set; }
|
public string? radio { get; set; }
|
||||||
public string? remark { get; set; }
|
public string? remark { get; set; }
|
||||||
public string? text { get; set; }
|
public string? text { get; set; }
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aspose.Cells.Drawing;
|
using Aspose.Cells.Drawing;
|
||||||
@@ -14,6 +15,7 @@ using JNPF.VisualDev;
|
|||||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.QcMgr.Entities;
|
using Tnb.QcMgr.Entities;
|
||||||
@@ -25,13 +27,13 @@ namespace Tnb.QcMgr
|
|||||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
[OverideVisualDev(ModuleId)]
|
[OverideVisualDev(ModuleId)]
|
||||||
public class QcCheckTaskResultServic:IDynamicApiController, ITransient, IOverideVisualDevService
|
public class QcCheckTaskResultService : IDynamicApiController, ITransient, IOverideVisualDevService
|
||||||
{
|
{
|
||||||
private const string ModuleId = "26873741070613";
|
private const string ModuleId = "26873741070613";
|
||||||
private readonly ISqlSugarRepository<QcCheckExecH> _repository;
|
private readonly ISqlSugarRepository<QcCheckExecH> _repository;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
public QcCheckTaskResultServic(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager)
|
public QcCheckTaskResultService(ISqlSugarRepository<QcCheckExecH> repository, IUserManager userManager)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
@@ -87,5 +89,67 @@ namespace Tnb.QcMgr
|
|||||||
}
|
}
|
||||||
return PageResult<QcCheckExecHOut>.SqlSugarPageResult(result);
|
return PageResult<QcCheckExecHOut>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetCheckTask(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||||
|
dic.Add("ok", "合格");
|
||||||
|
dic.Add("no", "不合格");
|
||||||
|
dic.Add("barelyOk", "让步合格");
|
||||||
|
dic.Add("await", "待检");
|
||||||
|
dic.Add("temporarily", "暂控");
|
||||||
|
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : "";
|
||||||
|
string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : "";
|
||||||
|
string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
||||||
|
var list = await db.Queryable<DictionaryDataEntity>()
|
||||||
|
.LeftJoin<DictionaryTypeEntity>((a, b) => a.DictionaryTypeId == b.Id)
|
||||||
|
.Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync();
|
||||||
|
var BasLocations = await db.Queryable<BasLocation>().ToListAsync();
|
||||||
|
Expression<Func<QcCheckExecHOut, object>> expression;
|
||||||
|
if (list.Where(p => p.FullName == "待执行").First().Id == status)
|
||||||
|
{
|
||||||
|
expression = a => DateTime.Parse(a.tasktime!);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
expression = a => DateTime.Parse(a.exectime!);
|
||||||
|
}
|
||||||
|
var result = await db.Queryable<QcCheckExecH>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.materialid == b.id)
|
||||||
|
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||||
|
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
|
||||||
|
// .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id)
|
||||||
|
.Select((a, b, c, d, e) => new QcCheckExecHOut
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
materialid = b.name,
|
||||||
|
checktype = a.checktype,
|
||||||
|
workid = d.FullName,
|
||||||
|
processid = c.process_name,
|
||||||
|
wareid = a.wareid,
|
||||||
|
checknum = a.checknum,
|
||||||
|
status = a.status,
|
||||||
|
result = a.result,
|
||||||
|
tasktime = a.tasktime == null ? "" : a.tasktime,
|
||||||
|
exectime = a.exectime == null ? "" : a.exectime,
|
||||||
|
execuser = e.RealName == null ? "" : e.RealName,
|
||||||
|
}).OrderByDescending(expression).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
foreach (var item in result.list)
|
||||||
|
{
|
||||||
|
item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : "";
|
||||||
|
item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : "";
|
||||||
|
item.result = dic.Where(p => p.Key == item.result).Any() ? dic.Where(p => p.Key == item.result).First().Value : "";
|
||||||
|
item.wareid = BasLocations.Where(p => p.id == item.wareid).Any() ? BasLocations.Where(p => p.id == item.wareid).First().location_code : "";
|
||||||
|
}
|
||||||
|
return PageResult<QcCheckExecHOut>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user