You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
305 lines
12 KiB
305 lines
12 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMAPP.BLL;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.Entity;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.DAL.Operation;
|
|
using QMAPP.FJC.Entity;
|
|
using QMFrameWork.Log;
|
|
using QMAPP.FJC.Entity.WIPManage;
|
|
using QMFrameWork.Common.Serialization;
|
|
using QMAPP.FJC.DAL.WarehouseManage;
|
|
using QMAPP.FJC.BLL.Dict;
|
|
|
|
namespace QMAPP.FJC.BLL.WarehouseManage
|
|
{
|
|
/// <summary>
|
|
/// 模块编号:M13-3
|
|
/// 作 用:出库(工控机)逻辑层
|
|
/// 作 者:王丹丹
|
|
/// 编写日期:2015年07月13日
|
|
///</summary>
|
|
public class OutWarehouseBLL : BaseBLL
|
|
{
|
|
#region 出库操作(零件)
|
|
/// <summary>
|
|
/// 出库操作(零件)
|
|
/// </summary>
|
|
/// <param name="product">条件</param>
|
|
public DataResult ProductOutWarehouse(Product product)
|
|
{
|
|
DataResult result = new DataResult();
|
|
ProductDAL productDal=new ProductDAL();
|
|
OutWarehouseDAL outWarehouseDal=new OutWarehouseDAL();
|
|
WIPOutRecorder outrecorder=new WIPOutRecorder();
|
|
int count=0;
|
|
try
|
|
{
|
|
if (product.OUTFLAG != EnumGeter.OUTFLAG.INWAREHOUSE.GetHashCode().ToString())
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.ProductIsExceptionOut;
|
|
return result;
|
|
}
|
|
if (product.CAPACITY - product.USINGCOUNT == 0)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.OperationProductUsed;
|
|
return result;
|
|
}
|
|
product.OUTFLAG = EnumGeter.OUTFLAG.EXCEPTIONOUT.GetHashCode().ToString();
|
|
|
|
#region 基本信息
|
|
//string json = JsonConvertHelper.GetDeserialize<Product>(product.ToString());
|
|
outrecorder.PID = Guid.NewGuid().ToString();
|
|
outrecorder.PRODUCTTYPE = product.PRODUCTTYPE;
|
|
outrecorder.PRODUCTCODE = product.PRODUCTCODE;
|
|
outrecorder.PROCESSTYPE = product.CURRENTPROCESS;
|
|
outrecorder.COUNT = product.CAPACITY-product.USINGCOUNT;
|
|
outrecorder.STATUS = product.STATUS;
|
|
outrecorder.MACHINECODDE = product.MACHINECODDE;
|
|
outrecorder.MACHINENAME = product.MACHINENAME;
|
|
outrecorder.PRODUCESHIFTTCODE = product.PRODUCESHIFTTCODE;
|
|
outrecorder.PRODUCESHIFTNAME = product.PRODUCESHIFTNAME;
|
|
outrecorder.PRODUCELINE = product.PRODUCELINE;
|
|
outrecorder.OUTTIME = DateTime.Now;
|
|
outrecorder.CREATEUSER = LoginUser.UserID;
|
|
outrecorder.CREATEDATE = DateTime.Now;
|
|
outrecorder.UPDATEUSER = outrecorder.CREATEUSER;
|
|
outrecorder.UPDATEDATE = outrecorder.CREATEDATE;
|
|
#endregion
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
productDal.BaseSession = session;
|
|
outWarehouseDal.BaseSession = session;
|
|
session.OpenCon();
|
|
//更新零件出库标记
|
|
count = new ProductDAL().Update(product);
|
|
//插入出库记录
|
|
count = outWarehouseDal.Insert(outrecorder);
|
|
session.CommitTs();
|
|
|
|
}
|
|
if (count == 0)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.OutWarehouseIsNotSuccess;
|
|
return result;
|
|
}
|
|
result.IsSuccess = true;
|
|
result.Msg = Resource.OutWarehouseIsSuccess;
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "出库(工控机)逻辑层-出库条码校验(工控机)!"
|
|
});
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 出库操作(本体)
|
|
/// <summary>
|
|
/// 出库操作(本体)
|
|
/// </summary>
|
|
/// <param name="main">条件</param>
|
|
public DataResult MainOutWarehouse(Main main)
|
|
{
|
|
DataResult result = new DataResult();
|
|
MainDAL mainDal = new MainDAL();
|
|
OutWarehouseDAL outWarehouseDal = new OutWarehouseDAL();
|
|
WIPOutRecorder outrecorder = new WIPOutRecorder();
|
|
int count = 0;
|
|
try
|
|
{
|
|
|
|
if (main.OUTFLAG != EnumGeter.OUTFLAG.INWAREHOUSE.GetHashCode().ToString())
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.ProductIsExceptionOut;
|
|
return result;
|
|
}
|
|
main.OUTFLAG = EnumGeter.OUTFLAG.EXCEPTIONOUT.GetHashCode().ToString();
|
|
|
|
#region 基本信息
|
|
//string json = JsonConvertHelper.GetDeserialize<Product>(product.ToString());
|
|
outrecorder.PID = Guid.NewGuid().ToString();
|
|
outrecorder.PRODUCTTYPE = EnumGeter.ProductType.biaopi.GetHashCode().ToString();
|
|
outrecorder.PRODUCTCODE = main.EPIDERMISCODE;
|
|
outrecorder.PROCESSTYPE = main.CURRENTPROCESS;
|
|
outrecorder.COUNT = 1;
|
|
outrecorder.STATUS = main.STATUS;
|
|
outrecorder.MACHINECODDE = main.MACHINECODDE;
|
|
outrecorder.PRODUCESHIFTTCODE = main.PRODUCESHIFTTCODE;
|
|
outrecorder.PRODUCESHIFTNAME = main.PRODUCESHIFTNAME;
|
|
outrecorder.PRODUCELINE = main.PRODUCELINE;
|
|
outrecorder.OUTTIME = DateTime.Now;
|
|
outrecorder.CREATEUSER = LoginUser.UserID;
|
|
outrecorder.CREATEDATE = DateTime.Now;
|
|
outrecorder.UPDATEUSER = outrecorder.CREATEUSER;
|
|
outrecorder.UPDATEDATE = outrecorder.CREATEDATE;
|
|
#endregion
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
mainDal.BaseSession = session;
|
|
outWarehouseDal.BaseSession = session;
|
|
|
|
session.OpenCon();
|
|
//更新本体出库标记
|
|
count = new MainDAL().Update(main);
|
|
//插入出库记录
|
|
count = outWarehouseDal.Insert(outrecorder);
|
|
session.CommitTs();
|
|
}
|
|
if (count == 0)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.OutWarehouseIsNotSuccess;
|
|
return result;
|
|
}
|
|
result.IsSuccess = true;
|
|
result.Msg = Resource.OutWarehouseIsSuccess;
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "出库(工控机)逻辑层-出库条码校验(工控机)!"
|
|
});
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 获取零件信息
|
|
/// <summary>
|
|
/// 获取零件信息
|
|
/// </summary>
|
|
/// <param name="product">条件</param>
|
|
public DataResult<Product> GetProductInfo(Product product)
|
|
{
|
|
DataResult<Product> result = new DataResult<Product>();
|
|
List<Product> listProduct = new List<Product>();
|
|
|
|
try
|
|
{
|
|
listProduct = new ProductDAL().GetList(product);
|
|
if (listProduct.Count == 0)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.OperationProNotFound;
|
|
return result;
|
|
}
|
|
product = listProduct[0];
|
|
|
|
#region 转换零件状态、当前工序、零件类别、零件状态显示类型
|
|
DictManageBLL dictOutFlagBll = new DictManageBLL(DictKind.OUTFLAG);
|
|
DictManageBLL dictProcessTypeBll = new DictManageBLL(DictKind.PROCESSTYPE);
|
|
DictManageBLL dictProductTypeBll = new DictManageBLL(DictKind.PRODUCTTYPE);
|
|
DictManageBLL dictProductStatusBll = new DictManageBLL(DictKind.PRODUCTSTATUS);
|
|
|
|
//出库状态
|
|
product.OUTFLAGNAME = dictOutFlagBll.GetDictValue(product.OUTFLAG);
|
|
//当前工序
|
|
product.CURRENTPROCESSNAME = dictProcessTypeBll.GetDictValue(product.CURRENTPROCESS);
|
|
//零件类别
|
|
product.PRODUCTTYPENAME = dictProductTypeBll.GetDictValue(product.PRODUCTTYPE);
|
|
//零件状态
|
|
product.STATUSNAME = dictProductStatusBll.GetDictValue(product.STATUS);
|
|
|
|
#endregion
|
|
|
|
result.Result = listProduct[0];
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "出库(工控机)逻辑层-获取零件信息!"
|
|
});
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取本体信息
|
|
/// <summary>
|
|
/// 获取本体信息
|
|
/// </summary>
|
|
/// <param name="product">条件</param>
|
|
public DataResult<Main> GetMainInfo(Main main)
|
|
{
|
|
DataResult<Main> result = new DataResult<Main>();
|
|
try
|
|
{
|
|
main = new MainDAL().GetMainForOutwarehouse(main);
|
|
if (main==null)
|
|
{
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.OperationMainNotFound;
|
|
return result;
|
|
}
|
|
|
|
#region 转换零件状态、当前工序、零件类别显示类型
|
|
DictManageBLL dictOutFlagBll = new DictManageBLL(DictKind.OUTFLAG);
|
|
DictManageBLL dictProcessTypeBll = new DictManageBLL(DictKind.PROCESSTYPE);
|
|
DictManageBLL dictProductTypeBll = new DictManageBLL(DictKind.PRODUCTTYPE);
|
|
DictManageBLL dictProductStatusBll = new DictManageBLL(DictKind.PRODUCTSTATUS);
|
|
|
|
//出库状态
|
|
main.OUTFLAGNAME = dictOutFlagBll.GetDictValue(main.OUTFLAG);
|
|
//当前工序
|
|
main.CURRENTPROCESSNAME = dictProcessTypeBll.GetDictValue(main.CURRENTPROCESS);
|
|
//零件类别
|
|
main.PRODUCTTYPENAME = dictProductTypeBll.GetDictValue(EnumGeter.ProductType.biaopi.GetHashCode().ToString());
|
|
//零件状态
|
|
main.STATUSNAME = dictProductStatusBll.GetDictValue(main.STATUS);
|
|
|
|
#endregion
|
|
|
|
result.Result = main;
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "出库(工控机)逻辑层-获取本体信息!"
|
|
});
|
|
result.IsSuccess = false;
|
|
result.Msg = Resource.SystemException;
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|