using iWareCommon.Common.Service;
|
using iWareCommon.Utils;
|
using iWareDataCore.BASE.Dao;
|
using iWareDataCore.BASE.Entity;
|
using iWareDataCore.ORM;
|
using iWareDataCore.Properties;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace iWareDataCore.BASE.Service
|
{
|
public class EmptyPlaceViewService : CommonService<EmptyPlaceViewEntity, BASEEmptyPlaceView, DbModelCore>
|
{
|
|
private static object Lock = new object();
|
|
private EmptyPlaceViewService() : base(EmptyPlaceViewDao.GetInstance()) { }
|
|
private static EmptyPlaceViewService Instance = null;
|
|
/// <summary>
|
/// 获取单例的方法
|
/// </summary>
|
/// <returns>角色服务的单例实体</returns>
|
public static EmptyPlaceViewService GetInstance()
|
{
|
|
if (Instance == null)
|
{
|
lock (Lock)
|
{
|
if (Instance == null)
|
{
|
Instance = new EmptyPlaceViewService();
|
}
|
}
|
}
|
return Instance;
|
}
|
|
|
|
/// <summary>
|
/// 批量修改物料状态
|
/// </summary>
|
/// <param name="ids">需要修改的物料id列表</param>
|
/// <param name="status">状态:1为启用,0为锁定</param>
|
/// <param name="msg">异常错误消息</param>
|
/// <returns>修改的物料数量</returns>
|
public int ChangeStatus(List<int> ids, int status, out string msg)
|
{
|
msg = "";
|
using (var dbModel = new DbModelCore())
|
{
|
try
|
{
|
var ones = dbModel.BASEMaterials.Where(x => ids.Contains(x.id)).ToList();
|
|
foreach (var one in ones)
|
{
|
one.status = status;
|
}
|
|
dbModel.SaveChanges();
|
return ones.Count;
|
}
|
catch (Exception ex)
|
{
|
msg = ex.Message;
|
LogTextHelper.WriteLog(Resources.LogDir, this.ToString(), "ChangeStatus", ex.Message);
|
return -1;
|
}
|
}
|
}
|
|
|
|
}
|
}
|