短管挤出入库申请
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
@@ -28,5 +29,12 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> InstockTypeOne(InstockInput inut);
|
||||
|
||||
/// <summary>
|
||||
/// 短管挤出入库申请
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> InstockTubeOne(PrdReport prdReport);
|
||||
}
|
||||
}
|
||||
@@ -389,5 +389,115 @@ namespace Tnb.ProductionMgr
|
||||
if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result2.IsSuccess ? "申请成功" : result2.ErrorMessage;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> InstockTubeOne(PrdReport prdReport)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
string location_code = "JMXHC-01";
|
||||
string warehouse_id = "26103348825381";
|
||||
|
||||
PrdInstockH prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
DbResult<bool> result2 = new DbResult<bool>();
|
||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x=>x.id==prdReport.material_id);
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
|
||||
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
bill_date = DateTime.Now,
|
||||
create_id = _userManager.UserId,
|
||||
location_code = location_code,
|
||||
carry_code = prdReport.material_box_code,
|
||||
is_check = 1,
|
||||
station_id = prdReport.station,
|
||||
workline_id = workline?.Id ?? "",
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
warehouse_id = warehouse_id,
|
||||
status = 0,
|
||||
};
|
||||
|
||||
prdInstockDs.Add(new PrdInstockD()
|
||||
{
|
||||
instock_id = prdInstockH.id,
|
||||
report_id = prdReport.create_id,
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
quantity = (int)prdReport.reported_qty,
|
||||
});
|
||||
});
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||
mesCreateInstockInput.instock = new MESWmsInstockHInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
warehouse_id = warehouse_id,
|
||||
source_id = prdInstockH.id,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = prdReport.material_box_code,
|
||||
location_code = location_code,
|
||||
is_check = 1,
|
||||
};
|
||||
mesCreateInstockInput.instockds = new List<MESWmsInstockDInput>();
|
||||
mesCreateInstockInput.instockcodes = new List<MESWmsInstockCodeInput>();
|
||||
mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
code_batch = prdReport.barcode,
|
||||
pr_qty = (int)prdReport.reported_qty,
|
||||
});
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = prdReport.material_id,
|
||||
material_code = basMaterial.code,
|
||||
unit_id = prdReport.unit_id,
|
||||
barcode = prdReport.barcode,
|
||||
code_batch = prdReport.barcode+"0001",
|
||||
codeqty = (int)prdReport.reported_qty,
|
||||
});
|
||||
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);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200 || !authResponse.data.ObjToBool())
|
||||
{
|
||||
throw Oops.Bah(authResponse.msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
result2 = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return result2.IsSuccess ? "true" : "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ namespace Tnb.ProductionMgr
|
||||
private static Dictionary<string, object> _dicProcess = new Dictionary<string, object>();
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly IQcCheckPlanService _qcCheckPlanService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
@@ -79,6 +80,7 @@ namespace Tnb.ProductionMgr
|
||||
IDictionaryDataService dictionaryDataService,
|
||||
IRunService runService,
|
||||
IBillRullService billRullService,
|
||||
IPrdInstockService prdInstockService,
|
||||
IVisualDevService visualDevService,
|
||||
IQcCheckPlanService qcCheckPlanService
|
||||
)
|
||||
@@ -92,6 +94,7 @@ namespace Tnb.ProductionMgr
|
||||
OverideFuncs.DeleteAsync = Delete;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
_billRuleService = billRullService;
|
||||
_prdInstockService = prdInstockService;
|
||||
_qcCheckPlanService=qcCheckPlanService;
|
||||
}
|
||||
|
||||
@@ -1442,12 +1445,12 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> PrdReport(PrdReportCrInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
var equip = await db.Queryable<EqpEquipment>().SingleAsync(x=>x.id==prdMoTask.eqp_id);
|
||||
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var row = -1;
|
||||
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
|
||||
var equip = await db.Queryable<EqpEquipment>().SingleAsync(x=>x.id==prdMoTask.eqp_id);
|
||||
var prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
|
||||
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
|
||||
|
||||
@@ -1725,13 +1728,20 @@ namespace Tnb.ProductionMgr
|
||||
// }
|
||||
// }
|
||||
|
||||
if (equip.tube == "1")
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
if (equip.tube == "1")
|
||||
{
|
||||
string resultMsg = await _prdInstockService.InstockTubeOne(report);
|
||||
if (resultMsg == "true") return true;
|
||||
throw Oops.Bah(resultMsg);
|
||||
}
|
||||
}
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||
return result.IsSuccess;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user