Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
16
BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs
Normal file
16
BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
namespace Tnb.BasicData
|
||||||
|
{
|
||||||
|
public static class WebApiConst
|
||||||
|
{
|
||||||
|
#region wms
|
||||||
|
|
||||||
|
//mes生产入库接口
|
||||||
|
public const string MES_CREATE_INSTOCK = "/api/wms/wms-in-stock/mes-create-instock";
|
||||||
|
|
||||||
|
//载具签收接口
|
||||||
|
public const string MES_CARRY_SIGN = "/api/wms/wms-sign-for-delivery/mes-carry-sign";
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class PrdInstockInput
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单据类型
|
||||||
|
/// </summary>
|
||||||
|
public string bill_type { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 载具编号
|
||||||
|
/// </summary>
|
||||||
|
public string carry_code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 起始库位编号
|
||||||
|
/// </summary>
|
||||||
|
public string location_code { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 检验(0-未检 1-已检)
|
||||||
|
/// </summary>
|
||||||
|
public int is_check { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 子表明细
|
||||||
|
/// </summary>
|
||||||
|
public List<Dictionary<string,string>> details { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ public partial class PrdInstockD : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数量
|
/// 数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string quantity { get; set; } = string.Empty;
|
public int quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 批次
|
/// 批次
|
||||||
@@ -49,4 +49,9 @@ public partial class PrdInstockD : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string barcode { get; set; } = string.Empty;
|
public string barcode { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产提报id
|
||||||
|
/// </summary>
|
||||||
|
public string report_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -38,16 +38,12 @@ public partial class PrdInstockH : BaseEntity<string>
|
|||||||
/// 起始库位编号
|
/// 起始库位编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string location_code { get; set; } = string.Empty;
|
public string location_code { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源单据ID
|
|
||||||
/// </summary>
|
|
||||||
public string source_id { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检验(0-未检 1-已检)
|
/// 检验(0-未检 1-已检)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string is_check { get; set; } = string.Empty;
|
public int is_check { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建用户
|
/// 创建用户
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr.Interfaces
|
namespace Tnb.ProductionMgr.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -6,6 +8,13 @@ namespace Tnb.ProductionMgr.Interfaces
|
|||||||
public interface IPrdInstockService
|
public interface IPrdInstockService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 生产入库报错
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<dynamic> SaveData(PrdInstockInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库申请同步
|
/// 入库申请同步
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
|
using JNPF;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Common.Enums;
|
using JNPF.Common.Enums;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
using JNPF.Systems.Entitys.Permission;
|
using JNPF.Systems.Entitys.Permission;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.ClearScript.Util.Web;
|
using Microsoft.ClearScript.Util.Web;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
@@ -16,6 +19,7 @@ using Tnb.ProductionMgr.Interfaces;
|
|||||||
using Tnb.ProductionMgr.Entities.Consts;
|
using Tnb.ProductionMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr;
|
using Tnb.WarehouseMgr;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -29,20 +33,20 @@ namespace Tnb.ProductionMgr
|
|||||||
private readonly ISqlSugarRepository<PrdFeedingH> _repository;
|
private readonly ISqlSugarRepository<PrdFeedingH> _repository;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IBillRullService _billRullService;
|
private readonly IBillRullService _billRullService;
|
||||||
private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
// private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public PrdFeedingService(
|
public PrdFeedingService(
|
||||||
ISqlSugarRepository<PrdFeedingH> repository,
|
ISqlSugarRepository<PrdFeedingH> repository,
|
||||||
IBillRullService billRullService,
|
IBillRullService billRullService,
|
||||||
WmsSignForDeliveryService wmsSignForDeliveryService,
|
// WmsSignForDeliveryService wmsSignForDeliveryService,
|
||||||
IUserManager userManager
|
IUserManager userManager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_wmsSignForDeliveryService = _wmsSignForDeliveryService;
|
// _wmsSignForDeliveryService = _wmsSignForDeliveryService;
|
||||||
_billRullService = billRullService;
|
_billRullService = billRullService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,12 +147,12 @@ namespace Tnb.ProductionMgr
|
|||||||
if (result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
{
|
{
|
||||||
//签收后调用载具签收接口
|
//签收后调用载具签收接口
|
||||||
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
// await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||||
{
|
// {
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
create_id = _userManager.UserId,
|
// create_id = _userManager.UserId,
|
||||||
carry_code = input.carry_code ?? "",
|
// carry_code = input.carry_code ?? "",
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||||
@@ -257,12 +261,26 @@ namespace Tnb.ProductionMgr
|
|||||||
if (result.IsSuccess)
|
if (result.IsSuccess)
|
||||||
{
|
{
|
||||||
//签收后调用载具签收接口
|
//签收后调用载具签收接口
|
||||||
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
// await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||||
|
// {
|
||||||
|
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
// create_id = _userManager.UserId,
|
||||||
|
// carry_code = input.carry_code ?? "",
|
||||||
|
// });
|
||||||
|
|
||||||
|
var mesCarrySignInput = new MESCarrySignInput()
|
||||||
{
|
{
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
create_id = _userManager.UserId,
|
create_id = _userManager.UserId,
|
||||||
carry_code = input.carry_code ?? "",
|
carry_code = input.carry_code ?? "",
|
||||||
});
|
};
|
||||||
|
|
||||||
|
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
|
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
|
};
|
||||||
|
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
|
using JNPF;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Enums;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.RemoteRequest;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using Mapster;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
using Tnb.ProductionMgr.Entities.Dto;
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
using Tnb.ProductionMgr.Interfaces;
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
|
using Tnb.WarehouseMgr;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -19,18 +31,112 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IBillRullService _billRullService;
|
|
||||||
|
|
||||||
|
|
||||||
public PrdInstockService(
|
public PrdInstockService(
|
||||||
ISqlSugarRepository<PrdInstockH> repository,
|
ISqlSugarRepository<PrdInstockH> repository,
|
||||||
IBillRullService billRullService,
|
|
||||||
IUserManager userManager
|
IUserManager userManager
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
_billRullService = billRullService;
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> SaveData(PrdInstockInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
var location = await db.Queryable<BasLocation>().FirstAsync(x => x.location_code == input.location_code);
|
||||||
|
PrdInstockH prdInstockH = null;
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
prdInstockH = new PrdInstockH()
|
||||||
|
{
|
||||||
|
bill_type = input.bill_type,
|
||||||
|
bill_date = DateTime.Now,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
location_code = input.location_code,
|
||||||
|
carry_code = input.carry_code,
|
||||||
|
is_check = input.is_check,
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
warehouse_id = location?.wh_id,
|
||||||
|
status = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||||
|
foreach (var item in input.details)
|
||||||
|
{
|
||||||
|
prdInstockDs.Add(new PrdInstockD()
|
||||||
|
{
|
||||||
|
instock_id = prdInstockH.id,
|
||||||
|
report_id = item.ContainsKey("report_id") ? item["report_id"] : "",
|
||||||
|
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||||
|
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||||
|
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||||
|
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||||
|
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||||
|
quantity = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await _repository.InsertAsync(prdInstockH);
|
||||||
|
|
||||||
|
if (prdInstockDs.Count > 0)
|
||||||
|
{
|
||||||
|
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||||
|
mesCreateInstockInput.instock = new MESWmsInstockHInput()
|
||||||
|
{
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||||
|
bill_date = DateTime.Now,
|
||||||
|
bill_type = input.bill_type,
|
||||||
|
warehouse_id = location?.wh_id,
|
||||||
|
source_id = prdInstockH.id,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
carry_code = input.carry_code,
|
||||||
|
location_code = input.location_code,
|
||||||
|
is_check = input.is_check,
|
||||||
|
};
|
||||||
|
mesCreateInstockInput.instockds = new List<MESWmsInstockDInput>();
|
||||||
|
mesCreateInstockInput.instockcodes = new List<MESWmsInstockCodeInput>();
|
||||||
|
foreach (var item in input.details)
|
||||||
|
{
|
||||||
|
mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput()
|
||||||
|
{
|
||||||
|
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||||
|
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||||
|
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||||
|
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||||
|
pr_qty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||||
|
});
|
||||||
|
|
||||||
|
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||||
|
{
|
||||||
|
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||||
|
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||||
|
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||||
|
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||||
|
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||||
|
codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
|
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
|
};
|
||||||
|
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||||
|
Console.WriteLine(sendResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||||
|
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
|
||||||
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
@@ -38,18 +40,41 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
dicMaterial = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
dicMaterial = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||||
}
|
}
|
||||||
var items = await _db.Queryable<WmsCarryCode>().Where(a => a.carry_id == carryId)
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it=>it.id == carryId);
|
||||||
.Select(a => new CarryCodeDetailOutput
|
List<CarryCodeDetailOutput> items = new();
|
||||||
{
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||||
barcode = a.barcode,
|
{
|
||||||
code_batch = a.code_batch!,
|
var carryDs = await _db.Queryable<WmsCarryD>().Where(it=>it.carry_id == carryId).ToListAsync();
|
||||||
codeqty = a.codeqty,
|
var carryMIds = carryDs.Select(x=>x.membercarry_id).ToList();
|
||||||
material_code = a.material_code,
|
items = await _db.Queryable<WmsCarryCode>().Where(a => carryMIds.Contains(a.carry_id))
|
||||||
material_id = a.material_id,
|
.Select(a => new CarryCodeDetailOutput
|
||||||
unit_id = a.unit_id,
|
{
|
||||||
})
|
barcode = a.barcode,
|
||||||
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
code_batch = a.code_batch!,
|
||||||
.ToListAsync();
|
codeqty = a.codeqty,
|
||||||
|
material_code = a.material_code,
|
||||||
|
material_id = a.material_id,
|
||||||
|
unit_id = a.unit_id,
|
||||||
|
})
|
||||||
|
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items = await _db.Queryable<WmsCarryCode>().Where(a => a.carry_id == carryId)
|
||||||
|
.Select(a => new CarryCodeDetailOutput
|
||||||
|
{
|
||||||
|
barcode = a.barcode,
|
||||||
|
code_batch = a.code_batch!,
|
||||||
|
codeqty = a.codeqty,
|
||||||
|
material_code = a.material_code,
|
||||||
|
material_id = a.material_id,
|
||||||
|
unit_id = a.unit_id,
|
||||||
|
})
|
||||||
|
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
return items ?? Enumerable.Empty<dynamic>();
|
return items ?? Enumerable.Empty<dynamic>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -72,7 +73,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
foreach (var ko in kittingOuts)
|
foreach (var ko in kittingOuts)
|
||||||
{
|
{
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => it.collocation_scheme_id == ko.collocation_scheme_id && it.is_lock == 0).ToListAsync();
|
var carrys = await _db.Queryable<WmsCarryH>()
|
||||||
|
.InnerJoin<WmsCollocationSchemeH>((a,b) => a.collocation_scheme_id == b.id)
|
||||||
|
.Where(a => a.collocation_scheme_id == ko.collocation_scheme_id && a.is_lock == 0)
|
||||||
|
.OrderBy((a,b)=>b.seq)
|
||||||
|
.ToListAsync();
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
{
|
{
|
||||||
var firstCarry = carrys.FirstOrDefault();
|
var firstCarry = carrys.FirstOrDefault();
|
||||||
@@ -131,7 +136,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task KittingOutByIsToBeShipped(IDbTransaction? tran = null)
|
public async Task KittingOutByIsToBeShipped()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -152,10 +157,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
|
//判断目标库位是否自动签收
|
||||||
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == ePoint.location_id);
|
||||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
if (points?.Count > 0)
|
if (points?.Count > 0)
|
||||||
@@ -165,36 +173,38 @@ namespace Tnb.WarehouseMgr
|
|||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
var ePoint = it.LastOrDefault();
|
var ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new();
|
||||||
{
|
preTask.org_id = _userManager.User.OrganizeId;
|
||||||
org_id = _userManager.User.OrganizeId,
|
preTask.startlocation_id = sPoint?.location_id!;
|
||||||
startlocation_id = sPoint?.location_id!,
|
preTask.startlocation_code = sPoint?.location_code!;
|
||||||
startlocation_code = sPoint?.location_code!,
|
preTask.endlocation_id = ePoint?.location_id!;
|
||||||
endlocation_id = ePoint?.location_id!,
|
preTask.endlocation_code = ePoint?.location_code!;
|
||||||
endlocation_code = ePoint?.location_code!,
|
preTask.start_floor = sPoint?.floor.ToString();
|
||||||
start_floor = sPoint?.floor.ToString(),
|
preTask.end_floor = ePoint?.floor.ToString();
|
||||||
end_floor = ePoint?.floor.ToString(),
|
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||||
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
preTask.biz_type = ko.biz_type;
|
||||||
biz_type = ko.biz_type,
|
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||||
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
|
preTask.carry_id = ko!.carry_id!;
|
||||||
carry_id = ko!.carry_id!,
|
preTask.carry_code = ko!.carry_code!;
|
||||||
carry_code = ko!.carry_code!,
|
preTask.area_id = sPoint?.area_id!;
|
||||||
area_id = sPoint?.area_id!,
|
preTask.area_code = it.Key;
|
||||||
area_code = it.Key,
|
preTask.require_id = ko.id;
|
||||||
require_id = ko.id,
|
preTask.require_code = ko.bill_code;
|
||||||
require_code = ko.bill_code,
|
preTask.create_id = _userManager.UserId;
|
||||||
create_id = _userManager.UserId,
|
preTask.create_time = DateTime.Now;
|
||||||
create_time = DateTime.Now
|
|
||||||
};
|
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (loc.is_sign == 0)
|
||||||
|
{
|
||||||
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
|
}
|
||||||
await _warehouseService.GenPreTask(preTasks, null!);
|
await _warehouseService.GenPreTask(preTasks, null!);
|
||||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
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();
|
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! } };
|
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.齐套).ToString() }, 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 });
|
||||||
|
await _db.Updateable<WmsKittingoutH>().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == ko.id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user