Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -27,7 +27,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 行号
|
/// 行号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int bill_line { get; set; }
|
public int? bill_line { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库单明细ID
|
/// 入库单明细ID
|
||||||
@@ -37,7 +37,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库单明细行号
|
/// 入库单明细行号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int bill_d_line { get; set; }
|
public int? bill_d_line { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 明细状态
|
/// 明细状态
|
||||||
@@ -72,7 +72,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否锁定
|
/// 是否锁定
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int is_lock { get; set; }
|
public int? is_lock { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否结束
|
/// 是否结束
|
||||||
@@ -87,7 +87,7 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 单位代码
|
/// 单位代码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string unit_code { get; set; } = string.Empty;
|
public string? unit_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 来源单据ID
|
/// 来源单据ID
|
||||||
@@ -132,12 +132,12 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建用户
|
/// 创建用户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string create_id { get; set; } = string.Empty;
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime create_time { get; set; } = DateTime.Now;
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改用户
|
/// 修改用户
|
||||||
@@ -149,4 +149,19 @@ public partial class WmsInstockCode : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? modify_time { get; set; }
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产工单号
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产工单行号
|
||||||
|
/// </summary>
|
||||||
|
public int? mo_line { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产工单BOM明细Id
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_bom_detail_id { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,8 @@
|
|||||||
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
|
||||||
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto;
namespace Tnb.WarehouseMgr.Interfaces
{
/// <summary>
/// 库房业务(出入库)接口
/// </summary>
public interface IWareHouseService
{
/// <summary>
/// 入库策略
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<List<BasLocation>> InStockStrategy([FromQuery] InStockStrategyQuery input);
/// <summary>
/// 出库策略
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
//Task<List<WmsCarryH>> OutStockStrategy([FromQuery] OutStockStrategyQuery input);
/// <summary>
/// 路径算法
/// </summary>
/// <param name="pStartId"></param>
/// <param name="pEndId"></param>
/// <returns></returns>
Task<List<WmsPointH>> PathAlgorithms(string pStartId, string pEndId);
/// <summary>
/// 生成预任务
/// </summary>
/// <param name="preTasks"></param>
/// <returns></returns>
Task<bool> GenPreTask(List<WmsPretaskH> preTasks,List<WmsPretaskCode> preTaskCodes);
/// <summary>
/// 生成预任务成功后操作
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task GenInStockTaskHandleAfter(GenPreTaskUpInput input,Expression<Func<WmsCarryH,WmsCarryH>> setCarryColumnsExp,Expression<Func<BasLocation,BasLocation>> setLocaionColumbExp);
}
}
|
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Interfaces
{
|
||||||
|
/// <summary>
/// 库房业务(出入库)接口
/// </summary>
public interface IWareHouseService
{
/// <summary>
/// 入库策略
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<List<BasLocation>> InStockStrategy([FromQuery] InStockStrategyQuery input);
/// <summary>
/// 出库策略
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
//Task<List<WmsCarryH>> OutStockStrategy([FromQuery] OutStockStrategyQuery input);
/// <summary>
/// 路径算法
/// </summary>
/// <param name="pStartId"></param>
/// <param name="pEndId"></param>
/// <returns></returns>
Task<List<WmsPointH>> PathAlgorithms(string pStartId, string pEndId);
/// <summary>
/// 生成预任务
/// </summary>
/// <param name="preTasks"></param>
/// <returns></returns>
Task<bool> GenPreTask(List<WmsPretaskH> preTasks,List<WmsPretaskCode> preTaskCodes);
/// <summary>
/// 生成预任务成功后操作
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task GenInStockTaskHandleAfter(GenPreTaskUpInput input,Expression<Func<WmsCarryH,WmsCarryH>> setCarryColumnsExp,Expression<Func<BasLocation,BasLocation>> setLocaionColumbExp);
/// <summary>
/// 任务完成
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
|
||||||
|
Task TaskComplate(TaskCompleUpInput input);
|
||||||
|
}
}
|
||||||
@@ -11,6 +11,7 @@ using Aop.Api.Domain;
|
|||||||
using Aspose.Cells.Drawing;
|
using Aspose.Cells.Drawing;
|
||||||
using Dm;
|
using Dm;
|
||||||
using JNPF.Common.Contracts;
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
@@ -49,11 +50,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService)
|
private readonly IUserManager _userManager;
|
||||||
|
public WareHouseService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IBillRullService billRullService, IUserManager userManager)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
|
_userManager = userManager;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据载具Id带出库位、仓库信息
|
/// 根据载具Id带出库位、仓库信息
|
||||||
@@ -438,9 +441,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
foreach (var dt in disTasks)
|
foreach (var dt in disTasks)
|
||||||
{
|
{
|
||||||
if (!input.prefix.IsNullOrWhiteSpace())
|
if (_userManager.User.LoginType == "App")
|
||||||
{
|
{
|
||||||
dt.biz_type = $"{input.prefix}{dt.biz_type}";
|
dt.biz_type = $"pda{dt.biz_type}";
|
||||||
}
|
}
|
||||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id };
|
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id };
|
||||||
if (dt.is_chain == 0)
|
if (dt.is_chain == 0)
|
||||||
|
|||||||
@@ -35,29 +35,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
private readonly IWareHouseService _wareHouseService;
|
|
||||||
private readonly IBillRullService _billRullService;
|
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
public WmsCarryBindService(
|
public WmsCarryBindService(
|
||||||
ISqlSugarRepository<WmsCarryH> repository,
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
IRunService runService,
|
IRunService runService,
|
||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
IUserManager userManager)
|
||||||
IUserManager userManager,
|
|
||||||
IBillRullService billRullService)
|
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
_wareHouseService = wareHouseService;
|
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
|
||||||
OverideFuncs.CreateAsync = CarryBind;
|
OverideFuncs.CreateAsync = CarryBind;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<dynamic> CarryBind(VisualDevModelDataCrInput input)
|
private async Task<dynamic> CarryBind(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
var isOk = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
@@ -66,18 +60,56 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _runService.Create(templateEntity, input);
|
await _runService.Create(templateEntity, input);
|
||||||
|
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarrybindH.carry_id)].ToString());
|
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarrybindH.membercarry_id)].ToString());
|
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||||
//更新主载具明细表,增加新的数据
|
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||||
var insert_id = await _db.Insertable<WmsCarryD>(new WmsCarryD {
|
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||||
carry_id = carry.id,
|
WmsCarrybindH wmsCarrybindH = carry.Adapt<WmsCarrybindH>();
|
||||||
membercarry_id = subCarry.id,
|
if (carryId != null && subCarryId != null)
|
||||||
membercarry_code = subCarry.carry_code,
|
{
|
||||||
loc = input.data[nameof(WmsCarrybindH.loc)].ToString()
|
wmsCarrybindH.id = SnowflakeIdHelper.NextId();
|
||||||
})
|
wmsCarrybindH.org_id = carry.org_id;
|
||||||
.ExecuteCommandAsync();
|
wmsCarrybindH.carry_id = carry.id;
|
||||||
if (insert_id<=0) throw Oops.Oh(ErrorCode.COM1000);
|
wmsCarrybindH.membercarry_id = subCarry.id;
|
||||||
|
wmsCarrybindH.membercarry_code = subCarry.carry_code;
|
||||||
|
wmsCarrybindH.loc = input.data[nameof(WmsCarrybindH.loc)].ParseToInt(1);
|
||||||
|
wmsCarrybindH.create_id = _userManager.UserId;
|
||||||
|
wmsCarrybindH.create_time = DateTime.Now;
|
||||||
|
var row = await _db.Insertable(wmsCarrybindH).ExecuteCommandAsync();
|
||||||
|
carry.carry_status = "1";
|
||||||
|
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
|
subCarry.carry_status = "1";
|
||||||
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
|
isOk = (row > 0);
|
||||||
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (carry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||||
|
}
|
||||||
|
if (subCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的子载具", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/* //更新主载具明细表,增加新的数据
|
||||||
|
var row = await _db.Insertable<WmsCarryD>(new WmsCarryD {
|
||||||
|
id = SnowflakeIdHelper.NextId(),
|
||||||
|
org_id = carry.org_id,
|
||||||
|
carry_id = carry.id,
|
||||||
|
membercarry_id = subCarry.id,
|
||||||
|
membercarry_code = subCarry.carry_code,
|
||||||
|
loc = input.data[nameof(WmsCarrybindH.loc)].ToString(),
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
|
})
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
if (row <= 0) throw Oops.Oh(ErrorCode.COM1000);
|
||||||
|
_db.Updateable<WmsCarryH>().SetColumns(it=>it.carry_status == "1").Where(it=>it.id == input.data[nameof(WmsCarrybindH.carry_id)].ToString());*/
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -124,7 +124,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null);
|
//根据载具移出Id,回更单据状态
|
||||||
|
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,169 +1,175 @@
|
|||||||
using System;
|
using JNPF.Common.Contracts;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Dtos.VisualDev;
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Extension;
|
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using JNPF.VisualDev.Entitys;
|
|
||||||
using JNPF.VisualDev.Interfaces;
|
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.Common.Utils;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具移出
|
/// 载具服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACE_ID)]
|
[OverideVisualDev(ModuleId)]
|
||||||
public class WmsCarryReplaceService : BaseWareHouseService
|
public class WmsCarryReplaceService : BaseWareHouseService, IWmsCarryService
|
||||||
{
|
{
|
||||||
|
private const string ModuleId = "26188532491557";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
|
||||||
private readonly IVisualDevService _visualDevService;
|
|
||||||
private readonly IWareHouseService _wareHouseService;
|
|
||||||
private readonly IBillRullService _billRullService;
|
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
public WmsCarryReplaceService(
|
private readonly IBillRullService _billRullService;
|
||||||
ISqlSugarRepository<WmsCarryH> repository,
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
IRunService runService,
|
public WmsCarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||||
IVisualDevService visualDevService,
|
|
||||||
IWareHouseService wareHouseService,
|
|
||||||
IUserManager userManager,
|
|
||||||
IBillRullService billRullService)
|
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
|
||||||
_visualDevService = visualDevService;
|
|
||||||
_wareHouseService = wareHouseService;
|
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
OverideFuncs.CreateAsync = CarryReplace;
|
OverideFuncs.CreateAsync = CarryReplace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<dynamic> CarryReplace(VisualDevModelDataCrInput input)
|
/// <summary>
|
||||||
|
/// 更换载具
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
/// 输入参数:
|
||||||
|
/// <br/>{
|
||||||
|
/// <br/> old_carry_id:老载具id
|
||||||
|
/// <br/> new_carry_id:新载具ID
|
||||||
|
/// <br/>}
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> CarryReplace(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
var isOk = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
|
var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
|
var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||||
|
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == oldCarryId);
|
||||||
|
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == newCarryId);
|
||||||
|
if (oldCarry != null && newCarry != null)
|
||||||
|
{
|
||||||
|
ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id };
|
||||||
|
isOk = await _updateSubCarry<WmsCarryD>(carryInput);
|
||||||
|
isOk = await _updateSubCarry<WmsCarryMat>(carryInput);
|
||||||
|
isOk = await _updateSubCarry<WmsCarryCode>(carryInput);
|
||||||
|
|
||||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true);
|
newCarry.status = oldCarry.status;
|
||||||
await _runService.Create(templateEntity, input);
|
newCarry.carry_status = oldCarry.carry_status;
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
newCarry.location_id = oldCarry.location_id;
|
||||||
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarryReplaceH.carry_id)].ToString());
|
newCarry.location_code = oldCarry.location_code;
|
||||||
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarryReplaceH.newcarry_id)].ToString());
|
newCarry.is_lock = oldCarry.is_lock;
|
||||||
if (oldCarry.carrystd_id != newCarry.carrystd_id)
|
newCarry.out_status = oldCarry.out_status;
|
||||||
{
|
newCarry.is_check = oldCarry.is_check;
|
||||||
string errorMessege = "新老载具规格应相同";
|
newCarry.bale_num = oldCarry.bale_num;
|
||||||
throw Oops.Oh(errorMessege);
|
newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id;
|
||||||
}
|
newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code;
|
||||||
if (oldCarry.carrystd_id == newCarry.carrystd_id)
|
newCarry.source_id = oldCarry.source_id;
|
||||||
{
|
newCarry.source_code = oldCarry.source_code;
|
||||||
var isOk = await _db.Updateable<WmsCarryD>().SetColumns(it => it.carry_id == newCarry.id).Where(it => it.carry_id == oldCarry.id).ExecuteCommandHasChangeAsync();
|
newCarry.create_id = _userManager.UserId;
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
newCarry.create_time = DateTime.Now;
|
||||||
isOk = await _db.Updateable<WmsCarryCode>().SetColumns(it => it.carry_id == newCarry.id).Where(it => it.carry_id == oldCarry.id).ExecuteCommandHasChangeAsync();
|
var row = await _db.Updateable(newCarry).ExecuteCommandAsync();
|
||||||
|
WmsCarryReplaceH wmsCarryReplaceH = oldCarry.Adapt<WmsCarryReplaceH>();
|
||||||
|
wmsCarryReplaceH.id = SnowflakeIdHelper.NextId();
|
||||||
|
wmsCarryReplaceH.org_id = oldCarry.org_id;
|
||||||
|
wmsCarryReplaceH.bill_code = await _billRullService.GetBillNumber(WmsCarryConst.WMS_CARRY_REPLACE_ENCODE);
|
||||||
|
wmsCarryReplaceH.carry_id = oldCarry.id;
|
||||||
|
wmsCarryReplaceH.carry_code = oldCarry.carry_code;
|
||||||
|
wmsCarryReplaceH.newcarry_id = newCarry.id;
|
||||||
|
wmsCarryReplaceH.newcarry_code = newCarry.carry_code;
|
||||||
|
row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync();
|
||||||
|
row = await UpdateNullCarry(oldCarry);
|
||||||
|
isOk = (row > 0);
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oldCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的旧载具", 500);
|
||||||
|
}
|
||||||
|
if (newCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的新载具", 500);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
}
|
||||||
* db.Updateable(WmsCarryD).SetColumns(it => it.carry_id == newCarry.id).Where(it=>it.carry_id == oldCarry.id).ExecuteCommand();
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* //入库取终点
|
|
||||||
//var OutStockStrategyInput = new OutStockStrategyQuery { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)].ToString(), Size = 1 };
|
|
||||||
//var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsMoveOutstock.carry_id)].ToString());
|
|
||||||
WmsPointH sPoint = null;
|
|
||||||
WmsPointH ePoint = null;
|
|
||||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
|
||||||
{
|
|
||||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
|
||||||
}
|
|
||||||
if (carry != null)
|
|
||||||
{
|
|
||||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sPoint != null && ePoint != null)
|
|
||||||
{
|
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
|
||||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
|
||||||
if (points?.Count > 0)
|
|
||||||
{
|
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
|
||||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
|
||||||
{
|
|
||||||
var sPoint = it.FirstOrDefault();
|
|
||||||
var ePoint = it.LastOrDefault();
|
|
||||||
|
|
||||||
WmsPretaskH preTask = new();
|
|
||||||
preTask.org_id = _userManager.User.OrganizeId;
|
|
||||||
preTask.startlocation_id = sPoint?.location_id;
|
|
||||||
preTask.startlocation_code = sPoint?.location_code;
|
|
||||||
preTask.endlocation_id = ePoint?.location_id;
|
|
||||||
preTask.endlocation_code = ePoint?.location_code;
|
|
||||||
preTask.start_floor = sPoint?.floor.ToString();
|
|
||||||
preTask.end_floor = ePoint?.floor.ToString();
|
|
||||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
|
||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
|
||||||
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID;
|
|
||||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
|
||||||
preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!;
|
|
||||||
preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!;
|
|
||||||
preTask.area_id = sPoint?.area_id;
|
|
||||||
preTask.area_code = it.Key;
|
|
||||||
preTask.require_id = input.data["ReturnIdentity"].ToString();
|
|
||||||
preTask.require_code = input.data[nameof(preTask.bill_code)]?.ToString()!;
|
|
||||||
preTask.create_id = _userManager.UserId;
|
|
||||||
preTask.create_time = DateTime.Now;
|
|
||||||
return preTask;
|
|
||||||
}).ToList();
|
|
||||||
var isOk = await _wareHouseService.GenPreTask(preTasks);
|
|
||||||
if (isOk)
|
|
||||||
{
|
|
||||||
var preTaskUpInput = new GenPreTaskUpInput();
|
|
||||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Log.Error("载具更换失败", ex);
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
return Task.FromResult(true);
|
return isOk;
|
||||||
}
|
}
|
||||||
/* public override async Task ModifyAsync(WareHouseUpInput input)
|
|
||||||
|
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||||
{
|
{
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
var row = -1;
|
||||||
var isOk = await _db.Updateable<WmsCarryReplaceH>().SetColumns(it => new WmsCarryReplaceH { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
try
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
{
|
||||||
}*/
|
carryObj.status = 0;
|
||||||
|
carryObj.carry_status = "0";
|
||||||
|
carryObj.location_id = null;
|
||||||
|
carryObj.location_code = null;
|
||||||
|
carryObj.out_status = "0";
|
||||||
|
carryObj.is_check = 0;
|
||||||
|
carryObj.status = 1;
|
||||||
|
carryObj.bale_num = null;
|
||||||
|
carryObj.collocation_scheme_id = null;
|
||||||
|
carryObj.collocation_scheme_code = null;
|
||||||
|
carryObj.source_id = null;
|
||||||
|
carryObj.source_code = null;
|
||||||
|
row = await _db.Updateable(carryObj).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
||||||
|
{
|
||||||
|
var row = -1;
|
||||||
|
var items = await _db.Queryable<T>().Where(it => it.carry_id == input.old_carry_id).ToListAsync();
|
||||||
|
if (items?.Count > 0)
|
||||||
|
{
|
||||||
|
List<T> newItems = DeepCopyHelper<T>.DeepCopyList(items);
|
||||||
|
if (newItems?.Count > 0)
|
||||||
|
{
|
||||||
|
newItems.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
|
x.carry_id = input.new_carry_id;
|
||||||
|
|
||||||
|
});
|
||||||
|
row = await _db.Insertable(newItems).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
row = await _db.Deleteable(items).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (row > 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,29 +35,24 @@ namespace Tnb.WarehouseMgr
|
|||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
private readonly IWareHouseService _wareHouseService;
|
|
||||||
private readonly IBillRullService _billRullService;
|
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
public WmsCarryUnbindService(
|
public WmsCarryUnbindService(
|
||||||
ISqlSugarRepository<WmsCarryH> repository,
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
IRunService runService,
|
IRunService runService,
|
||||||
IVisualDevService visualDevService,
|
IVisualDevService visualDevService,
|
||||||
IWareHouseService wareHouseService,
|
|
||||||
IUserManager userManager,
|
IUserManager userManager)
|
||||||
IBillRullService billRullService)
|
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
_wareHouseService = wareHouseService;
|
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
|
||||||
OverideFuncs.CreateAsync = CarryUnbind;
|
OverideFuncs.CreateAsync = CarryUnbind;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<dynamic> CarryUnbind(VisualDevModelDataCrInput input)
|
private async Task<dynamic> CarryUnbind(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
var isOk = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
@@ -66,13 +61,32 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _runService.Create(templateEntity, input);
|
await _runService.Create(templateEntity, input);
|
||||||
|
|
||||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarryunbindH.carry_id)].ToString());
|
var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == input.data[nameof(WmsCarryunbindH.membercarry_id)].ToString());
|
var subCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||||
|
var carry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == carryId);
|
||||||
|
var subCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == subCarryId);
|
||||||
var deleteQty = await _db.Deleteable<WmsCarryD>().Where(it => it.carry_id == carry.id ).ExecuteCommandAsync();
|
//WmsCarryunbindH wmsCarryUnbindH = carry.Adapt<WmsCarryunbindH>();
|
||||||
|
if (carryId != null && subCarryId != null)
|
||||||
if (deleteQty <= 0) throw Oops.Oh(ErrorCode.COM1002);
|
{
|
||||||
|
var row = await _db.Deleteable<WmsCarryD>().Where(it=>it.carry_id == subCarry.id).ExecuteCommandAsync();
|
||||||
|
carry.carry_status = "0";
|
||||||
|
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
|
subCarry.carry_status = "0";
|
||||||
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
|
isOk = (row > 0);
|
||||||
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (carry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的主载具", 500);
|
||||||
|
}
|
||||||
|
if (subCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的子载具", 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
_basLocationService = basLocationService;
|
_basLocationService = basLocationService;
|
||||||
//OverideFuncs.CreateAsync = Create;
|
OverideFuncs.CreateAsync = Create;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据载具编号获取起始库位点
|
/// 根据载具编号获取起始库位点
|
||||||
@@ -152,16 +152,20 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
//不需要插入操作表
|
if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null)
|
||||||
/* var preTaskUpInput = new GenPreTaskUpInput();
|
{
|
||||||
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString();
|
//查询库位表
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
{
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
//载具加锁,增加库位信息
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
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();
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
}
|
||||||
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/
|
|
||||||
|
//所有库位加锁
|
||||||
|
var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() };
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
//根据空载具入库Id,回更单据状态
|
//根据空载具入库Id,回更单据状态
|
||||||
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null);
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -77,7 +78,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/
|
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/
|
||||||
|
|
||||||
//出库取起点,获取所有符合输入的载具规格的载具
|
//出库取起点,获取所有符合输入的载具规格的载具
|
||||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)]);
|
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)
|
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
||||||
.Select((a,b) => new
|
.Select((a,b) => new
|
||||||
{
|
{
|
||||||
@@ -141,15 +142,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
var preTaskUpInput = new GenPreTaskUpInput();
|
//所有载具加锁
|
||||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
var ids = carrys.Select(x => x.carry_id).ToList();
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
//所有库位加锁
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
var loc = carrys.Select(x => x.location_id).ToList();
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => loc.Contains(it.id)).ExecuteCommandAsync();
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null);
|
//根据载具移入Id,回更单据状态
|
||||||
|
await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,9 +122,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||||
|
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null);
|
//根据载具移出Id,回更单据状态
|
||||||
|
await _db.Updateable<WmsMoveOutstock>().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
176
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs
Normal file
176
WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.Common.Utils;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 载具服务
|
||||||
|
/// </summary>
|
||||||
|
[OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)]
|
||||||
|
public class WmsPDACarryReplaceService : BaseWareHouseService, IWmsCarryService
|
||||||
|
{
|
||||||
|
//private const string ModuleId = "26188532491557";
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
public WmsPDACarryReplaceService(ISqlSugarRepository<WmsCarryH> repository, IUserManager userManager, IBillRullService billRullService)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_userManager = userManager;
|
||||||
|
_billRullService = billRullService;
|
||||||
|
OverideFuncs.CreateAsync = PDACarryReplace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更换载具
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
/// 输入参数:
|
||||||
|
/// <br/>{
|
||||||
|
/// <br/> old_carry_id:老载具id
|
||||||
|
/// <br/> new_carry_id:新载具ID
|
||||||
|
/// <br/>}
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> PDACarryReplace(VisualDevModelDataCrInput input)
|
||||||
|
{
|
||||||
|
var isOk = false;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : "";
|
||||||
|
var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : "";
|
||||||
|
var oldCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == oldCarryId);
|
||||||
|
var newCarry = await _db.Queryable<WmsCarryH>().FirstAsync(it => it.id == newCarryId);
|
||||||
|
if (oldCarry != null && newCarry != null)
|
||||||
|
{
|
||||||
|
ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id };
|
||||||
|
isOk = await _updateSubCarry<WmsCarryD>(carryInput);
|
||||||
|
isOk = await _updateSubCarry<WmsCarryMat>(carryInput);
|
||||||
|
isOk = await _updateSubCarry<WmsCarryCode>(carryInput);
|
||||||
|
|
||||||
|
newCarry.status = oldCarry.status;
|
||||||
|
newCarry.carry_status = oldCarry.carry_status;
|
||||||
|
newCarry.location_id = oldCarry.location_id;
|
||||||
|
newCarry.location_code = oldCarry.location_code;
|
||||||
|
newCarry.is_lock = oldCarry.is_lock;
|
||||||
|
newCarry.out_status = oldCarry.out_status;
|
||||||
|
newCarry.is_check = oldCarry.is_check;
|
||||||
|
newCarry.bale_num = oldCarry.bale_num;
|
||||||
|
newCarry.collocation_scheme_id = oldCarry.collocation_scheme_id;
|
||||||
|
newCarry.collocation_scheme_code = oldCarry.collocation_scheme_code;
|
||||||
|
newCarry.source_id = oldCarry.source_id;
|
||||||
|
newCarry.source_code = oldCarry.source_code;
|
||||||
|
newCarry.create_id = _userManager.UserId;
|
||||||
|
newCarry.create_time = DateTime.Now;
|
||||||
|
var row = await _db.Updateable(newCarry).ExecuteCommandAsync();
|
||||||
|
WmsCarryReplaceH wmsCarryReplaceH = oldCarry.Adapt<WmsCarryReplaceH>();
|
||||||
|
wmsCarryReplaceH.id = SnowflakeIdHelper.NextId();
|
||||||
|
wmsCarryReplaceH.org_id = oldCarry.org_id;
|
||||||
|
wmsCarryReplaceH.bill_code = await _billRullService.GetBillNumber(WmsCarryConst.WMS_CARRY_REPLACE_ENCODE);
|
||||||
|
wmsCarryReplaceH.carry_id = oldCarry.id;
|
||||||
|
wmsCarryReplaceH.carry_code = oldCarry.carry_code;
|
||||||
|
wmsCarryReplaceH.newcarry_id = newCarry.id;
|
||||||
|
wmsCarryReplaceH.newcarry_code = newCarry.carry_code;
|
||||||
|
row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync();
|
||||||
|
row = await UpdateNullCarry(oldCarry);
|
||||||
|
isOk = (row > 0);
|
||||||
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (oldCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的旧载具", 500);
|
||||||
|
}
|
||||||
|
if (newCarry == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("没有可用的新载具", 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error("载具更换失败", ex);
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
return isOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> UpdateNullCarry(WmsCarryH carryObj)
|
||||||
|
{
|
||||||
|
var row = -1;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
carryObj.status = 0;
|
||||||
|
carryObj.carry_status = "0";
|
||||||
|
carryObj.location_id = null;
|
||||||
|
carryObj.location_code = null;
|
||||||
|
carryObj.out_status = "0";
|
||||||
|
carryObj.is_check = 0;
|
||||||
|
carryObj.status = 1;
|
||||||
|
carryObj.bale_num = null;
|
||||||
|
carryObj.collocation_scheme_id = null;
|
||||||
|
carryObj.collocation_scheme_code = null;
|
||||||
|
carryObj.source_id = null;
|
||||||
|
carryObj.source_code = null;
|
||||||
|
row = await _db.Updateable(carryObj).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> _updateSubCarry<T>(ExChangeCarryInput input) where T : BaseEntity<string>, IWmsCarryEntity, new()
|
||||||
|
{
|
||||||
|
var row = -1;
|
||||||
|
var items = await _db.Queryable<T>().Where(it => it.carry_id == input.old_carry_id).ToListAsync();
|
||||||
|
if (items?.Count > 0)
|
||||||
|
{
|
||||||
|
List<T> newItems = DeepCopyHelper<T>.DeepCopyList(items);
|
||||||
|
if (newItems?.Count > 0)
|
||||||
|
{
|
||||||
|
newItems.ForEach(x =>
|
||||||
|
{
|
||||||
|
x.id = SnowflakeIdHelper.NextId();
|
||||||
|
x.carry_id = input.new_carry_id;
|
||||||
|
|
||||||
|
});
|
||||||
|
row = await _db.Insertable(newItems).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
row = await _db.Deleteable(items).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (row > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
_runService = runService;
|
_runService = runService;
|
||||||
_visualDevService = visualDevService;
|
_visualDevService = visualDevService;
|
||||||
_basLocationService = basLocationService;
|
_basLocationService = basLocationService;
|
||||||
//OverideFuncs.CreateAsync = Create;
|
OverideFuncs.CreateAsync = Create;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据载具编号获取起始库位点
|
/// 根据载具编号获取起始库位点
|
||||||
@@ -151,16 +151,25 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
//不需要插入操作表
|
f(input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null)
|
||||||
/* var preTaskUpInput = new GenPreTaskUpInput();
|
{
|
||||||
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString();
|
//查询库位表
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
{
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
//载具加锁,增加库位信息
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
{
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
||||||
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
//所有库位加锁
|
||||||
|
var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() };
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
public class WmsPDAEmptyInstockService : BaseWareHouseService
|
public class WmsPDAEmptyInstockService : BaseWareHouseService
|
||||||
{
|
{
|
||||||
private const string BizTypeId = "26121986416677";
|
private const string BizTypeId = "pda26121986416677";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
@@ -140,8 +140,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTaskUpInput.PreTaskRecord = handleH;
|
preTaskUpInput.PreTaskRecord = handleH;
|
||||||
//根据空载具入库Id,回更单据状态
|
//根据空载具入库Id,回更单据状态
|
||||||
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
await _db.Updateable<WmsEmptyInstock>().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync();
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,null,null);
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
public class WmsPDAEmptyOutstockService : BaseWareHouseService
|
public class WmsPDAEmptyOutstockService : BaseWareHouseService
|
||||||
{
|
{
|
||||||
private const string BizTypeId = "26121986416677";
|
private const string BizTypeId = "pda26121986416677";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
@@ -141,15 +141,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
var preTaskUpInput = new GenPreTaskUpInput();
|
//所有载具加锁
|
||||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
var ids = carrys.Select(x => x.carry_id).ToList();
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
//所有库位加锁
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
var loc = carrys.Select(x => x.location_id).ToList();
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.id).ToList();
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => loc.Contains(it.id)).ExecuteCommandAsync();
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, null, null);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
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;
|
||||||
|
namespace Tnb.WarehouseMgr
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异常取消
|
||||||
|
/// </summary>
|
||||||
|
[OverideVisualDev(ModuleConsts.MODULE_WMSEXCPTIONCOMPLETEPDA_ID)]
|
||||||
|
public class WmsPDAExceptionCompleteService : BaseWareHouseService
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly IWareHouseService _wareHouseService;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
public WmsPDAExceptionCompleteService(
|
||||||
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
|
IRunService runService,
|
||||||
|
IVisualDevService visualDevService,
|
||||||
|
IWareHouseService wareHouseService,
|
||||||
|
IUserManager userManager,
|
||||||
|
IBillRullService billRullService)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_wareHouseService = wareHouseService;
|
||||||
|
_userManager = userManager;
|
||||||
|
_billRullService = billRullService;
|
||||||
|
OverideFuncs.CreateAsync = ExceptionComplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> ExceptionComplete(VisualDevModelDataCrInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
var taskCompleUpInput = new TaskCompleUpInput();
|
||||||
|
List<string> list = new();
|
||||||
|
if (input.data.ContainsKey(nameof(WmsDistaskH.id)))
|
||||||
|
{
|
||||||
|
list.Add(input.data[nameof(WmsDistaskH.id)].ToString());
|
||||||
|
taskCompleUpInput.disTaskIds = list;
|
||||||
|
await _wareHouseService.TaskComplate(taskCompleUpInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Dtos.VisualDev;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.CodeAnalysis;
|
||||||
|
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.Interfaces;
|
||||||
|
namespace Tnb.WarehouseMgr
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 异常取消
|
||||||
|
/// </summary>
|
||||||
|
[OverideVisualDev(ModuleConsts.MODULE_WMSEXCPTIONREEXCUTEPDA_ID)]
|
||||||
|
public class WmsPDAExceptionReexcuteService : BaseWareHouseService
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly IWareHouseService _wareHouseService;
|
||||||
|
private readonly IBillRullService _billRullService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
public WmsPDAExceptionReexcuteService(
|
||||||
|
ISqlSugarRepository<WmsCarryH> repository,
|
||||||
|
IRunService runService,
|
||||||
|
IVisualDevService visualDevService,
|
||||||
|
IWareHouseService wareHouseService,
|
||||||
|
IUserManager userManager,
|
||||||
|
IBillRullService billRullService)
|
||||||
|
{
|
||||||
|
_db = repository.AsSugarClient();
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_wareHouseService = wareHouseService;
|
||||||
|
_userManager = userManager;
|
||||||
|
_billRullService = billRullService;
|
||||||
|
OverideFuncs.CreateAsync = ExceptionReexcute;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> ExceptionReexcute(VisualDevModelDataCrInput input)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
var items = await _db.Queryable<WmsDistaskH>().FirstAsync(it => it.id == input.data[nameof(WmsDistaskH.id)].ToString());
|
||||||
|
//items.agreement
|
||||||
|
//获取任务的协议,进行重新下发
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
return Task.FromResult(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@ using JNPF.VisualDev.Interfaces;
|
|||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NPOI.OpenXmlFormats.Vml;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
@@ -35,7 +36,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
[ServiceModule(BizTypeId)]
|
[ServiceModule(BizTypeId)]
|
||||||
public class WmsPDAInStockService : BaseWareHouseService
|
public class WmsPDAInStockService : BaseWareHouseService
|
||||||
{
|
{
|
||||||
private const string BizTypeId = "pda26121988909861";
|
private const string BizTypeId = "pda26191496816421";
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IRunService _runService;
|
private readonly IRunService _runService;
|
||||||
private readonly IVisualDevService _visualDevService;
|
private readonly IVisualDevService _visualDevService;
|
||||||
@@ -72,7 +73,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 };
|
||||||
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
|
||||||
@@ -145,17 +145,20 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
|
var requireIdField = "require_id";
|
||||||
|
var requireCodeField = "require_code";
|
||||||
|
|
||||||
var preTaskUpInput = new GenPreTaskUpInput();
|
var preTaskUpInput = new GenPreTaskUpInput();
|
||||||
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString();
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
||||||
if (input.data.ContainsKey("bill_id") && input.data["bill_id"].IsNotEmptyOrNull())
|
if (input.data.ContainsKey(requireIdField) && input.data[requireIdField].IsNotEmptyOrNull())
|
||||||
{
|
{
|
||||||
//创建预任务操作记录
|
//创建预任务操作记录
|
||||||
var operBillId = string.Empty;
|
var operBillId = string.Empty;
|
||||||
var instockH = await _db.Queryable<WmsInstockH>().FirstAsync(it => it.id == input.data["bill_id"].ToString());
|
var instockH = await _db.Queryable<WmsInstockH>().FirstAsync(it => it.id == input.data[requireIdField].ToString());
|
||||||
if (instockH != null)
|
if (instockH != null)
|
||||||
{
|
{
|
||||||
var handleH = instockH.Adapt<WmsHandleH>();
|
var handleH = instockH.Adapt<WmsHandleH>();
|
||||||
@@ -166,7 +169,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTaskUpInput.PreTaskRecord = handleH;
|
preTaskUpInput.PreTaskRecord = handleH;
|
||||||
}
|
}
|
||||||
//创建预任务条码操作记录
|
//创建预任务条码操作记录
|
||||||
jArr = JArray.Parse(input.data["tablefield115"].ToString());
|
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||||
if (jArr?.Children().Count() > 0)
|
if (jArr?.Children().Count() > 0)
|
||||||
{
|
{
|
||||||
foreach (var jo in jArr.Children())
|
foreach (var jo in jArr.Children())
|
||||||
@@ -176,8 +179,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
handleCode.org_id = _userManager.User.OrganizeId;
|
handleCode.org_id = _userManager.User.OrganizeId;
|
||||||
handleCode.bill_id = operBillId;
|
handleCode.bill_id = operBillId;
|
||||||
handleCode.material_id = materialId;
|
handleCode.material_id = materialId;
|
||||||
handleCode.material_code = jo.Value<string>(nameof(WmsHandleCode.material_code));
|
handleCode.material_code = jo.Value<string>(nameof(WmsHandleCode.material_code))!;
|
||||||
handleCode.barcode = jo.Value<string>(nameof(WmsHandleCode.barcode));
|
handleCode.barcode = jo.Value<string>(nameof(WmsHandleCode.barcode))!;
|
||||||
handleCode.code_batch = jo.Value<string>(nameof(WmsHandleCode.code_batch));
|
handleCode.code_batch = jo.Value<string>(nameof(WmsHandleCode.code_batch));
|
||||||
handleCode.codeqty = jo.Value<int>(nameof(WmsHandleCode.codeqty));
|
handleCode.codeqty = jo.Value<int>(nameof(WmsHandleCode.codeqty));
|
||||||
handleCode.unit_id = _db.Queryable<BasMaterial>().Single(it => it.id == materialId).unit_id;
|
handleCode.unit_id = _db.Queryable<BasMaterial>().Single(it => it.id == materialId).unit_id;
|
||||||
@@ -194,12 +197,38 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.is_out = 0;
|
x.is_out = 0;
|
||||||
});
|
});
|
||||||
//生成入库申请条码
|
//生成入库申请条码
|
||||||
|
var instockDetails = await _db.Queryable<WmsInstockD>()
|
||||||
await _db.Insertable(preTaskUpInput.PreTaskRecord).ExecuteCommandAsync();
|
.Where(b => b.bill_id == input.data[requireIdField].ToString())
|
||||||
|
.ToListAsync();
|
||||||
|
var items = instockDetails.Adapt<List<WmsInstockCode>>();
|
||||||
|
List<WmsInstockCode> instockCOdes = new();
|
||||||
|
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||||
|
if (jArr?.Children().Count() > 0)
|
||||||
|
{
|
||||||
|
foreach (var jo in jArr.Children())
|
||||||
|
{
|
||||||
|
var materialId = jo.Value<string>(nameof(WmsInstockCode.material_id));
|
||||||
|
var materialCode = jo.Value<string>(nameof(WmsInstockCode.material_code));
|
||||||
|
var codeBatch = jo.Value<string>(nameof(WmsInstockCode.code_batch));
|
||||||
|
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
||||||
|
if (b != null)
|
||||||
|
{
|
||||||
|
b.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode));
|
||||||
|
b.barcode_qty = jo.Value<int>(nameof(WmsInstockCode.barcode_qty));
|
||||||
|
instockCOdes.Add(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||||
|
await _db.Insertable(instockCOdes).ExecuteCommandAsync();
|
||||||
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
|
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
|
it => new BasLocation { is_lock = 1, is_use = "1" });
|
||||||
|
if (instockCOdes?.Count > 0)
|
||||||
|
{
|
||||||
|
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString(), is_lock = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }).Where(it => it.id == preTaskUpInput.CarryId).ExecuteCommandAsync();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,11 +243,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//public override async Task ModifyAsync(WareHouseUpInput input)
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||||
//{
|
{
|
||||||
// if (input == null) throw new ArgumentNullException(nameof(input));
|
|
||||||
// var isOk = await _db.Updateable<WmsMoveInstock>().SetColumns(it => new WmsMoveInstock { status = input.bizTypeId }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
}
|
||||||
// if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -115,16 +116,22 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
//不需要插入操作表
|
//查询库位表
|
||||||
/* var preTaskUpInput = new GenPreTaskUpInput();
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString());
|
||||||
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString();
|
{
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
//载具加锁,增加库位信息
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
{
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
is_lock = 1,
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
||||||
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/
|
location_code = location.location_code
|
||||||
|
}).Where(it => it.id == input.data[nameof(WmsTransfer.carry_id)].ToString()).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
//所有库位加锁
|
||||||
|
var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() };
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -115,16 +116,22 @@ namespace Tnb.WarehouseMgr
|
|||||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||||
if (isOk)
|
if (isOk)
|
||||||
{
|
{
|
||||||
//不需要插入操作表
|
//查询库位表
|
||||||
/* var preTaskUpInput = new GenPreTaskUpInput();
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString());
|
||||||
preTaskUpInput.PreTaskId = input.data["ReturnIdentity"].ToString();
|
{
|
||||||
preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!;
|
//载具加锁,增加库位信息
|
||||||
preTaskUpInput.CarryStartLocationId = points.FirstOrDefault().location_id;
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault().location_code;
|
{
|
||||||
preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList();
|
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
||||||
preTaskUpInput.PreTaskRecords = preTasks.Adapt<List<WmsHandleH>>();
|
is_lock = 1,
|
||||||
preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId());
|
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
||||||
await _wareHouseService.GenTaskHandleAfter(preTaskUpInput);*/
|
location_code = location.location_code
|
||||||
|
}).Where(it => it.id == input.data[nameof(WmsTransfer.carry_id)].ToString()).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
//所有库位加锁
|
||||||
|
var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() };
|
||||||
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
|||||||
public async Task<dynamic> GetCurrentUser(string type)
|
public async Task<dynamic> GetCurrentUser(string type)
|
||||||
{
|
{
|
||||||
if (type.IsNullOrEmpty()) type = "Web"; // 默认为Web端菜单目录
|
if (type.IsNullOrEmpty()) type = "Web"; // 默认为Web端菜单目录
|
||||||
|
//modify by ly on 20230616 用于区分pc与 pda
|
||||||
|
_userManager.User.LoginType = type;
|
||||||
|
|
||||||
var userId = _userManager.UserId;
|
var userId = _userManager.UserId;
|
||||||
|
|
||||||
@@ -669,7 +671,8 @@ public class OAuthService : IDynamicApiController, ITransient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new {
|
return new
|
||||||
|
{
|
||||||
theme = user.Theme == null ? "classic" : user.Theme,
|
theme = user.Theme == null ? "classic" : user.Theme,
|
||||||
token = string.Format("Bearer {0}", accessToken)
|
token = string.Format("Bearer {0}", accessToken)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace JNPF.Systems.Entitys.Permission;
|
|||||||
/// 用户信息基类.
|
/// 用户信息基类.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("BASE_USER")]
|
[SugarTable("BASE_USER")]
|
||||||
public class UserEntity : CLDEntityBase
|
public partial class UserEntity : CLDEntityBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 账户.
|
/// 账户.
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using JNPF.Common.Const;
|
||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace JNPF.Systems.Entitys.Permission;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户信息基类.
|
||||||
|
/// </summary>
|
||||||
|
public partial class UserEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 登录类型
|
||||||
|
/// </summary>
|
||||||
|
public string LoginType { get; set; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user