Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||||
|
var mCarryIds = carryDs.Select(x=>x.membercarry_id).ToList();
|
||||||
|
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => mCarryIds.Contains(it.carry_id)).ToListAsync();
|
||||||
data = carry.Adapt<CarryQueryOutput>();
|
data = carry.Adapt<CarryQueryOutput>();
|
||||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Ado.BeginTranAsync();
|
await _db.Ado.BeginTranAsync();
|
||||||
List<WmsKittingoutD> kittingOutDs = new();
|
List<WmsKittingoutD> kittingOutDs = new();
|
||||||
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
||||||
|
var ids = input.Select(x => x.location_code).ToArray();
|
||||||
|
|
||||||
for (int i = 0; i < kittingOuts.Count; i++)
|
for (int i = 0; i < kittingOuts.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -370,6 +371,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
x.bill_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
x.bill_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||||
x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||||
x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID;
|
||||||
|
x.location_id = ids[i];
|
||||||
var d = input[i]?.wmsKittingoutDs?.Adapt<List<WmsKittingoutD>>();
|
var d = input[i]?.wmsKittingoutDs?.Adapt<List<WmsKittingoutD>>();
|
||||||
d?.ForEach(it =>
|
d?.ForEach(it =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user