diff --git a/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs
new file mode 100644
index 00000000..9b46621b
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs
@@ -0,0 +1,18 @@
+namespace Tnb.BasicData
+{
+ ///
+ /// 工厂基础数据
+ ///
+ public static class FactoryConfigConst
+ {
+ ///
+ /// 报工是否允许超过工单计划数 是:1 否 :0
+ ///
+ public const string IS_SURPASS = "is_surpass";
+
+ ///
+ /// 报工允许超过工单计划数百分比 例:填写10就是10%
+ ///
+ public const string IS_SURPASS_PERCENTAGE = "is_surpass_percentage";
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasFactoryConfig.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasFactoryConfig.cs
new file mode 100644
index 00000000..96972c47
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasFactoryConfig.cs
@@ -0,0 +1,87 @@
+using JNPF.Common.Contracts;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.BasicData.Entities;
+
+///
+/// 工厂基础数据
+///
+[SugarTable("bas_factory_config")]
+public partial class BasFactoryConfig : BaseEntity
+{
+ public BasFactoryConfig()
+ {
+ id = SnowflakeIdHelper.NextId();
+ }
+ ///
+ /// 名称
+ ///
+ public string name { get; set; } = string.Empty;
+
+ ///
+ /// key
+ ///
+ public string key { get; set; } = string.Empty;
+
+ ///
+ /// 值
+ ///
+ public string value { get; set; } = string.Empty;
+
+ ///
+ /// 是否启用
+ ///
+ public int enabled { 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; }
+
+ ///
+ /// 排序
+ ///
+ public long? ordinal { get; set; }
+
+ ///
+ /// 是否系统
+ ///
+ public int? is_system { get; set; }
+
+ ///
+ /// 流程任务Id
+ ///
+ public string? f_flowtaskid { get; set; }
+
+ ///
+ /// 流程引擎Id
+ ///
+ public string? f_flowid { get; set; }
+
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs
new file mode 100644
index 00000000..82f7295c
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs
@@ -0,0 +1,22 @@
+namespace Tnb.ProductionMgr.Entities.Dto
+{
+ public class PrdMoListOuput
+ {
+ public string id { get; set; }
+
+ public string mo_type { get; set; }
+
+ public string mo_source { get; set; }
+ public string mo_code { get; set; }
+ public string plan_start_date { get; set; }
+ public string plan_end_date { get; set; }
+ public string material_id { get; set; }
+ public int? plan_qty { get; set; }
+ public string unit_id { get; set; }
+ public string mo_status { get; set; }
+ public string? remark { get; set; }
+ public string combine_mo_code { get; set; }
+ public string material_id_id { get; set; }
+ public List children { get; set; } = new List();
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs
new file mode 100644
index 00000000..722ddda9
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs
@@ -0,0 +1,14 @@
+namespace Tnb.ProductionMgr.Entities.Dto
+{
+ public class PrdMoTaskIssueListOutput
+ {
+ public string id { get; set; }
+ public string mo_task_code { get; set; }
+ public string material_id { get; set; }
+ public string mold_id { get; set; }
+ public string mo_task_status { get; set; }
+ public int? plan_qty { get; set; }
+ public int? scheduled_qty { get; set; }
+ public string create_time { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
index e714bb9b..aa48d3b7 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs
@@ -84,6 +84,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 工序名称
///
public string process_name { get; set;}
+
+ public string create_time { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
index 46a099c5..c5ca9609 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/WorkOrderAdjustmentListOutput.cs
@@ -17,5 +17,6 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public string estimated_start_date { get; set; }
public string estimated_end_date { get; set; }
public string eqp_id { get; set; }
+ public string create_time { get; set; }
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs
index 04c6db66..dcbe0c55 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs
@@ -53,5 +53,10 @@ public partial class PrdInstockD : BaseEntity
/// 生产提报id
///
public string report_id { get; set; } = string.Empty;
+
+ ///
+ /// 生产任务单号
+ ///
+ public string mo_task_code { get; set; } = string.Empty;
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
index f456faf7..6b12ce6d 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
@@ -227,5 +227,11 @@ public partial class PrdMo : BaseEntity
/// 物料单位
///
public string? unit_id { get; set; }
+
+ ///
+ /// 工单来源
+ ///
+ public string? mo_source { get; set; }
+
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
index 16b52328..6c2d1c49 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
@@ -1,28 +1,16 @@
-using System.Reflection.Emit;
-using System.Text;
-using Aop.Api.Domain;
-using DbModels;
-using JNPF.Common.Core.Manager;
-using JNPF.Common.Enums;
+using JNPF.Common.Core.Manager;
using JNPF.Common.Extension;
+using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
-using JNPF.Extensitions.EventBus;
using JNPF.FriendlyException;
-using JNPF.Logging;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
-using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
using JNPF.VisualDev.Interfaces;
-using Mapster;
using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging.Abstractions;
-using NPOI.SS.Formula.Functions;
-using Org.BouncyCastle.Crypto.Generators;
-using Senparc.Weixin.Work.AdvancedAPIs.MailList;
using SqlSugar;
using Tnb.BasicData;
using Tnb.BasicData.Entities;
@@ -74,43 +62,103 @@ namespace Tnb.ProductionMgr
OverideFuncs.GetListAsync = GetList;
}
+ // private async Task GetList(VisualDevModelListQueryInput input)
+ // {
+ // var db = _repository.AsSugarClient();
+ // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
+ // var data = await _runService.GetListResult(templateEntity, input);
+ // if (data?.list?.Count > 0)
+ // {
+ // foreach (var row in data.list)
+ // {
+ // var dic = row.ToDictionary(x => x.Key, x => x.Value);
+ // var pkName = "material_id_id";
+ // if (dic.ContainsKey(pkName))
+ // {
+ // var materialId = dic[pkName]?.ToString();
+ // var material = await db.Queryable().FirstAsync(it => it.id == materialId);
+ // if (material != null)
+ // {
+ // row.Add("material_name", material.name);
+ // row.Add($"material_attribute", material.attribute);
+ // if (dic.ContainsKey("material_id"))
+ // {
+ // row["material_id"] = material.code + "/" + material.name;
+ // }
+ // }
+ //
+ // if (dic.ContainsKey("unit_id"))
+ // {
+ // string unitId = dic["unit_id"]?.ToString() ?? "";
+ // var unit = await db.Queryable().SingleAsync(x => x.Id == unitId);
+ // row["unit_id"] = unit?.FullName ?? "";
+ // }
+ // }
+ // }
+ // }
+ // return data!;
+ // }
+
private async Task GetList(VisualDevModelListQueryInput input)
{
var db = _repository.AsSugarClient();
- VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
- var data = await _runService.GetListResult(templateEntity, input);
- if (data?.list?.Count > 0)
- {
- foreach (var row in data.list)
+ Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
+ string moCode = queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : "";
+ string moStatus = queryJson.ContainsKey("mo_status") ? queryJson["mo_status"].ToString() : "";
+ string combineMoCode = queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : "";
+ var result = await db.Queryable()
+ .LeftJoin((a, b) => a.material_id == b.id)
+ .LeftJoin((a, b, c) => c.EnCode == DictConst.MeasurementUnit)
+ .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.Id)
+ .LeftJoin((a, b, c, d, e) => a.mo_status == e.Id)
+ .LeftJoin((a, b, c, d, e,f) => a.mo_type==f.Id)
+ .WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d, e) => a.mo_code.Contains(moCode))
+ .WhereIF(!string.IsNullOrEmpty(combineMoCode),
+ (a, b, c, d, e) => a.combine_mo_code.Contains(combineMoCode))
+ .WhereIF(!string.IsNullOrEmpty(moStatus), (a, b, c, d, e) => a.mo_status == moStatus)
+ .Where(a=>SqlFunc.IsNullOrEmpty(a.parent_id))
+ .OrderByDescending(a=>a.create_time)
+ .Select((a, b, c, d, e,f) => new PrdMoListOuput
{
- var dic = row.ToDictionary(x => x.Key, x => x.Value);
- var pkName = "material_id_id";
- if (dic.ContainsKey(pkName))
- {
- var materialId = dic[pkName]?.ToString();
- var material = await db.Queryable().FirstAsync(it => it.id == materialId);
- if (material != null)
+ id = a.id,
+ mo_type = f.FullName,
+ mo_source = a.mo_source=="1" ? "ERP同步" : "新建/导入",
+ mo_code = a.mo_code,
+ plan_start_date = a.plan_start_date==null ? "" : a.plan_start_date.Value.ToString("yyyy-MM-dd"),
+ plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
+ material_id = b.code+"/"+b.name,
+ material_id_id = b.id,
+ plan_qty = a.plan_qty,
+ unit_id = d.FullName,
+ mo_status = e.FullName,
+ remark = a.remark,
+ children = SqlFunc.Subqueryable()
+ .LeftJoin((aa, bb) => aa.material_id == bb.id)
+ .LeftJoin((aa, bb, cc) => cc.EnCode == DictConst.MeasurementUnit)
+ .LeftJoin((aa, bb, cc, dd) => cc.Id == dd.DictionaryTypeId && aa.unit_id == dd.Id)
+ .LeftJoin((aa, bb, cc, dd, ee) => aa.mo_status == ee.Id)
+ .LeftJoin((aa, bb, cc, dd, ee,ff) => aa.mo_type==ff.Id)
+ .Where(aa=>aa.parent_id==a.id)
+ .ToList((aa,bb,cc,dd,ee,ff)=>new PrdMoListOuput
{
- row.Add("material_name", material.name);
- row.Add($"material_attribute", material.attribute);
- if (dic.ContainsKey("material_id"))
- {
- row["material_id"] = material.code + "/" + material.name;
- }
- }
-
- if (dic.ContainsKey("unit_id"))
- {
- string unitId = dic["unit_id"]?.ToString() ?? "";
- var unit = await db.Queryable().SingleAsync(x => x.Id == unitId);
- row["unit_id"] = unit?.FullName ?? "";
- }
- }
- }
- }
- return data!;
+ id = aa.id,
+ mo_type = ff.FullName,
+ mo_source = aa.mo_source=="1" ? "ERP同步" : "新建/导入",
+ mo_code = aa.mo_code,
+ plan_start_date = aa.plan_start_date==null ? "" : aa.plan_start_date.Value.ToString("yyyy-MM-dd"),
+ plan_end_date = aa.plan_end_date==null ? "" : aa.plan_end_date.Value.ToString("yyyy-MM-dd"),
+ material_id = bb.code+"/"+bb.name,
+ material_id_id = bb.id,
+ plan_qty = aa.plan_qty,
+ unit_id = dd.FullName,
+ mo_status = ee.FullName,
+ remark = aa.remark,
+ })
+ }).ToPagedListAsync(input.currentPage, int.MaxValue);
+ return PageResult.SqlSugarPageResult(result);
}
+
#region Get
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
index 2f3ebcec..3524721d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs
@@ -25,6 +25,7 @@ using JNPF.Systems.Entitys.System;
using Newtonsoft.Json;
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
using Tnb.BasicData;
+using Tnb.ProductionMgr.Entities.Dto;
namespace Tnb.ProductionMgr
{
@@ -116,7 +117,8 @@ namespace Tnb.ProductionMgr
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
.WhereIF(!string.IsNullOrEmpty(moTaskStatus), (a, b, c, d) => a.mo_task_status == moTaskStatus)
.Where((a,b,c,d,e,f)=>a.schedule_type==1)
- .Select((a, b, c, d,e,f) => new PrdMoTask
+ .OrderByDescending(a=>a.create_time)
+ .Select((a, b, c, d,e,f) => new PrdMoTaskIssueListOutput
{
id = a.id,
mo_task_code = a.mo_task_code,
@@ -125,8 +127,9 @@ namespace Tnb.ProductionMgr
mo_task_status = d.FullName,
plan_qty = f.plan_qty,
scheduled_qty = a.scheduled_qty,
+ create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
}).ToPagedListAsync(input.currentPage, input.pageSize);
- return PageResult.SqlSugarPageResult(result);
+ return PageResult.SqlSugarPageResult(result);
}
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 165b087b..ab218734 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -303,6 +303,7 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c, d) => a.mold_id == d.id)
.LeftJoin((a, b, c, d, e) => a.eqp_id == e.id)
.Where((a, b, c, d, e) => a.mo_id == moId)
+ .OrderByDescending((a,b,c,d,e)=>a.create_time)
.Select((a, b, c, d, e) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -321,6 +322,7 @@ namespace Tnb.ProductionMgr
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
process_code = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_code),
process_name = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_name),
+ create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
})
.Mapper(it =>
{
@@ -335,6 +337,7 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c, d) => a.workline_id == d.Id)
.LeftJoin((a,b,c,d,e)=>a.process_id==e.id)
.Where((a, b, c, d) => (b.id == moId || b.parent_id == moId) && SqlFunc.IsNullOrEmpty(a.parent_id))
+ .OrderByDescending((a,b,c,d,e)=>a.create_time)
.Select((a, b, c, d,e) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -350,6 +353,7 @@ namespace Tnb.ProductionMgr
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
plan_qty = a.scheduled_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
+ create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
})
.Mapper(it =>
{
@@ -375,6 +379,7 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c, d) => a.bom_id == d.id)
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code))
.Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id))
+ .OrderByDescending(a=>a.create_time)
.Select((a, b, c, d) => new PackSechelToBeIssueListOutput
{
mo_task_id = a.id,
@@ -1361,6 +1366,26 @@ namespace Tnb.ProductionMgr
throw Oops.Bah("暂停的任务单无法提报");
}
+ if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
+ {
+ var config1 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS);
+ if (config1?.value == "1")
+ {
+ var config2 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS_PERCENTAGE);
+ if (!string.IsNullOrEmpty(config2?.value))
+ {
+ if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty*(100+Convert.ToDecimal(config2?.value ?? "1"))/100)
+ {
+ throw Oops.Bah($"提报数量不能大于{100+Convert.ToDecimal(config2?.value ?? "0")}%排产数量");
+ }
+ }
+ }
+ else
+ {
+ throw Oops.Bah("提报数量不能大于排产数量");
+ }
+ }
+
// bool flag = (prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty == prdMoTask.scheduled_qty;
// if ((prdMoTask.reported_work_qty ?? 0) + (prdMoTask.scrap_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty)
@@ -1780,19 +1805,21 @@ namespace Tnb.ProductionMgr
worklineIds = await db.Queryable().Where(x => x.ParentId == eqpId && x.Category==DictConst.RegionCategoryWorklineCode && x.DeleteMark==null).Select(x=>x.Id).ToListAsync();
equipIds = await db.Queryable().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync();
}
-
+
var result = await db.Queryable()
.LeftJoin((a, b) => a.material_id == b.id)
.LeftJoin((a, b, c) => c.EnCode == DictConst.TaskStatus)
- .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
- .LeftJoin((a,b,c,d,e)=>a.mold_id==e.id)
- .LeftJoin((a,b,c,d,e,f)=>a.mo_id==f.id)
- .LeftJoin((a,b,c,d,e,f,g)=>a.workline_id==g.Id)
- .LeftJoin((a,b,c,d,e,f,g,h)=>a.eqp_id==h.id)
+ .LeftJoin((a, b, c, d) =>
+ c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode)
+ .LeftJoin((a, b, c, d, e) => a.mold_id == e.id)
+ .LeftJoin((a, b, c, d, e, f) => a.mo_id == f.id)
+ .LeftJoin((a, b, c, d, e, f, g) => a.workline_id == g.Id)
+ .LeftJoin((a, b, c, d, e, f, g, h) => a.eqp_id == h.id)
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode))
- .WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count<=0 && worklineIds.Count<=0, (a, b, c, d) => a.workline_id==eqpId || a.eqp_id==eqpId)
- .WhereIF(worklineIds.Count>0,(a, b, c, d)=>worklineIds.Contains(a.workline_id))
- .WhereIF(equipIds.Count>0,(a, b, c, d)=>equipIds.Contains(a.eqp_id))
+ .WhereIF(!string.IsNullOrEmpty(eqpId) && equipIds.Count <= 0 && worklineIds.Count <= 0,
+ (a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId)
+ .WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id))
+ .WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id))
.Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput
{
id = a.id,
@@ -1807,7 +1834,8 @@ namespace Tnb.ProductionMgr
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
- }).ToPagedListAsync(input.currentPage, input.pageSize);
+ create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
+ }).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult.SqlSugarPageResult(result);
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
index 4be63421..62cf4e1d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
@@ -81,6 +81,7 @@ namespace Tnb.ProductionMgr
// .WhereIF(end, a => a.estimated_end_date != null && endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
+ .OrderByDescending(a=>a.create_time)
.Select((a, b, c) => new PrdMoTask
{
id = a.id,
@@ -187,7 +188,7 @@ namespace Tnb.ProductionMgr
process_name = b.process_name,
plan_start_date = a.estimated_start_date,
plan_end_date = a.estimated_end_date,
- plan_qty = c.scheduled_qty,
+ plan_qty = a.scheduled_qty,
//complete_qty = SqlFunc.Subqueryable().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0),
mo_task_status = a.mo_task_status,
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
index c7cb7feb..d3903b74 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
@@ -155,8 +155,7 @@ namespace Tnb.ProductionMgr
plan_qty = a.scheduled_qty,
complete_qty = a.reported_work_qty,
mo_task_status = a.mo_task_status,
- schedule_type = a.schedule_type.ToString()
-
+ schedule_type = a.schedule_type.ToString(),
})
.Mapper(x=>x.mo_task_status=dic[x.mo_task_status].ToString())
.ToPagedListAsync(input.currentPage, input.pageSize);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
index 11628acf..63e4864f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
+++ b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj
@@ -1,4 +1,5 @@
-
+
+
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
index 372c4088..585b20b2 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs
@@ -70,13 +70,14 @@ namespace Tnb.WarehouseMgr
try
{
var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code);
+ if (carry.IsNull()) throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在", 500);
List carryCodes = new();
var carryDsLst = await _db.Queryable().Where(it => it.carry_id == carry.id).ToListAsync();
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && carryDsLst?.Count > 0)
{
var mIds = carryDsLst.Select(it => it.membercarry_id).ToList();
carryCodes = await _db.Queryable().Where(it => mIds.Contains(it.carry_id)).ToListAsync();
- if (carryCodes.Count < mIds.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空",500);
+ if (carryCodes.Count < mIds.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
for (int i = 0, cnt = mIds.Count; i < cnt; i++)
{
carryCodes[i].member_carrycode = carryDsLst.Find(x => x.membercarry_id == mIds[i])?.membercarry_code ?? string.Empty;
@@ -92,7 +93,7 @@ namespace Tnb.WarehouseMgr
catch (Exception)
{
await _db.Ado.RollbackTranAsync();
- throw ;
+ throw;
}
return data;
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs
index 76225f1c..f7cd1c6a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs
@@ -124,8 +124,8 @@ namespace Tnb.WarehouseMgr
if (details.Count > 0 && carryCodes.Count > 0)
{
var locTypes = new[] { ((int)EnumLocationType.出库库位).ToString(), ((int)EnumLocationType.出入库位).ToString() };
- var endLocs = await _db.Queryable().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToListAsync();
- var randomIndex = new Random().Next(0, endLocs.Count - 1);
+ var endLocs = await _db.Queryable().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync();
+ var randomIndex = new Random().Next(0, endLocs.GetUpperBound(0));
var carrys = await _db.Queryable().Where(it => carryCodes.Select(x => x.carry_id).Distinct().Contains(it.id)).ToListAsync();
var curDetails = details.DistinctBy(x => x.carry_id).ToList();
var curCarryCodes = carryCodes.FindAll(x => curDetails.Select(d => d.carry_id).Contains(x.carry_id));