Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -4,6 +4,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
{
|
{
|
||||||
public string? id { get; set; }
|
public string? id { get; set; }
|
||||||
public string? attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
|
|
||||||
|
public string? fhattachment { get; set; }
|
||||||
public string? create_time { get; set; }
|
public string? create_time { get; set; }
|
||||||
public string? equip_id { get; set; }
|
public string? equip_id { get; set; }
|
||||||
public string? equip_id_id { get; set; }
|
public string? equip_id_id { get; set; }
|
||||||
|
|||||||
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartRecord.cs
Normal file
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartRecord.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities
|
||||||
|
{
|
||||||
|
public class EquipSparePartRecordInput
|
||||||
|
{
|
||||||
|
public string? equip_id { get; set; }
|
||||||
|
}
|
||||||
|
public class EquipSparePartRecordOut
|
||||||
|
{
|
||||||
|
public string? id { get; set; }
|
||||||
|
public string? code { get; set; }
|
||||||
|
public string? name { get; set; }
|
||||||
|
public string? type { get; set; }
|
||||||
|
public string? execuser { get; set; }
|
||||||
|
public string? execdatetime { get; set; }
|
||||||
|
public int? num { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
public string? code { get; set; }
|
public string? code { get; set; }
|
||||||
public string? name { get; set; }
|
public string? name { get; set; }
|
||||||
public string? specification { get; set; }
|
public string? specification { get; set; }
|
||||||
|
public int? num { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
{
|
{
|
||||||
public string? id { get; set; }
|
public string? id { get; set; }
|
||||||
public string? attachment { get; set; }
|
public string? attachment { get; set; }
|
||||||
|
|
||||||
|
public string? fhattachment { get; set; }
|
||||||
public string? create_time { get; set; }
|
public string? create_time { get; set; }
|
||||||
public string? equip_id { get; set; }
|
public string? equip_id { get; set; }
|
||||||
public string? repeat_remark { get; set; }
|
public string? repeat_remark { get; set; }
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
public string repeat_result { get; set; } = string.Empty;
|
public string repeat_result { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string? repeat_remark { get; set; }
|
public string? repeat_remark { get; set; }
|
||||||
|
public string? attachment { get; set; }
|
||||||
|
|
||||||
public List<Dictionary<string, string>>? details { get; set; }
|
public List<Dictionary<string, string>>? details { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,4 +37,10 @@
|
|||||||
public string result { get; set; }
|
public string result { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public class MaintainItemResult
|
||||||
|
{
|
||||||
|
public string item_name { get; set; }
|
||||||
|
public string group_name { get; set; }
|
||||||
|
public string result { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldStartWxInput.cs
Normal file
13
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldStartWxInput.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities
|
||||||
|
{
|
||||||
|
public class MoldStartWxInput
|
||||||
|
{
|
||||||
|
public string? id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,5 +16,6 @@
|
|||||||
public string plan_start_time { get; set; }
|
public string plan_start_time { get; set; }
|
||||||
public string starttime { get; set; }
|
public string starttime { get; set; }
|
||||||
|
|
||||||
|
public string finishtime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,5 +20,6 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
public string repairer_id { get; set; }
|
public string repairer_id { get; set; }
|
||||||
public string repairer_id_id { get; set; }
|
public string repairer_id_id { get; set; }
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
|
public string attachment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,5 +7,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
|||||||
public string? repeat_result { get; set; }
|
public string? repeat_result { get; set; }
|
||||||
|
|
||||||
public string? repeat_remark { get; set; }
|
public string? repeat_remark { get; set; }
|
||||||
|
|
||||||
|
public string? attachment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,5 +164,10 @@ public partial class EqpMaintainRecordH : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? org_id { get; set; }
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核附件
|
||||||
|
/// </summary>
|
||||||
|
public string? fhattachment { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,4 +159,10 @@ public partial class EqpSpotInsRecordH : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? repeat_result { get; set; }
|
public string? repeat_result { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 复核附件
|
||||||
|
/// </summary>
|
||||||
|
public string? fhattachment { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,4 +53,12 @@ public partial class ToolMoldMaintainTask : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string status { get; set; }
|
public string status { get; set; }
|
||||||
|
|
||||||
|
public string? name { get; set; }
|
||||||
|
public string? attachment { get; set; }
|
||||||
|
public string? describe { get; set; }
|
||||||
|
|
||||||
|
public int is_finish { get; set; }
|
||||||
|
public string? wxattachment { get; set; }
|
||||||
|
public string? wxdescribe { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
|
using System.CodeDom.Compiler;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Filter;
|
using JNPF.Common.Filter;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
using JNPF.Systems.Entitys.System;
|
using JNPF.Systems.Entitys.System;
|
||||||
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.EquipMgr.Entities;
|
using Tnb.EquipMgr.Entities;
|
||||||
using Tnb.EquipMgr.Entities.Dto;
|
using Tnb.EquipMgr.Entities.Dto;
|
||||||
@@ -68,6 +71,9 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson);
|
||||||
}
|
}
|
||||||
|
var eqpSpareParts = await db.Queryable<EqpSpareParts>().ToListAsync();
|
||||||
|
var InstockDs= await db.Queryable<EqpSparePartsInstockD>().ToListAsync();
|
||||||
|
var RequisitionDs = await db.Queryable<EqpSparePartsRequisitionD>().ToListAsync();
|
||||||
SqlSugarPagedList<EquipSparePartsQueryOutput> result = await db.Queryable<EqpEquipSpareParts>()
|
SqlSugarPagedList<EquipSparePartsQueryOutput> 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<DictionaryTypeEntity>((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null)
|
||||||
@@ -82,10 +88,68 @@ namespace Tnb.EquipMgr
|
|||||||
type_name = d.FullName,
|
type_name = d.FullName,
|
||||||
code = b.code,
|
code = b.code,
|
||||||
name = b.name,
|
name = b.name,
|
||||||
specification = b.specification
|
specification = b.specification,
|
||||||
|
num = 0
|
||||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
foreach (var item in result.list)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var part = eqpSpareParts.Where(p => p.code == item.code).First();
|
||||||
|
var Instocknum = InstockDs.Where(p => p.spare_parts_id == part.id).Sum(p => p.quantity);
|
||||||
|
var Requisitionum = RequisitionDs.Where(p => p.spare_parts_id == part.id).Sum(p => p.quantity);
|
||||||
|
item.num = Instocknum > Requisitionum ? Instocknum - Requisitionum : 0;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return PageResult<EquipSparePartsQueryOutput>.SqlSugarPageResult(result);
|
return PageResult<EquipSparePartsQueryOutput>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取备品备件历史
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetEquipSparePartRecord(EquipSparePartRecordInput input)
|
||||||
|
{
|
||||||
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
|
var partsids = await db.Queryable<EqpEquipSpareParts>().Where(p => p.equip_id == input.equip_id).Select(p => p.spare_parts_id).ToListAsync();
|
||||||
|
var Instocks = await db.Queryable<EqpSparePartsInstockD>()
|
||||||
|
.LeftJoin<EqpSparePartsInstockH>((a, b) => a.instock_id == b.id)
|
||||||
|
.LeftJoin<EqpSpareParts>((a, b, c) => a.spare_parts_id == c.id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c, d) => b.instock_id == d.Id)
|
||||||
|
.Where((a, b, c, d) => partsids.Contains(a.spare_parts_id!))
|
||||||
|
.Select((a, b, c, d) => new EquipSparePartRecordOut()
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
code = c.code,
|
||||||
|
name = c.name,
|
||||||
|
type = "入库",
|
||||||
|
execuser = d.RealName,
|
||||||
|
execdatetime = b.create_time != null ? b.create_time.ToString() : "",
|
||||||
|
num = a.quantity
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var Requisitions = await db.Queryable<EqpSparePartsRequisitionD>()
|
||||||
|
.LeftJoin<EqpSparePartsRequisitionH>((a, b) => a.spare_parts_requisition_id == b.id)
|
||||||
|
.LeftJoin<EqpSpareParts>((a, b, c) => a.spare_parts_id == c.id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c, d) => b.recipient_id == d.Id)
|
||||||
|
.Where((a, b, c, d) => partsids.Contains(a.spare_parts_id!))
|
||||||
|
.Select((a, b, c, d) => new EquipSparePartRecordOut()
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
code = c.code,
|
||||||
|
name = c.name,
|
||||||
|
type = "领用",
|
||||||
|
execuser = d.RealName,
|
||||||
|
execdatetime = b.create_time != null ? b.create_time.ToString()!.Substring(0,19) : "",
|
||||||
|
num = a.quantity
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
Instocks.AddRange(Requisitions);
|
||||||
|
var result = Instocks.OrderByDescending(p => DateTime.Parse(p.execdatetime!));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,22 +99,22 @@ namespace Tnb.EquipMgr
|
|||||||
input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE);
|
input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
EqpRepairApply eqpRepairApply = new()
|
EqpRepairApply eqpRepairApply = new();
|
||||||
{
|
|
||||||
code = (string)input.data["code"],
|
eqpRepairApply.code = (string)input.data["code"];
|
||||||
name = (string)input.data["name"],
|
eqpRepairApply.name = (string)input.data["name"];
|
||||||
equip_id = (string)input.data["equip_id"],
|
eqpRepairApply.equip_id = (string)input.data["equip_id"];
|
||||||
expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? DateTimeOffset.FromUnixTimeSeconds(((long)input.data["expect_complete_time"]) / 1000).ToLocalTime().DateTime : null,
|
eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? DateTimeOffset.FromUnixTimeSeconds(((long)input.data["expect_complete_time"]) / 1000).ToLocalTime().DateTime : null;
|
||||||
is_ugent = (int?)(long)input.data["is_ugent"],
|
eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"];
|
||||||
attachment = input.data.ContainsKey("attachment") ? JSON.Serialize(input.data["attachment"]) : null,
|
eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? JsonConvert.SerializeObject(input.data["attachment"]) : null;
|
||||||
apply_user_id = (string)input.data["apply_user_id"],
|
eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"];
|
||||||
create_id = (string)input.data["create_id"],
|
eqpRepairApply.create_id = (string)input.data["create_id"];
|
||||||
create_time = DateTime.Now,
|
eqpRepairApply.create_time = DateTime.Now;
|
||||||
org_id = (string)input.data["org_id"],
|
eqpRepairApply.org_id = (string)input.data["org_id"];
|
||||||
remark = input.data.ContainsKey("remark") ? (string)input.data["remark"] : "",
|
eqpRepairApply.remark = input.data.ContainsKey("remark") ? (string)input.data["remark"] : "";
|
||||||
description = input.data.ContainsKey("description") ? (string)input.data["description"] : "",
|
eqpRepairApply.description = input.data.ContainsKey("description") ? (string)input.data["description"] : "";
|
||||||
status = RepairApplyStatus.TOBEEXECUTED
|
eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED;
|
||||||
};
|
|
||||||
_ = await _repository.InsertAsync(eqpRepairApply);
|
_ = await _repository.InsertAsync(eqpRepairApply);
|
||||||
|
|
||||||
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
// VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||||
@@ -397,7 +397,8 @@ namespace Tnb.EquipMgr
|
|||||||
repairer_id = c.RealName,
|
repairer_id = c.RealName,
|
||||||
repairer_id_id = c.Id,
|
repairer_id_id = c.Id,
|
||||||
remark = a.remark,
|
remark = a.remark,
|
||||||
status = f.FullName
|
status = f.FullName,
|
||||||
|
attachment=a.attachment
|
||||||
}).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
}).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||||
|
|
||||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Linq;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
@@ -117,7 +118,14 @@ namespace Tnb.EquipMgr
|
|||||||
|
|
||||||
if (eqpSparePartsList.Count > 0)
|
if (eqpSparePartsList.Count > 0)
|
||||||
{
|
{
|
||||||
_ = await db.Insertable<EqpEquipSpareParts>(eqpSparePartsList).ExecuteCommandAsync();
|
var datas= await db.Queryable<EqpEquipSpareParts>().ToListAsync();
|
||||||
|
foreach (var item in eqpSparePartsList)
|
||||||
|
{
|
||||||
|
if (!datas.Where(p => p.equip_id == item.equip_id && p.spare_parts_id == item.spare_parts_id).Any())
|
||||||
|
_ = await db.Insertable<EqpEquipSpareParts>(eqpSparePartsList).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
_ = await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
_ = await _repository.UpdateAsync(x => new EqpMaintainRecordH()
|
||||||
{
|
{
|
||||||
|
fhattachment=input.attachment,
|
||||||
repeat_result = input.repeat_result,
|
repeat_result = input.repeat_result,
|
||||||
repeat_remark = input.repeat_remark,
|
repeat_remark = input.repeat_remark,
|
||||||
repeat_user_id = _userManager.UserId,
|
repeat_user_id = _userManager.UserId,
|
||||||
@@ -244,6 +245,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
attachment = a.attachment,
|
attachment = a.attachment,
|
||||||
|
fhattachment= a.fhattachment,
|
||||||
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 = b.code,
|
||||||
equip_id_id = a.equip_id,
|
equip_id_id = a.equip_id,
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ namespace Tnb.EquipMgr
|
|||||||
repeat_result = input.repeat_result,
|
repeat_result = input.repeat_result,
|
||||||
repeat_remark = input.repeat_remark,
|
repeat_remark = input.repeat_remark,
|
||||||
repeat_user_id = _userManager.UserId,
|
repeat_user_id = _userManager.UserId,
|
||||||
|
fhattachment=input.attachment,
|
||||||
repeat_time = DateTime.Now,
|
repeat_time = DateTime.Now,
|
||||||
status = SpotInsRecordExecutionStatus.COMPLETED
|
status = SpotInsRecordExecutionStatus.COMPLETED
|
||||||
}, x => x.id == input.id);
|
}, x => x.id == input.id);
|
||||||
@@ -204,6 +205,7 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
attachment = a.attachment,
|
attachment = a.attachment,
|
||||||
|
fhattachment=a.fhattachment,
|
||||||
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,
|
equip_id = a.equip_id,
|
||||||
repeat_remark = a.repeat_remark,
|
repeat_remark = a.repeat_remark,
|
||||||
|
|||||||
@@ -196,33 +196,35 @@ namespace Tnb.EquipMgr
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
input.sidx = "b." + input.sidx;
|
input.sidx = "b." + input.sidx;
|
||||||
|
input.sort = "desc";
|
||||||
}
|
}
|
||||||
List<string> records = await _db.Queryable<ToolMoldMaintainItemRecord>().Select(p => p.plan_id + p.mold_id).ToListAsync();
|
List<string> records = await _db.Queryable<ToolMoldMaintainItemRecord>().Select(p => p.plan_id + p.mold_id).ToListAsync();
|
||||||
SqlSugarPagedList<PadMainListOutput> result = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
SqlSugarPagedList<PadMainListOutput> result = await _db.Queryable<ToolMoldMaintainPlanRelation>()
|
||||||
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)
|
.LeftJoin<ToolMoldMaintainPlan>((a, b) => a.maintain_plan_id == b.id)
|
||||||
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.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<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<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<UserEntity>((a, b, c, d, e) => b.create_id == e.Id)
|
||||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f, g) => c.mold_status == g.Id)
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => c.mold_status == f.Id)
|
||||||
.Where((a, b, c, d, e, f) => b.create_time != null)
|
.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(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f) => 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)
|
.WhereIF(start_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time >= start_time)
|
||||||
.WhereIF(end_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time <= end_time)
|
.WhereIF(end_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time <= end_time)
|
||||||
.WhereIF(input.status == "待保养", (a, b, c, d, e, f, g) => !records.Contains(a.maintain_plan_id + a.mold_id))
|
.WhereIF(input.status == "待保养", (a, b, c, d, e, f) => !records.Contains(a.maintain_plan_id + a.mold_id))
|
||||||
.WhereIF(input.status == "已完成", (a, b, c, d, e, f, g) => records.Contains(a.maintain_plan_id + a.mold_id))
|
.WhereIF(input.status == "已完成", (a, b, c, d, e, f) => records.Contains(a.maintain_plan_id + a.mold_id))
|
||||||
.Select((a, b, c, d, e, f, g) => new PadMainListOutput
|
.Select((a, b, c, d, e, f) => new PadMainListOutput
|
||||||
{
|
{
|
||||||
plan_id = b.id,
|
plan_id = b.id,
|
||||||
mold_id = c.id,
|
mold_id = c.id,
|
||||||
mold_code = c.mold_code!,
|
mold_code = c.mold_code!,
|
||||||
mold_name = c.mold_name!,
|
mold_name = c.mold_name!,
|
||||||
mold_status = g.FullName!,
|
mold_status = f.FullName!,
|
||||||
status = input.status,
|
status = input.status,
|
||||||
createuser = f.RealName,
|
createuser = e.RealName,
|
||||||
createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS),
|
createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
plan_start_time = b.plan_start_date == null ? "" : b.plan_start_date.Value.ToString(DbTimeFormat.SS),
|
plan_start_time = b.plan_start_date == null ? "" : b.plan_start_date.Value.ToString(DbTimeFormat.SS),
|
||||||
starttime = d.plan_start_time == null ? "" : d.plan_start_time.Value.ToString(DbTimeFormat.SS),
|
starttime = d.plan_start_time == null ? "" : d.plan_start_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
finishtime= d.plan_end_time == null ? "" : d.plan_end_time.Value.ToString(DbTimeFormat.SS),
|
||||||
}).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
}).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50);
|
||||||
return PageResult<PadMainListOutput>.SqlSugarPageResult(result);
|
return PageResult<PadMainListOutput>.SqlSugarPageResult(result);
|
||||||
}
|
}
|
||||||
@@ -303,7 +305,23 @@ namespace Tnb.EquipMgr
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetMaintainItem(MoldMaintainRunUpInput input)
|
||||||
|
{
|
||||||
|
var data = await _db.Queryable<ToolMoldMaintainItemRecord>()
|
||||||
|
.LeftJoin<ToolMoldMaintainItem>((a, b) => a.item_id == b.id)
|
||||||
|
.LeftJoin<ToolMoldMaintainGroup>((a, b, c) => a.item_group_id == c.id)
|
||||||
|
.Where((a, b, c) => a.plan_id == input.plan_id && a.mold_id == input.mold_id)
|
||||||
|
.Select((a, b, c) => new MaintainItemResult
|
||||||
|
{
|
||||||
|
group_name = c.name!,
|
||||||
|
item_name = b.name!,
|
||||||
|
result = a.result,
|
||||||
|
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模具保养计划执行-开始模具保养
|
/// 模具保养计划执行-开始模具保养
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -447,6 +465,11 @@ namespace Tnb.EquipMgr
|
|||||||
{
|
{
|
||||||
throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty");
|
throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty");
|
||||||
}
|
}
|
||||||
|
var plan_code = _db.Queryable<ToolMoldMaintainPlan>().Where(p => p.id == input.plan_id).Select(p=>p.plan_code).First();
|
||||||
|
var mold_code = _db.Queryable<ToolMolds>().Where(p => p.id == input.mold_id).Select(p => p.mold_code).First();
|
||||||
|
if (!string.IsNullOrEmpty(plan_code)&& !string.IsNullOrEmpty(mold_code)) {
|
||||||
|
_ = await _db.Updateable<ToolMoldMaintainRunRecord>().SetColumns(it => new ToolMoldMaintainRunRecord { plan_end_time = DateTime.Now }).Where(it => it.plan_code == plan_code && it.mold_code== mold_code).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
List<ToolMoldMaintainItemRecord> records = new();
|
List<ToolMoldMaintainItemRecord> records = new();
|
||||||
foreach (MaintainItemInfo item in input.items)
|
foreach (MaintainItemInfo item in input.items)
|
||||||
@@ -505,6 +528,11 @@ namespace Tnb.EquipMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模具保养计划执行-保养完成
|
/// 模具保养计划执行-保养完成
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
@@ -29,16 +30,19 @@ namespace Tnb.EquipMgr
|
|||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
private static Dictionary<string, (string code, string name)> _dicMold = new();
|
private static Dictionary<string, (string code, string name)> _dicMold = new();
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
public ToolMoldMaintainTaskService(
|
public ToolMoldMaintainTaskService(
|
||||||
ISqlSugarRepository<ToolMoldMaintainTask> repository,
|
ISqlSugarRepository<ToolMoldMaintainTask> repository,
|
||||||
IRunService runService,
|
IRunService runService,
|
||||||
IVisualDevService visualDevService
|
IVisualDevService visualDevService,
|
||||||
|
IUserManager userManager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
OverideFuncs.GetListAsync = GetList;
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
_userManager = userManager;
|
||||||
//OverideFuncs.CreateAsync = Create;
|
//OverideFuncs.CreateAsync = Create;
|
||||||
}
|
}
|
||||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
@@ -100,5 +104,23 @@ namespace Tnb.EquipMgr
|
|||||||
throw Oops.Oh(ErrorCode.COM1001);
|
throw Oops.Oh(ErrorCode.COM1001);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始维修
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">输入参数</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task StartWx(MoldStartWxInput input)
|
||||||
|
{
|
||||||
|
DateTime? StartTime = DateTime.Now;
|
||||||
|
int row = await _db.Updateable<ToolMoldMaintainTask>().SetColumns(it => new ToolMoldMaintainTask { status = "WXZ", modify_strat_time = StartTime, modify_id = _userManager.UserId })
|
||||||
|
.Where(it => input.id == it.id).ExecuteCommandAsync();
|
||||||
|
if (row < 1)
|
||||||
|
{
|
||||||
|
throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using JNPF.Common.Filter;
|
||||||
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class AndonPdaListInput : PageInputBase
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -68,17 +68,75 @@ namespace Tnb.ProductionMgr
|
|||||||
andon_info_name = b.name,
|
andon_info_name = b.name,
|
||||||
promoter_name = d.RealName,
|
promoter_name = d.RealName,
|
||||||
repair_name = c.RealName,
|
repair_name = c.RealName,
|
||||||
promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
|
promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
response_time = a.response_time == null ? "" : a.response_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
|
response_time = a.response_time == null ? "" : a.response_time.Value.ToString(DbTimeFormat.SS),
|
||||||
start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
|
start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString(DbTimeFormat.SS),
|
||||||
end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
|
end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString(DbTimeFormat.SS),
|
||||||
confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString("yyyy-MM-dd hh:mm:ss"),
|
confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString(DbTimeFormat.SS),
|
||||||
status = f.FullName,
|
status = f.FullName,
|
||||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
return PageResult<AndonPadListOutput>.SqlSugarPageResult(result);
|
return PageResult<AndonPadListOutput>.SqlSugarPageResult(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetAndonPdaList(AndonPdaListInput input)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||||
|
string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
||||||
|
List<string> statusList = new();
|
||||||
|
if (!string.IsNullOrEmpty(status))
|
||||||
|
{
|
||||||
|
switch (status)
|
||||||
|
{
|
||||||
|
case "1":
|
||||||
|
statusList.Add(DictConst.AndonStatusHJZ);
|
||||||
|
break;
|
||||||
|
case "2":
|
||||||
|
statusList.Add(DictConst.AndonStatusYXY);
|
||||||
|
statusList.Add(DictConst.AndonStatusCLZ);
|
||||||
|
break;
|
||||||
|
case "3":
|
||||||
|
statusList.Add(DictConst.AndonStatusDQR);
|
||||||
|
statusList.Add(DictConst.AndonStatusYWC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(input.sidx))
|
||||||
|
{
|
||||||
|
input.sidx = "create_time";
|
||||||
|
input.sort = "desc";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SqlSugarPagedList<AndonPadListOutput> result = await _db.Queryable<AndonRecords>()
|
||||||
|
.LeftJoin<AndonInfo>((a, b) => a.andon_info_id == b.id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c) => a.repair_id == c.Id)
|
||||||
|
.LeftJoin<UserEntity>((a, b, c, d) => a.create_id == d.Id)
|
||||||
|
.LeftJoin<DictionaryTypeEntity>((a, b, c, d, e) => e.EnCode == DictConst.AndonStatus)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e, f) => a.status == f.EnCode && e.Id == f.DictionaryTypeId)
|
||||||
|
.WhereIF(statusList.Count > 0, a => statusList.Contains(a.status))
|
||||||
|
.Select((a, b, c, d, e, f) => new AndonPadListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
andon_info_name = b.name,
|
||||||
|
promoter_name = d.RealName,
|
||||||
|
repair_name = c.RealName,
|
||||||
|
promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
response_time = a.response_time == null ? "" : a.response_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString(DbTimeFormat.SS),
|
||||||
|
status = f.FullName,
|
||||||
|
})
|
||||||
|
.MergeTable()
|
||||||
|
.OrderBy($"{input.sidx} {input.sort}")
|
||||||
|
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
|
||||||
|
return PageResult<AndonPadListOutput>.SqlSugarPageResult(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<dynamic> AddAndon(AddAndonInput input)
|
public async Task<dynamic> AddAndon(AddAndonInput input)
|
||||||
@@ -247,19 +305,28 @@ namespace Tnb.ProductionMgr
|
|||||||
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
||||||
if (andonRecords != null)
|
if (andonRecords != null)
|
||||||
{
|
{
|
||||||
if (andonRecords.status != DictConst.AndonStatusYXY)
|
if (andonRecords.repair_id!=_userManager.UserId)
|
||||||
{
|
{
|
||||||
throw Oops.Bah($"状态错误");
|
UserEntity user = await _db.Queryable<UserEntity>().SingleAsync(x => x.Id == andonRecords.repair_id);
|
||||||
|
throw Oops.Bah($"您不是处理人");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = await _db.Updateable<AndonRecords>()
|
if (andonRecords.status != DictConst.AndonStatusYXY)
|
||||||
.SetColumns(x => x.start_repair_time == DateTime.Now)
|
{
|
||||||
.Where(x => x.id == id)
|
throw Oops.Bah($"状态错误");
|
||||||
.ExecuteCommandAsync();
|
}
|
||||||
return true;
|
else
|
||||||
|
{
|
||||||
|
_ = await _db.Updateable<AndonRecords>()
|
||||||
|
.SetColumns(x => x.start_repair_time == DateTime.Now)
|
||||||
|
.Where(x => x.id == id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -274,19 +341,28 @@ namespace Tnb.ProductionMgr
|
|||||||
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
||||||
if (andonRecords != null)
|
if (andonRecords != null)
|
||||||
{
|
{
|
||||||
if (andonRecords.status != DictConst.AndonStatusCLZ)
|
if (andonRecords.repair_id!=_userManager.UserId)
|
||||||
{
|
{
|
||||||
throw Oops.Bah($"状态错误");
|
UserEntity user = await _db.Queryable<UserEntity>().SingleAsync(x => x.Id == andonRecords.repair_id);
|
||||||
|
throw Oops.Bah($"您不是处理人");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = await _db.Updateable<AndonRecords>()
|
if (andonRecords.status != DictConst.AndonStatusCLZ)
|
||||||
.SetColumns(x => x.end_repair_time == DateTime.Now)
|
{
|
||||||
.Where(x => x.id == id)
|
throw Oops.Bah($"状态错误");
|
||||||
.ExecuteCommandAsync();
|
}
|
||||||
return true;
|
else
|
||||||
|
{
|
||||||
|
_ = await _db.Updateable<AndonRecords>()
|
||||||
|
.SetColumns(x => x.end_repair_time == DateTime.Now)
|
||||||
|
.Where(x => x.id == id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -301,19 +377,28 @@ namespace Tnb.ProductionMgr
|
|||||||
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
AndonRecords andonRecords = await _db.Queryable<AndonRecords>().SingleAsync(x => x.id == id);
|
||||||
if (andonRecords != null)
|
if (andonRecords != null)
|
||||||
{
|
{
|
||||||
if (andonRecords.status != DictConst.AndonStatusYWC)
|
if (andonRecords.repair_id!=_userManager.UserId)
|
||||||
{
|
{
|
||||||
throw Oops.Bah($"状态错误");
|
UserEntity user = await _db.Queryable<UserEntity>().SingleAsync(x => x.Id == andonRecords.repair_id);
|
||||||
|
throw Oops.Bah($"您不是处理人");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_ = await _db.Updateable<AndonRecords>()
|
if (andonRecords.status != DictConst.AndonStatusYWC)
|
||||||
.SetColumns(x => x.confirm_time == DateTime.Now)
|
{
|
||||||
.Where(x => x.id == id)
|
throw Oops.Bah($"状态错误");
|
||||||
.ExecuteCommandAsync();
|
}
|
||||||
return true;
|
else
|
||||||
|
{
|
||||||
|
_ = await _db.Updateable<AndonRecords>()
|
||||||
|
.SetColumns(x => x.confirm_time == DateTime.Now)
|
||||||
|
.Where(x => x.id == id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
|
{
|
||||||
|
public class CloseElevatorInput
|
||||||
|
{
|
||||||
|
public IEnumerable<string> devNames { get; set; }
|
||||||
|
public int value { get; set; }
|
||||||
|
public string flag{ get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,7 +32,7 @@ public partial class WmsDistaskH : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 起始楼层
|
/// 起始楼层
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? start_floor { get; set; }
|
public int start_floor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 目标库位ID
|
/// 目标库位ID
|
||||||
@@ -42,7 +42,7 @@ public partial class WmsDistaskH : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 目标楼层
|
/// 目标楼层
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? end_floor { get; set; }
|
public int end_floor { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 起始点位ID
|
/// 起始点位ID
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace Tnb.WarehouseMgr.Interfaces
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 电梯控制服务接口
|
/// 电梯控制服务接口
|
||||||
@@ -31,10 +33,10 @@
|
|||||||
/// <param name="tags">标签集合</param>
|
/// <param name="tags">标签集合</param>
|
||||||
/// <param name="token">取消标志</param>
|
/// <param name="token">取消标志</param>
|
||||||
/// <returns>获取到的状态值</returns>
|
/// <returns>获取到的状态值</returns>
|
||||||
Task<(int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus)> GetElevatorStatus(string devName,IEnumerable<string> tags, CancellationToken token);
|
Task<(int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus)> GetElevatorStatus(string devName, IEnumerable<string> tags, CancellationToken token);
|
||||||
|
|
||||||
|
|
||||||
Task<Dictionary<string,int>> GetELevatorStatusMap(string devName,IEnumerable<string> tags, CancellationToken token);
|
Task<Dictionary<string, int>> GetELevatorStatusMap(string devName, IEnumerable<string> tags, CancellationToken token);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查Agv状态
|
/// 检查Agv状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -61,5 +63,7 @@
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> CallLift(string devName, int floor, CancellationToken cancellationToken);
|
Task<bool> CallLift(string devName, int floor, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
Task CloseElevatorControl(CloseElevatorInput input);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,6 +182,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
realFloor = 3;
|
realFloor = 3;
|
||||||
}
|
}
|
||||||
|
else if(floor == 1)
|
||||||
|
{
|
||||||
|
realFloor = 1;
|
||||||
|
}
|
||||||
return Task.FromResult(realFloor);
|
return Task.FromResult(realFloor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -200,10 +200,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
return await ToApiResult(HttpStatusCode.InternalServerError, "电梯还未开门,请重试!");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -223,53 +221,40 @@ namespace Tnb.WarehouseMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
Logger.Information($"任务链上报->任务链编号:{input.taskChainCode},状态:{input.status},设备ID:{input.deviceID}");
|
Logger.Information($"任务链上报->任务链编号:{input.taskChainCode},状态:{input.status},设备ID:{input.deviceID}");
|
||||||
/*switch (input.status)
|
switch (input.status)
|
||||||
{
|
{
|
||||||
case "CREATED": break;
|
case "CREATED": break;
|
||||||
case "ALLOCATED": break;
|
case "ALLOCATED": break;
|
||||||
case "PROCESSING":
|
case "PROCESSING":
|
||||||
//if (await _cacheManager.GetAsync($"{input.taskChainCode}") == "任务链状态上报,上报状态PROCESSING") break;
|
|
||||||
if (input.taskChainCode.Trim().IsNullOrEmpty())
|
if (input.taskChainCode.Trim().IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
break;
|
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync();
|
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync();
|
||||||
List<EqpEquipment> eps = await _db.Queryable<EqpEquipment>().Where(it => it.code.Contains(input.deviceID)).ToListAsync();
|
List<EqpEquipment> eps = await _db.Queryable<EqpEquipment>().Where(it => it.code.Contains(input.deviceID)).ToListAsync();
|
||||||
TaskExecuteUpInput taskExecuteUpInput = new()
|
if (disTasks == null || disTasks.Count < 1)
|
||||||
{
|
{
|
||||||
disTaskIds = disTasks.Select(x => x.id).ToList(),
|
Logger.Error($"根据任务链编号:{input.taskChainCode} ,未获取到任何任务");
|
||||||
EqpIds = eps.Select(x => x.id).ToList(),
|
}
|
||||||
};
|
if (disTasks?.Count > 0)
|
||||||
await _wareHouseService.TaskExecute(taskExecuteUpInput); break;
|
{
|
||||||
|
TaskExecuteUpInput taskExecuteUpInput = new()
|
||||||
|
{
|
||||||
|
disTaskIds = disTasks?.Select(x => x.id).ToList() ?? Enumerable.Empty<string>().ToList(),
|
||||||
|
EqpIds = eps?.Select(x => x.id).ToList() ?? Enumerable.Empty<string>().ToList(),
|
||||||
|
};
|
||||||
|
await _wareHouseService.TaskExecute(taskExecuteUpInput);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "CANCELLED": break;
|
case "CANCELLED": break;
|
||||||
case "SUCCEED": break;
|
case "SUCCEED": break;
|
||||||
case "FAILURE": break;
|
case "FAILURE": break;
|
||||||
case "FINISHED": break;
|
case "FINISHED": break;
|
||||||
default: break;
|
default: break;
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
if (input.taskChainCode.Trim().IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync();
|
|
||||||
List<EqpEquipment> eps = await _db.Queryable<EqpEquipment>().Where(it => it.code.Contains(input.deviceID)).ToListAsync();
|
|
||||||
if (disTasks == null || disTasks.Count < 1)
|
|
||||||
{
|
|
||||||
Logger.Error($"根据任务链编号:{input.taskChainCode} ,未获取到任何任务");
|
|
||||||
}
|
|
||||||
if (disTasks?.Count > 0)
|
|
||||||
{
|
|
||||||
TaskExecuteUpInput taskExecuteUpInput = new()
|
|
||||||
{
|
|
||||||
disTaskIds = disTasks?.Select(x => x.id).ToList() ?? Enumerable.Empty<string>().ToList(),
|
|
||||||
EqpIds = eps?.Select(x => x.id).ToList() ?? Enumerable.Empty<string>().ToList(),
|
|
||||||
};
|
|
||||||
await _wareHouseService.TaskExecute(taskExecuteUpInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*ConnectionConfigOptions opts = App.GetOptions<ConnectionConfigOptions>();
|
/*ConnectionConfigOptions opts = App.GetOptions<ConnectionConfigOptions>();
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ using DingTalk.Api.Request;
|
|||||||
using JNPF;
|
using JNPF;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Tnb.Common.Extension;
|
using Tnb.Common.Extension;
|
||||||
using Tnb.Common.Utils;
|
using Tnb.Common.Utils;
|
||||||
using Tnb.WarehouseMgr.Entities.Configs;
|
using Tnb.WarehouseMgr.Entities.Configs;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Enums;
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
@@ -24,11 +26,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly BackgroundService _agvHeartbeatMonitor;
|
private readonly BackgroundService _agvHeartbeatMonitor;
|
||||||
private static readonly Dictionary<string, Func<BackgroundService, bool>> _fetchStartedStausValue = new();
|
private static readonly Dictionary<string, Func<BackgroundService, bool>> _fetchStartedStausValue = new();
|
||||||
private readonly bool isFrontDoorBit = false; //是否到前门位
|
private readonly bool isFrontDoorBit = false; //是否到前门位
|
||||||
|
private readonly IServiceProvider _sp;
|
||||||
|
private readonly BackgroundService _backgudSvc;
|
||||||
|
|
||||||
public ElevatorControlService()
|
public ElevatorControlService(IServiceProvider sp, BackgroundService bgSvc)
|
||||||
{
|
{
|
||||||
_elevatorCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
_elevatorCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||||
//_agvHeartbeatMonitor = agvHeartbeatMonitorService;
|
_sp = sp;
|
||||||
|
_backgudSvc = bgSvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -402,5 +407,39 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
return isSuccefuly;
|
return isSuccefuly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Task<dynamic>> ParallelWriteTagAsync(CloseElevatorInput input)
|
||||||
|
{
|
||||||
|
var tasks = new List<Task<dynamic>>(input.devNames.Count());
|
||||||
|
foreach (var devName in input.devNames)
|
||||||
|
{
|
||||||
|
tasks.Add(WriteTagAsync(devName, ElevatorConsts.AGVControl, input.value));
|
||||||
|
}
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task CloseElevatorControl(CloseElevatorInput input)
|
||||||
|
{
|
||||||
|
if (input.devNames == null || !input.devNames.Any())
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(input.devNames));
|
||||||
|
}
|
||||||
|
var tasks = ParallelWriteTagAsync(input);
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
var timedTaskSvc = _backgudSvc as TimedTaskBackgroundService;
|
||||||
|
if (timedTaskSvc != null)
|
||||||
|
{
|
||||||
|
if (input.flag.Equals("close", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
_ = timedTaskSvc.CloseAgvHeartbeat(input.devNames);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = timedTaskSvc.OpenAgvHeartbeat(input.devNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ namespace Tnb.WarehouseMgr.Print
|
|||||||
{
|
{
|
||||||
private const uint IMAGE_BITMAP = 0;
|
private const uint IMAGE_BITMAP = 0;
|
||||||
private const uint LR_LOADFROMFILE = 16;
|
private const uint LR_LOADFROMFILE = 16;
|
||||||
private static readonly string dllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\Winpplb.dll");
|
private static readonly string winPPLBDllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\Winpplb.dll");
|
||||||
|
private static readonly string winPortDllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\WinPort.dll");
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||||
private static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType,
|
private static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType,
|
||||||
@@ -490,7 +491,7 @@ namespace Tnb.WarehouseMgr.Print
|
|||||||
/// 注:经测试,type=1E 手机不能识别;type=1 手机可识别;
|
/// 注:经测试,type=1E 手机不能识别;type=1 手机可识别;
|
||||||
/// 这个 B_Prn_Barcode 函数可以列印出一个指定类型的条码 功能。
|
/// 这个 B_Prn_Barcode 函数可以列印出一个指定类型的条码 功能。
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[DllImport("Library\\x64\\Winpplb.dll")]
|
[DllImport($"Library\\x64\\Winpplb.dll")]
|
||||||
|
|
||||||
public static extern int B_Prn_Barcode(int x, int y, int ori, string type, int narrow,
|
public static extern int B_Prn_Barcode(int x, int y, int ori, string type, int narrow,
|
||||||
int width, int height, char human, string data);
|
int width, int height, char human, string data);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using Aop.Api.Domain;
|
||||||
using JNPF;
|
using JNPF;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
@@ -26,24 +27,24 @@ namespace Tnb.WarehouseMgr
|
|||||||
private IEventPublisher _eventPublisher = default!;
|
private IEventPublisher _eventPublisher = default!;
|
||||||
private readonly ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build<ElevatorControlConfiguration>();
|
private readonly ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
|
private readonly IHostApplicationLifetime _lifeTime;
|
||||||
|
private static List<string> s_heartbeatDevNames = new();
|
||||||
//private static Dictionary<string, Func<CancellationToken?, Task>> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase);
|
//private static Dictionary<string, Func<CancellationToken?, Task>> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase);
|
||||||
public TimedTaskBackgroundService(IServiceProvider serviceProvider)
|
public TimedTaskBackgroundService()
|
||||||
{
|
{
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
IsStarted = true;
|
IsStarted = true;
|
||||||
|
s_heartbeatDevNames = _elevatorControlConfiguration.HeartbeatDevNames;
|
||||||
Task timedTask = Task.Run(() =>
|
Task timedTask = Task.Run(() =>
|
||||||
{
|
{
|
||||||
_eventPublisher = App.GetRequiredService<IEventPublisher>();
|
_eventPublisher = App.GetRequiredService<IEventPublisher>();
|
||||||
|
|
||||||
//电梯Agv心跳检测
|
//电梯Agv心跳检测
|
||||||
_ = TimedTask(async token =>
|
_ = TimedTask(async token =>
|
||||||
{
|
{
|
||||||
foreach (var devName in _elevatorControlConfiguration.HeartbeatDevNames)
|
foreach (var devName in s_heartbeatDevNames)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> parameter = new()
|
Dictionary<string, string> parameter = new()
|
||||||
{
|
{
|
||||||
@@ -56,7 +57,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await Console.Out.WriteLineAsync($"{devName.Match(@"\d+")}#梯, 心跳检测结果:{result}");
|
await Console.Out.WriteLineAsync($"{devName.Match(@"\d+")}#梯, 心跳检测结果:{result}");
|
||||||
}
|
}
|
||||||
}, stoppingToken, 30);
|
}, stoppingToken, 30);
|
||||||
|
|
||||||
});
|
});
|
||||||
return timedTask;
|
return timedTask;
|
||||||
}
|
}
|
||||||
@@ -144,6 +145,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
return delayTask;
|
return delayTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task CloseAgvHeartbeat(IEnumerable<string> devNames)
|
||||||
|
{
|
||||||
|
s_heartbeatDevNames.RemoveAll(x => devNames.Contains(x));
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task OpenAgvHeartbeat(IEnumerable<string> devNames)
|
||||||
|
{
|
||||||
|
s_heartbeatDevNames.AddRange(devNames);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义任务调度器,保证长任务在单独的线程中运行
|
/// 自定义任务调度器,保证长任务在单独的线程中运行
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<BasLocation> items = new();
|
List<BasLocation> items = new();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WmsInstockPolicies policy = await _db.Queryable<WmsInstockPolicies>().Where(it => it.status == 1).FirstAsync();
|
WmsInstockPolicies policy = await _db.CopyNew().Queryable<WmsInstockPolicies>().Where(it => it.status == 1).FirstAsync();
|
||||||
if (policy == null)
|
if (policy == null)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("没有可用的策略", 500);
|
throw new AppFriendlyException("没有可用的策略", 500);
|
||||||
@@ -173,7 +173,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
.And(it => it.is_type == ((int)EnumLocationType.存储库位).ToString())
|
.And(it => it.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||||
.And(it => it.is_use == ((int)EnumCarryStatus.空闲).ToString())
|
.And(it => it.is_use == ((int)EnumCarryStatus.空闲).ToString())
|
||||||
.ToExpression();
|
.ToExpression();
|
||||||
items = await _db.Queryable<BasLocation>().Where(whereExp).OrderBy(policy.policy).ToListAsync();
|
items = await _db.CopyNew().Queryable<BasLocation>().Where(whereExp).OrderBy(policy.policy).ToListAsync();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -238,6 +238,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
//获取电梯数据
|
//获取电梯数据
|
||||||
List<WmsElevatorH> elevatorList = await db.Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
List<WmsElevatorH> elevatorList = await db.Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
|
||||||
|
.Where((a, b) => a.enabled == 1)
|
||||||
.Select((a, b) => new WmsElevatorH
|
.Select((a, b) => new WmsElevatorH
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -249,6 +250,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
floor = b.floor
|
floor = b.floor
|
||||||
|
|
||||||
}, true).ToListAsync();
|
}, true).ToListAsync();
|
||||||
|
Logger.Information($"可用电梯信息:{elevatorList.Select(e => e.elevator_code)}");
|
||||||
|
|
||||||
|
|
||||||
//获取所有未下发的预任务申请
|
//获取所有未下发的预任务申请
|
||||||
@@ -416,14 +418,14 @@ namespace Tnb.WarehouseMgr
|
|||||||
foreach (var at in agvDTTasks)
|
foreach (var at in agvDTTasks)
|
||||||
{
|
{
|
||||||
var ele = elevatorList.Find(x => x.location_code == at.endlocation_code);
|
var ele = elevatorList.Find(x => x.location_code == at.endlocation_code);
|
||||||
Logger.Information($"ele.elevator_id={ele?.elevator_id}");
|
Logger.Information($"ele.elevator_id:{ele?.elevator_id},elevator_code:{ele.elevator_code}");
|
||||||
if (ele != null)
|
if (ele != null)
|
||||||
{
|
{
|
||||||
at.device_id = ele.elevator_id;
|
at.device_id = ele.elevator_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = agvDTTasks
|
List<(string endlocation_code, string device_id, string id, int start_floor)> endLocCodes = agvDTTasks
|
||||||
.Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
|
.Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList();
|
||||||
if (endLocCodes?.Count > 0)
|
if (endLocCodes?.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -475,13 +477,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="endLocCodes"></param>
|
/// <param name="endLocCodes"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task CallingLanding(List<(string endlocation_code, string device_id, string id, string floorNO)> endLocCodes)
|
private async Task CallingLanding(List<(string endlocation_code, string device_id, string id, int floorNO)> endLocCodes)
|
||||||
{
|
{
|
||||||
Logger.Information($" 开始呼梯操作.............");
|
Logger.Information($" 开始呼梯操作.............");
|
||||||
Logger.Information($"电梯信息:{JsonConvert.SerializeObject(s_elevatorMap)}");
|
Logger.Information($"电梯信息:{JsonConvert.SerializeObject(s_elevatorMap)}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach ((_, string devId, string disTaskId, string floorNO) in endLocCodes)
|
foreach ((_, string devId, string disTaskId, int floorNO) in endLocCodes)
|
||||||
{
|
{
|
||||||
Logger.Information($"devId:{devId}");
|
Logger.Information($"devId:{devId}");
|
||||||
if (!s_elevatorMap.TryGetValue(devId, out object? elevatorCode))
|
if (!s_elevatorMap.TryGetValue(devId, out object? elevatorCode))
|
||||||
@@ -597,7 +599,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
} while (doorStatus != 4);
|
} while (doorStatus != 4);
|
||||||
Logger.Information($"当前门状态:{doorStatus}");
|
Logger.Information($"当前门状态:{doorStatus}");
|
||||||
|
|
||||||
int floor = await GetRealFloor(disTask.end_floor.ParseToInt());
|
int floor = await GetRealFloor(disTask.end_floor);
|
||||||
|
|
||||||
Logger.Information($"目标楼层:{floor}");
|
Logger.Information($"目标楼层:{floor}");
|
||||||
|
|
||||||
@@ -608,7 +610,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
tuple = await _elevatorControlService.GetElevatorStatus(devName,tags, CancellationToken.None);
|
tuple = await _elevatorControlService.GetElevatorStatus(devName, tags, CancellationToken.None);
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
} while (tuple.sysStatus != 3 && tuple.runStatus != 0);
|
} while (tuple.sysStatus != 3 && tuple.runStatus != 0);
|
||||||
|
|
||||||
@@ -986,27 +988,38 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
List<WmsRoad> roads = await _db.Queryable<WmsRoad>().Where(it => it.status == 1).ToListAsync();
|
List<WmsRoad> roads = await _db.Queryable<WmsRoad>().Where(it => it.status == 1).ToListAsync();
|
||||||
List<WmsPointH> points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
|
List<WmsPointH> points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
|
||||||
|
Logger.Information($"points:{string.Join(",", points.Select(p => p.point_code))}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
|
if (points?.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
|
||||||
{
|
{
|
||||||
|
Logger.Information("包含电梯Agv任务");
|
||||||
//查询当前电梯点
|
//查询当前电梯点
|
||||||
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync();
|
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().InnerJoin<WmsElevatorH>((a, b) => a.bill_id == b.id).Where((a, b) => points.Select(x => x.id).Contains(a.point_id)).ToListAsync();
|
||||||
|
Logger.Information($"curEleDs==null :{curEleDs == null},curEleDs:{string.Join(",", curEleDs.Select(x => x.bill_id))}");
|
||||||
//如果有电梯点,则会进行电梯的均匀分配
|
//如果有电梯点,则会进行电梯的均匀分配
|
||||||
if (curEleDs?.Count > 0)
|
if (curEleDs?.Count > 0)
|
||||||
{
|
{
|
||||||
//当前电梯
|
//当前电梯
|
||||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
|
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id);
|
||||||
|
Logger.Information($"curEle==null :{curEle == null}");
|
||||||
|
|
||||||
//同电梯组电梯
|
//同电梯组电梯
|
||||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||||
|
if (curEle.enabled == 0 && (sGpEle == null || sGpEle.Count < 1))
|
||||||
if (curEle == null && sGpEle?.Count > 0)
|
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("电梯被禁用或未配置", 500);
|
throw new AppFriendlyException("电梯被禁用或未配置", 500);
|
||||||
}
|
}
|
||||||
|
if ((sGpEle == null || sGpEle.Count < 1) && curEle.enabled == 1)
|
||||||
|
{
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
if (sGpEle?.Count > 0 && curEle.enabled == 0)
|
||||||
|
{
|
||||||
|
return points;
|
||||||
|
}
|
||||||
//判断电梯组中各电梯任务数
|
//判断电梯组中各电梯任务数
|
||||||
if (curEle == null || sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
|
if (sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
|
||||||
{
|
{
|
||||||
List<WmsElevatorD> sGpDs = await _db.Queryable<WmsElevatorD>().Where(it => it.bill_id == sGpEle.First().id).ToListAsync();
|
List<WmsElevatorD> sGpDs = await _db.Queryable<WmsElevatorD>().Where(it => it.bill_id == sGpEle.First().id).ToListAsync();
|
||||||
if (sGpDs?.Count > 0)
|
if (sGpDs?.Count > 0)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
_ = await _db.Updateable(preTask).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
_ = await _db.Updateable(preTask).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
_ = await _db.Deleteable<WmsElevatorUnexecute>().Where(it => it.distask_id == id).ExecuteCommandAsync();
|
||||||
_ = await _db.Deleteable(disTask).ExecuteCommandAsync();
|
_ = await _db.Deleteable(disTask).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace JNPF.API.Entry;
|
|||||||
|
|
||||||
public class Startup : AppStartup
|
public class Startup : AppStartup
|
||||||
{
|
{
|
||||||
|
//private TimedTaskBackgroundService timedTaskSvc = new();
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
// 注册和配置Mvc和api服务
|
// 注册和配置Mvc和api服务
|
||||||
@@ -48,7 +49,7 @@ public class Startup : AppStartup
|
|||||||
|
|
||||||
services.AddMemoryCache(); // 使用本地缓存必须添加
|
services.AddMemoryCache(); // 使用本地缓存必须添加
|
||||||
services.AddConfigurableOptions<CacheOptions>();
|
services.AddConfigurableOptions<CacheOptions>();
|
||||||
services.AddSingleton( typeof(ISingleton), typeof(RedisData));
|
services.AddSingleton(typeof(ISingleton), typeof(RedisData));
|
||||||
// 微信
|
// 微信
|
||||||
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
|
||||||
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册(如果使用Senparc.Weixin SDK则添加)
|
||||||
@@ -56,15 +57,18 @@ public class Startup : AppStartup
|
|||||||
services.AddOverideVisualDev();
|
services.AddOverideVisualDev();
|
||||||
|
|
||||||
//定时任务
|
//定时任务
|
||||||
services.AddHostedService<TimedTaskBackgroundService>();
|
|
||||||
//services.AddHostedService<RedisBackGround>();
|
|
||||||
|
|
||||||
|
services.AddHostedService<TimedTaskBackgroundService>();
|
||||||
|
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
|
||||||
|
//var bgSvc = App.GetRequiredService<BackgroundService>();
|
||||||
|
//bgSvc.StartAsync(CancellationToken.None);
|
||||||
|
//services.AddHostedService<RedisBackGround>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting, IHostApplicationLifetime lifeTime)
|
||||||
{
|
{
|
||||||
// 添加状态码拦截中间件
|
// 添加状态码拦截中间件
|
||||||
app.UseUnifyResultStatusCodes();
|
app.UseUnifyResultStatusCodes();
|
||||||
@@ -113,5 +117,10 @@ public class Startup : AppStartup
|
|||||||
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
|
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
|
||||||
if (isStartTimeJob)
|
if (isStartTimeJob)
|
||||||
serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.Logging;
|
using JNPF.Logging;
|
||||||
|
using JNPF.Message;
|
||||||
|
using JNPF.Message.Interfaces.Message;
|
||||||
|
using JNPF.Message.Service;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.EquipMgr.Entities;
|
using Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
@@ -15,7 +18,7 @@ namespace JNPF.TaskScheduler.Listener
|
|||||||
// {
|
// {
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
// }
|
// }
|
||||||
|
private IMessageService _sendMessageService => App.GetService<IMessageService>();
|
||||||
[SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
[SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||||
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||||
{
|
{
|
||||||
@@ -171,6 +174,24 @@ namespace JNPF.TaskScheduler.Listener
|
|||||||
Console.WriteLine(dbResult.ErrorMessage);
|
Console.WriteLine(dbResult.ErrorMessage);
|
||||||
Log.Error(dbResult.ErrorMessage);
|
Log.Error(dbResult.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<EqpEquipment> equipments = await db.Queryable<EqpEquipment>().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync();
|
||||||
|
foreach (var item in tobeCreateList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||||
|
continue;
|
||||||
|
var users = new List<string>() { item.execute_user_id };
|
||||||
|
var title = equipments.FirstOrDefault(x => x.id == item.equip_id).code + "设备保养提醒";
|
||||||
|
await _sendMessageService.SentMessage(users, title, title);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.Logging;
|
using JNPF.Logging;
|
||||||
|
using JNPF.Message.Interfaces.Message;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.EquipMgr.Entities;
|
using Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ namespace JNPF.TaskScheduler.Listener
|
|||||||
// {
|
// {
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
// }
|
// }
|
||||||
|
private IMessageService _sendMessageService => App.GetService<IMessageService>();
|
||||||
[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
[SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||||
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
public async void GenerateSpotInspectionPlan(SpareTimer timer, long count)
|
||||||
{
|
{
|
||||||
@@ -172,6 +173,24 @@ namespace JNPF.TaskScheduler.Listener
|
|||||||
Console.WriteLine(dbResult.ErrorMessage);
|
Console.WriteLine(dbResult.ErrorMessage);
|
||||||
Log.Error(dbResult.ErrorMessage);
|
Log.Error(dbResult.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<EqpEquipment> equipments = await db.Queryable<EqpEquipment>().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync();
|
||||||
|
foreach (var item in tobeCreateList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null)
|
||||||
|
continue;
|
||||||
|
var users = new List<string>() { item.spot_record_user_id };
|
||||||
|
var title = equipments.FirstOrDefault(x => x.id == item.equip_id).code + "设备点巡检提醒";
|
||||||
|
await _sendMessageService.SentMessage(users, title, title);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
Log.Information($"---------------生成{tobeCreateList.Count}个计划---------------");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user