1
This commit is contained in:
@@ -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();
|
||||||
@@ -432,6 +433,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);
|
||||||
@@ -441,14 +445,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 +465,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 +476,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 +504,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 +547,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 +559,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 +579,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 +590,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 +608,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 +618,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 +715,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 +738,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 +761,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 +773,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 +795,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 +805,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 +814,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 () =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user