😎新增pdm插件,BOM对比需要的获取版、本获取BOM接口
This commit is contained in:
parent
a01b71b1ed
commit
29d6d6109b
@ -9,7 +9,8 @@
|
|||||||
{
|
{
|
||||||
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
||||||
"DbType": "SqlServer", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
"DbType": "SqlServer", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
||||||
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
|
//"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
|
||||||
|
"ConnectionString": "Data Source=.;Initial Catalog=VistarStarDataManage;User ID=sa;Password=123456;MultipleActiveResultSets=true",
|
||||||
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // Sqlite 库连接字符串123456
|
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=VistarStarDataManage;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // Sqlite 库连接字符串123456
|
||||||
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 库连接字符串
|
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 库连接字符串
|
||||||
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串",
|
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串",
|
||||||
@ -63,7 +64,8 @@
|
|||||||
{
|
{
|
||||||
"ConfigId": "启威星 1.94.4.74", // 库标识
|
"ConfigId": "启威星 1.94.4.74", // 库标识
|
||||||
"DbType": "SqlServer", // 库类型
|
"DbType": "SqlServer", // 库类型
|
||||||
"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
|
//"ConnectionString": "Data Source=192.168.10.101;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Vistar2024.;MultipleActiveResultSets=true",
|
||||||
|
"ConnectionString": "Data Source=1.94.4.74;Initial Catalog=SWManage_Vistar;User ID=sa;Password=ASDzxc123.;MultipleActiveResultSets=true",
|
||||||
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // 库连接字符串ASDzxc123.
|
//"ConnectionString": "Data Source=192.168.10.74;Initial Catalog=SWManage_Vistar;User ID=sa;Password=Aa123456;MultipleActiveResultSets=true", // 库连接字符串ASDzxc123.
|
||||||
"DbSettings": {
|
"DbSettings": {
|
||||||
"EnableInitDb": false, // 启用库初始化
|
"EnableInitDb": false, // 启用库初始化
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Vistar.Application.Service.StockInquiry.Dto
|
||||||
|
{
|
||||||
|
public class MaterialVersions
|
||||||
|
{
|
||||||
|
public int? Version_index { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Vistar.Application.Service.StockInquiry.Dto
|
||||||
|
{
|
||||||
|
public class PdmMaterialBom
|
||||||
|
{
|
||||||
|
public long OrderIndex { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string PartNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
/// </summary>
|
||||||
|
public float QtyManual { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 代号 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld005747 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 品牌 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld005590 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 材质 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld005587 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表面处理 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld006325 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld005744 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 版本+修订版 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string childVersion { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 库存 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld006928 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预留 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld006929 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 未清采购申请数量 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld006930 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 未清采购订单数量 映射字段
|
||||||
|
/// </summary>
|
||||||
|
public string fld006931 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -20,6 +20,7 @@ using System.ComponentModel;
|
|||||||
using System.Data.OscarClient;
|
using System.Data.OscarClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Vistar.Application.Common;
|
using Vistar.Application.Common;
|
||||||
using Vistar.Application.Const;
|
using Vistar.Application.Const;
|
||||||
@ -27,6 +28,7 @@ using Vistar.Application.Entity;
|
|||||||
using Vistar.Application.SapService.Dto;
|
using Vistar.Application.SapService.Dto;
|
||||||
using Vistar.Application.Service.StockInquiry.Dto;
|
using Vistar.Application.Service.StockInquiry.Dto;
|
||||||
using Vistar.Application.Util;
|
using Vistar.Application.Util;
|
||||||
|
using static SKIT.FlurlHttpClient.Wechat.Api.Models.ComponentTCBBatchCreateContainerServiceVersionRequest.Types;
|
||||||
|
|
||||||
namespace Vistar.Application.Service.StockInquiry;
|
namespace Vistar.Application.Service.StockInquiry;
|
||||||
|
|
||||||
@ -622,7 +624,8 @@ public class StockInquiryService : IDynamicApiController, ITransient
|
|||||||
var Verpr = await _dataValidationService.ProcessNumber(apiOutput.Verpr.ToDecimal());
|
var Verpr = await _dataValidationService.ProcessNumber(apiOutput.Verpr.ToDecimal());
|
||||||
priceValue = Verpr == 0 ? "9999.99" : Verpr.ToString();
|
priceValue = Verpr == 0 ? "9999.99" : Verpr.ToString();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
priceValue = "9999.99";
|
priceValue = "9999.99";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1212,4 +1215,97 @@ public class StockInquiryService : IDynamicApiController, ITransient
|
|||||||
return UpdateableOutput.ToList();
|
return UpdateableOutput.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取物料版本
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="materialCode"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<List<MaterialVersions>> GetPdmMaterialVersions(string materialCode)
|
||||||
|
{
|
||||||
|
var versionsLiat = await _obj137Rep.AsQueryable()
|
||||||
|
.Where(x => x._System_objNBS == materialCode && x.deleted == false && x._system_objConfigurationName == "默认")
|
||||||
|
.Select(x => new MaterialVersions { Version_index = x.VersionIndex, Version = x.revision })
|
||||||
|
.OrderByDescending(x => x.Version_index)
|
||||||
|
.ToListAsync();
|
||||||
|
return versionsLiat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取Bom
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="materialCode"></param>
|
||||||
|
/// <param name="versions"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[ApiDescriptionSettings(Name = "GetPdmMaterialBom", Description = "获取Bom", Order = 1000), HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<List<PdmMaterialBom>> GetPdmMaterialBom(string materialCode, string versions)
|
||||||
|
{
|
||||||
|
int versionsIndex = 0;
|
||||||
|
// 匹配一个或多个数字
|
||||||
|
Match match = Regex.Match(versions, @"\d+");
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
// 提取匹配的数字
|
||||||
|
string matchedNumber = match.Value;
|
||||||
|
versionsIndex = int.Parse(matchedNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
var materialData = await _obj137Rep.AsQueryable()
|
||||||
|
.Where(x => x._System_objNBS == materialCode && x.deleted == false && x.SWPDMConfigurationName == "默认" && x.VersionIndex == versionsIndex)
|
||||||
|
.OrderByDescending(x => x.idRecord)
|
||||||
|
.FirstAsync();
|
||||||
|
|
||||||
|
if (materialData == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var bom137List = await _configurationDataRep.AsQueryable().InnerJoin<Obj137>((x, y) => x.ChildGuid == y.RecordGuid && x.childVersion == y.VersionIndex)
|
||||||
|
.Where(x => x.ParentGuid == materialData.RecordGuid && x.ParentVersion == materialData.VersionIndex && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false)))
|
||||||
|
.Select((x, y) => new PdmMaterialBom
|
||||||
|
{
|
||||||
|
OrderIndex = (long)x.OrderIndex,
|
||||||
|
PartNumber = x.PartNumber,
|
||||||
|
Description = y._System_ObjDescription,
|
||||||
|
QtyManual = (float)x.QtyManual,
|
||||||
|
fld005747 = y._SWPDM_125_SW___,
|
||||||
|
fld005590 = y._SWPDM_65_SW___,
|
||||||
|
fld005587 = y._SWPDM_62_SW___,
|
||||||
|
fld006325 = y._SWPDM_61_SW_____,
|
||||||
|
fld005744 = y._SWPDM_126_SW___,
|
||||||
|
childVersion = y.VersionIndex.ToString()+" "+y.revision,
|
||||||
|
fld006928 = y.fld005623,
|
||||||
|
fld006929 = y.fld006530,
|
||||||
|
fld006930 = y.fld006532,
|
||||||
|
fld006931 = y.fld006531
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var bom112List = await _configurationDataRep.AsQueryable().InnerJoin<Obj112>((x, y) => x.ChildGuid == y.RecordGuid && x.childVersion == y.VersionIndex)
|
||||||
|
.Where(x => x.ParentGuid == materialData.RecordGuid && x.ParentVersion == materialData.VersionIndex && x.isDeleted == false && x.ConfigId == 8 && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false && (!(x.ParentSwFileType == 1 && x.isAddedFromSW == false)))
|
||||||
|
.Select((x, y) => new PdmMaterialBom
|
||||||
|
{
|
||||||
|
OrderIndex = (long)x.OrderIndex,
|
||||||
|
PartNumber = x.PartNumber,
|
||||||
|
Description = y._System_ObjDescription,
|
||||||
|
QtyManual = (float)x.QtyManual,
|
||||||
|
fld005747 = y.fld005323,
|
||||||
|
fld005590 = y.fld004592,
|
||||||
|
fld005587 = y.fld004593,
|
||||||
|
fld006325 = y.fld004903,
|
||||||
|
fld005744 = y.fld004594,
|
||||||
|
childVersion = y.VersionIndex.ToString() + " " + y.revision,
|
||||||
|
fld006928 = y.fld006751,
|
||||||
|
fld006929 = y.fld006750,
|
||||||
|
fld006930 = y.fld006753,
|
||||||
|
fld006931 = y.fld006752
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
// 合并两个列表
|
||||||
|
var combinedList = bom137List.Concat(bom112List).OrderBy(item => item.OrderIndex).ToList();
|
||||||
|
|
||||||
|
return combinedList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user