diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs
index ac47c8f2..1e4e57ed 100644
--- a/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs
@@ -18,5 +18,12 @@ namespace Tnb.BasicData.Interfaces
///
public Task GetHistoryList(EsopHistoryListQueryInput input);
+ ///
+ /// 根据生产bom工序id获取实体
+ ///
+ /// mbomProcessId
+ ///
+ public Task GetEntityByMbomProcessId(Dictionary dic);
+
}
}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasESopService.cs b/BasicData/Tnb.BasicData/BasESopService.cs
index 61b94458..00d86f39 100644
--- a/BasicData/Tnb.BasicData/BasESopService.cs
+++ b/BasicData/Tnb.BasicData/BasESopService.cs
@@ -126,6 +126,18 @@ namespace Tnb.BasicData
return PageResult.SqlSugarPageResult(list);
}
+ [HttpPost]
+ public async Task GetEntityByMbomProcessId(Dictionary dic)
+ {
+ string mbomProcessId = dic["mbomProcessId"];
+ if (!string.IsNullOrEmpty(mbomProcessId))
+ {
+ return await _repository.GetFirstAsync(x => x.mbom_process_id == mbomProcessId && x.enabled == 1);
+ }
+
+ return null;
+ }
+
[HttpPost]
public async Task UploadNewVersion(UploadNewVersionInput input)
{
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
index 7224dfc9..78c78153 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/EquipmentLife.cs
@@ -21,5 +21,9 @@ namespace Tnb.EquipMgr
/// 报废
///
public const string SCRAP = "4";
+ ///
+ /// 未入场
+ ///
+ public const string NOTADMITTED = "4";
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeInput.cs
new file mode 100644
index 00000000..c6a3d0da
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeInput.cs
@@ -0,0 +1,10 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class EquipWorkshopChangeInput
+ {
+ public string equip_id { get; set; } = string.Empty;
+ public string new_workshop_id { get; set; } = string.Empty;
+ public string? new_installation_location { get; set; }
+ public string? remark { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeQueryOutput.cs
new file mode 100644
index 00000000..b1099286
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipWorkshopChangeQueryOutput.cs
@@ -0,0 +1,36 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class EquipWorkshopChangeQueryOutput
+ {
+ public string id { get; set; } = string.Empty;
+ ///
+ /// 旧车间id
+ ///
+ public string old_workshop_id { get; set; } = string.Empty;
+
+ ///
+ /// 新车间id
+ ///
+ public string new_workshop_id { get; set; } = string.Empty;
+
+ ///
+ /// 旧安装地点
+ ///
+ public string? old_installation_location { get; set; }
+
+ ///
+ /// 新安装地点
+ ///
+ public string? new_installation_location { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public string? create_time { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
index 335cda29..ff6a8947 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs
@@ -187,5 +187,15 @@ public partial class EqpEquipment : BaseEntity
/// 工位编码
///
public string? station_code { get; set; }
+
+ ///
+ /// 质保开始时间
+ ///
+ public DateTime? warranty_start_time { get; set; }
+
+ ///
+ /// 质保结束时间
+ ///
+ public DateTime? warranty_end_time { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpWorkshopChangeLog.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpWorkshopChangeLog.cs
new file mode 100644
index 00000000..85b448f1
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpWorkshopChangeLog.cs
@@ -0,0 +1,72 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities;
+
+///
+/// 设备使用车间变更记录
+///
+[SugarTable("eqp_workshop_change_log")]
+public partial class EqpWorkshopChangeLog : BaseEntity
+{
+ public EqpWorkshopChangeLog()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 设备id
+ ///
+ public string equip_id { get; set; } = string.Empty;
+
+ ///
+ /// 旧车间id
+ ///
+ public string? old_workshop_id { get; set; }
+
+ ///
+ /// 新车间id
+ ///
+ public string? new_workshop_id { get; set; }
+
+ ///
+ /// 旧安装地点
+ ///
+ public string? old_installation_location { get; set; }
+
+ ///
+ /// 新安装地点
+ ///
+ public string? new_installation_location { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// 创建用户
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// 修改用户
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// 所属组织
+ ///
+ public string? org_id { get; set; }
+
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs
new file mode 100644
index 00000000..f4cdd287
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs
@@ -0,0 +1,23 @@
+using Tnb.EquipMgr.Entities.Dto;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ ///
+ /// 设备迁移服务
+ ///
+ public interface IEqpWorkshopChangeLogService
+ {
+ ///
+ /// 根据设备id获取迁移记录
+ ///
+ ///
+ public Task GetEquipWorkshopChangeList(EquipQueryInput input);
+
+ ///
+ /// 设备迁移
+ ///
+ ///
+ ///
+ public Task WorkshopChange(EquipWorkshopChangeInput input);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs
new file mode 100644
index 00000000..94074c06
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs
@@ -0,0 +1,95 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Enums;
+using JNPF.Common.Filter;
+using JNPF.DependencyInjection;
+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;
+using Tnb.EquipMgr.Interfaces;
+
+namespace Tnb.EquipMgr
+{
+ ///
+ /// 设备技术参数
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class EqpWorkshopChangeLogService : IEqpWorkshopChangeLogService, IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+
+ public EqpWorkshopChangeLogService(ISqlSugarRepository repository, IUserManager userManager)
+ {
+ _userManager = userManager;
+ _repository = repository;
+ }
+
+ [HttpPost]
+ public async Task GetEquipWorkshopChangeList(EquipQueryInput input)
+ {
+ var db = _repository.AsSugarClient();
+ // Dictionary? queryJson = new Dictionary();
+ // if (input!=null && !string.IsNullOrEmpty(input.queryJson))
+ // {
+ // queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? "");
+ // }
+ var result = await db.Queryable()
+ .LeftJoin((a,b)=>a.old_workshop_id==b.Id)
+ .LeftJoin((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
+ {
+ id = a.id,
+ old_workshop_id = b.FullName,
+ new_workshop_id = c.FullName,
+ 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));
+
+ return PageResult.SqlSugarPageResult(result);
+ }
+
+ [HttpPost]
+ public async Task WorkshopChange(EquipWorkshopChangeInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ EqpEquipment eqpEquipment = await db.Queryable().SingleAsync(x => x.id == input.equip_id);
+
+ EqpWorkshopChangeLog eqpWorkshopChangeLog = new EqpWorkshopChangeLog()
+ {
+ equip_id = input.equip_id,
+ old_workshop_id = eqpEquipment.use_department_id,
+ new_workshop_id = input.new_workshop_id,
+ old_installation_location = eqpEquipment.installation_location,
+ new_installation_location = input.new_installation_location,
+ remark = input.remark,
+ create_id = _userManager.UserId,
+ create_time = DateTime.Now,
+ org_id = _userManager.GetUserInfo().Result.organizeId
+ };
+
+ await _repository.InsertAsync(eqpWorkshopChangeLog);
+
+ await db.Updateable()
+ .SetColumns(x => x.use_department_id == input.new_workshop_id)
+ .SetColumns(x => x.installation_location == input.new_installation_location)
+ .Where(x => x.id == input.equip_id).ExecuteCommandAsync();
+
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ return result.IsSuccess ? "迁移成功" : result.ErrorMessage;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 79fe64ea..8d34e4f0 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -1070,7 +1070,8 @@ namespace Tnb.ProductionMgr
record.masterial_name = material?.name;
record.plan_start_date = taskInfo.estimated_start_date;
record.plan_end_date = taskInfo.estimated_end_date;
- record.plan_qty = taskInfo.plan_qty;
+ // record.plan_qty = taskInfo.plan_qty;
+ record.plan_qty = taskInfo.scheduled_qty;
record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
record.mo_task_type = mo?.mo_type;
record.status = taskInfo.mo_task_status;
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
index a285f4b6..e864bae8 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
@@ -150,8 +150,8 @@ namespace Tnb.ProductionMgr
{
nsChild[i].parentId = parentId;
nsChild[i].process_id = $"{items[i].process_code}/{items[i].process_name}";
- nsChild[i].plan_start_date = items[i].estimated_start_date.HasValue ? items[i].estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- nsChild[i].plan_end_date = items[i].estimated_end_date.HasValue ? items[i].estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
+ nsChild[i].plan_start_date = items[i].plan_start_date.HasValue ? items[i].plan_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
+ nsChild[i].plan_end_date = items[i].plan_end_date.HasValue ? items[i].plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
if (nsChild[i].workline_id.IsNotEmptyOrNull())
{
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
index 2bb31058..1ad7ad01 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
@@ -278,6 +278,7 @@ namespace Tnb.ProductionMgr
// reported_qty = a.reported_qty,
// prd_qty = a.prd_qty,
eqp_code = d.code,
+ mbom_process_id = a.mbom_process_id,
}).FirstAsync();
return prdTask;