diff --git a/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs
new file mode 100644
index 00000000..a62d9c12
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs
@@ -0,0 +1,23 @@
+namespace Tnb.BasicData
+{
+ ///
+ /// 单据模板业务编码
+ ///
+ public class CodeTemplateConst
+ {
+ ///
+ /// 物料签收编码
+ ///
+ public const string MATERIAL_RECEIPT_CODE = "MaterialReceipt";
+
+ ///
+ /// 生产投料编码
+ ///
+ public const string FEEDING_CODE = "Feeding";
+
+ ///
+ /// 生产任务单号单据模板编码
+ ///
+ public const string PRDMOTASK_CODE = "ProductionPlanAndSchedule";
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs
index e27f81bd..dbac4e6f 100644
--- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs
+++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs
@@ -44,7 +44,7 @@ public partial class BasLocation : BaseEntity
/// 是否使用
///
//[SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))]
- public int is_use { get; set; }
+ public int is_use { get; set; }
///
/// 是否最小
diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasDefectService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasDefectService.cs
new file mode 100644
index 00000000..21992ccb
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasDefectService.cs
@@ -0,0 +1,15 @@
+namespace Tnb.BasicData.Interfaces
+{
+ ///
+ /// 次品项服务
+ ///
+ public interface IBasDefectService
+ {
+ ///
+ /// 根据工序id获取次品项列表
+ ///
+ ///
+ ///
+ public Task GetDefectListByProcessId(Dictionary dic);
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasDefectService.cs b/BasicData/Tnb.BasicData/BasDefectService.cs
new file mode 100644
index 00000000..2ee6d6ba
--- /dev/null
+++ b/BasicData/Tnb.BasicData/BasDefectService.cs
@@ -0,0 +1,43 @@
+using JNPF.Common.Core.Manager;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Systems.Interfaces.System;
+using JNPF.VisualDev;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.BasicData.Interfaces;
+
+namespace Tnb.BasicData
+{
+ ///
+ /// 物料清单
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class BasDefectService: IBasDefectService,IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly DataBaseManager _dbManager;
+ private readonly IDictionaryDataService _dictionaryDataService;
+
+ public BasDefectService(
+ ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
+ {
+ _repository = repository;
+ _dbManager = dbManager;
+ _dictionaryDataService = dictionaryDataService;
+ }
+
+ [HttpPost]
+ public async Task GetDefectListByProcessId(Dictionary dic)
+ {
+ string processId = dic["processId"];
+ return await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.process_id == b.id)
+ .LeftJoin((a, b, c) => a.defective_id == c.id)
+ .Where((a, b, c) => a.process_id == processId)
+ .Select((a, b, c) => c).ToListAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs
index a97b121c..cd925157 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs
@@ -20,15 +20,6 @@ namespace Tnb.ProductionMgr.Entities.Consts
///
public const string WaitProductId = "25019244276501";
- ///
- /// 物料签收编码
- ///
- public const string MATERIAL_RECEIPT_CODE = "MaterialReceipt";
-
- ///
- /// 生产投料编码
- ///
- public const string FEEDING_CODE = "Feeding";
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
index 08bc9117..66d4d2ec 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs
@@ -71,11 +71,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
///
/// 预计开始时间
///
- public DateTime? estimated_start_date { get; set; }
+ public string? estimated_start_date { get; set; }
///
/// 预计结束时间
///
- public DateTime? estimated_end_date { get; set; }
+ public string? estimated_end_date { get; set; }
+
+ ///
+ /// 工序名称
+ ///
+ public string? process_name { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
index 4a2a743f..f456faf7 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs
@@ -222,5 +222,10 @@ public partial class PrdMo : BaseEntity
/// 父工单id
///
public string parent_id { get; set; }
+
+ ///
+ /// 物料单位
+ ///
+ public string? unit_id { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
index 097e9df0..d2135450 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs
@@ -187,5 +187,10 @@ public partial class PrdMoTask : BaseEntity
/// 最后一道工序完成数量
///
public int? last_process_complete_qty { get; set; }
+
+ ///
+ /// 物料单位
+ ///
+ public string? unit_id { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
index 047a6725..e45e0109 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs
@@ -52,7 +52,7 @@ namespace Tnb.ProductionMgr
.Select(x=>x.material_id)
.ToListAsync();
- string code = await _billRullService.GetBillNumber(MoStatus.FEEDING_CODE);
+ string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE);
PrdFeedingH prdFeedingH = new PrdFeedingH()
{
code = code,
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
index 7a2baec7..bf6d721d 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
@@ -79,7 +79,7 @@ namespace Tnb.ProductionMgr
.Select(x=>x.material_id)
.ToListAsync();
- string code = await _billRullService.GetBillNumber(MoStatus.MATERIAL_RECEIPT_CODE);
+ string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
{
code = code,
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 79fe64ea..f78051c0 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -63,6 +63,7 @@ namespace Tnb.ProductionMgr
private static Dictionary _dicWorkLine = new Dictionary();
private static Dictionary _dicProcess = new Dictionary();
private readonly ISqlSugarClient _db;
+ private readonly IBillRullService _billRuleService;
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
@@ -71,6 +72,7 @@ namespace Tnb.ProductionMgr
IUserManager userManager,
IDictionaryDataService dictionaryDataService,
IRunService runService,
+ IBillRullService billRullService,
IVisualDevService visualDevService
)
{
@@ -82,6 +84,7 @@ namespace Tnb.ProductionMgr
_db = _repository.AsSugarClient();
OverideFuncs.DeleteAsync = Delete;
OverideFuncs.GetListAsync = GetList;
+ _billRuleService = billRullService;
}
@@ -321,7 +324,7 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c) => a.material_id == c.id)
.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)
+ .Where((a, b, c, d) => (b.id == moId || b.parent_id == moId) && SqlFunc.IsNullOrEmpty(a.parent_id))
.Select((a, b, c, d,e) => new PrdMoTaskOutput
{
mo_task_code = a.mo_task_code,
@@ -376,8 +379,8 @@ namespace Tnb.ProductionMgr
// scheduled_qty = SqlFunc.Subqueryable().Where(it => it.mo_id == a.mo_id).Sum(it => it.scheduled_qty),
scheduled_qty = a.scheduled_qty,
plan_qty = SqlFunc.Subqueryable().Where(it => it.id == a.mo_id).Select(it => it.plan_qty),
- estimated_start_date = a.estimated_start_date,
- estimated_end_date = a.estimated_end_date,
+ estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
+ estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
bom_id = d.id,
bom_version = d.version
})
@@ -398,8 +401,9 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b) => a.material_id == b.id)
.LeftJoin((a, b, c) => a.workline_id == c.Id)
.LeftJoin((a, b, c, d) => a.mo_id == d.id)
+ .LeftJoin((a,b,c,d,e)=>a.process_id==e.id)
.Where((a, b, c, d) => a.parent_id == mo_task_id)
- .Select((a, b, c, d) => new PackSechelToBeIssueListOutput
+ .Select((a, b, c, d,e) => new PackSechelToBeIssueListOutput
{
mo_task_id = a.id,
mo_task_code = a.mo_task_code,
@@ -411,6 +415,9 @@ namespace Tnb.ProductionMgr
scheduled_qty = a.scheduled_qty,
plan_qty = d.plan_qty,
process_task_qty = a.process_task_qty,
+ estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
+ estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
+ process_name = e.process_name,
bom_version = SqlFunc.Subqueryable().Where(it => it.material_id == a.material_id).Select(it => it.version)
})
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString()! : "")
@@ -651,6 +658,7 @@ namespace Tnb.ProductionMgr
var mo = await db.Queryable().FirstAsync(it => it.id == input.mo_id);
var moCode = mo?.mo_code;
var taskCode = await db.Queryable().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync();
+ moTask.unit_id = mo.unit_id;
if (taskCode.IsNullOrEmpty())
{
moTask.mo_task_code = $"{moCode}-01";
@@ -763,26 +771,29 @@ namespace Tnb.ProductionMgr
moTask.estimated_end_date = input.estimated_end_date;
moTask.scheduled_qty = input.scheduled_qty;
var mo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id);
+ moTask.unit_id = mo.unit_id;
var moCode = mo?.mo_code;
- var taskCode = await _db.Queryable().Where(it => string.IsNullOrEmpty(it.parent_id) && !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode))
- .OrderByDescending(it => it.mo_task_code)
- .Select(it => it.mo_task_code)
- .FirstAsync();
- if (taskCode is null || taskCode.IsNullOrEmpty())
- {
- moTask.mo_task_code = $"{moCode}-01";
- }
- else
- {
- var pos = taskCode?.IndexOf("-", StringComparison.Ordinal);
- if (pos.HasValue && pos.Value > -1)
- {
- var num = taskCode.AsSpan().Slice(pos.Value + 1).ToString().ParseToInt();
- var code = taskCode.AsSpan().Slice(0, pos.Value).ToString();
- var n = (num + 1).ToString().PadLeft(2, '0');
- moTask.mo_task_code = $"{code}-{n}";
- }
- }
+ // var taskCode = await _db.Queryable().Where(it => string.IsNullOrEmpty(it.parent_id) && !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode))
+ // .OrderByDescending(it => it.mo_task_code)
+ // .Select(it => it.mo_task_code)
+ // .FirstAsync();
+ var taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE);
+ moTask.mo_task_code = taskCode;
+ // if (taskCode is null || taskCode.IsNullOrEmpty())
+ // {
+ // moTask.mo_task_code = $"{moCode}-01";
+ // }
+ // else
+ // {
+ // var pos = taskCode?.IndexOf("-", StringComparison.Ordinal);
+ // if (pos.HasValue && pos.Value > -1)
+ // {
+ // var num = taskCode.AsSpan().Slice(pos.Value + 1).ToString().ParseToInt();
+ // var code = taskCode.AsSpan().Slice(0, pos.Value).ToString();
+ // var n = (num + 1).ToString().PadLeft(2, '0');
+ // moTask.mo_task_code = $"{code}-{n}";
+ // }
+ // }
row = await _db.Insertable(moTask).ExecuteCommandAsync();
var material_h = await _db.Queryable().FirstAsync(it => it.id == moTask.material_id);
//添加生产任务操作记录日志
@@ -860,6 +871,7 @@ namespace Tnb.ProductionMgr
.LeftJoin((a, b, c, d) => b.route_detail_id == d.id)
.LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id)
.Where((a, b, c, d, e) => a.id == input.bom_id)
+ .OrderBy((a,b,c,d,e)=>b.ordinal)
.Select((a, b, c, d, e) => new SubBomListOutput
{
version = a.version,
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
index 2bb31058..6e2d5482 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
@@ -257,8 +257,10 @@ namespace Tnb.ProductionMgr
.LeftJoin((a,b,c)=>a.mold_id==c.id)
.LeftJoin((a,b,c,d)=>a.eqp_id==d.id)
.LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==e.EnCode)
+ .LeftJoin((a,b,c,d,e,f)=>a.workline_id==f.Id)
+ .LeftJoin((a,b,c,d,e,f,g)=>a.process_id==g.id)
.Where((a,b) => a.mo_task_code == mo_task_code)
- .Select((a,b,c,d,e) => new
+ .Select((a,b,c,d,e,f,g) => new
{
id = a.id,
mo_task_code = a.mo_task_code,
@@ -278,6 +280,9 @@ namespace Tnb.ProductionMgr
// reported_qty = a.reported_qty,
// prd_qty = a.prd_qty,
eqp_code = d.code,
+ workline_name = f.FullName,
+ process_name = g.process_name,
+ process_id = a.process_id
}).FirstAsync();
return prdTask;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
index 83daa894..53b76564 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs
@@ -23,6 +23,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts
///
public const string WMS_PRETASK_H_ENCODE = "PreTaskGen";
///
+ /// 载具移入生成Encode
+ ///
+ public const string WMS_CARRYMOINSTK_ENCODE = "CarryMoInStk";
+ ///
/// 任务执行ENCODE
///
public const string WMS_TASK_EXECUTE_ENCODE = "WmsTaskRequest";
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs
index f41c5f38..c1de744a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs
@@ -18,6 +18,15 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
///
/// 载具ID
///
- public string carryId { get; set; }
+ public string carryId { get; set; }
+
+ public string new_carry_code { get; set; }
+
+ ///
+ /// 任务执行条码表
+ ///
+ public List distaskCodes { get; set; }
}
+
+
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs
index cdd1bb7a..fa48bda3 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs
@@ -35,5 +35,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto
+
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs
index fcd567dd..4ef88721 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs
@@ -44,8 +44,8 @@ public partial class WmsCarryH : BaseEntity
/// 载具状态
///
///
- [SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))]
- public int carry_status { get; set; }
+ //[SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))]
+ public string carry_status { get; set; }
///
/// 载具分类ID
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs
index 9bbbc560..cf9870e0 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs
@@ -13,5 +13,5 @@ public partial class WmsDistaskH
/// 载具状态
///
[SugarColumn(IsIgnore = true)]
- public int carry_status { get; set; }
+ public string carry_status { get; set; }
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs
new file mode 100644
index 00000000..c6308eba
--- /dev/null
+++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using JNPF.Common.Dtos.VisualDev;
+
+namespace Tnb.WarehouseMgr.Interfaces
+{
+ ///
+ /// 载具移入服务接口
+ ///
+ public interface IWmsCarryMoveInStockService
+ {
+ Task CarryMoveIn(VisualDevModelDataCrInput input);
+ }
+}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
index 56f2fd96..812656cc 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs
@@ -270,7 +270,7 @@ namespace Tnb.WarehouseMgr
}
//获取所有未下发的预任务申请
- var preTasks = await _db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id)
+ var preTasks = await _db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
.InnerJoin((a, b, c) => a.area_id == c.id)
.Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID)
.OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code })
@@ -279,15 +279,20 @@ namespace Tnb.WarehouseMgr
move_num = c.move_num
}, true)
.ToListAsync();
+ var ids = preTasks.Select(x => x.id).Distinct().ToList();
+ var preTaskCodes = await _db.Queryable().Where(it => ids.Contains(it.bill_id)).ToListAsync();
if (preTasks.Count > 0)
{
//根据预任务管理区分组,获取到所有分组后的预任务,遍历每个预任务 是否为任务链,通过管理区ID
var preTaskGroups = preTasks.GroupBy(g => g.area_code).ToList();
List disTasks = new();
+ List distaskCodes = new();
foreach (var itGroup in preTaskGroups)
{
var moveNum = itGroup.First().move_num;
var items = itGroup.Adapt>();
+
+ items.ForEach(x => SnowflakeIdHelper.NextId());
items.ForEach(x =>
{
x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID;
@@ -325,14 +330,34 @@ namespace Tnb.WarehouseMgr
await _taskChainAttrHandle(items, areaPreTasks, moveNum);
}
}
+ if (preTaskCodes?.Count > 0)
+ {
+ foreach (var disTask in items)
+ {
+ var curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id);
+ var curDisTaskCodes = curPreTaskCodes.Adapt>();
+ curPreTaskCodes.ForEach(x =>
+ {
+ x.id = SnowflakeIdHelper.NextId();
+ x.bill_id = disTask.id;
+ x.create_time = DateTime.Now;
+ });
+ distaskCodes.AddRange(curDisTaskCodes);
+ }
+ }
+
disTasks.AddRange(items);
}
try
{
await _db.Ado.BeginTranAsync();
- disTasks.ForEach(x => x.id = SnowflakeIdHelper.NextId());
+ //disTasks.ForEach(x => x.id = SnowflakeIdHelper.NextId());
var row = await _db.Insertable(disTasks).ExecuteCommandAsync();
+ if (preTaskCodes?.Count > 0)
+ {
+ row = await _db.Insertable(distaskCodes).ExecuteCommandAsync();
+ }
if (row > 0)
{
var preTaskIds = preTasks.Select(x => x.id).ToList();
@@ -458,11 +483,12 @@ namespace Tnb.WarehouseMgr
for (int i = 0; i < multis.Count; i++)
{
var carryStatus = multis[i].carry_status;
- if (multis[i].carry_status == (int)EnumCarryStatus.空闲)
+ if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString())
{
- carryStatus = (int)EnumCarryStatus.空闲;
+ carryStatus = ((int)EnumCarryStatus.空闲).ToString();
}
- await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
+ var cStatus = carryStatus.ParseToInt();
+ await _db.Updateable().SetColumns(it => new BasLocation { is_use = cStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
}
//更新业务主表的单据状态
if (disTasks?.Count > 0)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
index 85a9ccd0..c8a19f8f 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs
@@ -70,9 +70,9 @@ namespace Tnb.WarehouseMgr
var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId);
if (carry != null && subCarry != null)
{
- carry.carry_status = (int)EnumCarryStatus.占用;
+ carry.carry_status = ((int)EnumCarryStatus.占用).ToString();
var row = await _db.Updateable(carry).ExecuteCommandAsync();
- subCarry.carry_status = (int)EnumCarryStatus.占用;
+ subCarry.carry_status = ((int)EnumCarryStatus.占用).ToString();
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
//更新载具明细表
WmsCarryD wmsCarryD = new()
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
index 4e9ade4d..ab349cb8 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs
@@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr
///
[OverideVisualDev(ModuleConsts.MODULE_CARRYMOVEINSTOCK_ID)]
[ServiceModule(BizTypeId)]
- public class WmsCarryMoveInStockService : BaseWareHouseService
+ public class WmsCarryMoveInStockService : BaseWareHouseService, IWmsCarryMoveInStockService
{
private const string BizTypeId = "26121988909861";
private readonly ISqlSugarClient _db;
@@ -58,7 +58,8 @@ namespace Tnb.WarehouseMgr
OverideFuncs.CreateAsync = CarryMoveIn;
}
- private async Task CarryMoveIn(VisualDevModelDataCrInput input)
+ [NonAction]
+ public async Task CarryMoveIn(VisualDevModelDataCrInput input)
{
try
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
index 8945d77a..42cab97b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs
@@ -160,7 +160,7 @@ namespace Tnb.WarehouseMgr
try
{
carryObj.status = 0;
- carryObj.carry_status = (int)EnumCarryStatus.空闲;
+ carryObj.carry_status = ((int)EnumCarryStatus.空闲).ToString();
carryObj.location_id = null;
carryObj.location_code = null;
carryObj.out_status = "0";
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
index 1bdd4499..7b8577ae 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs
@@ -92,9 +92,9 @@ namespace Tnb.WarehouseMgr
wmsCarryUnbindCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
}
- carry.carry_status = (int)EnumCarryStatus.空闲;
+ carry.carry_status = ((int)EnumCarryStatus.空闲).ToString();
row = await _db.Updateable(carry).ExecuteCommandAsync();
- subCarry.carry_status = (int)EnumCarryStatus.空闲;
+ subCarry.carry_status = ((int)EnumCarryStatus.空闲).ToString();
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
isOk = (row > 0);
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs
index 5066db04..94c43365 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs
@@ -158,7 +158,7 @@ namespace Tnb.WarehouseMgr
var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
{
//载具加锁,增加库位信息
- await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.占用,
+ await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(),
is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync();
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
index fe5418ca..9ac2b976 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs
@@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr
var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id)
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
- && a.carry_status == (int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0)
+ && a.carry_status == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0)
.ToListAsync();
WmsPointH sPoint = null;
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
index d26a486a..ff57cc39 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs
@@ -12,7 +12,9 @@ using NPOI.SS.Formula.Functions;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts;
+using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
@@ -21,8 +23,10 @@ namespace Tnb.WarehouseMgr
///
/// 入库申请服务
///
+ [ServiceModule(BizTypeId)]
public class WmsInStockService : BaseWareHouseService, IWmsInStockService
{
+ private const string BizTypeId = "26191496816421";
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
@@ -155,5 +159,56 @@ namespace Tnb.WarehouseMgr
return barCode;
}
+
+ public override async Task ModifyAsync(WareHouseUpInput input)
+ {
+ if (input == null) throw new ArgumentNullException("input");
+ //更具distaskCode的barcode 更新 instockcode 的 is_end 为 1
+ try
+ {
+ await _db.Ado.BeginTranAsync();
+
+ if (input.distaskCodes?.Count > 0)
+ {
+ var barCodes = input.distaskCodes.Select(x => x.barcode);
+ await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync();
+ var instockCodes = await _db.Queryable().Where(it => barCodes.Contains(it.barcode)).Select(it => new
+ {
+ id = it.bill_d_id,
+ barcode_qty = it.codeqty,
+ }).ToListAsync();
+ var dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList());
+ var ids = instockCodes.Select(it => it.id).ToList();
+ var instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync();
+
+ foreach (var item in instockDetails)
+ {
+ if (dic.ContainsKey(item.id))
+ {
+ item.qty += dic[item.id].Sum(x => x);
+ if (item.qty >= item.pr_qty)
+ {
+ item.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
+ }
+ }
+ }
+ await _db.Updateable(instockDetails).ExecuteCommandAsync();
+ var allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync();
+ if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
+ {
+ await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
+ //如果是自动单据,需要回更上层系统
+ }
+ }
+
+ await _db.Ado.CommitTranAsync();
+ }
+ catch (Exception)
+ {
+ await _db.Ado.RollbackTranAsync();
+ throw;
+ }
+ }
+
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
index ba350f16..1641dc39 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs
@@ -17,6 +17,7 @@ using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
+using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Enums;
@@ -28,8 +29,10 @@ namespace Tnb.WarehouseMgr
/// 出库申请业务类
///
[OverideVisualDev(ModuleConsts.MODULE_WMSOUTSTOCK_ID)]
+ [ServiceModule(BizTypeId)]
public class WmsOutStockService : BaseWareHouseService, IWmsOutStockService
{
+ private const string BizTypeId = "26191522660645";
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IRunService _runService;
@@ -37,6 +40,9 @@ namespace Tnb.WarehouseMgr
private readonly IWareHouseService _wareHouseService;
private readonly IUserManager _userManager;
private readonly IBillRullService _billRullService;
+ private readonly IWmsCarryMoveInStockService _wmsCarryMoveInStockService;
+ private readonly IWmsCarryService _wareCarryService;
+
public WmsOutStockService(
ISqlSugarRepository repository,
@@ -45,7 +51,9 @@ namespace Tnb.WarehouseMgr
IVisualDevService visualDevService,
IWareHouseService wareHouseService,
IUserManager userManager,
- IBillRullService billRullService)
+ IBillRullService billRullService,
+ IWmsCarryMoveInStockService wmsCarryMoveInStockService,
+ IWmsCarryService wareCarryService)
{
_db = repository.AsSugarClient();
_dictionaryDataService = dictionaryDataService;
@@ -54,6 +62,8 @@ namespace Tnb.WarehouseMgr
_wareHouseService = wareHouseService;
_userManager = userManager;
_billRullService = billRullService;
+ _wmsCarryMoveInStockService = wmsCarryMoveInStockService;
+ _wareCarryService = wareCarryService;
OverideFuncs.CreateAsync = OutStockApplyFor;
}
@@ -219,6 +229,7 @@ namespace Tnb.WarehouseMgr
genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList();
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
}
+ else throw new AppFriendlyException("库存不足", 500);
}
else throw new AppFriendlyException($"请输入物料明细", 500);
@@ -257,7 +268,7 @@ namespace Tnb.WarehouseMgr
[HttpGet]
public async Task Testxx()
{
- var carryCodePropNames = typeof(WmsCarryCode).GetProperties().Select(p => p.Name);
+ var carryCodePropNames = typeof(WmsDistaskCode).GetProperties().Select(p => p.Name);
var outStockCodePropNames = typeof(WmsOutstockCode).GetProperties().Select(p => p.Name);
var intersects = carryCodePropNames.Intersect(outStockCodePropNames).ToList();
var excepts = carryCodePropNames.Except(outStockCodePropNames).ToList();
@@ -271,55 +282,142 @@ namespace Tnb.WarehouseMgr
public override async Task ModifyAsync(WareHouseUpInput input)
{
if (input == null) throw new ArgumentNullException("input");
- var carryId = input.carryIds[^input.carryIds.Count];
- var carry = await _db.Queryable().SingleAsync(it => it.id == carryId);
- if (carry != null)
- {
- var outStatus = carry.out_status.ToEnum();
- if (outStatus == EnumOutStatus.全部出)
- {
- //当前载具对应的所有条码插入
- var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync();
- var outStockCodes = carryCodes.Adapt>();
- var otds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync();
- outStockCodes.ForEach(x =>
- {
- var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
- x.id = SnowflakeIdHelper.NextId();
- x.bill_id = input.requireId;
- x.bill_d_id = billDId;
- x.org_id = _userManager.User.OrganizeId;
- x.create_id = _userManager.UserId;
- x.create_time = DateTime.Now;
- });
- await _db.Insertable(outStockCodes).ExecuteCommandAsync();
- var detailIds = outStockCodes.Select(x => x.bill_d_id).ToList();
- var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id));
- var dic = outStockCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
- foreach (var osd in curOutstockDetails)
+
+ try
+ {
+
+ await _db.Ado.BeginTranAsync();
+
+ var carryId = input.carryIds[^input.carryIds.Count];
+ var carry = await _db.Queryable().SingleAsync(it => it.id == carryId);
+ if (carry != null)
+ {
+ var otds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync();
+ var outStatus = carry.out_status.ToEnum();
+ if (outStatus == EnumOutStatus.全部出)
{
- if (dic.ContainsKey(osd.id))
+ //当前载具对应的所有条码插入
+ var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync();
+ var outStockCodes = carryCodes.Adapt>();
+
+ outStockCodes.ForEach(x =>
{
- osd.qty += dic[osd.id].Sum(d => d);
- if (osd.qty >= osd.pr_qty)
+ var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
+ if (billDId.IsNullOrEmpty())
{
- osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
+ billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id;
+ }
+ x.id = SnowflakeIdHelper.NextId();
+ x.bill_id = input.requireId;
+ x.bill_d_id = billDId;
+ x.org_id = _userManager.User.OrganizeId;
+ x.create_id = _userManager.UserId;
+ x.create_time = DateTime.Now;
+ });
+ await _db.Insertable(outStockCodes).ExecuteCommandAsync();
+
+ var detailIds = outStockCodes.Select(x => x.bill_d_id).ToList();
+ var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id));
+ var dic = outStockCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
+ foreach (var osd in curOutstockDetails)
+ {
+ if (dic.ContainsKey(osd.id))
+ {
+ osd.qty += dic[osd.id].Sum(d => d);
+ if (osd.qty >= osd.pr_qty)
+ {
+ osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
+ }
}
}
+ await _db.Updateable(curOutstockDetails).ExecuteCommandAsync();
+ if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
+ {
+ await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
+ //如果是自动单据,需要回更上层系统
+ }
+ await _wareCarryService.UpdateNullCarry(carry);
}
- await _db.Updateable(curOutstockDetails).ExecuteCommandAsync();
- if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
+ else if (outStatus == EnumOutStatus.分拣出)
{
- await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
- //如果是自动单据,需要回更上层系统
- }
- }
- else if (outStatus == EnumOutStatus.分拣出)
- {
+ if (input.distaskCodes?.Count > 0)
+ {
+ var osCodes = input.distaskCodes.Adapt>();
+ osCodes.ForEach(x =>
+ {
+ var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
+ if (billDId.IsNullOrEmpty())
+ {
+ billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id;
+ }
+ x.id = SnowflakeIdHelper.NextId();
+ x.bill_id = input.requireId;
+ x.bill_d_id = billDId;
+ x.org_id = _userManager.User.OrganizeId;
+ x.create_id = _userManager.UserId;
+ x.create_time = DateTime.Now;
+ });
+ await _db.Insertable(osCodes).ExecuteCommandAsync();
+ var carryCodes = await _db.Queryable().Where(it => input.carryIds.Contains(it.carry_id)).ToListAsync();
+ var dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty);
+ var dicUpdate = new Dictionary();
+ var delBarcodes = new List();
+ foreach (var dtc in input.distaskCodes)
+ {
+ if (dicCodeQty.ContainsKey(dtc.barcode))
+ {
+ if (dtc.codeqty < dicCodeQty[dtc.barcode])
+ {
+ dicUpdate[dtc.barcode] = dicCodeQty[dtc.barcode] - dtc.codeqty;
+ }
+ else
+ {
+ delBarcodes.Add(dtc.barcode);
+ }
+ }
+ }
+ if (dicUpdate.Count > 0)
+ {
+ foreach (var pair in dicUpdate)
+ {
+ WmsCarryCode carryCode = new();
+ carryCode.codeqty = pair.Value;
+ await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).Where(it => it.barcode == pair.Key).ExecuteCommandAsync();
+ }
+ await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
+ await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
+
+ }
+ if (delBarcodes.Count > 0)
+ {
+ await _db.Deleteable().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync();
+ }
+ //载具移入
+ var outStockH = await _db.Queryable().SingleAsync(it => it.id == input.requireId);
+ var visulDevInput = new VisualDevModelDataCrInput();
+ visulDevInput.data = new Dictionary
+ {
+ [nameof(InStockStrategyQuery.warehouse_id)] = outStockH.warehouse_id,
+ [nameof(WmsPointH.location_id)] = outStockH.location_id,
+ [nameof(WmsCarryD.carry_id)] = input.carryIds.First(),
+ [nameof(WmsHandleH.biz_type)] = input.bizTypeId,
+ [nameof(WmsHandleH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_CARRYMOINSTK_ENCODE).GetAwaiter().GetResult(),
+ };
+ await _wmsCarryMoveInStockService.CarryMoveIn(visulDevInput);
+ }
+
+ }
+
+ await _db.Ado.CommitTranAsync();
}
}
+ catch (Exception ex)
+ {
+ await _db.Ado.RollbackTranAsync();
+ throw;
+ }
}
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
index 657c232a..61a57092 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs
@@ -84,9 +84,9 @@ namespace Tnb.WarehouseMgr
create_time = DateTime.Now
};
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
- carry.carry_status = (int)EnumCarryStatus.占用;
+ carry.carry_status = ((int)EnumCarryStatus.占用).ToString();
row = await _db.Updateable(carry).ExecuteCommandAsync();
- subCarry.carry_status = (int)EnumCarryStatus.占用;
+ subCarry.carry_status = ((int)EnumCarryStatus.占用).ToString();
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync();
//更新载具绑定条码表
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
index 6652b476..2e499b53 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs
@@ -91,9 +91,9 @@ namespace Tnb.WarehouseMgr
wmsCarryUnbindCode.create_time = DateTime.Now;
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
}
- carry.carry_status = (int)EnumCarryStatus.空闲;
+ carry.carry_status = ((int)EnumCarryStatus.空闲).ToString();
row = await _db.Updateable(carry).ExecuteCommandAsync();
- subCarry.carry_status = (int)EnumCarryStatus.空闲;
+ subCarry.carry_status = ((int)EnumCarryStatus.空闲).ToString();
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
isOk = (row > 0);
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs
index 3b44dd0b..2ecb1828 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs
@@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr
//载具加锁,增加库位信息
await _db.Updateable().SetColumns(it => new WmsCarryH
{
- carry_status = (int)EnumCarryStatus.占用,
+ carry_status = ((int)EnumCarryStatus.占用).ToString(),
is_lock = 1,
location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(),
location_code = location.location_code
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs
index c3733ac8..d6a71cc6 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs
@@ -70,12 +70,12 @@ namespace Tnb.WarehouseMgr
//判断目标库位是否自动签收
var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString());
-
+
//出库取起点,获取所有符合输入的载具规格的载具
var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id)
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
- && a.carry_status ==(int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0)
+ && a.carry_status == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0)
.ToListAsync();
WmsPointH sPoint = null;
@@ -216,7 +216,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.RollbackTranAsync();
throw;
-
+
}
}
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
index 5143677d..349e1ab6 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs
@@ -130,7 +130,7 @@ namespace Tnb.WarehouseMgr
try
{
carryObj.status = 0;
- carryObj.carry_status = (int)EnumCarryStatus.空闲;
+ carryObj.carry_status = ((int)EnumCarryStatus.空闲).ToString();
carryObj.location_id = null;
carryObj.location_code = null;
carryObj.out_status = "0";
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
index d5c7a96c..59d85c04 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs
@@ -150,6 +150,7 @@ namespace Tnb.WarehouseMgr
}
}
}
+
//生成预任务,同时如果包含条码信息同时插入条码记录
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
if (isOk)
@@ -239,7 +240,7 @@ namespace Tnb.WarehouseMgr
await _db.Insertable(carryCodes).ExecuteCommandAsync();
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
- it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
+ it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
it => new BasLocation { is_lock = 1, is_use = (int)EnumCarryStatus.占用 });
if (instockCOdes?.Count > 0)
{
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs
index 89027139..54c69b7b 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs
@@ -145,7 +145,7 @@ namespace Tnb.WarehouseMgr
var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString();
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
- it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = (int)EnumCarryStatus.寄存, bale_num = baleNum },
+ it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = ((int)EnumCarryStatus.寄存).ToString(), bale_num = baleNum },
it => new BasLocation { is_lock = 1 });
//((int)EnumCarryStatus.寄存).ToString()
}
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
index 259fa4e2..44c4981a 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
//载具加锁,增加库位信息
await _db.Updateable().SetColumns(it => new WmsCarryH
{
- carry_status = (int)EnumCarryStatus.占用,
+ carry_status = ((int)EnumCarryStatus.占用).ToString(),
is_lock = 1,
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
location_code = location.location_code
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
index 9fa176f7..ecc671a9 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs
@@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr
GenPreTaskUpInput genPreTaskAfterUpInput = new();
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList();
- await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = (int)EnumCarryStatus.齐套分拣 });
+ await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套分拣).ToString() }, it => new BasLocation { is_use = (int)EnumCarryStatus.齐套分拣 });
}
}
@@ -198,7 +198,7 @@ namespace Tnb.WarehouseMgr
{
await _db.Ado.BeginTranAsync();
- await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套, location_id = null, location_code = null }).ExecuteCommandAsync();
+ await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.齐套).ToString(), location_id = null, location_code = null }).ExecuteCommandAsync();
await _db.Updateable().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲 }).ExecuteCommandAsync();
await _db.Ado.CommitTranAsync();
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
index 6af12c94..34cccb55 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs
@@ -30,12 +30,14 @@ namespace Tnb.WarehouseMgr
private readonly ISqlSugarClient _db;
private readonly IWmsCarryService _wareCarryService;
private readonly IDictionaryDataService _dictionaryDataService;
+ private readonly IWmsCarryMoveInStockService _wmsCarryMoveInStockService;
private static Dictionary _dicBizType = new();
- public WmsSignForDeliveryService(ISqlSugarRepository repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService)
+ public WmsSignForDeliveryService(ISqlSugarRepository repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService, IWmsCarryMoveInStockService wmsCarryMoveInStockService)
{
_db = repository.AsSugarClient();
_wareCarryService = wareCarryService;
_dictionaryDataService = dictionaryDataService;
+ _wmsCarryMoveInStockService = wmsCarryMoveInStockService;
}
///
/// 根据载具ID获取,对应的执行任务记录
@@ -66,6 +68,12 @@ namespace Tnb.WarehouseMgr
var carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId);
if (carry != null)
{
+ if (carry.location_id.IsNotEmptyOrNull())
+ {
+ var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id);
+ loc.is_use = (int)EnumCarryStatus.空闲;
+ await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
+ }
var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId);
if (disTask != null)
{
@@ -77,18 +85,26 @@ namespace Tnb.WarehouseMgr
case "寄存出库":
case "齐套出库":
case "一般出库":
- await _wareCarryService.UpdateNullCarry(carry);
+ {
+ WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } };
+ await DoUpdate(upInput); //回更业务
+
+
+ }
break;
+ case "载具移出":
+ {
+ WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } };
+ await DoUpdate(upInput); //回更业务
+ }
+ break;
+
}
}
- var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id);
- loc.is_use = (int)EnumCarryStatus.空闲;
- await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
- WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List { input.carryId } };
- await DoUpdate(upInput); //回更业务
+ disTask.is_sign = 1;
+ await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync();
}
}
-
await _db.Ado.CommitTranAsync();
}
catch (Exception)
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
index 20f2935c..2ce0a3c7 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
//载具加锁,增加库位信息
await _db.Updateable().SetColumns(it => new WmsCarryH
{
- carry_status = (int)EnumCarryStatus.占用,
+ carry_status = ((int)EnumCarryStatus.占用).ToString(),
is_lock = 1,
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
location_code = location.location_code
diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
index acb65df1..49223de9 100644
--- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
+++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs
@@ -180,7 +180,7 @@ namespace Tnb.WarehouseMgr
var subCarrys = await _db.Queryable().Where(it => it.carry_id == ko.carry_id).ToListAsync();
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds, LocationIds = new List { carry.location_id, ko.location_id } };
- await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套 }, it => new BasLocation { is_lock = 1 });
+ await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
}
}