/**
* IEC_OrderBasicDAL.cs
*
* 功 能: 订单主信息业务类
* 类 名: IEC_OrderBasicBLL
*
* Ver 变更日期 负责人 变更内容
* ───────────────────────────────────
* V0.01 2013-4-23 10:55:24 吴崎均 初版
* V0.02 2013-5-6 9:08 吴崎均 增加分页方法(调用订单专用分页存储)
* V0.03 2013-5-10 16:33 吴崎均 增加方法:发起订单属性改变请求、执行订单属性改变请求
* V0.04 2013-5-11 13:21 吴崎均 增加方法:根据接手人查询属性变更请求集合
* V0.05 2013-5-11 14:13 吴崎均 增加方法:答复订单属性改变请求
* V0.06 2013-5-14 11:38 吴崎均 增加方法:根据卖家编号加载下一订单编号方法
* V0.07 2013-5-15 15:19 吴崎均 增加方法:根据编号获取订单信息
* V0.08 2013-5-17 11:07 吴崎均 增加方法:送货(含送货订单操作)
* V0.09 2013-5-17 14:21 吴崎均 增加方法:根据编号获取货运信息,根据订单编号获取订单操作信息集合
* V0.10 2013-5-20 9:47 吴崎均 增加方法:根据订单编号获取收货地址信息
* V0.11 2013-5-28 13:50 吴崎均 修改批量删除方法定义及实现
* V0.12 2013-5-30 10:28 吴崎均 增加方法:预付款收/付款
* V0.13 2013-5-31 19:01 吴崎均 增加方法:根据订单编号确认收货
*
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CY.Model;
using CY.IDAL;
using CY.Infrastructure.Query;
namespace CY.BLL.EC
{
///
/// 订单主信息业务类
///
public class EC_OrderBasicBLL
{
IEC_OrderBasicDAL _eC_OrderBasicDAL = null;
public EC_OrderBasicBLL()
{
_eC_OrderBasicDAL = AbstractFactory.Factory.GetDALByInterfaceName(AbstractFactory.DALInterface.IEC_OrderBasicDAL) as IEC_OrderBasicDAL;
}
///
/// 分页查询(根据联系人和结束状态)
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPage(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPage(pagination, searchParam);
}
///
/// 分页查询(根据联系人和结束状态)厂商订单,根据区域以及客户、业务经理查询
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPage_Seller(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPage_Seller(pagination, searchParam);
}
///
/// 统计订单金额
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public EC_OrderBasic SumOrderMoney(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SumOrderMoney(pagination, searchParam);
}
///
/// 统计订单金额
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public EC_OrderBasic SumOrderMoney_receive(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SumOrderMoney_receive(pagination, searchParam);
}
///
/// 生产安排分页查询
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPageAg(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPageAg(pagination, searchParam);
}
///
/// 生产安排分页查询
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPageSeal(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPageSeal(pagination, searchParam);
}
///
/// 受理订单
///
/// 订单编号
/// 受理佣金(受理订单时站方收取的服务费)
///
public bool AcceptOrder(int orderId, double commission)
{
return _eC_OrderBasicDAL.AcceptOrder(orderId, commission);
}
///
/// 锁定订单
///
/// 订单编号
/// 操作人
///
public bool SuodingOrder(int orderId, string operater)
{
return _eC_OrderBasicDAL.SuodingOrder(orderId, operater);
}
///
/// 批量受理订单
///
///
///
///
public bool AcceptOrderAll(string orderIds, double commission)
{
return _eC_OrderBasicDAL.AcceptOrderAll(orderIds, commission);
}
///
/// 修改订单状态(非支付状态且不可修改为未受理和已受理)
///
/// 订单操作
///
public bool UpdateOrderState(params EC_OrderOperate[] orderOperates)
{
return _eC_OrderBasicDAL.UpdateOrderState(orderOperates);
}
///
/// 根据编号批量删除数据
///
/// 当前操作人
/// 编号集合
///
public bool DeleteDataByIds(string currentOperator, params int[] ids)
{
return _eC_OrderBasicDAL.DeleteDataByIds(currentOperator, ids);
}
///
/// 根据卖家编号加载下一订单编号方法
///
/// 卖家编号
///
public string LoadOrderIdBySellerId(Guid memberId)
{
return _eC_OrderBasicDAL.LoadOrderIdBySellerId(memberId);
}
///
/// 根据编号获取订单信息
///
/// 订单唯一编号
///
public EC_OrderBasic SelectModelById(int orderId)
{
return _eC_OrderBasicDAL.SelectModelById(orderId);
}
///
/// 根据订单编号获取订单
///
/// 订单编号
///
public IEnumerable GetOrderByIds(string orderIds)
{
return _eC_OrderBasicDAL.GetOrderByIds(orderIds);
}
///
/// 根据订单编号获取自动外协订单
///
/// 订单编号
///
public EC_OrderBasic SelectOutOrderById(int orderId)
{
return _eC_OrderBasicDAL.SelectOutOrderById(orderId);
}
///
/// 根据自动外协订单编号获取来源订单
///
/// 订单编号
///
public EC_OrderBasic SelectFromOutOrderById(int orderId)
{
return _eC_OrderBasicDAL.SelectFromOutOrderById(orderId);
}
///
/// 发起订单属性改变请求
///
/// 请求
///
public int OrderPropertyChangeRequest(EC_OrderDialogue dialogue)
{
return _eC_OrderBasicDAL.OrderPropertyChangeRequest(dialogue);
}
///
/// 执行订单属性改变请求
///
/// 要执行的目标数据
/// 执行者
///
public int OrderPropertyChangeExecute(Guid requestId, Guid memberId)
{
return _eC_OrderBasicDAL.OrderPropertyChangeExecute(requestId, memberId);
}
///
/// 根据接手人查询属性变更请求集合
///
/// 接手用户
///
public IEnumerable SelectPropertyChangeRequest(Guid memberId)
{
return _eC_OrderBasicDAL.SelectPropertyChangeRequest(memberId);
}
///
/// 答复订单属性改变请求
///
/// 要答复的目标数据
/// 答复人
/// 是否同意
///
public int OrderPropertyChangeReply(Guid requestId, Guid memberId, bool isAllow)
{
return _eC_OrderBasicDAL.OrderPropertyChangeReply(requestId, memberId, isAllow);
}
///
/// 收款(线下转账、现金)
///
/// 订单编号
/// 操作记录
///
public bool ReceiveMoneyToAccount(int orderId, OA_FirmAccountRecord firmAccountRecord)
{
return _eC_OrderBasicDAL.ReceiveMoneyToAccount(orderId, firmAccountRecord);
}
///
/// 送货
///
/// 货运信息
///
public bool DeliverPresswork(EC_AwbInfo awbInfo)
{
return _eC_OrderBasicDAL.DeliverPresswork(awbInfo);
}
///
/// 根据编号获取货运信息
///
/// 订单编号
///
public EC_AwbInfo SelectAwbInfoById(int orderId)
{
return _eC_OrderBasicDAL.SelectAwbInfoById(orderId);
}
///
/// 根据订单编号获取订单操作信息
///
/// 订单编号
///
public IEnumerable SelectOrderOperates(int orderId)
{
return _eC_OrderBasicDAL.SelectOrderOperates(orderId);
}
///
/// 获取倒数第二个的操作
///
///
///
public EC_OrderOperate GetSecondOrderOperateByDEC(int orderId)
{
EC_OrderOperate mode = null;
IEnumerable list = SelectOrderOperates(orderId);
if (list != null && list.Count() > 0)
{
if (list.Count() == 1)
{
mode = list.ToList()[0];
}
else
{
mode = list.ToList()[1];
}
}
return mode;
}
///
/// 根据订单编号获取收货地址信息
///
/// 订单编号集合
///
public IEnumerable SelectOrderAddress(string orderIds)
{
return _eC_OrderBasicDAL.SelectOrderAddress(orderIds);
}
///
/// 收款(外协预付款、客户预付款)
///
/// 卖家
/// 买家
/// 订单编号
/// 金额
/// 操作类型编号(2:预付款,3普通付款)
/// 支付科目(订单付款,外协付款)
/// 操作人
///
public bool ReceiveMoney(Guid sellerId, Guid buyerId, int orderId, decimal money, int operatTypeId, string subjectName, string currentOperator)
{
return _eC_OrderBasicDAL.ReceiveMoney(sellerId, buyerId, orderId, money, operatTypeId, subjectName, currentOperator);
}
///
/// 根据订单编号确认收货
///
/// 订单编号
/// 买家编号
///
public bool ConfirmAcceptById(int orderId, Guid memberId)
{
return _eC_OrderBasicDAL.ConfirmAcceptById(orderId, memberId);
}
///
/// 根据编号获取订单列表
///
///
///
///
public IEnumerable GetEC_OrderBasicListByKeyid(string Keyids, Guid FirmId)
{
return _eC_OrderBasicDAL.GetEC_OrderBasicListByKeyid(Keyids, FirmId);
}
///
/// 订单完工
///
///
///
///
public bool CompletedOrderList(List m_EC_OrderOperateList, List m_EC_OrderBasicList)
{
return _eC_OrderBasicDAL.CompletedOrderList(m_EC_OrderOperateList, m_EC_OrderBasicList);
}
///
/// 卖家退单操作
///
///
///
///
///
public int RetireOrderBySeller(int orderId, decimal retireMony, string operatorName)
{
return _eC_OrderBasicDAL.RetireOrderBySeller(orderId, retireMony, operatorName);
}
///
/// 判断是否已经操作
///
///
///
///
///
public bool IsOpearted(int keyid, int orderState, string opType)
{
return _eC_OrderBasicDAL.IsOpearted(keyid, orderState, opType);
}
///
/// 查询后道(3)整单(4)
///
///
///
///
///
///
///
///
///
///
///
///
///
public IEnumerable SelectAferOfOutOrder(Infrastructure.Query.Pagination pagination, Guid MemberId, DateTime? StartCreatTime, DateTime? EndCreatTime, DateTime? StartReturnTime, DateTime? EndReturnTime, string Creater, string OutFirm, string WorkStates, string OutOrderId, int? RelationType)
{
return _eC_OrderBasicDAL.SelectAferOfOutOrder(pagination, MemberId, StartCreatTime, EndCreatTime, StartReturnTime, EndReturnTime, Creater, OutFirm, WorkStates, OutOrderId, RelationType);
}
///
/// 修改打印状态
///
///
public void UpdatePrintState(int orderId)
{
_eC_OrderBasicDAL.UpdatePrintState(orderId);
}
///
/// 修改打印状态
///
///
public void UpdatePrintfengqianState(int orderId)
{
_eC_OrderBasicDAL.UpdatePrintfengqianState(orderId);
}
///
/// 修改标签打印状态
///
///
public void UpdatePrintBiaoqianState(int orderId)
{
_eC_OrderBasicDAL.UpdatePrintBiaoqianState(orderId);
}
///
/// 分页查询外协订单(根据联系人和结束状态)
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPage_Outsource(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPage_Outsource(pagination, searchParam);
}
///
/// 更新
///
///
///
public bool UpdateModel(Model.EC_OrderBasic model)
{
return _eC_OrderBasicDAL.UpdateModel(model);
}
///
/// 判断某订单是否是另一订单的自动外协订单
///
///
///
public bool IsOutOrder(int orderId)
{
return _eC_OrderBasicDAL.IsOutOrder(orderId);
}
///
/// WEB服务自动完成订单
///
public void AutoCompleteOrderByWebService()
{
_eC_OrderBasicDAL.AutoCompleteOrderByWebService();
}
///
/// 删除外协订单
///
///
///
public bool DeleteOutOrder(int OrderId)
{
return _eC_OrderBasicDAL.DeleteOutOrder(OrderId);
}
///
/// 根据新增订单操作,并修改订单状态
///
///
///
public bool UpdateOrderState(EC_OrderOperate orderOperate)
{
return _eC_OrderBasicDAL.UpdateOrderState(orderOperate);
}
///
/// 分页查询(根据联系人和结束状态)-订单收款去除已冻结订单
///
/// 分页对象
/// 查询参数
/// 查询结果 传入参数错误时结果为空
public IEnumerable SelectModelPage_Financial(Infrastructure.Query.Pagination pagination, Dictionary searchParam)
{
return _eC_OrderBasicDAL.SelectModelPage_Financial(pagination, searchParam);
}
///
/// 查询客户预付款列表
///
///
///
public IEnumerable GetModelPageListForPrepayments(Pagination pa, string DeliveryTime, string Province, string City, string County, string BuyerName, string BusinessManagerId, string SellerOrderId, string DocumentName, Guid SellerId)
{
string Condition = " and ( ob.[OrderState] ='2' or ob.[OrderState] ='3' and SellerId='"+ SellerId + "' )";
if (!string.IsNullOrEmpty(DeliveryTime))
{
if (DeliveryTime == "明天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=1 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=1 )";
}
else if (DeliveryTime == "后天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=2 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=2 )";
}
else if (DeliveryTime == "3天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=3 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=3 )";
}
else if (DeliveryTime == "4天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=4 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=4 )";
}
else if (DeliveryTime == "5天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=5 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=5) ";
}
else if (DeliveryTime == "6天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=6 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=6) ";
}
else if (DeliveryTime == "7天")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])=7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])=7 )";
}
else if (DeliveryTime == "一周后")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime]) >7 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])>7 )";
}
else if (DeliveryTime == "逾期")
{
Condition += " and ( DATEDIFF(DAY,GETDATE(),ob.[DeliveryTime])<=0 or DATEDIFF(DAY,GETDATE(),oe.[DelayTime])<=0 )";
}
}
if (!string.IsNullOrEmpty(Province))
Condition += string.Format(" and CustomerCommunications.Province='{0}'", Province);
if (!string.IsNullOrEmpty(City))
Condition += string.Format(" and CustomerCommunications.City='{0}'", City);
if (!string.IsNullOrEmpty(County))
Condition += string.Format(" and CustomerCommunications.County='{0}'", County);
if (!string.IsNullOrEmpty(BuyerName))
{
Condition += " and ob.BuyerName like '%" + BuyerName + "%'";
}
if (!string.IsNullOrEmpty(BusinessManagerId))
{
Condition += string.Format(" and oe.BusinessManagerId='{0}'", BusinessManagerId);
}
if (!string.IsNullOrEmpty(SellerOrderId))
{
Condition += " and ob.SellerOrderId like '%" + SellerOrderId + "%'"; ;
}
if (!string.IsNullOrEmpty(DocumentName))
{
Condition += " and ob.DocumentName like '%" + DocumentName + "%'"; ;
}
Query query = new Query();
IList criterias = new List()
{
new Criterion("", Condition),
new Criterion("orderBy"," [DeliveryTime] DESC ")
};
query.Criteria = criterias;
return _eC_OrderBasicDAL.SelectModelPage_weiwangong(query, pa);
}
///
/// 根据新增订单操作,并修改订单状态
///
///
///
public void UpdateDeliveryOrderId(int orderId, Guid DeliveryOrderId)
{
_eC_OrderBasicDAL.UpdateDeliveryOrderId(orderId, DeliveryOrderId);
}
///
/// 根据发货单id查询
///
///
///
///
public IEnumerable GetEC_OrderBasicListBydeliverorderId(Guid deliverorderId, Guid FirmId)
{
return _eC_OrderBasicDAL.GetEC_OrderBasicListBydeliverorderId(deliverorderId, FirmId);
}
}
}