diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Consts/DictionaryConstants.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Consts/DictionaryConstants.cs
new file mode 100644
index 00000000..46c93d21
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Consts/DictionaryConstants.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.ProductionMgr.Entitys.新文件夹
+{
+ public class DictionaryConstants
+ {
+ ///
+ /// 生产任务状态TypeId
+ ///
+ public const string PrdTaskStatusTypeId = "25572555259157";
+
+
+ }
+ ///
+ /// 工单状态
+ ///
+ public class MoStatus
+ {
+ ///
+ /// 已排产
+ ///
+ public const string AlreadyId = "25019252113685";
+ ///
+ /// 待排产
+ ///
+ public const string WaitProductId = "25019244276501";
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskSortOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskSortOutput.cs
new file mode 100644
index 00000000..64a64a40
--- /dev/null
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/PrdTaskSortOutput.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tnb.ProductionMgr.Entitys.Entity;
+
+namespace Tnb.ProductionMgr.Entitys.Dto.PrdManage
+{
+ ///
+ /// 生产任务重新排序输出参数
+ ///
+ public class PrdTaskSortOutput : PrdTask
+ {
+ ///
+ /// 序号
+ ///
+ public int no { get; set; }
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs
index a57de08b..18a3b1cf 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/ProductionSchedulingCrInput.cs
@@ -171,14 +171,14 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder
/// Default:
/// Nullable:True
///
- public int? mold_cavity_num { get; set; }
+ public int? mold_cavity_qty { get; set; }
///
/// Desc:计划生产数量
/// Default:
/// Nullable:True
///
- public int? plan_num { get; set; }
+ public int? plan_qty { get; set; }
///
/// Desc:吨位
@@ -189,7 +189,7 @@ namespace Tnb.ProductionMgr.Entitys.Dto.WorkOrder
///
/// 已排产数量
///
- public int scheduled_num { get; set; }
+ public int scheduled_qty { get; set; }
///
/// 设备型号
///
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs
index 331adba6..fd17de24 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/Molds.cs
@@ -36,7 +36,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Default:
/// Nullable:True
///
- public int? maintain_num { get; set; }
+ public int? maintain_qty { get; set; }
///
/// Desc:日定额
@@ -64,7 +64,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Default:
/// Nullable:True
///
- public int? cavity_num { get; set; }
+ public int? cavity_qty { get; set; }
///
/// Desc:模具寿命
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs
index fe118fcb..006a3e6f 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdMo.cs
@@ -68,7 +68,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Default:
/// Nullable:True
///
- public decimal? input_qty { get; set; }
+ public int input_qty { get; set; }
///
/// Desc:已完工数量
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs
index d16b5fcc..48e25b0a 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Entity/PrdTask.cs
@@ -99,21 +99,21 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Default:
/// Nullable:True
///
- public int? mold_cavity_num { get; set; }
+ public int? mold_cavity_qty { get; set; }
///
/// Desc:计划生产数量
/// Default:
/// Nullable:True
///
- public int? plan_num { get; set; }
+ public int? plan_qty { get; set; }
///
/// Desc:完成数量
/// Default:
/// Nullable:True
///
- public int? comple_num { get; set; }
+ public int? comple_qty { get; set; }
///
/// Desc:吨位
@@ -127,7 +127,7 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Default:
/// Nullable:True
///
- public int? scheduled_num { get; set; }
+ public int scheduled_qty { get; set; }
///
/// Desc:工单Id
@@ -135,14 +135,24 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// Nullable:True
///
public string mo_id { get; set; }
-
+ ///
+ /// 工单数(生产任务数)
+ ///
+ public int mo_qty{ get; set; }
///
/// Desc:模具Id
/// Default:NULL::character varying
/// Nullable:True
///
public string mold_id { get; set; }
-
+ ///
+ /// 模具编号
+ ///
+ public string mold_code { get; set; }
+ ///
+ /// 模具名称
+ ///
+ public string mold_name { get; set; }
///
/// Desc:设备Id
/// Default:NULL::character varying
@@ -172,6 +182,10 @@ namespace Tnb.ProductionMgr.Entitys.Entity
///
public string item_code { get; set; }
///
+ /// 产品名称
+ ///
+ public string item_name { get; set; }
+ ///
/// 产品规格型号
///
public string item_standard { get; set; }
@@ -214,6 +228,10 @@ namespace Tnb.ProductionMgr.Entitys.Entity
/// 生产任务ID
///
public string prd_task_id { get; set; }
+ ///
+ /// 同组标识
+ ///
+ public string group_flag { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
index 6f417b1e..73ebf359 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
@@ -17,6 +17,7 @@ using SqlSugar;
using Tnb.ProductionMgr.Entitys.Dto.PrdManage;
using Tnb.ProductionMgr.Entitys.Dto.WorkOrder;
using Tnb.ProductionMgr.Entitys.Entity;
+using Tnb.ProductionMgr.Entitys.新文件夹;
using Tnb.ProductionPlanMgr.Entitys.Dto.WorkOrder;
using Tnb.ProductionPlanMgr.Interfaces;
@@ -132,11 +133,12 @@ namespace Tnb.ProductionPlanMgr
entity.status = "ToBeScheduled"; //任务单状态默认,待排产
entity.create_id = _userManager.UserId;
entity.create_time = DateTime.Now;
-
+ entity.prd_task_id = input.id;
var db = _repository.AsSugarClient();
try
{
await db.Ado.BeginTranAsync();
+
row = await db.Storageable(entity).ExecuteCommandAsync();
var taskLogEntity = input.Adapt();
@@ -156,17 +158,17 @@ namespace Tnb.ProductionPlanMgr
if (row > 0)
{
var obj = (await db.Queryable().FirstAsync(it => it.id == input.mo_id));
- obj.input_qty += entity.scheduled_num;
+ obj.input_qty += entity.scheduled_qty;
var moStatus = "";
//判断,已排产数量>=计划数量时将状态改为 已排产
if (obj.input_qty >= obj.plan_qty)
{
- moStatus = "25019252113685";
+ moStatus = MoStatus.AlreadyId;
}
else
{
//修改工单状态为待排产,同事修改已排产数量
- moStatus = "25019244276501";
+ moStatus = MoStatus.WaitProductId;
}
row = await db.Updateable().SetColumns(it => new PrdMo
{
@@ -197,7 +199,7 @@ namespace Tnb.ProductionPlanMgr
{
throw new ArgumentNullException(nameof(input));
}
- var db = _repository.AsSugarClient(); ;
+ var db = _repository.AsSugarClient();
var row = await db.Updateable()
.SetColumns(it => new PrdTask { status = "ToBeStarted" })
.Where(it => input.TaskIds.Contains(it.id))
@@ -205,9 +207,6 @@ namespace Tnb.ProductionPlanMgr
return (row > 0);
}
-
-
-
///
/// 根据产品ID获取模具列表
///
@@ -221,7 +220,7 @@ namespace Tnb.ProductionPlanMgr
///
mold_name:模具名称
///
item_name:产品名称
///
item_code:产品编号
- ///
cavity_num:模穴数
+ ///
cavity_qty:模穴数
///
}
///
]
///
@@ -238,12 +237,63 @@ namespace Tnb.ProductionPlanMgr
mold_name = a.mold_name,
item_name = b.item_name,
item_code = b.item_code,
- cavity_num = a.cavity_num,
+ cavity_qty = a.cavity_qty,
})
.ToListAsync();
return list;
}
+ ///
+ /// 工单调整-生产任务重新排序
+ ///
+ /// 设备ID
+ /// 排序后生产任务列表
+ ///
+ /// returns:
+ ///
[
+ ///
{
+ ///
no:生产序号
+ ///
mo_id:工单编号
+ ///
group_flag:同组标识
+ ///
plan_qty:计划生产数量
+ ///
comple_qty:完成数量
+ ///
item_name:产品名称
+ ///
mold_code:模具编号
+ ///
}
+ ///
]
+ ///
+ [HttpGet("sort/{eqpId}")]
+ public async Task PrdTaskSort(string eqpId)
+ {
+ var taskStatusDic = await _dictionaryDataService.GetDicByTypeId(DictionaryConstants.PrdTaskStatusTypeId);
+ var list = await _repository.AsSugarClient().Queryable()
+ .Where(it => it.eqp_id == eqpId)
+ .OrderBy(o => o.estimated_start_date)
+ .ToListAsync();
+ var data = list.Select((x, idx) => new PrdTaskSortOutput
+ {
+ no = idx + 1,
+ mo_id = x.mo_id,
+ status = taskStatusDic.ContainsKey(x.status) ? taskStatusDic[x.status].ToString() : "",
+ group_flag = x.group_flag,
+ plan_qty = x.plan_qty,
+ comple_qty = x.comple_qty,
+ item_name = x.item_name,
+ mold_code = x.mold_code,
+ }).ToList();
+ return data;
+ }
+ ///
+ /// 工单调整-转移机台
+ ///
+ ///
+ [HttpPost("tran-platform")]
+ public async Task TransferPlatform()
+ {
+ return null;
+ }
+
+
///
/// 查看工单操作记录
///
@@ -252,17 +302,9 @@ namespace Tnb.ProductionPlanMgr
[HttpGet("record/{taskId}")]
public async Task GetMoOperRecord(string taskId)
{
- //var list = await _repository.AsSugarClient().Queryable().LeftJoin((a, b) => a.prd_task_id == b.id)
- // .WhereIF(!string.IsNullOrWhiteSpace(input.mo_no),b=>b.id == input.task_no)
- // .WhereIF(!string.IsNullOrWhiteSpace(input.task_no), b => b.prd_task_id == input.task_id)
- // .WhereIF(!string.IsNullOrWhiteSpace(input.item_code), a => a.item_code == input.item_code)
- // .WhereIF(!string.IsNullOrWhiteSpace(input.eqp_code), a => a.eqp_type_code == input.eqp_code)
- // .WhereIF(input.plan_start_date.HasValue, a => a.plan_start_date >= input.plan_start_date!.Value)
- // .WhereIF(input.plan_end_date.HasValue, a => a.plan_end_date <= input.plan_end_date!.Value)
- // .ToListAsync();
var list = await _repository.AsSugarClient().Queryable().Where(it => it.id == taskId).ToListAsync();
var data = list.Adapt>();
- var dic = await _dictionaryDataService.GetDicByTypeId("25572555259157");
+ var dic = await _dictionaryDataService.GetDicByTypeId(DictionaryConstants.PrdTaskStatusTypeId);
_repository.AsSugarClient().ThenMapper(data, x => x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : "");
return data;
}
diff --git a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs
index 40684167..33739605 100644
--- a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs
+++ b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs
@@ -419,7 +419,7 @@ WHERE pcolumn.table_name='{0}' ORDER BY ordinal_position";
{
if (link != null && _sqlSugarClient.CurrentConnectionConfig.ConfigId != link.Id) _sqlSugarClient = ChangeDataBase(link);
- return _sqlSugarClient.DbMaintenance.GetPrimaries(tableName);
+ return _sqlSugarClient.CopyNew().DbMaintenance.GetPrimaries(tableName);
}
///
diff --git a/system/Tnb.Systems/System/DbLinkService.cs b/system/Tnb.Systems/System/DbLinkService.cs
index 30bbf401..6a337e44 100644
--- a/system/Tnb.Systems/System/DbLinkService.cs
+++ b/system/Tnb.Systems/System/DbLinkService.cs
@@ -318,7 +318,7 @@ public class DbLinkService : IDbLinkService, IDynamicApiController, ITransient
[NonAction]
public async Task GetInfo(string id)
{
- return await _repository.AsSugarClient().Queryable().FirstAsync(m => m.Id == id && m.DeleteMark == null);
+ return await _repository.AsSugarClient().CopyNew().Queryable().FirstAsync(m => m.Id == id && m.DeleteMark == null);
}
#endregion
}
\ No newline at end of file