diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
index ae6fb528..56ff4cf3 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
@@ -31,10 +31,23 @@ namespace Tnb.WarehouseMgr.Entities.Consts
///
public const string PRETASK_BILL_STATUS_START_ID = "26126834032677";
///
+ /// 预任务单据状态-已完成Id
+ ///
+ public const string PRETASK_BILL_STATUS_COMPLE_ID = "26126860808229";
+ //
+ ///
/// 任务单据状态-已下达Id
///
public const string TASK_BILL_STATUS_YXD_ID = "26126853976101";
///
+ /// 任务单据状态-执行中Id
+ ///
+ public const string TASK_BILL_STATUS_RUNING_ID = "26126856028453";
+ ///
+ /// 任务单据状态-已完成ID
+ ///
+ public const string TASK_BILL_STATUS_COMPLE_ID = "26126860808229";
+ ///
/// 预任务生成业务类型-载具移入Id
///
public const string BIZTYPE_MOVEIN_ID = "26121988909861";
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs
new file mode 100644
index 00000000..b312aaeb
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
+{
+ ///
+ /// 任务完成输入参数
+ ///
+ public class TaskCompleUpInput
+ {
+ ///
+ /// 任务执行Ids
+ ///
+ public List disTaskIds { get; set; }
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs
index 46f82a66..dc065732 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs
@@ -14,6 +14,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
///
/// 任务执行Ids
///
- public List DisTaskIds { get; set; }
+ public List disTaskIds { get; set; }
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 32f5d28c..2ebf940f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -355,21 +355,49 @@ namespace Tnb.WarehouseMgr
///
///
[HttpPost]
- public async Task TaskExecuteAfter()
+ public async Task TaskExecuteAfter(TaskExecuteAfterUpInput input)
{
//更新任务执行表单据状态
- //清空载具库位数据
- //清空起始库位,状态改为空闲、锁定状态,未锁定
+ try
+ {
+ await _db.Ado.BeginTranAsync();
+
+ await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
+ //清空载具库位数据
+ var carryIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.carry_id).ToListAsync();
+ if (carryIds?.Count > 0)
+ {
+ await _db.Updateable().SetColumns(it => new WmsCarryH { location_id = null, location_code = null }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync();
+ }
+ var startLocationIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.startlocation_id).ToListAsync();
+ //更新起始库位,状态改为空闲、锁定状态,未锁定
+ if (startLocationIds?.Count > 0)
+ {
+ await _db.Updateable().SetColumns(it => new BasLocation { is_use = "0", is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync();
+ }
+
+ await _db.Ado.CommitTranAsync();
+ }
+ catch (Exception)
+ {
+ await _db.Ado.RollbackTranAsync();
+ }
}
///
/// 任务完成
///
///
[HttpPost]
- public async Task TaskComplate()
+ public async Task TaskComplate(TaskCompleUpInput input)
{
//更新任务执行表,单据状态为 完成
+ await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync();
//更新预任务申请表,单据状态为 已完成
+ var preTaskIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.pretask_id).ToListAsync();
+ if(preTaskIds?.Count > 0)
+ {
+ await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync();
+ }
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
//更新库位信息,使用状态为 使用,锁定状态为未锁定
//更新业务主表的单据状态