Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
23
BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs
Normal file
23
BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 单据模板业务编码
|
||||
/// </summary>
|
||||
public class CodeTemplateConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料签收编码
|
||||
/// </summary>
|
||||
public const string MATERIAL_RECEIPT_CODE = "MaterialReceipt";
|
||||
|
||||
/// <summary>
|
||||
/// 生产投料编码
|
||||
/// </summary>
|
||||
public const string FEEDING_CODE = "Feeding";
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务单号单据模板编码
|
||||
/// </summary>
|
||||
public const string PRDMOTASK_CODE = "ProductionPlanAndSchedule";
|
||||
}
|
||||
}
|
||||
15
BasicData/Tnb.BasicData.Interfaces/IBasDefectService.cs
Normal file
15
BasicData/Tnb.BasicData.Interfaces/IBasDefectService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Tnb.BasicData.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 次品项服务
|
||||
/// </summary>
|
||||
public interface IBasDefectService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据工序id获取次品项列表
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetDefectListByProcessId(Dictionary<string, string> dic);
|
||||
}
|
||||
}
|
||||
43
BasicData/Tnb.BasicData/BasDefectService.cs
Normal file
43
BasicData/Tnb.BasicData/BasDefectService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料清单
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class BasDefectService: IBasDefectService,IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasDefect> _repository;
|
||||
private readonly DataBaseManager _dbManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
|
||||
public BasDefectService(
|
||||
ISqlSugarRepository<BasDefect> repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
|
||||
{
|
||||
_repository = repository;
|
||||
_dbManager = dbManager;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetDefectListByProcessId(Dictionary<string, string> dic)
|
||||
{
|
||||
string processId = dic["processId"];
|
||||
return await _repository.AsSugarClient().Queryable<BasProcessDefective>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<BasDefect>((a, b, c) => a.defective_id == c.id)
|
||||
.Where((a, b, c) => a.process_id == processId)
|
||||
.Select((a, b, c) => c).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,15 +20,6 @@ namespace Tnb.ProductionMgr.Entities.Consts
|
||||
/// </summary>
|
||||
public const string WaitProductId = "25019244276501";
|
||||
|
||||
/// <summary>
|
||||
/// 物料签收编码
|
||||
/// </summary>
|
||||
public const string MATERIAL_RECEIPT_CODE = "MaterialReceipt";
|
||||
|
||||
/// <summary>
|
||||
/// 生产投料编码
|
||||
/// </summary>
|
||||
public const string FEEDING_CODE = "Feeding";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,11 +71,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// <summary>
|
||||
/// 预计开始时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_start_date { get; set; }
|
||||
public string? estimated_start_date { get; set; }
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
public string? estimated_end_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序名称
|
||||
/// </summary>
|
||||
public string? process_name { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,4 +223,9 @@ public partial class PrdMo : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string parent_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料单位
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -188,4 +188,9 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
/// </summary>
|
||||
public int? last_process_complete_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料单位
|
||||
/// </summary>
|
||||
public string? unit_id { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Tnb.ProductionMgr
|
||||
private static Dictionary<string, object> _dicWorkLine = new Dictionary<string, object>();
|
||||
private static Dictionary<string, object> _dicProcess = new Dictionary<string, object>();
|
||||
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<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
|
||||
.LeftJoin<BasProcess>((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<PrdMoTask>().Where(it => it.mo_id == a.mo_id).Sum(it => it.scheduled_qty),
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
plan_qty = SqlFunc.Subqueryable<PrdMo>().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<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.workline_id == c.Id)
|
||||
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
|
||||
.LeftJoin<BasProcess>((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<BasMbom>().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<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
var moCode = mo?.mo_code;
|
||||
var taskCode = await db.Queryable<PrdMoTask>().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<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
moTask.unit_id = mo.unit_id;
|
||||
var moCode = mo?.mo_code;
|
||||
var taskCode = await _db.Queryable<PrdMoTask>().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<PrdMoTask>().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<BasMaterial>().FirstAsync(it => it.id == moTask.material_id);
|
||||
//添加生产任务操作记录日志
|
||||
@@ -860,6 +871,7 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<BasRouteD>((a, b, c, d) => b.route_detail_id == d.id)
|
||||
.LeftJoin<BasMbomOutput>((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,
|
||||
|
||||
@@ -257,8 +257,10 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<ToolMolds>((a,b,c)=>a.mold_id==c.id)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d)=>a.eqp_id==d.id)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==e.EnCode)
|
||||
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f)=>a.workline_id==f.Id)
|
||||
.LeftJoin<BasProcess>((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;
|
||||
|
||||
@@ -23,6 +23,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
||||
/// </summary>
|
||||
public const string WMS_PRETASK_H_ENCODE = "PreTaskGen";
|
||||
/// <summary>
|
||||
/// 载具移入生成Encode
|
||||
/// </summary>
|
||||
public const string WMS_CARRYMOINSTK_ENCODE = "CarryMoInStk";
|
||||
/// <summary>
|
||||
/// 任务执行ENCODE
|
||||
/// </summary>
|
||||
public const string WMS_TASK_EXECUTE_ENCODE = "WmsTaskRequest";
|
||||
|
||||
@@ -19,5 +19,14 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string carryId { get; set; }
|
||||
|
||||
public string new_carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务执行条码表
|
||||
/// </summary>
|
||||
public List<WmsDistaskCode> distaskCodes { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,5 +35,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ public partial class WmsCarryH : BaseEntity<string>
|
||||
/// 载具状态
|
||||
/// </summary>
|
||||
///
|
||||
[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; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具分类ID
|
||||
|
||||
@@ -13,5 +13,5 @@ public partial class WmsDistaskH
|
||||
/// 载具状态
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int carry_status { get; set; }
|
||||
public string carry_status { get; set; }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 载具移入服务接口
|
||||
/// </summary>
|
||||
public interface IWmsCarryMoveInStockService
|
||||
{
|
||||
Task<dynamic> CarryMoveIn(VisualDevModelDataCrInput input);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
//获取所有未下发的预任务申请
|
||||
var preTasks = await _db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id)
|
||||
var preTasks = await _db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
|
||||
.InnerJoin<WmsAreaH>((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<WmsPretaskCode>().Where(it => ids.Contains(it.bill_id)).ToListAsync();
|
||||
if (preTasks.Count > 0)
|
||||
{
|
||||
//根据预任务管理区分组,获取到所有分组后的预任务,遍历每个预任务 是否为任务链,通过管理区ID
|
||||
var preTaskGroups = preTasks.GroupBy(g => g.area_code).ToList();
|
||||
List<WmsDistaskH> disTasks = new();
|
||||
List<WmsDistaskCode> distaskCodes = new();
|
||||
foreach (var itGroup in preTaskGroups)
|
||||
{
|
||||
var moveNum = itGroup.First().move_num;
|
||||
var items = itGroup.Adapt<List<WmsDistaskH>>();
|
||||
|
||||
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<List<WmsDistaskCode>>();
|
||||
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<BasLocation>().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<BasLocation>().SetColumns(it => new BasLocation { is_use = cStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
||||
}
|
||||
//更新业务主表的单据状态
|
||||
if (disTasks?.Count > 0)
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace Tnb.WarehouseMgr
|
||||
var subCarry = await _db.Queryable<WmsCarryH>().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()
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
[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<dynamic> CarryMoveIn(VisualDevModelDataCrInput input)
|
||||
[NonAction]
|
||||
public async Task<dynamic> CarryMoveIn(VisualDevModelDataCrInput input)
|
||||
{
|
||||
|
||||
try
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Tnb.WarehouseMgr
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
|
||||
{
|
||||
//载具加锁,增加库位信息
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.占用,
|
||||
await _db.Updateable<WmsCarryH>().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();
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr
|
||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((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;
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// 入库申请服务
|
||||
/// </summary>
|
||||
[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<WmsInstockCode>().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync();
|
||||
var instockCodes = await _db.Queryable<WmsInstockCode>().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<WmsInstockD>().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<WmsInstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
await _db.Updateable<WmsInstockH>().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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
/// 出库申请业务类
|
||||
/// </summary>
|
||||
[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<WmsOutstockD> 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<string>(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,20 +282,32 @@ namespace Tnb.WarehouseMgr
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
var carryId = input.carryIds[^input.carryIds.Count];
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
var otds = await _db.Queryable<WmsOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
var outStatus = carry.out_status.ToEnum<EnumOutStatus>();
|
||||
if (outStatus == EnumOutStatus.全部出)
|
||||
{
|
||||
//当前载具对应的所有条码插入
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
var outStockCodes = carryCodes.Adapt<List<WmsOutstockCode>>();
|
||||
var otds = await _db.Queryable<WmsOutstockD>().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;
|
||||
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;
|
||||
@@ -314,11 +337,86 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
await _wareCarryService.UpdateNullCarry(carry);
|
||||
}
|
||||
else if (outStatus == EnumOutStatus.分拣出)
|
||||
{
|
||||
if (input.distaskCodes?.Count > 0)
|
||||
{
|
||||
var osCodes = input.distaskCodes.Adapt<List<WmsOutstockCode>>();
|
||||
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<WmsCarryCode>().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<string, decimal>();
|
||||
var delBarcodes = new List<string>();
|
||||
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<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
await _db.Deleteable<WmsCarryMat>().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
if (delBarcodes.Count > 0)
|
||||
{
|
||||
await _db.Deleteable<WmsCarryCode>().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync();
|
||||
}
|
||||
//载具移入
|
||||
var outStockH = await _db.Queryable<WmsOutstockH>().SingleAsync(it => it.id == input.requireId);
|
||||
var visulDevInput = new VisualDevModelDataCrInput();
|
||||
visulDevInput.data = new Dictionary<string, object>
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||
//更新载具绑定条码表
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr
|
||||
//载具加锁,增加库位信息
|
||||
await _db.Updateable<WmsCarryH>().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
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Tnb.WarehouseMgr
|
||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((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;
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
|
||||
//载具加锁,增加库位信息
|
||||
await _db.Updateable<WmsCarryH>().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
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Tnb.WarehouseMgr
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(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<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套, location_id = null, location_code = null }).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.齐套).ToString(), location_id = null, location_code = null }).ExecuteCommandAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲 }).ExecuteCommandAsync();
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
@@ -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<string, object> _dicBizType = new();
|
||||
public WmsSignForDeliveryService(ISqlSugarRepository<WmsDistaskH> repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService)
|
||||
public WmsSignForDeliveryService(ISqlSugarRepository<WmsDistaskH> repository, IWmsCarryService wareCarryService, IDictionaryDataService dictionaryDataService, IWmsCarryMoveInStockService wmsCarryMoveInStockService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_wareCarryService = wareCarryService;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_wmsCarryMoveInStockService = wmsCarryMoveInStockService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据载具ID获取,对应的执行任务记录
|
||||
@@ -66,6 +68,12 @@ namespace Tnb.WarehouseMgr
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
if (carry.location_id.IsNotEmptyOrNull())
|
||||
{
|
||||
var loc = await _db.Queryable<BasLocation>().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<WmsDistaskH>().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<string> { input.carryId } };
|
||||
await DoUpdate(upInput); //回更业务
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == carry.location_id);
|
||||
loc.is_use = (int)EnumCarryStatus.空闲;
|
||||
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
||||
case "载具移出":
|
||||
{
|
||||
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||
await DoUpdate(upInput); //回更业务
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
disTask.is_sign = 1;
|
||||
await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
|
||||
//载具加锁,增加库位信息
|
||||
await _db.Updateable<WmsCarryH>().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
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Tnb.WarehouseMgr
|
||||
var subCarrys = await _db.Queryable<WmsCarryD>().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<string> { 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 });
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user