/// <summary> /// 更新结算单状态 /// </summary> /// <param name="lstSettlementSysNo">结算单系统编号集合</param> /// <param name="status">审核或作废,枚举结算单状态</param> /// <param name="userSysNo">操作人系统编号</param> /// <returns>封装的实体(Status,StatusCode,Message)</returns> /// <remarks> /// 2013/6/28 黄伟 创建 /// </remarks> public abstract Result UpdateStatus(IList <int> lstSettlementSysNo, LogisticsStatus.结算单状态 status, int userSysNo);
/// <summary> /// 更新结算单 /// </summary> /// <param name="lstSettlementSysNo">结算单系统编号集合</param> /// <param name="status">审核或作废,枚举结算单状态</param> /// <param name="userSysNo">操作人系统编号</param> /// <returns>封装的实体(Status,StatusCode,Message)</returns> /// <remarks> /// 2013-06-28 黄伟 创建 /// </remarks> public override Result UpdateStatus(IList <int> lstSettlementSysNo, LogisticsStatus.结算单状态 status, int userSysNo) { var success = false; //预留审核逻辑 var strMsgSuccess = status == LogisticsStatus.结算单状态.已结算 ? "审核成功!" : "作废成功!"; var strMsgFailed = status == LogisticsStatus.结算单状态.已结算 ? "审核失败!" : "作废失败!"; //取消事务,目前已经禁止作废结算单 何方 2014/04/21 //更新结算单状态 Context.Sql( "update lgsettlement set status=@status,lastupdateby=@userSysNo where sysno in(@settlementSysNo)") .Parameter("status", status.GetHashCode()) .Parameter("userSysNo", userSysNo) .Parameter("settlementSysNo", lstSettlementSysNo) .Execute(); if (status == LogisticsStatus.结算单状态.作废) { //通过结算单明细来更新相应单据 lstSettlementSysNo.ToList().ForEach(s => { var lstLgSettlementItem = LgSettlementItemDaoImpl.Instance.GetLgSettlementItems(s); lstLgSettlementItem.ForEach(p => { #region 百城当日达 非第三方快递 var soOrder = IOutStockDao.Instance.GetSoOrder(p.StockOutSysNo); var stockOut = IOutStockDao.Instance.GetModel(p.StockOutSysNo); var lgDelivery = ILgDeliveryDao.Instance.GetDelivery(p.DeliverySysNo); #region 出库单/配送单明细状态是签收/拒收 switch (stockOut.Status) { #region 拒收 case (int)WarehouseStatus.出库单状态.拒收: /* 首单拒收并且货到付款 * 该订单所有出库单都是拒收则为第一单拒收,如果存在其他签收出库单则不是第一单拒收 */ if (IsRejectAtFirst(soOrder.SysNo) && stockOut.IsCOD == 1) { break; } #region 退换货子流程 DoRMAForVoidSettlement(soOrder.SysNo); break; #endregion #endregion #region 部分签收 case (int)WarehouseStatus.出库单状态.部分退货: /* * 部分签收走退换货子流程 */ #region 退换货子流程 DoRMAForVoidSettlement(soOrder.SysNo); #endregion break; #endregion } #endregion #region 收款单处理 //出库单应收金额是否>0 if (stockOut.Receivable > 0) { var fnReceiptVoucher = FnReceiptVoucherDaoImpl.Instance.GetEntity((int)FinanceStatus.收款来源类型.销售单, soOrder.SysNo); //fnReceiptVoucher.Status = (int)FinanceStatus.收款单状态.待确认; //IFnReceiptVoucherDao.Instance.Update(fnReceiptVoucher); //收款单明细-若存在则修改状态为无效 //FnReceiptVoucherItemDaoImpl.Instance.Update(fnReceiptVoucher.SysNo, // FinanceStatus.收款单明细状态.无效); } #endregion #region 配送单-配送在途 ILgDeliveryDao.Instance.UpdateStatus(p.DeliverySysNo, LogisticsStatus.配送单状态.配送在途); #endregion #region 配送单明细-待签收 ILgDeliveryDao.Instance.UpdateDeliveryItemStatus(p.DeliverySysNo, LogisticsStatus.配送单据类型.出库单, p.StockOutSysNo, LogisticsStatus.配送单明细状态.待签收); #endregion //#region 配送员信用额度-扣减信用额度 bugid 3031 moved to bo //var delUserCredit = ILgDeliveryUserCreditDao.Instance.GetLgDeliveryUserCredit(lgDelivery.DeliveryUserSysNo, // stockOut.WarehouseSysNo); //delUserCredit.RemainingDeliveryCredit -= stockOut.StockOutAmount; //ILgDeliveryUserCreditDao.Instance.Update(delUserCredit); //#endregion #region 出库单子流程 /*若是全部签收,则只更新出库单状态->配送中*/ /* else: * 是否有入库单? * Y:出库单-配送中;入库单-作废 * N:出库单-待出库 */ if (stockOut.Status == (int)WarehouseStatus.出库单状态.已签收) { IOutStockDao.Instance.UpdateStatus(p.StockOutSysNo, WarehouseStatus.出库单状态.配送中); } else { var stockIn = IInStockDao.Instance.GetWhStockInByVoucherSource( (int)WarehouseStatus.入库单据类型.出库单, stockOut.SysNo); if (stockIn != null) { IOutStockDao.Instance.UpdateStatus(p.StockOutSysNo, WarehouseStatus.出库单状态.配送中); stockIn.Status = (int)WarehouseStatus.入库单状态.作废; IInStockDao.Instance.UpdateWhStockIn(stockIn); } else { IOutStockDao.Instance.UpdateStatus(p.StockOutSysNo, WarehouseStatus.出库单状态.待出库); } /* removed for 出库单会更新订单状态 * var orderSysNo = OutStockDaoImpl.Instance.GetSoOrder(p.StockOutSysNo).SysNo; * //修改订单:已出库 OrderStatus.销售单状态.已创建出库单 * SoOrderDaoImpl.Instance.UpdateOrderStatus(orderSysNo, (int)OrderStatus.销售单状态.已创建出库单); */ } #endregion #endregion }); }); success = true; } return(success ? new Result { Status = true, StatusCode = 0, Message = strMsgSuccess } : new Result { Status = false, StatusCode = -1, Message = strMsgFailed }); }