385 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			385 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockOutRequest;
 | |
| using DeiNiu.wms.win.portalService;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockOutPickRequest;
 | |
| using DeiNiu.wms.win.ServiceCustomer;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockLocation;
 | |
| using DeiNiu.wms.win.ServiceReferenceLot;
 | |
| using DeiNiu.wms.win.ServiceReferenceOwner;
 | |
| using DeiNiu.wms.win.ServiceReferenceVender;
 | |
| using DeiNiu.wms.win.ServiceReferenceStockInRequest;
 | |
| using DeiNiu.wms.win.TMService;
 | |
| using DeiNiu.wms.win.ViechleService;
 | |
| using DeiNiu.wms.win.waveRuleService;
 | |
| using System.ServiceModel;
 | |
| 
 | |
| namespace DeiNiu.wms.win
 | |
| {
 | |
|     public partial class FormBase : DevExpress.XtraBars.Ribbon.RibbonForm
 | |
|     {
 | |
| 
 | |
|         protected string buildSvrAddress(string svrName)
 | |
|         {
 | |
|             return string.Format("http://{0}/{1}", Park.svrUrl, svrName);
 | |
|         }
 | |
|         PortalClient _pclient;
 | |
|         protected PortalClient pclient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_pclient == null)
 | |
|                     _pclient = new PortalClient("BasicHttpBinding_IPortal",
 | |
|                           string.Format("http://{0}/{1}", Park.svrMgrUrl, "PortalService.svc")
 | |
|                           );
 | |
| 
 | |
|                 return _pclient;
 | |
|             }
 | |
|         }
 | |
|         protected string buildSvrMgrAddress(string svrName)
 | |
|         {
 | |
|             return string.Format("http://{0}/{1}", Park.svrUrl, svrName);
 | |
|         }
 | |
|         WmsOutRequestClient _outClient;
 | |
|         protected WmsOutRequestClient outClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_outClient == null)
 | |
|                 {
 | |
|                     _outClient = new WmsOutRequestClient("BasicHttpBinding_IWmsOutRequest",
 | |
|                       buildSvrAddress("WmsOutRequestService.svc"));
 | |
|                 }
 | |
|                 return _outClient;
 | |
|             }
 | |
|         }
 | |
|      
 | |
|         DeiNiu.wms.win.ServiceCustomer.CustomerClient _custClient;
 | |
|         protected DeiNiu.wms.win.ServiceCustomer.CustomerClient custClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_custClient == null)
 | |
|                 {
 | |
|                     _custClient = new CustomerClient("BasicHttpBinding_ICustomer",
 | |
|                        buildSvrAddress("CustomerService.svc"));
 | |
|                 }
 | |
|                 return _custClient;
 | |
|             }
 | |
|         }
 | |
|         ServiceReferenceGoods.GoodsClient _goodClient;
 | |
|         protected ServiceReferenceGoods.GoodsClient goodClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_goodClient == null)
 | |
|                 {
 | |
|                     _goodClient = new ServiceReferenceGoods.GoodsClient("BasicHttpBinding_IGoods",
 | |
|                      buildSvrAddress("GoodsService.svc"));
 | |
|                 }
 | |
|                 return _goodClient;
 | |
| 
 | |
|             }
 | |
|         }
 | |
|         StockLocationServiceClient _stkLocClient;
 | |
|         protected StockLocationServiceClient stkLocClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_stkLocClient == null)
 | |
|                 {
 | |
|                     _stkLocClient = new StockLocationServiceClient("BasicHttpBinding_IStockLocationService",
 | |
|                 buildSvrAddress("StockLocationService.svc"));
 | |
|                     //return new StockLocationServiceClient();
 | |
|                 }
 | |
|                 return _stkLocClient;
 | |
|             }
 | |
|         }
 | |
|         LotServiceClient _lotClient;
 | |
|         protected LotServiceClient lotClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                /* if (_lotClient == null)
 | |
|                 {
 | |
|                     _lotClient = new LotServiceClient("BasicHttpBinding_ILotService",
 | |
|                    buildSvrAddress("LotService.svc"));
 | |
|                 }
 | |
|                 return _lotClient;
 | |
|                 */
 | |
|                 try
 | |
|                 {
 | |
|                     if (_lotClient != null && _lotClient.State == CommunicationState.Opened)
 | |
|                     {
 | |
|                         return _lotClient;
 | |
|                     }
 | |
| 
 | |
|                     if (_lotClient == null || _lotClient.State != CommunicationState.Opened)
 | |
|                     {
 | |
|                         _lotClient = new LotServiceClient("BasicHttpBinding_ILotService",
 | |
|                         buildSvrAddress("LotService.svc"));
 | |
|                     }
 | |
| 
 | |
|                 }
 | |
|                 catch
 | |
|                 {
 | |
|                     _lotClient = new LotServiceClient("BasicHttpBinding_ILotService",
 | |
|                   buildSvrAddress("LotService.svc"));
 | |
|                 }
 | |
|                 return _lotClient;
 | |
| 
 | |
|             }
 | |
|         }
 | |
|         OwnerClient _ownerClient;
 | |
|         protected OwnerClient ownerClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_ownerClient == null)
 | |
|                 {
 | |
|                     _ownerClient = new OwnerClient("BasicHttpBinding_IOwner",
 | |
|                  buildSvrAddress("OwnerService.svc"));
 | |
|                 }
 | |
|                 return _ownerClient;
 | |
|             }
 | |
|         }
 | |
|         Erp_bussinessDocClient _docClient;
 | |
|         protected Erp_bussinessDocClient docClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_docClient == null)
 | |
|                 {
 | |
|                     _docClient = new Erp_bussinessDocClient("BasicHttpBinding_IErp_bussinessDoc",
 | |
|                 buildSvrAddress("Erp_bussinessDocService.svc"));
 | |
|                 } return _docClient;
 | |
|             }
 | |
|         }
 | |
|         WmsInRequestClient _inClient;
 | |
|         protected WmsInRequestClient inClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_inClient == null)
 | |
|                 {
 | |
|                     _inClient = new WmsInRequestClient("BasicHttpBinding_IWmsInRequest",
 | |
|                         buildSvrAddress("WmsInRequestService.svc"));
 | |
|                 }
 | |
|                 return _inClient;
 | |
|             }
 | |
|         }
 | |
|        
 | |
|         ViechleClient _vclient;
 | |
|         protected ViechleClient vclient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_vclient == null)
 | |
|                 {
 | |
|                     _vclient = new ViechleService.ViechleClient("BasicHttpBinding_IViechle",
 | |
|                         buildSvrAddress("Viechle.svc"));
 | |
|                 }
 | |
|                 return _vclient;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         WaveRuleClient _wrClient;
 | |
|         protected WaveRuleClient wrClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 if (_wrClient == null)
 | |
|                 {
 | |
|                     _wrClient = new WaveRuleClient("BasicHttpBinding_IWaveRule",
 | |
|                        buildSvrAddress("WaveRuleService.svc"));
 | |
|                 }
 | |
|                 return _wrClient;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
|         WmsOutPickRequestClient _pickClient;
 | |
|         protected WmsOutPickRequestClient pickClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 /*
 | |
|                 if (_pickClient != null)
 | |
|                 {
 | |
|                     _pickClient.Close();
 | |
|                 }
 | |
|                 */
 | |
|                 try
 | |
|                 {
 | |
|                     if (_pickClient != null && _pickClient.State == CommunicationState.Opened)
 | |
|                     {
 | |
|                         return _pickClient;
 | |
|                     }
 | |
| 
 | |
|                     if (_pickClient == null || _pickClient.State != CommunicationState.Opened)
 | |
|                     {
 | |
|                         _pickClient = new WmsOutPickRequestClient("BasicHttpBinding_IWmsOutPickRequest",
 | |
|                          buildSvrAddress("WmsOutPickRequestService.svc"));
 | |
|                     }
 | |
|                    
 | |
|                 }
 | |
|                 catch
 | |
|                 {
 | |
|                     _pickClient = new WmsOutPickRequestClient("BasicHttpBinding_IWmsOutPickRequest",
 | |
|                        buildSvrAddress("WmsOutPickRequestService.svc"));
 | |
|                 }
 | |
|                 return _pickClient;
 | |
|             }
 | |
|         }
 | |
|         TMService.TMServiceClient _tmsClient;
 | |
|         protected TMServiceClient  tmsClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
| 
 | |
|                 if (_tmsClient == null || _tmsClient.State != CommunicationState.Opened)
 | |
|                 {
 | |
|                     _tmsClient = new TMServiceClient("BasicHttpBinding_ITMService",
 | |
|                      buildSvrAddress("TMService.svc"));
 | |
|                 }
 | |
|                 return _tmsClient;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         OrderService.WmsOrderRequestClient  _orderClient;
 | |
|         protected OrderService.WmsOrderRequestClient orderClient
 | |
|         {
 | |
|             get
 | |
|             {
 | |
| 
 | |
|                 if (_orderClient == null || _orderClient.State != CommunicationState.Opened)
 | |
|                 {
 | |
|                     _orderClient = new OrderService.WmsOrderRequestClient("BasicHttpBinding_IWmsOrderRequest",
 | |
|                      buildSvrAddress("WmsOrderRequestService.svc"));
 | |
|                 }
 | |
|                 return _orderClient;
 | |
|             }
 | |
|         }
 | |
|         FlowService.WmsFlowClient  _taskClient;
 | |
|         protected FlowService.WmsFlowClient taskClient
 | |
|         {
 | |
|             get
 | |
|             { 
 | |
|                 if (_taskClient == null || _taskClient.State != CommunicationState.Opened)
 | |
|                 {
 | |
|                     _taskClient = new FlowService.WmsFlowClient("BasicHttpBinding_IWmsFlow",
 | |
|                      buildSvrAddress("WmsFlowService.svc"));
 | |
|                 }
 | |
|                 return _taskClient;
 | |
|             }
 | |
|         } 
 | |
| 
 | |
|         protected void closeClient2(System.ServiceModel.ClientBase<IWmsOutPickRequest> client)
 | |
|         {
 | |
| 
 | |
|         }
 | |
|         protected void closeClient()
 | |
|         {
 | |
|             if (_pickClient != null)
 | |
|             {
 | |
|                 _pickClient.Close();
 | |
|                 //   _pickClient = null;
 | |
|             }
 | |
|             if (_taskClient != null)
 | |
|             {
 | |
|                 _taskClient.Close();
 | |
|                 //   _pickClient = null;
 | |
|             }
 | |
|             if (_orderClient != null)
 | |
|             {
 | |
|                 _orderClient.Close();
 | |
|                 //   _pickClient = null;
 | |
|             }
 | |
|             if (_wrClient != null)
 | |
|             {
 | |
|                 _wrClient.Close();
 | |
|                 _wrClient = null;
 | |
|             }
 | |
|             if (_vclient != null)
 | |
|             {
 | |
|                 _vclient.Close();
 | |
|                 _vclient = null;
 | |
|             }
 | |
| 
 | |
|             if (_tmsClient != null)
 | |
|             {
 | |
|                 _tmsClient.Close();
 | |
|                 _tmsClient = null;
 | |
|             }
 | |
| 
 | |
|             if (_inClient != null)
 | |
|             {
 | |
|                 _inClient.Close();
 | |
|                 _inClient = null;
 | |
|             }
 | |
| 
 | |
|             if (_docClient != null)
 | |
|             {
 | |
|                 _docClient.Close();
 | |
|                 _docClient = null;
 | |
|             }
 | |
| 
 | |
|             if (_ownerClient != null)
 | |
|             {
 | |
|                 _ownerClient.Close();
 | |
|                 _ownerClient = null;
 | |
|             }
 | |
|             if (_outClient != null)
 | |
|             {
 | |
|                 _outClient.Close();
 | |
|                 _outClient = null;
 | |
|             }
 | |
|            
 | |
|             if (_pclient != null)
 | |
|             {
 | |
|                 _pclient.Close();
 | |
|                 _pclient = null;
 | |
|             }
 | |
|             if (_custClient != null)
 | |
|             {
 | |
|                 _custClient.Close();
 | |
|                 _custClient = null;
 | |
|             }
 | |
|             if (_goodClient != null)
 | |
|             {
 | |
|                 _goodClient.Close();
 | |
|                 _goodClient = null;
 | |
|             }
 | |
|             if (_stkLocClient != null)
 | |
|             {
 | |
|                 _stkLocClient.Close();
 | |
|                 _stkLocClient = null;
 | |
|             }
 | |
|             if (_lotClient != null)
 | |
|             {
 | |
|                 _lotClient.Close();
 | |
|                 _lotClient = null;
 | |
|             }
 | |
| 
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|         public FormBase()
 | |
|         {
 | |
|             InitializeComponent();
 | |
|         }
 | |
|     }
 | |
| }
 |