mes物料签收后调用wms载具签收接口
This commit is contained in:
@@ -3,7 +3,7 @@ using Tnb.ProductionMgr.Entities.Dto;
|
|||||||
namespace Tnb.ProductionMgr.Interfaces
|
namespace Tnb.ProductionMgr.Interfaces
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料签收服务接口
|
/// 物料投料服务接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPrdFeedingService
|
public interface IPrdFeedingService
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using Tnb.BasicData;
|
|||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 业务实现:物料签收
|
/// 业务实现:物料投料
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
@@ -159,7 +159,7 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
return result.IsSuccess ? "投料成功" : result.ErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@@ -272,34 +272,34 @@ namespace Tnb.ProductionMgr
|
|||||||
// carry_code = input.carry_code ?? "",
|
// carry_code = input.carry_code ?? "",
|
||||||
// });
|
// });
|
||||||
|
|
||||||
var mesCarrySignInput = new MESCarrySignInput()
|
// 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;
|
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
// Dictionary<string, object> header = new Dictionary<string, object>()
|
||||||
{
|
// {
|
||||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
};
|
// };
|
||||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
// var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||||
Log.Information(sendResult);
|
// Log.Information(sendResult);
|
||||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
// AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
if (authResponse.code != 200)
|
// if (authResponse.code != 200)
|
||||||
{
|
// {
|
||||||
throw Oops.Bah(authResponse.msg);
|
// throw Oops.Bah(authResponse.msg);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
result2 = await db.Ado.UseTranAsync(async () =>
|
// result2 = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
// {
|
||||||
await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
// await db.Insertable<PrdFeedingH>(prdFeedingH).ExecuteCommandAsync();
|
||||||
await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
// await db.Insertable<PrdFeedingD>(list).ExecuteCommandAsync();
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage);
|
if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage);
|
||||||
|
|||||||
@@ -1,11 +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.Models;
|
||||||
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Logging;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
@@ -14,6 +19,13 @@ using Tnb.ProductionMgr.Interfaces;
|
|||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.ProductionMgr.Entities.Consts;
|
using Tnb.ProductionMgr.Entities.Consts;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities.Dto;
|
||||||
|
using Tnb.ProductionMgr.Interfaces;
|
||||||
|
using Tnb.ProductionMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -71,6 +83,9 @@ namespace Tnb.ProductionMgr
|
|||||||
public async Task<dynamic> SaveData(MaterialReceiptInput input)
|
public async Task<dynamic> SaveData(MaterialReceiptInput input)
|
||||||
{
|
{
|
||||||
var db = _repository.AsSugarClient();
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result2 = new DbResult<bool>();
|
||||||
|
PrdMaterialReceiptH prdMaterialReceiptH = null;
|
||||||
|
List<PrdMaterialReceiptD> list = new List<PrdMaterialReceiptD>();
|
||||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
var moTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == input.mo_task_id);
|
var moTask = await db.Queryable<PrdMoTask>().FirstAsync(x => x.id == input.mo_task_id);
|
||||||
@@ -80,7 +95,7 @@ namespace Tnb.ProductionMgr
|
|||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
|
||||||
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
|
prdMaterialReceiptH = new PrdMaterialReceiptH()
|
||||||
{
|
{
|
||||||
code = code,
|
code = code,
|
||||||
station_id = input.station_id,
|
station_id = input.station_id,
|
||||||
@@ -125,13 +140,54 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
// await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
||||||
await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
// await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
|
||||||
return result.IsSuccess ? "签收成功" : result.ErrorMessage;
|
if (result.IsSuccess)
|
||||||
|
{
|
||||||
|
//签收后调用载具签收接口
|
||||||
|
// 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,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
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);
|
||||||
|
Log.Information(sendResult);
|
||||||
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
|
if (authResponse.code != 200)
|
||||||
|
{
|
||||||
|
throw Oops.Bah(authResponse.msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result2 = await db.Ado.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
await db.Insertable<PrdMaterialReceiptH>(prdMaterialReceiptH).ExecuteCommandAsync();
|
||||||
|
await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage);
|
||||||
|
return result2.IsSuccess ? "签收成功" : result2.ErrorMessage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user