diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsInventoryController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsInventoryController.cs
index 86ba107..d002e90 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsInventoryController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsInventoryController.cs
@@ -102,7 +102,33 @@ namespace DOAN.Admin.WebApi.Controllers
return ToResponse(response);
}
-
+
+ //TODO 入库
+ [HttpPost("entryInventory")]
+ public IActionResult EntryInventory([FromBody] DevicePartsInventoryDto parm)
+ {
+ var response = _DevicePartsInventoryService.EntryInventory(parm);
+ return SUCCESS(response);
+ }
+
+
+ //TODO 出库
+ [HttpPost("OutInventory")]
+ public IActionResult OutInventory([FromBody] DevicePartsInventoryDto parm)
+ {
+ var response = _DevicePartsInventoryService.OutInventory(parm);
+ return SUCCESS(response);
+ }
+
+
+
+ //TODO 盘点
+ [HttpPost("CheckInventory")]
+ public IActionResult CheckInventory([FromBody] DevicePartsInventoryDto parm)
+ {
+ var response = _DevicePartsInventoryService.CheckInventory(parm);
+ return SUCCESS(response);
+ }
diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsStorageLocationsController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsStorageLocationsController.cs
index 0559a91..48cafb4 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsStorageLocationsController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsStorageLocationsController.cs
@@ -38,6 +38,15 @@ namespace DOAN.Admin.WebApi.Controllers
var response = _DevicePartsStorageLocationsService.GetList(parm);
return SUCCESS(response);
}
+
+ //TODO 查询备品备件库位编号
+ [HttpGet("list_location_code")]
+ public IActionResult QueryDevicePartsStorageLocationsLocationCode(string query)
+ {
+ var response = _DevicePartsStorageLocationsService.QueryDevicePartsStorageLocationsLocationCode(query);
+
+ return SUCCESS(response);
+ }
///
diff --git a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DeviceSparePartsController.cs b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DeviceSparePartsController.cs
index 819b7f7..c0b52ac 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DeviceSparePartsController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DeviceSparePartsController.cs
@@ -38,6 +38,16 @@ namespace DOAN.Admin.WebApi.Controllers
var response = _DeviceSparePartsService.GetList(parm);
return SUCCESS(response);
}
+
+ //TODO 查询备品备件基本信息表列表 不分页
+ [HttpGet("list_nopage")]
+ [ActionPermissionFilter(Permission = "deviceManagement:devicespareparts:list")]
+ public IActionResult QueryDeviceSpareParts2(string query)
+ {
+ var response = _DeviceSparePartsService.GetListNOPage(query);
+
+ return SUCCESS(response);
+ }
///
diff --git a/DOAN.Model/MES/dev/Dto/DevicePartsInventoryDto.cs b/DOAN.Model/MES/dev/Dto/DevicePartsInventoryDto.cs
index 0740665..251658e 100644
--- a/DOAN.Model/MES/dev/Dto/DevicePartsInventoryDto.cs
+++ b/DOAN.Model/MES/dev/Dto/DevicePartsInventoryDto.cs
@@ -28,7 +28,7 @@ namespace DOAN.Model.Dto
///
public class DevicePartsInventoryDto
{
- [Required(ErrorMessage = "库存ID不能为空")]
+
public int InventoryId { get; set; }
[Required(ErrorMessage = "备件ID不能为空")]
@@ -36,7 +36,7 @@ namespace DOAN.Model.Dto
[Required(ErrorMessage = "数量不能为空")]
public int Quantity { get; set; }
-
+ [Required(ErrorMessage = "库位不能为空")]
public string Location { get; set; }
public DateTime? LastInventoryCheck { get; set; }
diff --git a/DOAN.Model/MES/dev/Dto/DeviceSparePartsDto.cs b/DOAN.Model/MES/dev/Dto/DeviceSparePartsDto.cs
index 1f78929..dcecf0a 100644
--- a/DOAN.Model/MES/dev/Dto/DeviceSparePartsDto.cs
+++ b/DOAN.Model/MES/dev/Dto/DeviceSparePartsDto.cs
@@ -7,14 +7,17 @@ namespace DOAN.Model.MES.dev.Dto
///
public class DeviceSparePartsQueryDto : PagerInfo
{
+ public string PartName { get; set; }
+ public string PartCode { get; set; }
}
+
///
/// 备品备件基本信息表输入输出对象
///
public class DeviceSparePartsDto
{
- [Required(ErrorMessage = "备件ID不能为空")]
+
public int PartId { get; set; }
[Required(ErrorMessage = "备件名称不能为空")]
diff --git a/DOAN.Service/MES/dev/DevicePartsInventoryService.cs b/DOAN.Service/MES/dev/DevicePartsInventoryService.cs
index 01c2013..1044a00 100644
--- a/DOAN.Service/MES/dev/DevicePartsInventoryService.cs
+++ b/DOAN.Service/MES/dev/DevicePartsInventoryService.cs
@@ -101,6 +101,68 @@ namespace DOAN.Service.MES.dev
//return response;
return Update(model, true);
}
+
+ ///
+ /// 入库
+ ///
+ ///
+ ///
+ public bool EntryInventory(DevicePartsInventoryDto parm)
+ {
+
+
+ //要么新增,要么修改
+ bool isExist = Context.Queryable()
+ .Where(it => it.PartId == parm.PartId && it.Location == parm.Location).Any();
+ if (isExist)
+ {
+ return Context.Updateable()
+ .SetColumns(it=>it.Quantity==it.Quantity+parm.Quantity)
+ .SetColumns(it=>it.UpdatedAt==DateTime.Now)
+ .Where(it=>it.PartId==parm.PartId&&it.Location==parm.Location)
+ .ExecuteCommand()>0;
+ }
+ else
+ { DevicePartsInventory inventory = new DevicePartsInventory
+ {
+ PartId = parm.PartId,
+ Quantity = parm.Quantity,
+ Location = parm.Location,
+ CreatedAt = DateTime.Now,
+
+ };
+ return Context.Insertable(inventory).ExecuteCommand()>0;
+ }
+
+
+ }
+
+
+
+
+ ///
+ /// 出库
+ ///
+ ///
+ ///
+ public bool OutInventory(DevicePartsInventoryDto parm)
+ {
+ return Context.Updateable()
+ .SetColumns(it=>it.Quantity==it.Quantity-parm.Quantity)
+ .SetColumns(it=>it.UpdatedAt==DateTime.Now)
+ .Where(it=>it.PartId==parm.PartId&&it.Location==parm.Location)
+ .ExecuteCommand()>0;
+ }
+ public bool CheckInventory(DevicePartsInventoryDto parm)
+ {
+ return Context.Updateable()
+ .SetColumns(it=>it.Quantity==parm.Quantity)
+ .SetColumns(it=>it.UpdatedAt==DateTime.Now)
+ .SetColumns(it=>it.LastInventoryCheck==DateTime.Now)
+ .Where(it=>it.PartId==parm.PartId&&it.Location==parm.Location)
+ .ExecuteCommand()>0;
+ }
+
}
}
\ No newline at end of file
diff --git a/DOAN.Service/MES/dev/DevicePartsStorageLocationsService.cs b/DOAN.Service/MES/dev/DevicePartsStorageLocationsService.cs
index 245d8f6..a5a514c 100644
--- a/DOAN.Service/MES/dev/DevicePartsStorageLocationsService.cs
+++ b/DOAN.Service/MES/dev/DevicePartsStorageLocationsService.cs
@@ -34,6 +34,14 @@ namespace DOAN.Service.MES.dev
return response;
}
+ public string[] QueryDevicePartsStorageLocationsLocationCode(string query)
+ {
+ return Queryable()
+ .Where(x => x.LocationCode.Contains(query))
+ .Select(x => x.LocationCode)
+ .ToArray();
+ }
+
///
/// 获取详情
diff --git a/DOAN.Service/MES/dev/DeviceSparePartsService.cs b/DOAN.Service/MES/dev/DeviceSparePartsService.cs
index d3747a4..079b924 100644
--- a/DOAN.Service/MES/dev/DeviceSparePartsService.cs
+++ b/DOAN.Service/MES/dev/DeviceSparePartsService.cs
@@ -10,6 +10,7 @@ using DOAN.Repository;
using System.Linq;
using DOAN.Service.MES.dev.IService;
+using Mapster;
namespace DOAN.Service.MES.dev
{
@@ -26,7 +27,10 @@ namespace DOAN.Service.MES.dev
///
public PagedInfo GetList(DeviceSparePartsQueryDto parm)
{
- var predicate = Expressionable.Create();
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.PartName), it => it.PartName.Contains(parm.PartName))
+ .AndIF(!string.IsNullOrEmpty(parm.PartCode), it => it.PartCode.Contains(parm.PartCode))
+ ;
var response = Queryable()
.Where(predicate.ToExpression())
@@ -35,6 +39,15 @@ namespace DOAN.Service.MES.dev
return response;
}
+ public List GetListNOPage(string query)
+ {
+ var response = Queryable()
+ .Where(x => x.PartName.Contains(query)||x.PartCode.Contains(query))
+ .ToList().Adapt,List>();
+
+ return response;
+ }
+
///
/// 获取详情
diff --git a/DOAN.Service/MES/dev/IService/IDevicePartsInventoryService.cs b/DOAN.Service/MES/dev/IService/IDevicePartsInventoryService.cs
index 5bda5f0..6b6fab7 100644
--- a/DOAN.Service/MES/dev/IService/IDevicePartsInventoryService.cs
+++ b/DOAN.Service/MES/dev/IService/IDevicePartsInventoryService.cs
@@ -20,5 +20,11 @@ namespace DOAN.Service.MES.dev.IService
int UpdateDevicePartsInventory(DevicePartsInventory parm);
+ bool EntryInventory(DevicePartsInventoryDto parm);
+
+ bool OutInventory(DevicePartsInventoryDto parm);
+
+ bool CheckInventory(DevicePartsInventoryDto parm);
+
}
}
diff --git a/DOAN.Service/MES/dev/IService/IDevicePartsStorageLocationsService.cs b/DOAN.Service/MES/dev/IService/IDevicePartsStorageLocationsService.cs
index 46c40e5..9bc3e8c 100644
--- a/DOAN.Service/MES/dev/IService/IDevicePartsStorageLocationsService.cs
+++ b/DOAN.Service/MES/dev/IService/IDevicePartsStorageLocationsService.cs
@@ -14,6 +14,9 @@ namespace DOAN.Service.MES.dev.IService
{
PagedInfo GetList(DevicePartsStorageLocationsQueryDto parm);
+
+ string[] QueryDevicePartsStorageLocationsLocationCode(string query);
+
DevicePartsStorageLocations GetInfo(int LocationId);
DevicePartsStorageLocations AddDevicePartsStorageLocations(DevicePartsStorageLocations parm);
diff --git a/DOAN.Service/MES/dev/IService/IDeviceSparePartsService.cs b/DOAN.Service/MES/dev/IService/IDeviceSparePartsService.cs
index a80af05..17682f7 100644
--- a/DOAN.Service/MES/dev/IService/IDeviceSparePartsService.cs
+++ b/DOAN.Service/MES/dev/IService/IDeviceSparePartsService.cs
@@ -14,6 +14,8 @@ namespace DOAN.Service.MES.dev.IService
{
PagedInfo GetList(DeviceSparePartsQueryDto parm);
+ List GetListNOPage(string query);
+
DeviceSpareParts GetInfo(int PartId);
DeviceSpareParts AddDeviceSpareParts(DeviceSpareParts parm);