ldj/WcfService1/ScheduledService.svc.cs

220 lines
5.3 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using DeiNiu.wms.Logical;
using System.Transactions;
using DeiNiu.wms.Data.Model;
using DeiNiu.Utils;
namespace DeiNiu.Wcf
{
// 注意: 使用“重构”菜单上的“重命名”命令可以同时更改代码、svc 和配置文件中的类名“ScheduledService”。
public class ScheduledService : IScheduledService
{
static int syncOperId =1;
static lWmsInRequest _lir;
static WmsGoods _wgoods;
WmsGoods wgoods
{
get
{
if (_wgoods == null )
{
_wgoods = new WmsGoods();
}
return _wgoods;
}
}
lWmsInRequest lir
{
get
{
if (_lir == null )
{
_lir = new lWmsInRequest(syncOperId);
}
return _lir;
}
}
private static lWmsOutRequest _lor;
lWmsOutRequest lor
{
get
{
if (_lor == null )
{
_lor = new lWmsOutRequest(syncOperId);
}
return _lor;
}
}
private static lOwner _lOwner;
lOwner lOwnerObj
{
get
{
if (_lOwner == null )
{
_lOwner = new lOwner(syncOperId);
}
return _lOwner;
}
}
private static lCustomer _lcust;
lCustomer lcust
{
get
{
if (_lcust == null)
{
_lcust = new lCustomer(syncOperId);
}
return _lcust;
}
}
private static lWmsOutPickRequest _lop ;
lWmsOutPickRequest lop
{
get
{
if (_lop == null)
{
_lop = new lWmsOutPickRequest(syncOperId);
}
return _lop;
}
}
private static lWmsOutPickPort _lopp;
lWmsOutPickPort lopp
{
get
{
if (_lopp == null )
{
_lopp = new lWmsOutPickPort(syncOperId );
}
return _lopp;
}
}
/*
public void syncOutRequest()
{
lor.syncOrders();
}
/// <summary>
/// sync out request,create pickorders
/// </summary>
public void preProcessOutOrders()
{
lor.preProcessOutOrders();
}
*/
/// <summary>
/// sync inrequests
/// 启用入库收货、验收模块后不再自动同步入库数据
/// </summary>
public void syncInRequest()
{
// lir.syncOrders();
}
public void syncGoods()
{
wgoods.syncGoods();
}
public int syncNewOwners()
{
return lOwnerObj.syncOwner();
}
public int syncCustomer()
{
return lcust.syncCustomer();
}
public void createPDAPickTasks()
{
lop.createPDAPickTasks( );
}
public void syncAndCreatePickRequest(enumOutStockRequestStatus status)
{
lor.preProcessOutOrdersImp(status);
}
static bool isCreateWaveing = false;
public bool createPickWaves()
{
// LogHelper.debug(typeof(ScheduledService), "begin to createPickWaves...");
if (isCreateWaveing)
{
// LogHelper.debug(typeof(ScheduledService), "!!!!!!!!!!!!!!!!! new pick wave ... is processing... return ....");
return false;
}
isCreateWaveing = true;
// WmsConstants.WAVE_LINE = line;
// WmsConstants.WAVE_SALE = sales;
try
{
bool ok = lopp.createPickWaves();
// LogHelper.debug(typeof(ScheduledService), "end createPickWaves...success? " +ok);
isCreateWaveing = false;
return ok;
}
catch (Exception e)
{
throw e;
}
finally
{
isCreateWaveing = false;
}
}
public int[] getJobInterVal()
{
_lop = new lWmsOutPickRequest(syncOperId);
int[] a = new int[4];
a[0] = WmsConstants.JOB_OUT_REQUEST_INTERVAL;
a[1] = WmsConstants.JOB_IN_REQUEST_INTERVAL;
a[2] = WmsConstants.JOB_BASIC_INFO_SYNC_INTERVAL;
a[3] = WmsConstants.JOB_OUT_REQUEST_NO_STOCK_CHECK_INTERVAL;
return a;
}
public int getWaveInterval()
{
WaveRule wr = new WaveRule() .getCurrentActiveRule(enumWaveRuleType.);
return wr.interval;
}
public void truncateDataForTestOnly()
{
// lir.truncateDataForTestOnly();
}
}
}