138 lines
4.3 KiB
C#
138 lines
4.3 KiB
C#
|
/// <summary>
|
|||
|
///WCF service
|
|||
|
///FOR TABLE t_erp_packing
|
|||
|
///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_ERP_PACKING : IErp_packing
|
|||
|
{
|
|||
|
#region options
|
|||
|
/*: basicService,
|
|||
|
private static lErp_packing _lErp_packing ;
|
|||
|
lErp_packing lErp_packingObj
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if ( _lErp_packing == null || _lErp_packing.operId != getOperId())
|
|||
|
{
|
|||
|
_lErp_packing= new lErp_packing(getOperId());
|
|||
|
}
|
|||
|
return _lErp_packing;
|
|||
|
}
|
|||
|
}
|
|||
|
*/
|
|||
|
#endregion
|
|||
|
|
|||
|
public enumDbResult add(WcfErp_packing obj)
|
|||
|
{
|
|||
|
return obj.getDbObject().Add()>0? enumDbResult.成功: enumDbResult.失败;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public enumDbResult update(WcfErp_packing obj)
|
|||
|
{
|
|||
|
return obj.getDbObject().Update()>0? enumDbResult.成功: enumDbResult.失败;
|
|||
|
}
|
|||
|
|
|||
|
public enumDbResult delete(WcfErp_packing obj)
|
|||
|
{
|
|||
|
return obj.getDbObject().Delete()>0? enumDbResult.成功: enumDbResult.失败;
|
|||
|
}
|
|||
|
#region options
|
|||
|
/*
|
|||
|
public List<Result> updateList(List<WcfErp_packing> objs)
|
|||
|
{
|
|||
|
|
|||
|
List<Result> results = new List<Result>();
|
|||
|
// using (TransactionScope scope = new TransactionScope())
|
|||
|
{
|
|||
|
foreach (WcfErp_packing obj in objs)
|
|||
|
{
|
|||
|
Result rs = new Result(obj.id, obj.getDbObject().Update());
|
|||
|
results.Add(rs);
|
|||
|
|
|||
|
}
|
|||
|
// scope.Complete();
|
|||
|
}
|
|||
|
return results;
|
|||
|
}
|
|||
|
|
|||
|
public List<Result> addList(List<WcfErp_packing> objs)
|
|||
|
{
|
|||
|
|
|||
|
List<Result> results = new List<Result>();
|
|||
|
// using (TransactionScope scope = new TransactionScope())
|
|||
|
{
|
|||
|
foreach (WcfErp_packing obj in objs)
|
|||
|
{
|
|||
|
Result rs = new Result( obj.getDbObject().Add(),1);
|
|||
|
results.Add(rs);
|
|||
|
|
|||
|
}
|
|||
|
// scope.Complete();
|
|||
|
}
|
|||
|
return results;
|
|||
|
}
|
|||
|
|
|||
|
public List<Result> deleteList(List<WcfErp_packing> objs)
|
|||
|
{
|
|||
|
|
|||
|
List<Result> results = new List<Result>();
|
|||
|
// using (TransactionScope scope = new TransactionScope())
|
|||
|
{
|
|||
|
foreach (WcfErp_packing obj in objs)
|
|||
|
{
|
|||
|
Result rs = new Result(obj.id, obj.getDbObject().Delete());
|
|||
|
results.Add(rs);
|
|||
|
|
|||
|
}
|
|||
|
// scope.Complete();
|
|||
|
}
|
|||
|
return results;
|
|||
|
}*/
|
|||
|
#endregion
|
|||
|
public WcfErp_packing getObj(int Id)
|
|||
|
{
|
|||
|
WcfErp_packing wcfObj = new WcfErp_packing ();
|
|||
|
Erp_packing dbObj = new Erp_packing(Id);
|
|||
|
return wcfObj.getWcfObject(dbObj);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public WcfErp_packingList query(string condition, int pageno)
|
|||
|
{
|
|||
|
condition = string.IsNullOrEmpty(condition) ? "" : condition;
|
|||
|
WcfErp_packingList objLst = new WcfErp_packingList();
|
|||
|
List<WcfErp_packing> lst = new List<WcfErp_packing>();
|
|||
|
Erp_packing dbObj = new Erp_packing();
|
|||
|
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 WcfErp_packing(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;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|