bug
This commit is contained in:
@@ -37,7 +37,7 @@ namespace Tnb.ProductionMgr
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class PrdMaterialReceiptService : BaseWareHouseService,IPrdMaterialReceiptService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string BizTypeId = "FloorCallMaterial34354738929685";
|
||||
private const string BizTypeId = "FloorCallMaterial";
|
||||
private readonly ISqlSugarRepository<PrdMaterialReceiptH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
|
||||
@@ -377,7 +377,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
private async Task<string> X1AutoPrdReport()
|
||||
public async Task<string> X1AutoPrdReport()
|
||||
{
|
||||
string carryCode = await _redisData.TryGetValueByKeyField<string>("外包装箱码垛线", "WBZX_x1_take_tp");
|
||||
int num = await _redisData.TryGetValueByKeyField<int>("外包装箱码垛线", "WBZX_x1_Enquantity");
|
||||
@@ -403,7 +403,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
private async Task<string> X2AutoPrdReport()
|
||||
public async Task<string> X2AutoPrdReport()
|
||||
{
|
||||
string carryCode = await _redisData.TryGetValueByKeyField<string>("外包装箱码垛线", "WBZX_x2_take_tp");
|
||||
int num = await _redisData.TryGetValueByKeyField<int>("外包装箱码垛线", "WBZX_x2_Enquantity");
|
||||
|
||||
@@ -34,11 +34,13 @@ using Microsoft.Extensions.Logging;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Asn1.X509;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -58,6 +60,8 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IWmsCarryBindService _wmsCarryBindService;
|
||||
private readonly IWmsCarryUnbindService _wmsCarryUnbindService;
|
||||
private readonly IOrganizeService _organizeService;
|
||||
private readonly IWmsCarryQueryService _wmsCarryQueryService;
|
||||
|
||||
public static SemaphoreSlim s_taskDistributeToZCC = new(1);
|
||||
|
||||
@@ -70,6 +74,8 @@ namespace Tnb.WarehouseMgr
|
||||
IBillRullService billRullService,
|
||||
IEventPublisher eventPublisher,
|
||||
IWmsCarryUnbindService wmsCarryUnbindService,
|
||||
IOrganizeService organizeService,
|
||||
IWmsCarryQueryService wmsCarryQueryService,
|
||||
IWmsCarryBindService wmsCarryBindService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -80,7 +86,8 @@ namespace Tnb.WarehouseMgr
|
||||
_billRullService = billRullService;
|
||||
_wmsCarryBindService = wmsCarryBindService;
|
||||
_wmsCarryUnbindService = wmsCarryUnbindService;
|
||||
|
||||
_organizeService = organizeService;
|
||||
_wmsCarryQueryService = wmsCarryQueryService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
@@ -609,6 +616,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
await sign(input);
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch(Exception ex)
|
||||
@@ -1139,5 +1147,103 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 长管签收
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
private async Task sign(WareHouseUpInput input)
|
||||
{
|
||||
JNPF.Logging.Log.Information($"物料呼叫完成回更参数:{JsonConvert.SerializeObject(input)}");
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(input.requireId))
|
||||
{
|
||||
throw Oops.Bah("来源id为空");
|
||||
}
|
||||
|
||||
PrdMoTask moTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.requireId);
|
||||
if (moTask == null)
|
||||
{
|
||||
throw Oops.Bah($"未找到来源id为{input.requireId}的生产任务单");
|
||||
}
|
||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
|
||||
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
|
||||
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
|
||||
string orgId = WmsWareHouseConst.AdministratorOrgId;
|
||||
string userId = moTask.worker_id;
|
||||
foreach(string carryId in input.carryIds)
|
||||
{
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
|
||||
|
||||
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||
{
|
||||
code = code,
|
||||
station_id = moTask.workstation_id,
|
||||
mo_task_id = moTask.id,
|
||||
process_id = moTask.process_id,
|
||||
equip_id = moTask.eqp_id,
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
carry_id = carry.id,
|
||||
workline_id = moTask.workline_id,
|
||||
carry_code = carry.carry_code,
|
||||
mbom_process_id = moTask.mbom_process_id,
|
||||
create_id = userId,
|
||||
create_time = DateTime.Now,
|
||||
org_id = orgId
|
||||
};
|
||||
insertHList.Add(prdMaterialReceiptH);
|
||||
|
||||
CarryQueryOutput carryQueryOutput = await _wmsCarryQueryService.MESCarryQueryResult(new MESCarryQueryResultInput(){carry_code = carry.carry_code});
|
||||
if (carryQueryOutput.wmsCarryCodes != null && carryQueryOutput.wmsCarryCodes.Count > 0)
|
||||
{
|
||||
JNPF.Logging.Log.Information($"签收载具信息{JsonConvert.SerializeObject(carryQueryOutput)}");
|
||||
foreach (var item in carryQueryOutput.wmsCarryCodes)
|
||||
{
|
||||
|
||||
insertDList.Add(new PrdMaterialReceiptD
|
||||
{
|
||||
material_receipt_id = prdMaterialReceiptH.id,
|
||||
material_id = item.material_id,
|
||||
num = item.codeqty,
|
||||
batch = item.code_batch,
|
||||
unit_id = item.unit_id,
|
||||
carry_id = carry.id,
|
||||
barcode = item.barcode,
|
||||
is_all_feeding = 0,
|
||||
member_carry_id = item.member_carryid,
|
||||
member_carry_code = item.member_carrycode,
|
||||
feeding_num = 0,
|
||||
supplier_id = item.supplier_id,
|
||||
instock_time = item.instock_time,
|
||||
check_conclusion = item.check_conclusion,
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("未找到物料明细");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (insertHList.Count <= 0 || insertDList.Count <= 0)
|
||||
{
|
||||
throw Oops.Bah(ErrorCode.COM1000);
|
||||
}
|
||||
|
||||
int row1 = await _db.Insertable(insertHList).ExecuteCommandAsync();
|
||||
int row2 = await _db.Insertable(insertDList).ExecuteCommandAsync();
|
||||
if (row1 <= 0 || row2 <= 0)
|
||||
{
|
||||
throw Oops.Bah(ErrorCode.COM1000);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user