Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -88,5 +88,10 @@ public partial class EqpDaq : BaseEntity<string>
|
|||||||
/// 流程引擎Id
|
/// 流程引擎Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? f_flowid { get; set; }
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库位号
|
||||||
|
/// </summary>
|
||||||
|
public string? location_code { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -99,9 +99,14 @@
|
|||||||
public string? station { get; set; }
|
public string? station { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 料箱二维码
|
/// 料箱编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string material_box_qrcode { get; set; }
|
public string material_box_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库库位
|
||||||
|
/// </summary>
|
||||||
|
public string location_code { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public partial class PrdReport : BaseEntity<string>
|
|||||||
public string material_box_code { get; set; }
|
public string material_box_code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 长管挤出入库库位
|
/// 入库库位
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string location_code { get; set; }
|
public string location_code { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,20 @@ namespace Tnb.ProductionMgr.Interfaces
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<dynamic> InstockTypeOne(InstockInput input);
|
public Task<dynamic> InstockTypeOne(InstockInput input);
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// 短管挤出入库申请
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="input"></param>
|
||||||
|
// /// <returns></returns>
|
||||||
|
// public Task<string> InstockTubeOne(PrdReport prdReport);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 短管挤出入库申请
|
/// 短管挤出入库申请
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Task<string> InstockTubeOne(PrdReport prdReport);
|
public Task<string> InstockTubeOne(InstockInput input);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 长管管挤出入库申请
|
/// 长管管挤出入库申请
|
||||||
|
|||||||
@@ -317,6 +317,7 @@ namespace Tnb.ProductionMgr
|
|||||||
throw Oops.Bah("未找到提报记录");
|
throw Oops.Bah("未找到提报记录");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrdInstockH? prdInstockH = null;
|
PrdInstockH? prdInstockH = null;
|
||||||
List<PrdInstockD> prdInstockDs = new() { };
|
List<PrdInstockD> prdInstockDs = new() { };
|
||||||
DbResult<bool> result2 = new();
|
DbResult<bool> result2 = new();
|
||||||
@@ -421,17 +422,176 @@ namespace Tnb.ProductionMgr
|
|||||||
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage);
|
return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [HttpPost]
|
||||||
|
// public async Task<string> InstockTubeOne(PrdReport prdReport)
|
||||||
|
// {
|
||||||
|
// ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
|
// 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);
|
||||||
|
// string create_id = prdReport.create_id;
|
||||||
|
// UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
|
||||||
|
// string org_id = user.OrganizeId;
|
||||||
|
// 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 = create_id,
|
||||||
|
// 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 = org_id,
|
||||||
|
// 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.mo_task_code,
|
||||||
|
// quantity = (int)prdReport.reported_qty,
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// if (result.IsSuccess)
|
||||||
|
// {
|
||||||
|
// MESCreateInstockInput mesCreateInstockInput = new()
|
||||||
|
// {
|
||||||
|
// instock = new MESWmsInstockHInput()
|
||||||
|
// {
|
||||||
|
// org_id = org_id,
|
||||||
|
// bill_date = DateTime.Now,
|
||||||
|
// bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
|
// warehouse_id = warehouse_id,
|
||||||
|
// source_id = prdInstockH.id,
|
||||||
|
// create_id = create_id,
|
||||||
|
// 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.mo_task_code,
|
||||||
|
// codeqty = (int)prdReport.reported_qty,
|
||||||
|
// });
|
||||||
|
// // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
|
// string domain = "http://tnb.tuotong-tech.com";
|
||||||
|
// 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 || !(bool)authResponse.data
|
||||||
|
// ? 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";
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<string> InstockTubeOne(PrdReport prdReport)
|
public async Task<string> InstockTubeOne(InstockInput input)
|
||||||
{
|
{
|
||||||
|
string equip_code = input.equip_code;
|
||||||
|
string label_code = input.label_code;
|
||||||
|
if (string.IsNullOrEmpty(equip_code))
|
||||||
|
{
|
||||||
|
throw Oops.Bah("请传机台号");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(label_code))
|
||||||
|
{
|
||||||
|
throw Oops.Bah("请传标签号");
|
||||||
|
}
|
||||||
|
|
||||||
ISqlSugarClient db = _repository.AsSugarClient();
|
ISqlSugarClient db = _repository.AsSugarClient();
|
||||||
string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
|
// string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
|
||||||
string warehouse_id = "2";
|
string warehouse_id = "2";
|
||||||
|
|
||||||
PrdInstockH? prdInstockH = null;
|
PrdInstockH? prdInstockH = null;
|
||||||
List<PrdInstockD> prdInstockDs = new() { };
|
List<PrdInstockD> prdInstockDs = new() { };
|
||||||
DbResult<bool> result2 = new();
|
DbResult<bool> result2 = new();
|
||||||
|
EqpEquipment equipment = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
equipment = await db.Queryable<EqpEquipment>()
|
||||||
|
.LeftJoin<EqpDaq>((x,y)=>x.id==y.equip_id)
|
||||||
|
.Where((x,y) => y.equip_code==equip_code && y.label_name==label_code && y.label_point=="提报装箱称重点位")
|
||||||
|
.Select((x,y)=>x)
|
||||||
|
.FirstAsync();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
if (equipment == null)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("未找到机台");
|
||||||
|
}
|
||||||
|
|
||||||
|
EqpDaq daq = await db.Queryable<EqpDaq>().Where(x =>
|
||||||
|
x.equip_id == equipment.id && x.label_name == label_code && x.label_point == "提报装箱称重点位").FirstAsync();
|
||||||
|
|
||||||
|
if (daq == null)
|
||||||
|
{
|
||||||
|
throw Oops.Bah("未找到数采信号");
|
||||||
|
}
|
||||||
|
|
||||||
|
string location_code = daq.location_code;
|
||||||
|
|
||||||
|
PrdReport prdReport = await db.Queryable<PrdReport>()
|
||||||
|
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
||||||
|
string create_id = prdReport.create_id;
|
||||||
|
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
|
||||||
|
string org_id = user.OrganizeId;
|
||||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||||
@@ -441,14 +601,14 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
location_code = location_code,
|
location_code = location_code,
|
||||||
carry_code = prdReport.material_box_code,
|
carry_code = prdReport.material_box_code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
station_id = prdReport.station,
|
station_id = prdReport.station,
|
||||||
workline_id = workline?.Id ?? "",
|
workline_id = workline?.Id ?? "",
|
||||||
workshop_id = workshop?.Id ?? "",
|
workshop_id = workshop?.Id ?? "",
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
status = 0,
|
status = 0,
|
||||||
};
|
};
|
||||||
@@ -461,7 +621,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
quantity = (int)prdReport.reported_qty,
|
quantity = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -472,12 +632,12 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
instock = new MESWmsInstockHInput()
|
instock = new MESWmsInstockHInput()
|
||||||
{
|
{
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
source_id = prdInstockH.id,
|
source_id = prdInstockH.id,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
carry_code = prdReport.material_box_code,
|
carry_code = prdReport.material_box_code,
|
||||||
location_code = location_code,
|
location_code = location_code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
@@ -500,19 +660,19 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
codeqty = (int)prdReport.reported_qty,
|
codeqty = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
string domain = "http://tnb.tuotong-tech.com";
|
string domain = "http://tnb.tuotong-tech.com";
|
||||||
Dictionary<string, object> header = new()
|
Dictionary<string, object> header = new()
|
||||||
{
|
{
|
||||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
};
|
};
|
||||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||||
Log.Information(sendResult);
|
Log.Information(sendResult);
|
||||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
|
result2 = authResponse.code != 200 || !(bool)authResponse.data
|
||||||
? throw Oops.Bah(authResponse.msg)
|
? throw Oops.Bah(authResponse.msg)
|
||||||
: await db.Ado.UseTranAsync(async () =>
|
: await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
@@ -543,6 +703,9 @@ namespace Tnb.ProductionMgr
|
|||||||
List<PrdInstockD> prdInstockDs = new() { };
|
List<PrdInstockD> prdInstockDs = new() { };
|
||||||
DbResult<bool> result2 = new();
|
DbResult<bool> result2 = new();
|
||||||
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
|
||||||
|
string create_id = prdReport.create_id;
|
||||||
|
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
|
||||||
|
string org_id = user.OrganizeId;
|
||||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
|
||||||
@@ -552,14 +715,14 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
location_code = location_code,
|
location_code = location_code,
|
||||||
carry_code = prdReport.material_box_code,
|
carry_code = prdReport.material_box_code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
station_id = prdReport.station,
|
station_id = prdReport.station,
|
||||||
workline_id = workline?.Id ?? "",
|
workline_id = workline?.Id ?? "",
|
||||||
workshop_id = workshop?.Id ?? "",
|
workshop_id = workshop?.Id ?? "",
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
status = 0,
|
status = 0,
|
||||||
};
|
};
|
||||||
@@ -572,7 +735,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
quantity = (int)prdReport.reported_qty,
|
quantity = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -583,12 +746,12 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
instock = new MESWmsInstockHInput()
|
instock = new MESWmsInstockHInput()
|
||||||
{
|
{
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
source_id = prdInstockH.id,
|
source_id = prdInstockH.id,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
carry_code = prdReport.material_box_code,
|
carry_code = prdReport.material_box_code,
|
||||||
location_code = location_code,
|
location_code = location_code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
@@ -601,7 +764,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_id = prdReport.material_id,
|
material_id = prdReport.material_id,
|
||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
code_batch = prdReport.barcode,
|
code_batch = prdReport.mo_task_code,
|
||||||
pr_qty = (int)prdReport.reported_qty,
|
pr_qty = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -611,19 +774,19 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
codeqty = (int)prdReport.reported_qty,
|
codeqty = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||||
string domain = "http://tnb.tuotong-tech.com";
|
string domain = "http://tnb.tuotong-tech.com";
|
||||||
Dictionary<string, object> header = new()
|
Dictionary<string, object> header = new()
|
||||||
{
|
{
|
||||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
};
|
};
|
||||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||||
Log.Information(sendResult);
|
Log.Information(sendResult);
|
||||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
|
result2 = authResponse.code != 200 || !(bool)authResponse.data
|
||||||
? throw Oops.Bah(authResponse.msg)
|
? throw Oops.Bah(authResponse.msg)
|
||||||
: await db.Ado.UseTranAsync(async () =>
|
: await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
@@ -708,10 +871,14 @@ namespace Tnb.ProductionMgr
|
|||||||
|
|
||||||
List<PrdReport> prdReports = await db.Queryable<PrdReport>().Where(x => reportIds.Contains(x.id)).ToListAsync();
|
List<PrdReport> prdReports = await db.Queryable<PrdReport>().Where(x => reportIds.Contains(x.id)).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
if (prdReports == null || prdReports.Count<=0)
|
if (prdReports == null || prdReports.Count<=0)
|
||||||
{
|
{
|
||||||
throw Oops.Bah("未找到提报记录");
|
throw Oops.Bah("未找到提报记录");
|
||||||
}
|
}
|
||||||
|
string create_id = prdReports[0].create_id;
|
||||||
|
UserEntity user = await db.Queryable<UserEntity>().SingleAsync(x => x.Id == create_id);
|
||||||
|
string org_id = user.OrganizeId;
|
||||||
|
|
||||||
PrdInstockH? prdInstockH = null;
|
PrdInstockH? prdInstockH = null;
|
||||||
List<PrdInstockD> prdInstockDs = new() { };
|
List<PrdInstockD> prdInstockDs = new() { };
|
||||||
@@ -727,14 +894,14 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
location_code = basLocation.location_code,
|
location_code = basLocation.location_code,
|
||||||
carry_code = prdOutPacking.code,
|
carry_code = prdOutPacking.code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
station_id = station.Id,
|
station_id = station.Id,
|
||||||
workline_id = workline?.Id ?? "",
|
workline_id = workline?.Id ?? "",
|
||||||
workshop_id = workshop?.Id ?? "",
|
workshop_id = workshop?.Id ?? "",
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
// warehouse_id = basLocation?.wh_id,
|
// warehouse_id = basLocation?.wh_id,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
status = 0,
|
status = 0,
|
||||||
@@ -750,7 +917,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
quantity = (int)prdReport.reported_qty,
|
quantity = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -762,13 +929,13 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
instock = new MESWmsInstockHInput()
|
instock = new MESWmsInstockHInput()
|
||||||
{
|
{
|
||||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
org_id = org_id,
|
||||||
bill_date = DateTime.Now,
|
bill_date = DateTime.Now,
|
||||||
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
bill_type = DictConst.CHANCHENGPINRUKUDAN,
|
||||||
// warehouse_id = basLocation?.wh_id,
|
// warehouse_id = basLocation?.wh_id,
|
||||||
warehouse_id = warehouse_id,
|
warehouse_id = warehouse_id,
|
||||||
source_id = prdInstockH.id,
|
source_id = prdInstockH.id,
|
||||||
create_id = _userManager.UserId,
|
create_id = create_id,
|
||||||
carry_code = prdOutPacking.code,
|
carry_code = prdOutPacking.code,
|
||||||
location_code = basLocation.location_code,
|
location_code = basLocation.location_code,
|
||||||
is_check = 1,
|
is_check = 1,
|
||||||
@@ -784,7 +951,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_id = prdReport.material_id,
|
material_id = prdReport.material_id,
|
||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
code_batch = prdReport.barcode,
|
code_batch = prdReport.mo_task_code,
|
||||||
pr_qty = (int)prdReport.reported_qty,
|
pr_qty = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -794,7 +961,7 @@ namespace Tnb.ProductionMgr
|
|||||||
material_code = basMaterial.code,
|
material_code = basMaterial.code,
|
||||||
unit_id = prdReport.unit_id,
|
unit_id = prdReport.unit_id,
|
||||||
barcode = prdReport.barcode,
|
barcode = prdReport.barcode,
|
||||||
code_batch = prdReport.barcode + "0001",
|
code_batch = prdReport.mo_task_code,
|
||||||
codeqty = (int)prdReport.reported_qty,
|
codeqty = (int)prdReport.reported_qty,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -803,12 +970,12 @@ namespace Tnb.ProductionMgr
|
|||||||
string domain = "http://tnb.tuotong-tech.com";
|
string domain = "http://tnb.tuotong-tech.com";
|
||||||
Dictionary<string, object> header = new()
|
Dictionary<string, object> header = new()
|
||||||
{
|
{
|
||||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||||
};
|
};
|
||||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
|
||||||
Log.Information(sendResult);
|
Log.Information(sendResult);
|
||||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||||
result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
|
result2 = authResponse.code != 200 || !(bool)authResponse.data
|
||||||
? throw Oops.Bah(authResponse.msg)
|
? throw Oops.Bah(authResponse.msg)
|
||||||
: await db.Ado.UseTranAsync(async () =>
|
: await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1500,7 +1500,8 @@ namespace Tnb.ProductionMgr
|
|||||||
report = input.Adapt<PrdReport>();
|
report = input.Adapt<PrdReport>();
|
||||||
report.id = SnowflakeIdHelper.NextId();
|
report.id = SnowflakeIdHelper.NextId();
|
||||||
report.reported_qty = input.reported_qty;
|
report.reported_qty = input.reported_qty;
|
||||||
report.material_box_code = input.material_box_qrcode;
|
report.material_box_code = input.material_box_code;
|
||||||
|
report.location_code = input.location_code;
|
||||||
report.create_id = _userManager.UserId;
|
report.create_id = _userManager.UserId;
|
||||||
report.create_time = DateTime.Now;
|
report.create_time = DateTime.Now;
|
||||||
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
// report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString();
|
||||||
@@ -1730,8 +1731,9 @@ namespace Tnb.ProductionMgr
|
|||||||
string[] arr = JsonConvert.DeserializeObject<string[]>(basMaterial.category_id);
|
string[] arr = JsonConvert.DeserializeObject<string[]>(basMaterial.category_id);
|
||||||
if (arr.Length > 0 && arr.Contains("DGJCJ"))//短管挤出件入库申请
|
if (arr.Length > 0 && arr.Contains("DGJCJ"))//短管挤出件入库申请
|
||||||
{
|
{
|
||||||
string resultMsg = await _prdInstockService.InstockTubeOne(report);
|
// string resultMsg = await _prdInstockService.InstockTubeOne(report);
|
||||||
return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
|
// return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arr.Length > 0 && arr.Contains("CGJCJ"))//短管挤出件入库申请
|
if (arr.Length > 0 && arr.Contains("CGJCJ"))//短管挤出件入库申请
|
||||||
|
|||||||
Reference in New Issue
Block a user