😎新增创建排版软件接口
This commit is contained in:
parent
2c0a3bd794
commit
0ac2aaf171
@ -0,0 +1,24 @@
|
||||
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
|
||||
//
|
||||
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
|
||||
//
|
||||
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Vistar.Application.Service.ProductDesignLibrary.Dto;
|
||||
public class CreateLayoutInput
|
||||
{
|
||||
public string ParentCode { get; set; }
|
||||
public List<Item> Item { get; set; }
|
||||
|
||||
}
|
||||
public class Item
|
||||
{
|
||||
public string ChildCode { get; set; }
|
||||
public string Quantity { get; set; }
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
|
||||
using Admin.NET.Core;
|
||||
using Admin.NET.Core.Service;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@ -21,6 +22,7 @@ using Vistar.Application.Const;
|
||||
using Vistar.Application.Entity;
|
||||
using Vistar.Application.SapService.Dto;
|
||||
using Vistar.Application.Service.ProductDesignLibrary.Dto;
|
||||
using Vistar.Application.SolidWorksManageService.Dto;
|
||||
using Vistar.Application.Util;
|
||||
|
||||
namespace Vistar.Application.Service.ProductDesignLibrary;
|
||||
@ -39,6 +41,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
public Common.DataValidationService _dataValidationService;
|
||||
public SqlSugarRepository<Obj122> _obj122Rep;
|
||||
public SqlSugarRepository<Obj121> _obj121Rep;
|
||||
public SolidWorksManageService.SolidWorksManageService _solidWorksManageService;
|
||||
|
||||
public ProductDesignLibraryService(
|
||||
SqlSugarRepository<Obj137> obj137Rep,
|
||||
@ -49,7 +52,8 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
SqlSugarRepository<Obj118> obj118Rep,
|
||||
DataValidationService dataValidationService,
|
||||
SqlSugarRepository<Obj122> obj122Rep,
|
||||
SqlSugarRepository<Obj121> obj121Rep
|
||||
SqlSugarRepository<Obj121> obj121Rep,
|
||||
SolidWorksManageService.SolidWorksManageService solidWorksManageService
|
||||
)
|
||||
{
|
||||
_obj137Rep = obj137Rep;
|
||||
@ -61,6 +65,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
_dataValidationService = dataValidationService;
|
||||
_obj122Rep = obj122Rep;
|
||||
_obj121Rep = obj121Rep;
|
||||
_solidWorksManageService = solidWorksManageService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -192,7 +197,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
.Where(x => x.RecordGuid == input.ParentGuid && x.deleted == false && x._system_objConfigurationName == "默认" && !x.SWPDMFileName.Contains("SLDDRW"))
|
||||
.MaxAsync(x => x.VersionIndex);
|
||||
var BomData = await _configurationDataRep.AsQueryable()
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent && (x.fld005577 != "不包含" || x.fld005577 == null)&&x.isSuppressed== false && x.inContext == false)
|
||||
.Where(x => x.ConfigId == configid.ConfigID && x.ParentGuid == input.ParentGuid && x.isDeleted == false && x.ParentVersion == parent && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false)
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Description), u => u.Description.Contains(input.Description.Trim()))
|
||||
.WhereIF(!string.IsNullOrWhiteSpace(input.PartNumber), u => u.PartNumber.Contains(input.PartNumber.Trim()))
|
||||
.Select<ProductDesignLibraryBomOutput>().ToPagedListAsync(input.Page, input.PageSize);
|
||||
@ -314,7 +319,8 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
await _obj137Rep.AsUpdateable()
|
||||
.SetColumns(it => new Obj137
|
||||
{
|
||||
@ -326,7 +332,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
.Where(it => it.idRecord == ParentData.idRecord)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
var msg = apiOutput.msg;
|
||||
if (apiOutput.msg == "")
|
||||
{
|
||||
@ -379,7 +385,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
});
|
||||
continue;
|
||||
}
|
||||
if (input[i].fld005530 == "N" || input[i].fld005530=="D"|| input[i].fld005530 ==null)
|
||||
if (input[i].fld005530 == "N" || input[i].fld005530 == "D" || input[i].fld005530 == null)
|
||||
{
|
||||
SapOutputList.Add(new SapOutput()
|
||||
{
|
||||
@ -500,7 +506,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取时间戳精确到毫秒,sap要求每次调用生成不重复guid
|
||||
string millisecondTimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
|
||||
@ -638,7 +644,7 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
if (!string.IsNullOrEmpty(ParentData.fld005686))
|
||||
{
|
||||
var configidold = await _configurationsRep.AsQueryable().Where(x => x.ObjectId == 137 && x.ConfigSystemName == "SolidWorks").FirstAsync();
|
||||
var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configidold.ConfigID && x.ParentGuid == bomData[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005686) && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext==false).ToListAsync();
|
||||
var BomData = await _configurationDataRep.AsQueryable().Where(x => x.ConfigId == configidold.ConfigID && x.ParentGuid == bomData[0].ParentGuid && x.isDeleted == false && x.ParentVersion == Convert.ToInt32(ParentData.fld005686) && (x.fld005577 != "不包含" || x.fld005577 == null) && x.isSuppressed == false && x.inContext == false).ToListAsync();
|
||||
for (int i = 0; i < BomData.Count; i++)
|
||||
{
|
||||
|
||||
@ -786,10 +792,10 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
public async Task<SapOutput> SyncToSAPProcessRoute(List<BomPageProductDesignLibraryInput> input)
|
||||
{
|
||||
var ParentData = await _obj137Rep.AsQueryable()
|
||||
.Where(x =>
|
||||
x.RecordGuid == input[0].ParentGuid
|
||||
&& x.deleted == false
|
||||
&& x.VersionIndex == input[0].ParentVersion
|
||||
.Where(x =>
|
||||
x.RecordGuid == input[0].ParentGuid
|
||||
&& x.deleted == false
|
||||
&& x.VersionIndex == input[0].ParentVersion
|
||||
&& x._system_objConfigurationName == "默认"
|
||||
&& !x.SWPDMFileName.Contains("SLDDRW")
|
||||
&& x.CheckedStatus == 0
|
||||
@ -900,10 +906,10 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
|
||||
//查询需要同步的产品
|
||||
var materialData = await _obj137Rep.AsQueryable()
|
||||
.Where(x =>
|
||||
x.CheckedStatus == 0
|
||||
&& x.deleted == false
|
||||
&& x.IsLatestVersion == true
|
||||
.Where(x =>
|
||||
x.CheckedStatus == 0
|
||||
&& x.deleted == false
|
||||
&& x.IsLatestVersion == true
|
||||
&& x._system_objConfigurationName == "默认"
|
||||
&& !x.SWPDMFileName.Contains("SLDDRW")
|
||||
&& (x._SWPDM_1202_SW_____ != "不展开" || x._SWPDM_1202_SW_____ == null)
|
||||
@ -1013,4 +1019,87 @@ public class ProductDesignLibraryService : IDynamicApiController, ITransient
|
||||
return sapOutputList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建排版软件
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<string> CreateLayout(CreateLayoutInput input)
|
||||
{
|
||||
string output = "";
|
||||
if (string.IsNullOrEmpty(input.ParentCode))
|
||||
{
|
||||
return "请输入父项编码";
|
||||
}
|
||||
var parentData = await _obj137Rep.AsQueryable().Where(x => x._System_objNBS == input.ParentCode && x.deleted == false).OrderByDescending(x => x.idRecord).FirstAsync();
|
||||
if (parentData != null)
|
||||
{
|
||||
return "未查询到父项编码";
|
||||
}
|
||||
int lineNumber = 0;
|
||||
foreach (var item in input.Item)
|
||||
{
|
||||
lineNumber ++;
|
||||
string lineNumberStr = (lineNumber * 10).ToString("0000");
|
||||
var outputData = output+"子项编码"+item.ChildCode;
|
||||
if (string.IsNullOrEmpty(item.ChildCode)|| string.IsNullOrEmpty(item.Quantity))
|
||||
{
|
||||
outputData = outputData + "未输入必填项编码";
|
||||
continue;
|
||||
}
|
||||
var childData = await _obj122Rep.AsQueryable().Where(x => x._System_objNBS == item.ChildCode && x.deleted == false).OrderByDescending(x => x.idRecord).FirstAsync();
|
||||
|
||||
if (childData != null)
|
||||
{
|
||||
output = outputData + "未查询到子项编码;";
|
||||
continue;
|
||||
}
|
||||
|
||||
var configurationData = await _configurationDataRep.AsQueryable().Where(x=> x.RecordImage!=null && x.ChildObjID ==112).FirstAsync();
|
||||
|
||||
var bomData = new ConfigurationData
|
||||
{
|
||||
ParentGuid = parentData.RecordGuid,
|
||||
ChildGuid = childData.RecordGuid,
|
||||
ChildObjID = 112,
|
||||
ConfigId = 8,
|
||||
childVersion = childData.VersionIndex,
|
||||
ParentVersion = (int)parentData.VersionIndex,
|
||||
isDeleted = false,
|
||||
ChildConfigID = 0,
|
||||
CreatedUserID = 2,
|
||||
ModifiedUserID = 2,
|
||||
CreatedDate = DateTime.Now,
|
||||
ModifiedDate = DateTime.Now,
|
||||
Quantity = item.Quantity.ToDouble(),
|
||||
Description = parentData._System_ObjDescription,
|
||||
EffectiveFrom = DateTime.Now,
|
||||
EffectiveTo = DateTime.Now.AddYears(100),
|
||||
Revision = "",
|
||||
Marker = lineNumberStr,
|
||||
Type = "正常",
|
||||
OrderIndex = lineNumber,
|
||||
PartNumber = childData._System_objNBS,
|
||||
RecordImage = configurationData.RecordImage,
|
||||
Folder = configurationData.Folder,
|
||||
ParentObjectID = 137,
|
||||
ChildSwFileType = 0,
|
||||
ParentSwFileType = 1,
|
||||
isSuppressed = false,
|
||||
isAddedFromSW = true,
|
||||
QtyManual = item.Quantity.ToDouble(),
|
||||
SwConfiguration = "",
|
||||
inContext = false,
|
||||
PrimaryFile = "",
|
||||
bKeepQuantityInSync = true,
|
||||
BOMGuid = await _dataValidationService.GetGuid(),
|
||||
IsPDMReference=false
|
||||
};
|
||||
var addChildBomBom = await _configurationDataRep.AsInsertable(bomData).InsertColumns(x => new { x.ParentGuid, x.ChildGuid, x.ChildObjID, x.ConfigId,x.childVersion, x.ParentVersion, x.isDeleted, x.ChildConfigID, x.CreatedUserID, x.ModifiedUserID, x.CreatedDate, x.ModifiedDate, x.Quantity, x.Description, x.EffectiveFrom, x.EffectiveTo, x.Revision, x.Marker, x.Type, x.OrderIndex, x.PartNumber, x.RecordImage, x.Folder, x.ParentObjectID, x.ChildSwFileType, x.ParentSwFileType, x.isSuppressed, x.isAddedFromSW, x.QtyManual, x.SwConfiguration, x.inContext, x.PrimaryFile, x.bKeepQuantityInSync, x.BOMGuid, x.IsPDMReference }).ExecuteReturnEntityAsync();
|
||||
|
||||
//var message = AddItemsInBomOutput.Message;
|
||||
//output = outputData + message+";";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user