189 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			189 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | /// <summary> | |||
|  | ///WCF service | |||
|  | ///FOR TABLE t_erp_receiveValidDetail | |||
|  | ///By wm   | |||
|  | ///on 06/06/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_RECEIVEVALIDDETAIL :baseSvc, IErp_receiveValidDetail  | |||
|  |     { | |||
|  |         #region options | |||
|  |       /*: basicService,  | |||
|  |         private static  lErp_receiveValidDetail  _lErp_receiveValidDetail ; | |||
|  |          lErp_receiveValidDetail  lErp_receiveValidDetailObj | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 if ( _lErp_receiveValidDetail  == null ||   _lErp_receiveValidDetail.operId != getOperId()) | |||
|  |                 { | |||
|  |                      _lErp_receiveValidDetail= new  lErp_receiveValidDetail(getOperId()); | |||
|  |                 } | |||
|  |                 return  _lErp_receiveValidDetail; | |||
|  |             } | |||
|  |         } | |||
|  |        */ | |||
|  |        #endregion  | |||
|  |         | |||
|  |          public WcfErp_receiveValidDetail getObj(int Id) | |||
|  |         { | |||
|  |             WcfErp_receiveValidDetail  wcfObj = new WcfErp_receiveValidDetail (); | |||
|  |             Erp_receiveValidDetail dbObj = new Erp_receiveValidDetail(Id); | |||
|  |             return wcfObj.getWcfObject(dbObj); | |||
|  |         } | |||
|  | 
 | |||
|  |         public  Result add(WcfErp_receiveValidDetail obj) | |||
|  |         { | |||
|  |             int id = 0; | |||
|  |             try | |||
|  |             {   | |||
|  |                 id= obj.getDbObject().Add(); | |||
|  |             } | |||
|  |             catch(Exception ex) | |||
|  |             { | |||
|  |                 return new Result(enumDbResult.失败,ex.Message); | |||
|  |             } | |||
|  | 
 | |||
|  |             return id>0?  new Result( id,enumDbResult.成功):new Result(enumDbResult.失败); | |||
|  |             | |||
|  |         } | |||
|  |     #region options | |||
|  |        /* | |||
|  |         public Result update(WcfErp_receiveValidDetail obj) | |||
|  |         { | |||
|  |             int cnt = 0; | |||
|  |             try {  | |||
|  |              | |||
|  |                 cnt = obj.getDbObject().Update(); | |||
|  | 
 | |||
|  |             }catch(Exception er) | |||
|  |             { | |||
|  |                 return new Result(enumDbResult.失败, er.Message); | |||
|  |             }  | |||
|  | 
 | |||
|  |             return new Result(cnt,  enumDbResult.成功); | |||
|  |             | |||
|  |         } | |||
|  | 
 | |||
|  |         public enumDbResult delete(WcfErp_receiveValidDetail obj) | |||
|  |         { | |||
|  |             int cnt = 0; | |||
|  |             try {  | |||
|  |              | |||
|  |                 cnt = obj.getDbObject().Delete(); | |||
|  | 
 | |||
|  |             }catch(Exception er) | |||
|  |             { | |||
|  |                 return new Result(enumDbResult.失败, er.Message); | |||
|  |             }  | |||
|  | 
 | |||
|  |             return new Result(cnt,  enumDbResult.成功); | |||
|  |         } | |||
|  |       | |||
|  |         public List<Result> updateList(List<WcfErp_receiveValidDetail> objs) | |||
|  |         { | |||
|  |               | |||
|  |             List<Result> results = new List<Result>(); | |||
|  |            // using (TransactionScope scope = new TransactionScope()) | |||
|  |             { | |||
|  |                 foreach (WcfErp_receiveValidDetail 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_receiveValidDetail> objs) | |||
|  |         { | |||
|  | 
 | |||
|  |             List<Result> results = new List<Result>(); | |||
|  |            // using (TransactionScope scope = new TransactionScope()) | |||
|  |             { | |||
|  |                 foreach (WcfErp_receiveValidDetail obj in objs) | |||
|  |                 { | |||
|  |                     Result rs = new Result( obj.getDbObject().Add(),1); | |||
|  |                     results.Add(rs); | |||
|  | 
 | |||
|  |                 } | |||
|  |               //  scope.Complete(); | |||
|  |             } | |||
|  |             return results; | |||
|  |         } | |||
|  | 
 | |||
|  |         public List<Result> deleteList(List<WcfErp_receiveValidDetail> objs) | |||
|  |         { | |||
|  | 
 | |||
|  |             List<Result> results = new List<Result>(); | |||
|  |            // using (TransactionScope scope = new TransactionScope()) | |||
|  |             { | |||
|  |                 foreach (WcfErp_receiveValidDetail obj in objs) | |||
|  |                 { | |||
|  |                     Result rs = new Result(obj.id, obj.getDbObject().Delete()); | |||
|  |                     results.Add(rs); | |||
|  | 
 | |||
|  |                 } | |||
|  |               //  scope.Complete(); | |||
|  |             } | |||
|  |             return results; | |||
|  |         }*/ | |||
|  |   #endregion  | |||
|  |       | |||
|  | 
 | |||
|  |          | |||
|  |         public WcfErp_receiveValidDetailList query(string condition, int pageno) | |||
|  |         { | |||
|  |              condition = filterRisk(condition); | |||
|  |             WcfErp_receiveValidDetailList objLst = new WcfErp_receiveValidDetailList(); | |||
|  |             List<WcfErp_receiveValidDetail> lst = new List<WcfErp_receiveValidDetail>(); | |||
|  |             Erp_receiveValidDetail dbObj = new   Erp_receiveValidDetail(); | |||
|  |             dbObj.rownumStart =(Convert.ToInt16(  pageno)-1)*  WmsConstants.PAGER_SIZE; | |||
|  |             dbObj.rownumEnd = dbObj.rownumStart + DeiNiu.Utils.WmsConstants.PAGER_SIZE; | |||
|  |             DataSet ds = dbObj.Query(condition);                      | |||
|  |             if (ds.Tables.Count >1) | |||
|  |             { | |||
|  |               DataTable dt = ds.Tables[0];     | |||
|  |                 foreach(DataRow dr in dt.Rows) | |||
|  |                 {  | |||
|  |                     lst.Add(new WcfErp_receiveValidDetail(dr)); | |||
|  |                 } | |||
|  |                 objLst.rows = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString()); | |||
|  |             } | |||
|  |             objLst.list =lst;  | |||
|  |             objLst.page = Convert.ToInt16(pageno); | |||
|  |             objLst.pageSize = WmsConstants.PAGER_SIZE; | |||
|  |              | |||
|  |             objLst.pageCnt = objLst.rows / WmsConstants.PAGER_SIZE; | |||
|  |             return objLst; | |||
|  |         } | |||
|  | 
 | |||
|  |         public List<WcfErp_receiveValidDetail> getInStockDetail(string preInOrder) | |||
|  |         { | |||
|  |             List<WcfErp_receiveValidDetail> lst = new List<WcfErp_receiveValidDetail>(); | |||
|  |             Erp_receiveValidDetail dbObj = new Erp_receiveValidDetail(); | |||
|  |             DataTable dt=   dbObj.getDetailByOrder(preInOrder); | |||
|  |   | |||
|  |             foreach (DataRow dr in dt.Rows) | |||
|  |             { | |||
|  |                 lst.Add(new WcfErp_receiveValidDetail(dr)); | |||
|  |             } | |||
|  | 
 | |||
|  |             return lst;  | |||
|  | 
 | |||
|  |         } | |||
|  |     } | |||
|  |  } |