159 lines
4.6 KiB
C#
159 lines
4.6 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using WMS.Model.CK;
|
|||
|
|
using System.Data;
|
|||
|
|
using WMS.IData;
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Model.SC;
|
|||
|
|
|
|||
|
|
namespace WMS.Business.SC
|
|||
|
|
{
|
|||
|
|
public class BussGoodsMaterial : IBussFactory
|
|||
|
|
{
|
|||
|
|
public void GetGoodsSts()
|
|||
|
|
{
|
|||
|
|
DataTable tb = DataProvider.Instance.Goods.GetGoodsSts();
|
|||
|
|
if(tb!=null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
foreach (DataRow row in tb.Rows)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
int a = GetCtGoodsMeaSure(row["GOODS_ID"].ToString());
|
|||
|
|
if (a > 0)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.Goods.UpGoodsCtData(row["GOODS_ID"].ToString());
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public int GetCtGoodsMeaSure(string goodsID)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DataTable tb= DataProvider.Instance.GoodsMeasure.GetCtGoodsMeaSure(goodsID);
|
|||
|
|
if(tb!=null)
|
|||
|
|
{
|
|||
|
|
if(tb.Rows.Count>0)
|
|||
|
|
{
|
|||
|
|
return int.Parse( tb.Rows[0]["a"].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取商品原材料对应关系
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns>商品原材料对应关系</returns>
|
|||
|
|
public List<GoodsMaterialModel> GetGoodsMaterialList(GoodsMaterialModel model)
|
|||
|
|
{
|
|||
|
|
List<GoodsMaterialModel> GoodsMaterialModel = new List<GoodsMaterialModel>();
|
|||
|
|
DataTable table = DataProvider.Instance.GoodsMaterial.GetGoodsMaterialDT(model);
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
GoodsMaterialModel = ConvertHelper<GoodsMaterialModel>.ConvertToList(table);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return GoodsMaterialModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public List<GoodsMaterialModel> GetGoodsMaterialNew()
|
|||
|
|
{
|
|||
|
|
List<GoodsMaterialModel> GoodsMaterialModel = new List<GoodsMaterialModel>();
|
|||
|
|
DataTable table = DataProvider.Instance.GoodsMaterial.GetGoodsMaterialNew();
|
|||
|
|
if (table != null)
|
|||
|
|
{
|
|||
|
|
GoodsMaterialModel = ConvertHelper<GoodsMaterialModel>.ConvertToList(table);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return GoodsMaterialModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除商品原材料对应关系
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="ID">商品ID</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
public string DeleteGoodsMaterial(string ID)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.GoodsMaterial.DeleteGoodsMaterial(ID);
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增商品原材料对应关系
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="listGoodsMaterial">商品原材料对应关系List</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
public string InsertGoodsMaterial(List<GoodsMaterialModel> listGoodsMaterial)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
|
|||
|
|
//foreach (GoodsMaterialModel model in listGoodsMaterial)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
int a= GetCtGoodsMeaSure(listGoodsMaterial[0].GOODS_ID);
|
|||
|
|
if(a>0)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.Goods.UpGoodsCtData(listGoodsMaterial[0].GOODS_ID);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//增加明细
|
|||
|
|
|
|||
|
|
foreach (GoodsMaterialModel model in listGoodsMaterial)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.GoodsMaterial.InsertGoodsMaterial(model);
|
|||
|
|
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
|
|||
|
|
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 修改商品原材料对应关系
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="listGoodsMaterial">商品原材料对应关系List</param>
|
|||
|
|
/// <returns>是否成功</returns>
|
|||
|
|
public string UpdateGoodsMaterial(List<GoodsMaterialModel> listGoodsMaterial)
|
|||
|
|
{
|
|||
|
|
//删除所有明细
|
|||
|
|
DataProvider.Instance.GoodsMaterial.DeleteGoodsMaterial(listGoodsMaterial[0].GOODS_ID);
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
|
|||
|
|
Transaction = DataProvider.Instance.TranOracle;
|
|||
|
|
|
|||
|
|
//增加明细
|
|||
|
|
foreach (GoodsMaterialModel model in listGoodsMaterial)
|
|||
|
|
{
|
|||
|
|
DataProvider.Instance.GoodsMaterial.InsertGoodsMaterial(model);
|
|||
|
|
|
|||
|
|
logList.Add(DataProvider.Instance.logData);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
TaCmtOrRak();
|
|||
|
|
return ErrText;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|