ldj/WcfServiceErp/T_ERPGOODS.svc.cs

151 lines
4.5 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00
/// <summary>
///WCF service
///FOR TABLE t_erpGoods
///By wm
///on 05/10/2023
/// </summary>
using System.Collections.Generic;
using System.Data;
using DeiNiu.wms.Data.Model.Wcf ;
using DeiNiu.wms.Data.Model;
using System.Transactions;
using DeiNiu.Utils;
using System;
using DeiNiu.Wcf.erp.wcfData;
namespace DeiNiu.Wcf
{
// 注意: 使用“重构”菜单上的“重命名”命令可以同时更改代码、svc 和配置文件中的类名 。
public class T_ERPGOODS : IErpGoods
{
#region options
/*: basicService,
private static lErpGoods _lErpGoods ;
lErpGoods lErpGoodsObj
{
get
{
if ( _lErpGoods == null || _lErpGoods.operId != getOperId())
{
_lErpGoods= new lErpGoods(getOperId());
}
return _lErpGoods;
}
}
*/
#endregion
public enumDbResult add(WcfErpGoods obj)
{
try
{
WmsGoods goods = new WmsGoods();
goods.goodsId = obj.goodsId;
goods.bigCount = obj.bigCount;
goods.Add();
obj.getDbObject().Add();
}
catch
{
return enumDbResult.;
}
return enumDbResult. ;
}
public enumDbResult update(WcfErpGoods obj)
{
return obj.getDbObject().Update()>0? enumDbResult.: enumDbResult.;
}
public enumDbResult delete(WcfErpGoods obj)
{
return obj.getDbObject().Delete()>0? enumDbResult.: enumDbResult.;
}
#region options
/*
public List<Result> updateList(List<WcfErpGoods> objs)
{
List<Result> results = new List<Result>();
// using (TransactionScope scope = new TransactionScope())
{
foreach (WcfErpGoods obj in objs)
{
Result rs = new Result(obj.id, obj.getDbObject().Update());
results.Add(rs);
}
// scope.Complete();
}
return results;
}
public List<Result> addList(List<WcfErpGoods> objs)
{
List<Result> results = new List<Result>();
// using (TransactionScope scope = new TransactionScope())
{
foreach (WcfErpGoods obj in objs)
{
Result rs = new Result( obj.getDbObject().Add(),1);
results.Add(rs);
}
// scope.Complete();
}
return results;
}
public List<Result> deleteList(List<WcfErpGoods> objs)
{
List<Result> results = new List<Result>();
// using (TransactionScope scope = new TransactionScope())
{
foreach (WcfErpGoods obj in objs)
{
Result rs = new Result(obj.id, obj.getDbObject().Delete());
results.Add(rs);
}
// scope.Complete();
}
return results;
}*/
#endregion
public WcfErpGoods getObj(string goodsId)
{
WcfErpGoods wcfObj = new WcfErpGoods ();
ErpGoods dbObj = new ErpGoods(goodsId);
return wcfObj.getWcfObject(dbObj);
}
public WcfErpGoodsList query(string condition, int pageno)
{
condition = string.IsNullOrEmpty(condition) ? "" : condition;
WcfErpGoodsList objLst = new WcfErpGoodsList();
List<WcfErpGoods> lst = new List<WcfErpGoods>();
ErpGoods dbObj = new ErpGoods();
dbObj.rownumStart =(Convert.ToInt16( pageno)-1)* WmsConstants.PAGER_SIZE;
dbObj.rownumEnd = dbObj.rownumStart + DeiNiu.Utils.WmsConstants.PAGER_SIZE;
DataSet ds = dbObj.Query(condition);
DataTable dt = ds.Tables[0];
foreach(DataRow dr in dt.Rows)
{
lst.Add(new WcfErpGoods(dr));
}
objLst.list =lst;
objLst.page = Convert.ToInt16(pageno);
objLst.pageSize = WmsConstants.PAGER_SIZE;
objLst.rows = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
objLst.pageCnt = objLst.rows / WmsConstants.PAGER_SIZE;
return objLst;
}
}
}