物料模型
This commit is contained in:
parent
ffe009e6d3
commit
de8607460f
@ -25,7 +25,6 @@ namespace MDM.Controllers.Material
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("MasterDataManagement/Material/MaterialList")]
|
||||
[AllowAnonymous]
|
||||
public class MaterialListController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
@ -62,7 +61,7 @@ namespace MDM.Controllers.Material
|
||||
public IActionResult GetMaterialList(string Id)
|
||||
{
|
||||
var response = _MaterialListService.GetInfo(Id);
|
||||
|
||||
|
||||
var info = response.Adapt<MaterialList>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
|
||||
@ -20,13 +20,11 @@ using NPOI.HPSF;
|
||||
|
||||
//创建时间:2025-11-15
|
||||
namespace MDM.Controllers.Material
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料类别
|
||||
/// </summary>
|
||||
//[Verify]
|
||||
{ /// <summary>
|
||||
/// 物料类别
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("MasterDataManagement/Material/MaterialType")]
|
||||
[AllowAnonymous]
|
||||
public class MaterialTypeController : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
@ -63,7 +61,7 @@ namespace MDM.Controllers.Material
|
||||
public IActionResult GetMaterialType(int Id)
|
||||
{
|
||||
var response = _MaterialTypeService.GetInfo(Id);
|
||||
|
||||
|
||||
var info = response.Adapt<MaterialType>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
@ -126,7 +124,7 @@ namespace MDM.Controllers.Material
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
// 使用Path.Combine构建正确的路径,避免硬编码的路径分隔符
|
||||
string fullPath = Path.Combine(webHostEnvironment.ContentRootPath, "..\\MDM", "Assets", "ImportTemplate", "MaterialMODEL.xlsx");
|
||||
|
||||
|
||||
(string, string) result = ("MaterialMODEL.xlsx", fullPath);
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
@ -154,7 +152,7 @@ namespace MDM.Controllers.Material
|
||||
[AllowAnonymous]
|
||||
public IActionResult ExportData()
|
||||
{
|
||||
|
||||
|
||||
var excelBytes = _MaterialTypeService.ExportData();
|
||||
string fileName = $"PlanAchievementRate_{DateTime.Now.Date:yyyyMMdd}.xlsx";
|
||||
return File(
|
||||
|
||||
@ -29,9 +29,9 @@ namespace MDM.Services.Material
|
||||
public PagedInfo<MaterialListDto> GetList(MaterialListQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<MaterialList>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkMaterialTypeCode),it=>it.FkMaterialTypeCode.Contains(parm.FkMaterialTypeCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Name),it=>it.Name.Contains(parm.Name))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Code),it=>it.Code.Contains(parm.Code))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.FkMaterialTypeCode), it => it.FkMaterialTypeCode.Contains(parm.FkMaterialTypeCode))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
||||
;
|
||||
|
||||
var response = Queryable()
|
||||
@ -169,9 +169,9 @@ namespace MDM.Services.Material
|
||||
|
||||
//保质期(天)
|
||||
if (currentRow.GetCell(9) != null && currentRow.GetCell(9).CellType == CellType.Numeric)
|
||||
item.ExpirationDate =Convert.ToInt16(currentRow.GetCell(9).ToString());
|
||||
item.ExpirationDate = Convert.ToInt16(currentRow.GetCell(9).ToString());
|
||||
|
||||
|
||||
|
||||
//保质期预警天数
|
||||
if (currentRow.GetCell(10) != null && currentRow.GetCell(10).CellType == CellType.Numeric)
|
||||
item.ShelfLifeWarningDays = Convert.ToInt16(currentRow.GetCell(10).ToString());
|
||||
@ -186,7 +186,7 @@ namespace MDM.Services.Material
|
||||
// item.StartTime = Convert.ToInt16(currentRow.GetCell(12).ToString());
|
||||
|
||||
|
||||
|
||||
|
||||
//对应条码
|
||||
if (currentRow.GetCell(12) != null && currentRow.GetCell(12).CellType == CellType.String)
|
||||
item.BarCode = currentRow.GetCell(12).ToString();
|
||||
@ -254,7 +254,7 @@ namespace MDM.Services.Material
|
||||
var item = dataList[i];
|
||||
IRow row = sheet.GetRow(startRowIndex + i) ?? sheet.CreateRow(startRowIndex + i);
|
||||
|
||||
|
||||
|
||||
row.CreateCell(0).SetCellValue(item.FkMaterialTypeCode);
|
||||
row.CreateCell(1).SetCellValue(item.Name);
|
||||
row.CreateCell(2).SetCellValue(item.Code);
|
||||
|
||||
@ -28,10 +28,10 @@ namespace MDM.Services.Material
|
||||
public PagedInfo<MaterialTypeDto> GetList(MaterialTypeQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable.Create<MaterialType>()
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Name),it=>it.Name.Contains(parm.Name))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Code),it=>it.Code.Contains(parm.Code))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ParentCode),it=>it.ParentCode.Contains(parm.ParentCode))
|
||||
.AndIF(parm.Status!=null,it=>it.Status==parm.Status)
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
||||
.AndIF(!string.IsNullOrEmpty(parm.ParentCode), it => it.ParentCode.Contains(parm.ParentCode))
|
||||
.AndIF(parm.Status != null, it => it.Status == parm.Status)
|
||||
|
||||
|
||||
|
||||
@ -107,7 +107,7 @@ namespace MDM.Services.Material
|
||||
if (currentRow != null && currentRow.GetCell(0) != null) // 确保行不为空
|
||||
{
|
||||
MaterialType item = new MaterialType();
|
||||
|
||||
|
||||
//物料类型名称
|
||||
if (currentRow.GetCell(0) != null && currentRow.GetCell(0).CellType == CellType.String)
|
||||
item.Name = currentRow.GetCell(0).ToString();
|
||||
@ -122,7 +122,7 @@ namespace MDM.Services.Material
|
||||
if (currentRow.GetCell(3) != null && currentRow.GetCell(3).CellType == CellType.String)
|
||||
{
|
||||
string statusstring = currentRow.GetCell(3).ToString();
|
||||
if(statusstring == "启用")
|
||||
if (statusstring == "启用")
|
||||
{
|
||||
item.Status = 1;
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace MDM.Services.Material
|
||||
}
|
||||
UseTran2(() =>
|
||||
{
|
||||
// Context.Deleteable<ProPlanAchievementrateVersion2>().Where(it => it.RecordDate == RecordDate.Date).ExecuteCommand();
|
||||
// Context.Deleteable<ProPlanAchievementrateVersion2>().Where(it => it.RecordDate == RecordDate.Date).ExecuteCommand();
|
||||
Context.Insertable(materialTypes).ExecuteCommand();
|
||||
});
|
||||
return materialTypes.Count;
|
||||
@ -182,7 +182,7 @@ namespace MDM.Services.Material
|
||||
}
|
||||
|
||||
List<MaterialType> dataList = Context.Queryable<MaterialType>()
|
||||
.Where(it=>it.Status==1)
|
||||
.Where(it => it.Status == 1)
|
||||
.ToList();
|
||||
|
||||
using (var fileStream = new FileStream(templatePath, FileMode.Open, FileAccess.Read))
|
||||
@ -198,7 +198,7 @@ namespace MDM.Services.Material
|
||||
|
||||
// 为每个需要数字的单元格设置值,并应用 numberCellStyle
|
||||
row.CreateCell(0).SetCellValue(item.Name);
|
||||
|
||||
|
||||
// 以下为字符串类型字段,不需要数字格式
|
||||
row.CreateCell(1).SetCellValue(item.Code);
|
||||
row.CreateCell(2).SetCellValue(item.ParentCode);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user