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.
205 lines
6.1 KiB
205 lines
6.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using QMFrameWork.Data;
|
|
using QMAPP.FJC.Entity.Operation;
|
|
using QMAPP.FJC.DAL.Operation;
|
|
using QMAPP.FJC.BLL.Dict;
|
|
using QMAPP.BLL;
|
|
using QMAPP.Entity;
|
|
using QMAPP.FJC.Entity;
|
|
using QMFrameWork.Log;
|
|
using System.Data;
|
|
|
|
namespace QMAPP.FJC.BLL.Operation
|
|
{
|
|
public class ProductOutBLL : BaseBLL
|
|
{
|
|
#region 获取列表
|
|
/// <summary>
|
|
/// 获取列表
|
|
/// </summary>
|
|
/// <param name="condition">条件</param>
|
|
/// <param name="page">数据页</param>
|
|
/// <returns>数据页</returns>
|
|
public DataResult<DataPage> GetInfoList(ProductOut condition, DataPage page)
|
|
{
|
|
DataResult<DataPage> result = new DataResult<DataPage>();
|
|
try
|
|
{
|
|
DataPage dataPage = new ProductOutDAL().GetList(condition, page);
|
|
|
|
List<ProductOut> list = dataPage.Result as List<ProductOut>;
|
|
|
|
#region 显示类型
|
|
//处理字典信息
|
|
DictManageBLL dictOUTREASON = new DictManageBLL(DictKind.OUTREASON);
|
|
foreach (var info in list)
|
|
{
|
|
info.OUTREASON = dictOUTREASON.GetDictValue(info.OUTREASON);
|
|
}
|
|
#endregion
|
|
|
|
page.Result = list;
|
|
|
|
result.Result = dataPage;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
result.IsSuccess = true;
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Form获取列表
|
|
/// </summary>
|
|
/// <param name="condition">条件</param>
|
|
/// <param name="page">数据页</param>
|
|
/// <returns>数据页</returns>
|
|
public DataPage GetList(ProductOut condition, DataPage page)
|
|
{
|
|
try
|
|
{
|
|
page = new ProductOutDAL().GetList(condition, page);
|
|
|
|
List<ProductOut> list = page.Result as List<ProductOut>;
|
|
|
|
page.Result = list;
|
|
|
|
return page;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 导出数据
|
|
/// <summary>
|
|
/// 获取导出的数据
|
|
/// </summary>
|
|
/// <param name="user">查询条件</param>
|
|
/// <returns>数据</returns>
|
|
public DataTable GetExportData(ProductOut model)
|
|
{
|
|
try
|
|
{
|
|
DataTable dt = new ProductOutDAL().GetExportData(model);
|
|
|
|
//处理字典信息
|
|
DictManageBLL dictOUTREASON = new DictManageBLL(DictKind.OUTREASON);
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
//替换状态类别显示值
|
|
dr["OUTREASON"] = dictOUTREASON.GetDictValue(dr["OUTREASON"].ToString());
|
|
}
|
|
//根据所选信息进行导出
|
|
if (string.IsNullOrEmpty(model.PIDList) == false)
|
|
{
|
|
model.PIDList = "'" + model.PIDList.Replace(":", "','") + "'";
|
|
DataView dv = new DataView(dt);
|
|
dv.RowFilter = "PID in (" + model.PIDList + ")";
|
|
dt = dv.ToTable();
|
|
}
|
|
return dt;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 更新产品表信息(出库状态)
|
|
/// <summary>
|
|
/// 更新产品表信息(出库状态)
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public DataResult<int> InsertProductOut(ProductOut model)
|
|
{
|
|
DataResult<int> result = new DataResult<int>();
|
|
Product productinfo = new Product();
|
|
|
|
try
|
|
{
|
|
//基本信息
|
|
model.UPDATEUSER = model.CREATEUSER;
|
|
model.UPDATEDATE = model.CREATEDATE;
|
|
|
|
foreach (var item in model.productList)
|
|
{
|
|
item.OUTFLAG = EnumGeter.OUTFLAG.OUTWAREHOUSE.GetHashCode().ToString();
|
|
}
|
|
result.Result = new ProductOutDAL().InsertProductOut(model);
|
|
result.IsSuccess = true;
|
|
result.Msg = "操作成功!";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogHelper.Error(new LogInfo()
|
|
{
|
|
ErrorInfo = ex,
|
|
Tag = ex.StackTrace,
|
|
Info = "产品表更新插入异常!"
|
|
});
|
|
result.IsSuccess = false;
|
|
result.Ex = ex;
|
|
}
|
|
return result;
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 获取出库原因列表(winform使用)
|
|
/// <summary>
|
|
/// 获取出库原因列表(winform使用)
|
|
/// </summary>
|
|
/// <param name="condition"></param>
|
|
/// <returns></returns>
|
|
public List<OutReason> GetOutReasonList(OutReason condition)
|
|
{
|
|
List<OutReason> result = new List<OutReason>();
|
|
try
|
|
{
|
|
List<OutReason> list = new ProductOutDAL().GetOutReasonList(condition);
|
|
return list;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取每种零件号的出库数量
|
|
|
|
/// <summary>
|
|
/// 获取出库数量
|
|
/// </summary>
|
|
/// <param name="materialCode"></param>
|
|
/// <returns></returns>
|
|
public int GetProductOutConut(string materialCode)
|
|
{
|
|
|
|
int materialCount = 0;
|
|
string sql = string.Format("select count(1) from T_AW_PRODUCTOUT where MATERIAL_CODE='{0}'", materialCode);
|
|
using (IDataSession session = AppDataFactory.CreateMainSession())
|
|
{
|
|
materialCount = Convert.ToInt32(session.ExecuteSqlScalar(sql, new List<DataParameter>().ToArray()));
|
|
}
|
|
return materialCount;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
}
|
|
|