1
This commit is contained in:
@@ -155,5 +155,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// 物料分类ID
|
||||
/// </summary>
|
||||
public string category_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 入库仓库id
|
||||
/// </summary>
|
||||
public string warehouse_id { get; set; }
|
||||
|
||||
public string warehouse_code { get; set; }
|
||||
|
||||
public string warehouse_name { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -129,5 +129,10 @@ public partial class PrdReport : BaseEntity<string>
|
||||
/// 料箱编号
|
||||
/// </summary>
|
||||
public string material_box_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 长管挤出入库库位
|
||||
/// </summary>
|
||||
public string location_code { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -36,5 +36,12 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> InstockTubeOne(PrdReport prdReport);
|
||||
|
||||
/// <summary>
|
||||
/// 长管管挤出入库申请
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<string> InstockTubeThree(PrdReport prdReport);
|
||||
}
|
||||
}
|
||||
@@ -263,6 +263,7 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
string equip_code = inut.equip_code;
|
||||
string as_location_code = inut.as_location_code;
|
||||
string warehouse_id = "2";
|
||||
if (!string.IsNullOrEmpty(equip_code))
|
||||
{
|
||||
throw Oops.Bah("请传机台号");
|
||||
@@ -315,7 +316,8 @@ namespace Tnb.ProductionMgr
|
||||
workline_id = workline?.Id ?? "",
|
||||
workshop_id = workshop?.Id ?? "",
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
warehouse_id = basLocation?.wh_id,
|
||||
// warehouse_id = basLocation?.wh_id,
|
||||
warehouse_id = warehouse_id,
|
||||
status = 0,
|
||||
};
|
||||
|
||||
@@ -341,7 +343,8 @@ namespace Tnb.ProductionMgr
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||
warehouse_id = basLocation?.wh_id,
|
||||
// warehouse_id = basLocation?.wh_id,
|
||||
warehouse_id = warehouse_id,
|
||||
source_id = prdInstockH.id,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = prdReport.material_box_code,
|
||||
@@ -397,8 +400,118 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<string> InstockTubeOne(PrdReport prdReport)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
string location_code = "JMXHC-01";
|
||||
string warehouse_id = "26103348825381";
|
||||
string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
|
||||
string warehouse_id = "2";
|
||||
|
||||
PrdInstockH? prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new() { };
|
||||
DbResult<bool> result2 = new();
|
||||
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()
|
||||
{
|
||||
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,
|
||||
},
|
||||
instockds = new List<MESWmsInstockDInput>(),
|
||||
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()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||
Log.Information(sendResult);
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
|
||||
? throw Oops.Bah(authResponse.msg)
|
||||
: await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
_ = await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
_ = await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return result2.IsSuccess ? "true" : "false";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 长管管挤出入库申请
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> InstockTubeThree(PrdReport prdReport)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
string location_code = prdReport.location_code;
|
||||
string warehouse_id = "27209786980373";//长件挤出缓存仓
|
||||
|
||||
PrdInstockH? prdInstockH = null;
|
||||
List<PrdInstockD> prdInstockDs = new() { };
|
||||
|
||||
@@ -360,6 +360,11 @@ namespace Tnb.ProductionMgr
|
||||
_ = await db.Insertable<PrdMaterialReceiptD>(list).ExecuteCommandAsync();
|
||||
});
|
||||
}
|
||||
|
||||
if (result.ErrorMessage == "存在不属于生产bom的投入物料,确认签收吗")
|
||||
{
|
||||
return "存在不属于生产bom的投入物料,确认签收吗";
|
||||
}
|
||||
return !result.IsSuccess
|
||||
? throw Oops.Bah(result.ErrorMessage)
|
||||
: !result2.IsSuccess ? throw Oops.Bah(result2.ErrorMessage) : (dynamic)"签收成功";
|
||||
|
||||
@@ -1723,6 +1723,12 @@ namespace Tnb.ProductionMgr
|
||||
string resultMsg = await _prdInstockService.InstockTubeOne(report);
|
||||
return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
|
||||
}
|
||||
|
||||
if (arr.Length > 0 && arr.Contains("CGJCJ"))//短管挤出件入库申请
|
||||
{
|
||||
string resultMsg = await _prdInstockService.InstockTubeThree(report);
|
||||
return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Tnb.ProductionMgr
|
||||
try
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
string warehouse_id = "26103348825381";//二楼缓存仓
|
||||
string warehouse_id = "27209786980373";//长件挤出缓存仓
|
||||
|
||||
MESCreateOutstockInput input = new MESCreateOutstockInput();
|
||||
input.outstock = new MESWmsOutstockHInput();
|
||||
|
||||
Reference in New Issue
Block a user