/// <summary> /// 删除退换货检查信息 /// </summary> /// <param name="refundId"></param> /// <returns></returns> public bool DeleteCheckRefundInfo(Guid refundId) { var info = _refundDal.GetCheckRefundInfo(refundId); if (info.RefundId == Guid.Empty) { return(true); } return(_refundDal.DeleteCheckRefundInfo(refundId)); }
/// <summary> /// 是否成功生成退货商品检查 /// </summary> /// <param name="applyId"></param> /// <param name="expressNo"> </param> /// <param name="expressName"> </param> /// <returns></returns> public bool IsSuccessCreateCheck(Guid applyId, Guid warehouseId, string expressNo, string expressName) { //退换货原商品明细 var applyInfo = _shopRefund.GetShopExchangedApplyInfo(applyId); if (applyInfo == null) { return(false); } var shopApplyDetailInfos = _shopApplyDetail.GetShopApplyDetailList(applyId).ToList(); var flag = false; //门店传递仓库 var info = WarehouseManager.Get(warehouseId); if (info == null) { return(false); } if (shopApplyDetailInfos != null && shopApplyDetailInfos.Count > 0) { var checkRefund = new CheckRefundInfo { RefundId = Guid.NewGuid(), RefundNo = applyInfo.ApplyNo, OrderId = applyId, ExpressNo = expressNo, ExpressName = expressName, CreateTime = DateTime.Now, CheckState = (int)CheckState.Checking, Remark = string.Empty, WarehouseId = warehouseId, Amount = shopApplyDetailInfos.Sum(act => act.Quantity * act.Price), ReStartReason = "", CheckFilialeId = info.LogisticFilialeId, IsTransfer = false }; IList <CheckRefundDetailInfo> checkRefundDetailInfos = (from item in shopApplyDetailInfos select new CheckRefundDetailInfo { RefundId = checkRefund.RefundId, Id = item.ID, GoodsId = item.GoodsID, RealGoodsId = item.RealGoodsID, GoodsName = item.GoodsName, GoodsCode = item.GoodsCode, DamageCount = 0, Quantity = item.Quantity, ReturnCount = item.Quantity, ReturnReason = "", ReturnType = applyInfo.IsBarter ? 1 : 0, SellPrice = item.Price, Specification = item.Specification }).ToList(); using (var tran = new TransactionScope(TransactionScopeOption.Required)) { try { var list = _checkRefund.GetShopCheckRefundList(applyInfo.ShopID, applyId, string.Empty); if (list != null && list.Count > 0) { #region 门店采购退货增加了修改功能,需要二次检查信息;解决方案:删除老的“售后检查表”及“售后检查表明细”的数据,重新插入新的相应的信息;需求号1970(此操作跟伟哥确认过) zal 2016-03-23 var isSuccess = _checkRefund.DeleteCheckRefundInfo(list.First().RefundId); if (!isSuccess) { return(false); } #endregion } var result = _checkRefund.InsertCheckRefundAndDetailList(checkRefund, checkRefundDetailInfos); if (result) { var row = _shopRefund.UpdateExchangeState(applyId, (int)ExchangedState.Checking, "退回商品检查"); if (row > 0) { flag = true; tran.Complete(); } } } catch (Exception) { flag = false; } } } return(flag); }