|
|
|
|
using HighWayIot.Config;
|
|
|
|
|
using HighWayIot.Log4net;
|
|
|
|
|
using HighWayIot.Repository.domain;
|
|
|
|
|
using HighWayIot.Repository.service;
|
|
|
|
|
using HighWayIot.Repository.service.Impl;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Aucma.Scada.Business
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 实时库存业务逻辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class InventoryInfoBusiness
|
|
|
|
|
{
|
|
|
|
|
private static readonly Lazy<InventoryInfoBusiness> lazy = new Lazy<InventoryInfoBusiness>(() => new InventoryInfoBusiness());
|
|
|
|
|
public static InventoryInfoBusiness Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return lazy.Value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LogHelper logHelper = LogHelper.Instance;
|
|
|
|
|
|
|
|
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
|
|
|
|
|
|
private IBaseSpaceInfoService _spaceInfoService = new BaseSpaceInfoServiceImpl();
|
|
|
|
|
|
|
|
|
|
public InventoryInfoBusiness()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取货道信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<BaseSpaceInfo> GetSpaceInfos(string storeCode)
|
|
|
|
|
{
|
|
|
|
|
List<BaseSpaceInfo> spaceInfos = null;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
spaceInfos =_spaceInfoService.GetSpaceInfosByStoreCode(storeCode);
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logHelper.Error("获取货道信息异常", ex);
|
|
|
|
|
}
|
|
|
|
|
return spaceInfos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改货道入库标识
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
|
public bool UpdateInStoreFlag(string storeCode,string spaceCode)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode);
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.inStoreFlag = spaceInfo.inStoreFlag == 1 ? 2 : 1;
|
|
|
|
|
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};入库标识:{spaceInfo.inStoreFlag};修改{(result == true ? "成功" : "失败")}");
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logHelper.Error("修改货道入库标识异常", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改货道出库标识
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool UpdateOutStoreFlag(string storeCode,string spaceCode)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode);
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.outStoreFlag = spaceInfo.outStoreFlag == 1 ? 2 : 1;
|
|
|
|
|
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};出库标识:{spaceInfo.outStoreFlag};修改{(result == true ? "成功" : "失败")}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logHelper.Error("修改货道出库标识异常", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改异常货道标识
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool UpdateUnusualFlag(string storeCode, string spaceCode)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode);
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.unusualFlag = spaceInfo.unusualFlag == 1 ? 2 : 1;
|
|
|
|
|
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};异常标识:{spaceInfo.unusualFlag};修改{(result == true ? "成功" : "失败")}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logHelper.Error("修改异常货道标识", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改货道状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="storeCode"></param>
|
|
|
|
|
/// <param name="spaceCode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool UpdateSpaceStatus(string storeCode,string spaceCode)
|
|
|
|
|
{
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
BaseSpaceInfo spaceInfo = _spaceInfoService.GetSpaceInfoBySpaceCode(storeCode, spaceCode);
|
|
|
|
|
if (spaceInfo != null)
|
|
|
|
|
{
|
|
|
|
|
spaceInfo.spaceStatus = spaceInfo.spaceStatus == 1 ? 2 : 1;
|
|
|
|
|
result = _spaceInfoService.UpdateSpaceInfo(spaceInfo);
|
|
|
|
|
logHelper.Info($"修改仓库:{storeCode};货道:{spaceCode};货道状态:{spaceInfo.unusualFlag};修改{(result == true ? "成功" : "失败")}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logHelper.Error("修改异常货道标识", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|