生产报告回写id 产成品入库修改
This commit is contained in:
9
BasicData/Tnb.BasicData.Entities/Dto/ErpReportDto.cs
Normal file
9
BasicData/Tnb.BasicData.Entities/Dto/ErpReportDto.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Tnb.BasicData.Entities.Dto
|
||||||
|
{
|
||||||
|
public class ErpReportDto
|
||||||
|
{
|
||||||
|
public string pk_wr { get; set; }
|
||||||
|
public string pk_wr_product { get; set; }
|
||||||
|
public string report_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ using SqlSugar;
|
|||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.BasicData.Entities.Dto;
|
using Tnb.BasicData.Entities.Dto;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
|
||||||
namespace Tnb.BasicData
|
namespace Tnb.BasicData
|
||||||
{
|
{
|
||||||
@@ -154,6 +155,45 @@ namespace Tnb.BasicData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thirdResult.Code == 200 && record.third_name == "BIP" && record.name == "生产报告")
|
||||||
|
{
|
||||||
|
Dictionary<string,object> requestData = JsonConvert.DeserializeObject<Dictionary<string,object>>(record.request_data);
|
||||||
|
|
||||||
|
string reportId = requestData.ContainsKey("report_id") ? requestData["report_id"].ToString() : "";
|
||||||
|
if (string.IsNullOrEmpty(reportId))
|
||||||
|
{
|
||||||
|
Log.Error($"请求记录id{record.id}生产报告提报id为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
JObject data = (JObject)thirdResult.msg;
|
||||||
|
JToken children = data.SelectToken("children")[0];
|
||||||
|
var responsetDtos = children.Select(x => new ErpReportDto()
|
||||||
|
{
|
||||||
|
pk_wr_product = x["valueIndex"]["pk_wr_product"].ToString(),
|
||||||
|
pk_wr = x["valueIndex"]["pk_wr"].ToString(),
|
||||||
|
report_id = reportId
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
int updateRow = 0;
|
||||||
|
foreach (var item in responsetDtos)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(item.pk_wr) && !string.IsNullOrEmpty(item.pk_wr_product))
|
||||||
|
{
|
||||||
|
updateRow += await db.Updateable<PrdReport>()
|
||||||
|
.SetColumns(x => x.erp_pk_wr == item.pk_wr)
|
||||||
|
.SetColumns(x => x.erp_pk_wr_product == item.pk_wr_product)
|
||||||
|
.Where(x => x.id == item.report_id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (updateRow <= 0)
|
||||||
|
{
|
||||||
|
Log.Error($"请求记录{record.id}更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await db.Ado.CommitTranAsync();
|
await db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||||
|
<ProjectReference Include="..\..\ProductionMgr\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||||
<ProjectReference Include="..\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
<ProjectReference Include="..\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
||||||
|
|||||||
@@ -160,4 +160,13 @@ public partial class PrdReport : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string check_result { get; set; }
|
public string check_result { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表头主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_pk_wr { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 表体主键
|
||||||
|
/// </summary>
|
||||||
|
public string erp_pk_wr_product { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2481,6 +2481,7 @@ namespace Tnb.ProductionMgr
|
|||||||
erpRequestData.Add("vtrantypeid","0001A11000000002LVX8");
|
erpRequestData.Add("vtrantypeid","0001A11000000002LVX8");
|
||||||
erpRequestData.Add("vdef1",null);
|
erpRequestData.Add("vdef1",null);
|
||||||
erpRequestData.Add("vdef2",null);
|
erpRequestData.Add("vdef2",null);
|
||||||
|
erpRequestData.Add("report_id",report.id);
|
||||||
|
|
||||||
|
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
|||||||
@@ -823,6 +823,45 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (thirdResult.Code == 200 && record.third_name == "BIP" && record.name == "生产报告")
|
||||||
|
{
|
||||||
|
Dictionary<string,object> requestData = JsonConvert.DeserializeObject<Dictionary<string,object>>(record.request_data);
|
||||||
|
|
||||||
|
string reportId = requestData.ContainsKey("report_id") ? requestData["report_id"].ToString() : "";
|
||||||
|
if (string.IsNullOrEmpty(reportId))
|
||||||
|
{
|
||||||
|
Log.Error($"请求记录id{record.id}生产报告提报id为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
JObject data = (JObject)thirdResult.msg;
|
||||||
|
JToken children = data.SelectToken("children")[0];
|
||||||
|
var responsetDtos = children.Select(x => new ErpReportDto()
|
||||||
|
{
|
||||||
|
pk_wr_product = x["valueIndex"]["pk_wr_product"].ToString(),
|
||||||
|
pk_wr = x["valueIndex"]["pk_wr"].ToString(),
|
||||||
|
report_id = reportId
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
int updateRow = 0;
|
||||||
|
foreach (var item in responsetDtos)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(item.pk_wr) && !string.IsNullOrEmpty(item.pk_wr_product))
|
||||||
|
{
|
||||||
|
updateRow += await _db.Updateable<PrdReport>()
|
||||||
|
.SetColumns(x => x.erp_pk_wr == item.pk_wr)
|
||||||
|
.SetColumns(x => x.erp_pk_wr_product == item.pk_wr_product)
|
||||||
|
.Where(x => x.id == item.report_id)
|
||||||
|
.ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (updateRow <= 0)
|
||||||
|
{
|
||||||
|
Log.Error($"请求记录{record.id}更新失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("cdptvid","0001A11000000007GGO8");//部门先写死
|
erpRequestData.Add("cdptvid","0001A11000000007GGO8");//部门先写死
|
||||||
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
erpRequestData.Add("corpoid", erpOrg.corpoid);
|
||||||
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
erpRequestData.Add("corpvid", erpOrg.corpvid);
|
||||||
erpRequestData.Add("cotherwhid", wmsErpWarehouserelaHs.Find(x=>x.wms_warehousecode==wmsRawmatTransferoutstockD.warehouse_instock_code)?.erp_warehouseid ?? "");
|
erpRequestData.Add("cotherwhid", wmsRawmatTransferoutstockD.warehouse_instock_code);
|
||||||
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.erp_warehousecode==wmsRawmatTransferoutstockD.erp_wh_type)?.erp_warehouseid ?? "");
|
erpRequestData.Add("cwarehouseid", wmsErpWarehouserelaHs.Find(x=>x.erp_warehousecode==wmsRawmatTransferoutstockD.erp_wh_type)?.erp_warehouseid ?? "");
|
||||||
erpRequestData.Add("creationtime", nowStr);
|
erpRequestData.Add("creationtime", nowStr);
|
||||||
erpRequestData.Add("creator", erpCreateId);
|
erpRequestData.Add("creator", erpCreateId);
|
||||||
@@ -297,7 +297,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
["cbodytranstypecode"] = "4Y-01",
|
["cbodytranstypecode"] = "4Y-01",
|
||||||
["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.wms_warehousecode==wmsRawmatTransferoutstockD.warehouse_instock_code)?.erp_warehouseid ?? "",
|
["cbodywarehouseid"] = wmsRawmatTransferoutstockD.warehouse_instock_code,
|
||||||
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
|
["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "",
|
||||||
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
|
["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "",
|
||||||
["corpoid"] = erpOrg.corpoid,
|
["corpoid"] = erpOrg.corpoid,
|
||||||
|
|||||||
@@ -349,7 +349,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
WmsPrdInstockH instock = await _db.Queryable<WmsPrdInstockH>().SingleAsync(x=>x.id==wmsPrdInstockD.prd_instock_id);
|
WmsPrdInstockH instock = await _db.Queryable<WmsPrdInstockH>().SingleAsync(x=>x.id==wmsPrdInstockD.prd_instock_id);
|
||||||
BasWarehouse scWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.scwarehouse_id);
|
BasWarehouse scWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.scwarehouse_id);
|
||||||
BasWarehouse kcWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.warehouse_id);
|
BasWarehouse kcWarehouse = await _db.Queryable<BasWarehouse>().SingleAsync(x=>x.id==wmsPrdInstockD.warehouse_id);
|
||||||
//todo 产成品入库
|
PrdReport prdReport = await _db.Queryable<PrdReport>().SingleAsync(x => x.id == instock.prd_report_id);
|
||||||
|
|
||||||
List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instock_id == instock.id).ToListAsync();
|
List<WmsPrdInstockCode> allInstockDetails = await _db.Queryable<WmsPrdInstockCode>().Where(it => it.prd_instock_id == instock.id).ToListAsync();
|
||||||
|
|
||||||
List<String> materialIds = Arrays.AsList(instock.material_id);
|
List<String> materialIds = Arrays.AsList(instock.material_id);
|
||||||
@@ -397,7 +398,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
erpRequestData.Add("pk_group", erpOrg.pk_group);
|
||||||
erpRequestData.Add("vbillcode", instock.bill_code);
|
erpRequestData.Add("vbillcode", instock.bill_code);
|
||||||
erpRequestData.Add("vtrantypecode", "46-01");
|
erpRequestData.Add("vtrantypecode", "46-01");
|
||||||
erpRequestData.Add("csourcebillhid", "");//todo 后面填
|
erpRequestData.Add("csourcebillhid", prdReport?.erp_pk_wr ?? "");//todo 后面填
|
||||||
|
|
||||||
|
|
||||||
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
@@ -414,8 +415,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
["cproductid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
|
["cproductid"] = erpExtendFields.Find(x => x.table_id == instock.material_id)?.cmaterialoid ?? "",
|
||||||
["fproductclass"] = 1,
|
["fproductclass"] = 1,
|
||||||
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
|
["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10,
|
||||||
["csourcebillhid"] = "",
|
["csourcebillhid"] = prdReport?.erp_pk_wr ?? "",
|
||||||
["csourcebillbid"] = "",
|
["csourcebillbid"] = prdReport?.erp_pk_wr_product ?? "",
|
||||||
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "",
|
||||||
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "",
|
||||||
|
|||||||
Reference in New Issue
Block a user