天津投入产出系统后端
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.

150 lines
4.7 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Ref:
using System.Data;
using QMAPP.BoraUpgrade.DAL;
using QMAPP.BoraUpgrade.Entity;
namespace QMAPP.BoraUpgrade.BLL
{
public class ProductHelper
{
/// <summary>
/// 新增产品信息
/// </summary>
/// <param name="eProduct">产品实例</param>
/// <returns>成功 True 否则 False</returns>
public static bool Insert(T_AW_PRODUCT eProduct)
{
bool returnVal = false;
returnVal = ProductDataAccess.Insert(eProduct);
return returnVal;
}
public static int GetIsMilling(string productCode)
{
return ProductDataAccess.GetIsMilling(productCode);
}
/// <summary>
/// 根据ProductCode提取产品实例
/// </summary>
/// <param name="productCode">产品编号</param>
/// <returns></returns>
public static T_AW_PRODUCT GetProductByProductCode(string productCode)
{
T_AW_PRODUCT returnVal = null;
DataTable dataSrouce = ProductDataAccess.GetProductByProductCode(productCode);
if (dataSrouce.Rows.Count > 0)
{
returnVal = new T_AW_PRODUCT();
DataRow fristDataRow = dataSrouce.Rows[0];
returnVal.PID = fristDataRow[0].ToString();
returnVal.PRODUCTCODE = fristDataRow[2].ToString();
returnVal.MATERIAL_CODE = fristDataRow[6].ToString();
returnVal.PLAN_NO = fristDataRow[27].ToString();
returnVal.USINGCOUNT = int.Parse(fristDataRow["USINGCOUNT"].ToString());
returnVal.USINGSTATE = fristDataRow["USINGSTATE"].ToString();
}
return returnVal;
}
public static T_AW_PRODUCT GetProductByLoc(string productCode, string locCode)
{
T_AW_PRODUCT returnVal = null;
DataTable dataSrouce = ProductDataAccess.GetProductByLocCode(productCode, locCode);
if (dataSrouce.Rows.Count > 0)
{
returnVal = new T_AW_PRODUCT();
DataRow fristDataRow = dataSrouce.Rows[0];
returnVal.PID = fristDataRow["PID"].ToString();
returnVal.PRODUCTCODE = fristDataRow["PRODUCTCODE"].ToString();
returnVal.MATERIAL_CODE = fristDataRow["MATERIAL_CODE"].ToString();
returnVal.STATUS = fristDataRow["STATUS"].ToString();
returnVal.USINGSTATE = fristDataRow["USINGSTATE"].ToString();
returnVal.WORKCELL_CODE = fristDataRow["WORKCELL_CODE"].ToString();
returnVal.WORKLOC_CODE = fristDataRow["WORKLOC_CODE"].ToString();
returnVal.MACHINECODDE = fristDataRow["MACHINECODDE"].ToString();
if (!string.IsNullOrEmpty(fristDataRow["UPDATEDATE"].ToString()))
returnVal.UPDATEDATE = DateTime.Parse(fristDataRow["UPDATEDATE"].ToString());
if (!string.IsNullOrEmpty(fristDataRow["CREATEDATE"].ToString()))
returnVal.CREATEDATE = DateTime.Parse(fristDataRow["CREATEDATE"].ToString());
}
return returnVal;
}
public static DataTable GetBora3MCodes(string pMaterialCode)
{
return ProductDataAccess.GetBora3MCodes(pMaterialCode);
}
/// <summary>
/// 宝来3.0洗削后,将产品物料号,从宝来3.0的新物料号改回原物料号
/// </summary>
/// <param name="productCode">产品条码</param>
/// <param name="mCode">宝来物料号</param>
/// <param name="bora3MCode">宝来3.0物料号</param>
public static bool UpdateProductMaterialCode(string productCode, string mCode, string bora3MCode)
{
return ProductDataAccess.UpdateProductMaterialCode(productCode, mCode, bora3MCode);
}
public static DateTime GetSerivceTime()
{
return ProductDataAccess.GetServiceDateTime();
}
#region 修改产品信息
/// <summary>
/// 修改产品信息
/// </summary>
/// <param name="eProduct">产品信息实例</param>
/// <returns>成功 True 否则 False</returns>
public static bool Update(T_AW_PRODUCT eProduct)
{
bool returnVal = false;
returnVal = ProductDataAccess.Update(eProduct);
return returnVal;
}
public static bool Modify(T_AW_PRODUCT eProduct)
{
bool returnVal = false;
returnVal = ProductDataAccess.Modify(eProduct);
return returnVal;
}
#endregion
}
}