物料分类功能完善
This commit is contained in:
@@ -21,6 +21,8 @@ namespace DOAN.Model.BZFM.Dto
|
|||||||
[Required(ErrorMessage = "物料编码不能为空")]
|
[Required(ErrorMessage = "物料编码不能为空")]
|
||||||
public string MaterialCode { get; set; }
|
public string MaterialCode { get; set; }
|
||||||
|
|
||||||
|
public string MaterialName { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "仓库编码不能为空")]
|
[Required(ErrorMessage = "仓库编码不能为空")]
|
||||||
public string WarehouseCode { get; set; }
|
public string WarehouseCode { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ namespace DOAN.Model.BZFM.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class MmMaterialCategoryQueryDto : PagerInfo
|
public class MmMaterialCategoryQueryDto : PagerInfo
|
||||||
{
|
{
|
||||||
|
public string CategoryCode { get; set; }
|
||||||
|
public string CategoryName { get; set; }
|
||||||
|
public string Status { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,8 +31,6 @@ namespace DOAN.Model.BZFM.Dto
|
|||||||
public DateTime? CreatedTime { get; set; }
|
public DateTime? CreatedTime { get; set; }
|
||||||
|
|
||||||
public DateTime? UpdatedTime { get; set; }
|
public DateTime? UpdatedTime { get; set; }
|
||||||
[ExcelColumn(Name = "状态(0/1)")]
|
|
||||||
public string StatusLabel { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ namespace DOAN.Model.BZFM
|
|||||||
[SugarColumn(ColumnName = "material_code")]
|
[SugarColumn(ColumnName = "material_code")]
|
||||||
public string MaterialCode { get; set; }
|
public string MaterialCode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "material_name")]
|
||||||
|
public string MaterialName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 仓库编码
|
/// 仓库编码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ namespace DOAN.Service.BZFM
|
|||||||
var newInventory = new MmInventory()
|
var newInventory = new MmInventory()
|
||||||
{
|
{
|
||||||
MaterialCode = mmMaterial.MaterialCode,
|
MaterialCode = mmMaterial.MaterialCode,
|
||||||
|
MaterialName = mmMaterial.MaterialName,
|
||||||
LocationCode = mmLocation.LocationCode,
|
LocationCode = mmLocation.LocationCode,
|
||||||
LocationName = mmLocation.LocationName,
|
LocationName = mmLocation.LocationName,
|
||||||
WarehouseCode = mmLocation.WarehouseCode,
|
WarehouseCode = mmLocation.WarehouseCode,
|
||||||
@@ -271,6 +272,7 @@ namespace DOAN.Service.BZFM
|
|||||||
var newInventory = new MmInventory()
|
var newInventory = new MmInventory()
|
||||||
{
|
{
|
||||||
MaterialCode = mmMaterial.MaterialCode,
|
MaterialCode = mmMaterial.MaterialCode,
|
||||||
|
MaterialName = mmMaterial.MaterialName,
|
||||||
LocationCode = mmLocation.LocationCode,
|
LocationCode = mmLocation.LocationCode,
|
||||||
LocationName = mmLocation.LocationName,
|
LocationName = mmLocation.LocationName,
|
||||||
WarehouseCode = mmLocation.WarehouseCode,
|
WarehouseCode = mmLocation.WarehouseCode,
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ namespace DOAN.Service.BZFM
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public MmMaterialCategory AddMmMaterialCategory(MmMaterialCategory model)
|
public MmMaterialCategory AddMmMaterialCategory(MmMaterialCategory model)
|
||||||
{
|
{
|
||||||
|
// 检查是否有重复
|
||||||
|
bool hasAny = Context.Queryable<MmMaterialCategory>()
|
||||||
|
.Where(it => it.CategoryCode == model.CategoryCode)
|
||||||
|
.Any();
|
||||||
|
if (hasAny)
|
||||||
|
{
|
||||||
|
throw new Exception("分类编码不可重复!");
|
||||||
|
}
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
return Insertable(model).ExecuteReturnEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +69,15 @@ namespace DOAN.Service.BZFM
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public int UpdateMmMaterialCategory(MmMaterialCategory model)
|
public int UpdateMmMaterialCategory(MmMaterialCategory model)
|
||||||
{
|
{
|
||||||
|
// 检查是否有重复
|
||||||
|
bool hasAny = Context.Queryable<MmMaterialCategory>()
|
||||||
|
.Where(it => it.CategoryCode == model.CategoryCode)
|
||||||
|
.Where(it => it.Id != model.Id)
|
||||||
|
.Any();
|
||||||
|
if (hasAny)
|
||||||
|
{
|
||||||
|
throw new Exception("分类编码不可重复!");
|
||||||
|
}
|
||||||
return Update(model, true);
|
return Update(model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +88,11 @@ namespace DOAN.Service.BZFM
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private static Expressionable<MmMaterialCategory> QueryExp(MmMaterialCategoryQueryDto parm)
|
private static Expressionable<MmMaterialCategory> QueryExp(MmMaterialCategoryQueryDto parm)
|
||||||
{
|
{
|
||||||
var predicate = Expressionable.Create<MmMaterialCategory>();
|
var predicate = Expressionable.Create<MmMaterialCategory>()
|
||||||
|
.AndIF(!string.IsNullOrEmpty(parm.CategoryCode),it=>it.CategoryCode.Contains(parm.CategoryCode))
|
||||||
|
.AndIF(!string.IsNullOrEmpty(parm.CategoryName), it => it.CategoryName.Contains(parm.CategoryName))
|
||||||
|
//检查数据:(启用/停用)
|
||||||
|
.AndIF(!string.IsNullOrEmpty(parm.Status), it => it.Status == parm.Status);
|
||||||
|
|
||||||
return predicate;
|
return predicate;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user