Beispiel #1
0
        public ActionResult ShopInvoice(int whStockOutSysNo)
        {
            WhStockOut model    = null;
            var        stockOut = BLL.Warehouse.WhWarehouseBo.Instance.Get(whStockOutSysNo);

            if (stockOut != null)
            {
                //订单
                var order = BLL.Order.SoOrderBo.Instance.GetEntity(stockOut.OrderSysNO);
                ViewBag.OrderSysNo = order.SysNo;
                //门店
                var warehouse = WhWarehouseBo.Instance.GetWarehouseEntity(order.DefaultWarehouseSysNo);
                ViewBag.WarehouseName = warehouse != null ? warehouse.WarehouseName : "未知";

                //收货地址
                ViewBag.ReceiveAddress = BLL.Order.SoOrderBo.Instance.GetOrderReceiveAddress(order.ReceiveAddressSysNo);

                //付款方式
                ViewBag.PayType = BLL.Basic.PaymentTypeBo.Instance.GetEntity(order.PayTypeSysNo);
                //提货时间
                ViewBag.SignTime = stockOut.SignTime.ToString("yyyy-MM-dd HH:mm");
                //商品
                model = WhWarehouseBo.Instance.Get(whStockOutSysNo);
                ViewBag.WhStockOutItem = model;
                ViewBag.Total          = model.Items.Sum(i => i.RealSalesAmount);

                //分销商订单
                var dsOrders = BLL.MallSeller.DsOrderBo.Instance.GetEntityByTransactionSysNo(order.TransactionSysNo);
                if (dsOrders.Any())
                {
                    var dsOrder = dsOrders.First();
                    var mall    = BLL.MallSeller.DsOrderBo.Instance.GetDsDealerMall(dsOrder.DealerMallSysNo);
                    ViewBag.mallOrderId  = dsOrder.MallOrderId;
                    ViewBag.mallShopName = mall.ShopName;
                }
                ViewBag.CouponAmount = order.CouponAmount;//优惠券金额
                var ordercoupon = Hyt.BLL.Order.SoOrderBo.Instance.GetCouponByOrderSysNo(order.SysNo).FirstOrDefault();
                if (ordercoupon != null)
                {
                    var coupon = PromotionBo.Instance.GetCoupon(ordercoupon.CouponCode);
                    if (coupon != null)
                    {
                        ViewBag.CouponDes = coupon.Description;//优惠券内容
                    }
                }
                ViewBag.DiscountAmount  = order.ProductDiscountAmount + order.OrderDiscountAmount; //折扣金额
                ViewBag.DeliveryRemarks = order.DeliveryRemarks;                                   //配送备注
                ViewBag.Remarks         = order.InternalRemarks;                                   //对内备注
                ViewBag.CoinPay         = order.CoinPay;                                           //会员币支付
            }
            return(View("ShopInvoice", model));
        }
        /// <summary>
        /// 确认或者取消电子面单
        /// </summary>
        /// <param name="stockOut">出库单</param>
        /// <param name="actionType">电子面单操作类型</param>
        /// <param name="userid">用户编号</param>
        /// <remarks>2015-10-8 杨浩 创建</remarks>
        public bool ConfirmElectronicWayBill(WhStockOut stockOut, LogisticsStatus.电子面单操作类型 actionType, int userid)
        {
            //UpdateStatus(stockOut.SysNo, actionType == LogisticsStatus.电子面单操作类型.取消订单 ? LogisticsStatus.电子面单状态.作废 : LogisticsStatus.电子面单状态.已确认, userid);//更新本地数据库中的电子面单状态
            //var response =  LgBestExpressSurfaceBillServiceBo.Instance.UpdateBill(stockOut, actionType);
            //if (response.IsSuccess)
            //{
            //    if (response.ExpressOrderResult.OrderStatus == "ACCEPT")//接单成功
            //    {
            //        return true;
            //    }
            //    var firstOrDefault = response.ExpressOrderResult.Errors.ErrorList.FirstOrDefault();
            //    if (firstOrDefault != null && actionType != LogisticsStatus.电子面单操作类型.取消订单)
            //    {
            //        throw new HytException(firstOrDefault.ErrorDescription);//接单失败
            //    }
            //    else
            //    {
            //        return false;
            //    }
            //}

            //else
            //{
            //    var error = response.ExpressOrderResult.Errors.ErrorList.FirstOrDefault();
            //    if (error != null)
            //    {
            //        SysLog.Instance.WriteLog(LogStatus.SysLogLevel.Error, LogStatus.系统日志来源.后台,
            //            " 确认或取消百世汇通电子面单未成功,出库单号:" + response.ExpressOrderResult.CustomerOrderCode + "错误编号:" + error.ErrorCode + "错误描述:" + error.ErrorDescription,
            //            LogStatus.系统日志目标类型.出库单, stockOut.SysNo, null, string.Empty, userid);
            //        if (actionType != LogisticsStatus.电子面单操作类型.取消订单)
            //        {
            //            throw new HytException(error.ErrorCode);
            //        }
            //        else
            //        {
            //            return false;
            //        }
            //    }
            //    if (actionType != LogisticsStatus.电子面单操作类型.取消订单)
            //    {
            //        throw new HytException(response.ExpressOrderXmlResult);
            //    }
            //    else
            //    {
            //        return false;
            //    }
            //}
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// 是否允许调货
        /// </summary>
        /// <param name="stockOut">出库单</param>
        /// <returns></returns>
        /// <remarks>2016-04-08 朱成果 创建</remarks>
        public Hyt.Model.Result <TransferCargoConfig> CanTransferCargo(WhStockOut stockOut)
        {
            Hyt.Model.Result <TransferCargoConfig> result = new Hyt.Model.Result <TransferCargoConfig>()
            {
                Status = false
            };
            if (stockOut == null)
            {
                result.Message = string.Format("当前出库单不存在");
                return(result);
            }
            if (!(stockOut.DeliveryTypeSysNo == Hyt.Model.SystemPredefined.DeliveryType.普通百城当日达 || stockOut.DeliveryTypeSysNo == Hyt.Model.SystemPredefined.DeliveryType.门店自提))
            {
                result.Message = string.Format("当前配送方式出库单不允许调货");
                return(result);
            }
            if (stockOut.IsCOD == Hyt.Model.WorkflowStatus.WarehouseStatus.是否到付.是.GetHashCode())
            {
                result.Message = string.Format("货到付款订单不允许调货");
                return(result);
            }
            if (stockOut.Status != (int)WarehouseStatus.出库单状态.待出库)
            {
                result.Message = string.Format("只有待出库的出库单才允许申请调货");
                return(result);
            }
            //if (WhWarehouseBo.Instance.IsSelfSupport(stockOut.WarehouseSysNo))
            //{
            //    result.Message = string.Format("自营仓库不允许申请调货");
            //    return result;
            //}
            var config = Hyt.BLL.Basic.TransferCargoConfigBo.Instance.GetEntityByApplyWarehouseSysNo(stockOut.WarehouseSysNo);//有调货配置

            if (config == null)
            {
                result.Message = string.Format("申请仓库编号为:{0}的仓库未配置配货仓库,请在基础管理-调货配置中配置", stockOut.WarehouseSysNo);
                return(result);
            }
            result.Data = config;
            var exist = ExistTransferCargoByStockOutSysno(stockOut.SysNo);

            if (exist)
            {
                result.Message = string.Format("出库单号为:{0}的出库单已申请过调货,不能再次申请", stockOut.SysNo);
                return(result);
            }
            result.Status = true;
            return(result);
        }
Beispiel #4
0
 /// <summary>
 /// 创建业务员配送单(但是未结算)
 /// </summary>
 /// <param name="order">订单信息</param>
 /// <param name="user">业务员信息</param>
 /// <param name="outStock">出库单信息</param>
 /// <remarks>2014-9-17  朱成果 创建</remarks>
 private void DeliveryTwoSaleSoOrder(AppOrder order, SyUser user, WhStockOut outStock)
 {
     if (order.Invoice != null)
     {
         order.Invoice.LastUpdateBy   = user.SysNo;
         order.Invoice.LastUpdateDate = DateTime.Now;
         order.Invoice.Status         = (int)Hyt.Model.WorkflowStatus.FinanceStatus.发票状态.已开票;
         Hyt.BLL.Order.SoOrderBo.Instance.UpdateOrderInvoice(order.Invoice); //更新发票 余勇 修改 改为调用业务层方法
     }
     outStock.Status       = (int)Hyt.Model.WorkflowStatus.WarehouseStatus.出库单状态.配送中;
     outStock.StockOutBy   = user.SysNo;
     outStock.StockOutDate = DateTime.Now;
     Hyt.DataAccess.Warehouse.IOutStockDao.Instance.Update(outStock);                 //更新出库单状态
     GenerateOtherDataForTwoSale(order, user, outStock);                              //创建业务员配送单
     Hyt.BLL.Warehouse.WhWarehouseBo.Instance.UpdateErpProductNumber(outStock.SysNo); //修改EAS库存
 }
Beispiel #5
0
        /// <summary>
        /// 退货从出库单创建入库单
        /// </summary>
        /// <param name="stockOut">出库单实体.</param>
        /// <param name="returnNumber">商品退货数量</param>
        /// <param name="operatorSysNo">操作人.</param>
        /// <param name="sourceType">来源单据类型.</param>
        /// <param name="sourceSysNo">来源单据系统编号.</param>
        /// <param name="transactionSysNo">事务编号.</param>
        /// <param name="remarks">备注.</param>
        /// <returns></returns>
        /// <remarks>
        /// 2013/7/11 何方 创建
        /// </remarks>
        public int CreateStockIn(WhStockOut stockOut, Dictionary <int, int> returnNumber, int operatorSysNo, WarehouseStatus.入库单据类型 sourceType, int sourceSysNo, string transactionSysNo = "", string remarks = "")
        {
            var stockIn = new WhStockIn
            {
                CreatedBy        = operatorSysNo,
                CreatedDate      = DateTime.Now,
                DeliveryType     = (int)WarehouseStatus.入库物流方式.拒收,
                IsPrinted        = (int)WarehouseStatus.是否已经打印拣货单.否,
                Remarks          = remarks,
                SourceSysNO      = sourceSysNo,
                SourceType       = (int)sourceType,
                Status           = (int)WarehouseStatus.入库单状态.待入库,
                TransactionSysNo = transactionSysNo,
                WarehouseSysNo   = stockOut.WarehouseSysNo,
                ItemList         = new List <WhStockInItem>(),
                LastUpdateBy     = operatorSysNo,
                LastUpdateDate   = DateTime.Now
            };

            if (returnNumber != null && returnNumber.Any())
            {
                stockIn.Status = (int)WarehouseStatus.入库单状态.待入库;
                //入库单明细
                foreach (var orderItemSysNo in returnNumber.Keys)
                {
                    var stockOutItem = stockOut.Items.SingleOrDefault(x => x.OrderItemSysNo == orderItemSysNo);
                    if (stockOutItem == null)
                    {
                        throw new Exception(string.Format("出库单:{0}不包含商品{1}", stockOut.SysNo, orderItemSysNo));
                    }

                    stockIn.ItemList.Add(new WhStockInItem
                    {
                        CreatedBy           = operatorSysNo,
                        CreatedDate         = DateTime.Now,
                        ProductName         = stockOutItem.ProductName,
                        ProductSysNo        = stockOutItem.ProductSysNo,
                        StockInQuantity     = returnNumber[orderItemSysNo],//退货数量
                        RealStockInQuantity = 0,
                        LastUpdateBy        = operatorSysNo,
                        LastUpdateDate      = DateTime.Now
                    });
                }
            }
            return(InStockBo.Instance.CreateStockIn(stockIn));
        }
Beispiel #6
0
        /// <summary>
        /// 构建业务员配送单信息
        /// </summary>
        /// <param name="order">订单</param>
        /// <param name="user">业务员</param>
        /// <param name="outStock">出库单</param>
        /// <remarks>2014-9-17  朱成果 创建</remarks>
        private void GenerateOtherDataForTwoSale(AppOrder order, SyUser user, WhStockOut outStock)
        {
            var  payType   = PaymentTypeBo.Instance.GetPaymentTypeFromMemory(order.SoOrder.PayTypeSysNo);
            bool isNeedPay = payType.PaymentType == (int)BasicStatus.支付方式类型.预付;//是否预付
            var  delivery  = new LgDelivery()
            {
                DeliveryUserSysNo = user.SysNo,
                DeliveryTypeSysNo = outStock.DeliveryTypeSysNo,
                CreatedBy         = user.SysNo,
                CreatedDate       = DateTime.Now,
                Status            = (int)LogisticsStatus.配送单状态.配送在途,
                StockSysNo        = outStock.WarehouseSysNo,
                IsEnforceAllow    = 0,
                PaidAmount        = isNeedPay ? order.SoOrder.CashPay : 0,
                CODAmount         = isNeedPay ? 0 : order.SoOrder.CashPay,
            };
            var deliverySysNo = Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.CreateLgDelivery(delivery);//创建配送单
            var deliveryItem  = new LgDeliveryItem()
            {
                DeliverySysNo    = deliverySysNo,
                NoteType         = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单据类型.出库单,
                NoteSysNo        = outStock.SysNo,
                Status           = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单明细状态.待签收,
                AddressSysNo     = outStock.ReceiveAddressSysNo,
                TransactionSysNo = outStock.TransactionSysNo,
                StockOutAmount   = outStock.StockOutAmount,
                PaymentType      = payType.PaymentType,
                Receivable       = !isNeedPay ? order.SoOrder.CashPay : 0,
                IsCOD            = !isNeedPay ? (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.是 : (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.否,
                Remarks          = "【二次销售自动创建】",
                CreatedBy        = user.SysNo,
                CreatedDate      = DateTime.Now
            };

            Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.AddDeliveryItem(deliveryItem);//配送单明细
            Order.SoOrderBo.Instance.WriteSoTransactionLog(outStock.TransactionSysNo,
                                                           "出库单" + outStock.SysNo +
                                                           "分配配送成功,配送单<span style='color:red'>" +
                                                           deliverySysNo + "</span>",
                                                           user.UserName);//日志
            string msg = "出库单" + outStock.SysNo + "由百城当日达配送员<span style='color:red'>{0}</span>配送中,送货人联系电话<span style='color:red'>{1}</span>";

            msg = string.Format(msg, user.UserName, user.MobilePhoneNumber);
            Order.SoOrderBo.Instance.WriteSoTransactionLog(outStock.TransactionSysNo, msg, user.UserName);//日志
        }
Beispiel #7
0
        private void AddBaseTaskObjectToList(List <BaseTask> listObject)
        {
            BaseTask bsAT                    = new BsArea();
            BaseTask bsDP                    = new BsDeliveryPayment();
            BaseTask bsPT                    = new BsPaymentType();
            BaseTask bsCode                  = new BsCode();
            BaseTask bsOrganization          = new BsOrganization();
            BaseTask bsOrganizationWarehouse = new BsOrganizationWarehouse();

            BaseTask crCustomer = new CrCustomer();
            BaseTask crCL       = new CrCustomerLevel();
            BaseTask crCQ       = new CrCustomerQuestion();
            BaseTask crRA       = new CrReceiveAddress();

            BaseTask dsMallType      = new DsMallType();
            BaseTask dsDealerLevel   = new DsDealerLevel();
            BaseTask feArticle       = new FeArticle();
            BaseTask feAC            = new FeArticleCategory();
            BaseTask feCS            = new FeCommentSupport();
            BaseTask fepc            = new FeProductComment();
            BaseTask fePCI           = new FeProductCommentImage();
            BaseTask fePCR           = new FeProductCommentReply();
            BaseTask feSearchKeyword = new FeSearchKeyword();
            BaseTask feadvertgroup   = new FeAdvertGroup();
            BaseTask feadvertitem    = new FeAdvertItem();
            BaseTask feproductgroup  = new FeProductGroup();
            BaseTask feproductitem   = new FeProductItem();

            BaseTask fnIT      = new FnInvoiceType();
            BaseTask fninvoice = new FnInvoice();

            BaseTask fnpv = new  FnReceiptVoucher();
            BaseTask fnReceiptVoucherItem = new FnReceiptVoucherItem();
            BaseTask fnop                 = new FnOnlinePayment();
            BaseTask fnPaymentVoucher     = new FnPaymentVoucher();
            BaseTask fnPaymentVoucherItem = new FnPaymentVoucherItem();

            BaseTask lgDelivery              = new LgDelivery();
            BaseTask lgDI                    = new LgDeliveryItem();
            BaseTask lgDS                    = new LgDeliveryScope();
            BaseTask lgDT                    = new LgDeliveryType();
            BaseTask lgDUC                   = new LgDeliveryUserCredit();
            BaseTask lgPT                    = new LgPickupType();
            BaseTask lgsettlement            = new LgSettlement();
            BaseTask lgSI                    = new LgSettlementItem();
            BaseTask lgDeliveryPrintTemplate = new LgDeliveryPrintTemplate();
            BaseTask pdAttribute             = new PdAttribute();
            BaseTask pdAG                    = new PdAttributeGroup();
            BaseTask pdAGA                   = new PdAttributeGroupAssociation();
            BaseTask pdAO                    = new PdAttributeOption();
            BaseTask pdBrand                 = new PdBrand();
            BaseTask pdCGA                   = new PdCatAttributeGroupAso();
            BaseTask pdCategory              = new PdCategory();
            BaseTask pdCA                    = new PdCategoryAssociation();
            BaseTask pdPrice                 = new PdPrice();
            BaseTask pdProduct               = new PdProduct();
            BaseTask pdPA                    = new PdProductAssociation();
            BaseTask pdProductAttribute      = new PdProductAttribute();
            BaseTask pdPI                    = new PdProductImage();
            BaseTask pdTemplate              = new PdTemplate();
            BaseTask pdProductStatistics     = new PdProductStatistics();

            BaseTask soOrder         = new SoOrder();
            BaseTask soOrderItem     = new SoOrderItem();
            BaseTask soRA            = new SoReceiveAddress();
            BaseTask SyUG            = new SyUserGroup();
            BaseTask syGU            = new SyGroupUser();
            BaseTask syMenu          = new SyMenu();
            BaseTask syMenuPrivilege = new SyMenuPrivilege();
            BaseTask syPrivilege     = new SyPrivilege();
            BaseTask syRole          = new SyRole();
            BaseTask syRoleMenu      = new SyRoleMenu();
            BaseTask syRolePrivilege = new SyRolePrivilege();
            BaseTask syPermission    = new SyPermission();
            BaseTask syUser          = new SyUser();
            BaseTask syUW            = new SyUserWarehouse();
            BaseTask syMyMenu        = new SyMyMenu();

            BaseTask spcombo                  = new SpCombo();
            BaseTask spComboItem              = new SpComboItem();
            BaseTask spcopon                  = new spcoupon();
            BaseTask sqpromotion              = new SPpromotion();
            BaseTask spromotiongift           = new SPpromotiongift();
            BaseTask sppromotionoverlay       = new SPpromotionoverlay();
            BaseTask sppromotionrule          = new SPpromotionrule();
            BaseTask sppromotionrulecondition = new SPpromotionrulecondition();
            BaseTask sppromotionrulekeyvalue  = new SPpromotionrulekeyvalue();
            BaseTask syTaskConfig             = new SyTaskConfig();

            BaseTask whStockOut     = new WhStockOut();
            BaseTask whStockOutItem = new WhstockOutItem();
            BaseTask whwarehouse    = new WhWarehouse();
            BaseTask whwa           = new WHwarehousearea();
            BaseTask whwdy          = new WHwarehouseDeliveryType();
            BaseTask whWPT          = new WhWarehousePickupType();
            BaseTask whstockin      = new WhStockIn();
            BaseTask whstockinItem  = new WHStockinItem();
            BaseTask rcReturn       = new RCReturn();
            BaseTask rcReturnItem   = new RcReturnItem();

            listObject.Add(bsAT);
            listObject.Add(bsDP);
            listObject.Add(bsPT);
            listObject.Add(bsCode);
            listObject.Add(bsOrganization);
            listObject.Add(bsOrganizationWarehouse);

            listObject.Add(crCustomer);
            listObject.Add(crCL);
            listObject.Add(crCQ);
            listObject.Add(crRA);
            listObject.Add(dsMallType);
            listObject.Add(dsDealerLevel);
            listObject.Add(feArticle);
            listObject.Add(feAC);
            listObject.Add(feCS);
            listObject.Add(fePCI);
            listObject.Add(fePCR);
            listObject.Add(fepc);
            listObject.Add(feSearchKeyword);
            listObject.Add(feadvertgroup);
            listObject.Add(feadvertitem);
            listObject.Add(feproductgroup);
            listObject.Add(feproductitem);

            listObject.Add(fnIT);
            listObject.Add(fnpv);
            listObject.Add(fnReceiptVoucherItem);
            listObject.Add(fnop);
            listObject.Add(fninvoice);

            listObject.Add(fnPaymentVoucher);
            listObject.Add(fnPaymentVoucherItem);

            listObject.Add(lgDelivery);
            listObject.Add(lgDI);
            listObject.Add(lgDS);
            listObject.Add(lgDT);
            listObject.Add(lgPT);
            listObject.Add(lgsettlement);
            listObject.Add(lgSI);
            listObject.Add(lgDeliveryPrintTemplate);

            listObject.Add(pdAttribute);
            listObject.Add(pdAG);
            listObject.Add(pdAGA);
            listObject.Add(pdAO);
            listObject.Add(pdBrand);
            listObject.Add(pdCGA);
            listObject.Add(pdCategory);
            listObject.Add(pdCA);
            listObject.Add(pdPrice);
            listObject.Add(pdProduct);
            listObject.Add(pdPA);
            listObject.Add(pdProductAttribute);
            listObject.Add(pdTemplate);
            listObject.Add(pdProductStatistics);

            listObject.Add(soOrder);
            listObject.Add(soOrderItem);

            listObject.Add(spcombo);
            listObject.Add(spComboItem);
            listObject.Add(spcopon);
            listObject.Add(sqpromotion);
            listObject.Add(spromotiongift);
            //listObject.Add(sppromotionoverlay);
            listObject.Add(sppromotionrule);
            listObject.Add(sppromotionrulecondition);
            listObject.Add(sppromotionrulekeyvalue);

            listObject.Add(syGU);
            listObject.Add(syUW);
            listObject.Add(SyUG);
            listObject.Add(syMenu);
            listObject.Add(syUser);
            listObject.Add(syPermission);

            listObject.Add(syMenuPrivilege);
            listObject.Add(syPrivilege);
            listObject.Add(syRole);
            listObject.Add(syRoleMenu);
            listObject.Add(syRolePrivilege);
            listObject.Add(syMyMenu);
            listObject.Add(syTaskConfig);

            listObject.Add(whStockOut);
            listObject.Add(whStockOutItem);
            listObject.Add(whwarehouse);
            listObject.Add(whwa);
            listObject.Add(whwdy);
            listObject.Add(whWPT);
            listObject.Add(whstockin);
            listObject.Add(whstockinItem);
            listObject.Add(rcReturn);
            listObject.Add(rcReturnItem);
            listObject.Add(lgDUC);
            listObject.Add(pdPI);
            listObject.Add(soRA);
        }
Beispiel #8
0
        public ActionResult Picking(int id)
        {
            //兼容火狐浏览器,必须重新刷新前台才能显示
            var isRefresh = Request.Params["isRefresh"];

            BsArea city;
            BsArea area;
            BsArea prov;

            var order      = Hyt.BLL.Order.SoOrderBo.Instance.GetByOutStockSysNo(id);
            var dealerInfo = BLL.Stores.StoresBo.Instance.GetStoreById(order.DealerSysNo);
            var dailiInfo  = Hyt.DataAccess.Stores.IStoresDao.Instance.GetDiLiByCreatId(order.DealerSysNo);

            //kis单据号
            ViewBag.KisVoucherNo = BLL.Sys.EasBo.Instance.GetVoucherNo((int)出库状态.出库, order.TransactionSysNo);

            if (dealerInfo != null)
            {
                ViewBag.DealerName = dealerInfo.DealerName;
            }

            if (dailiInfo != null)
            {
                ViewBag.DaiLiName = dailiInfo.UserName;
            }

            WhStockOut master = WhWarehouseBo.Instance.Get(id);

            if (order == null)
            {
                throw new HytException("找不到出库单编号为" + id + "订单");
            }

            //是否更新出库单状态
            bool isUpdate = false;

            if (master.IsPrintedPickupCover == 0 && master.Status == WarehouseStatus.出库单状态.待拣货.GetHashCode())
            {
                isUpdate = true;
                master.IsPrintedPickupCover = 1;
                master.LastUpdateBy         = CurrentUser.Base.SysNo;
                master.LastUpdateDate       = DateTime.Now;
                master.Status = WarehouseStatus.出库单状态.待打包.GetHashCode();
            }

            if (order.OrderSource == (int)OrderStatus.销售单来源.分销商升舱)
            {
                #region 来源淘宝订单 打印

                //分销配货(拣货,出库)单
                var dsModel = PrintBo.Instance.GetPrintDsPicking(id);

                if (dsModel == null)
                {
                    throw new HytException("找不到编号为" + id + "出库单");
                }

                dsModel.QuantityCount = dsModel.List.Sum(item => item.ProductQuantity);
                dsModel.WeightCount   = dsModel.List.Sum(item => item.Weight);
                //根据编号获得实际地区全称,可用dsModel.ListDs中地区
                prov = BasicAreaBo.Instance.GetProvinceEntity(dsModel.AreaSysNo, out city, out area);

                ViewBag.City = city == null ? "找不到对应城市" : city.AreaName;
                ViewBag.Area = area == null ? "找不到对应地区" : area.AreaName;
                ViewBag.Prov = prov == null ? "找不到对应省" : prov.AreaName;
                //关联订单
                dsModel.SoOrder = order;

                if (isUpdate)
                {
                    WhWarehouseBo.Instance.UpdateStockOut(master);
                }
                if (string.IsNullOrEmpty(isRefresh))
                {
                    Hyt.BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, "打印分销出库单", LogStatus.系统日志目标类型.出库单, id,
                                                     CurrentUser.Base.SysNo);
                }


                if (dsModel.IsSelfSupport == (int)DistributionStatus.商城是否自营.是)
                {
                    dsModel.MoneyCount = dsModel.List.Sum(item => item.RealSalesAmount);
                    return(View("DsPickingSelfSupport", dsModel));
                }
                else
                {
                    return(View("DsPicking2", dsModel));
                }
                #endregion
            }
            else
            {
                #region 商城打印
                //int? b = null;
                //int a = b ?? 0;
                var model = PrintBo.Instance.GetPrintPicking(id);

                if (model == null)
                {
                    throw new HytException("找不到编号为" + id + "出库单");
                }

                model.QuantityCount = model.List.Sum(item => item.ProductQuantity);
                model.MoneyCount    = model.List.Sum(item => item.RealSalesAmount);

                //根据编号获得实际地区全称
                prov = BasicAreaBo.Instance.GetProvinceEntity(model.AreaSysNo, out city, out area);

                ViewBag.City = city == null ? "" : city.AreaName;
                ViewBag.Area = area == null ? "" : area.AreaName;
                ViewBag.Prov = prov == null ? "" : prov.AreaName;


                if (isUpdate)
                {
                    WhWarehouseBo.Instance.UpdateStockOut(master);
                }
                if (string.IsNullOrEmpty(isRefresh))
                {
                    Hyt.BLL.Log.SysLog.Instance.Info(LogStatus.系统日志来源.后台, "打印商城出库单", LogStatus.系统日志目标类型.出库单, id,
                                                     CurrentUser.Base.SysNo);
                }
                //关联订单
                model.SoOrder = order;

                return(View("Picking2", model));

                #endregion
            }
        }
Beispiel #9
0
        /// <summary>
        /// 门店自提(补充业务所需的配送单和结算单)
        /// </summary>
        /// <param name="entity">出库单</param>
        /// <param name="user">操作人</param>
        /// <param name="payMoney">收款金额,如为空表已付款</param>
        /// <param name="PaymentType">PaymentType.现金或者 PaymentType.刷卡</param>
        /// <returns></returns>
        /// <remarks>2013-08-21 朱成果 创建</remarks>
        private void GenerateOtherDataForPickUp(WhStockOut entity, Hyt.Model.SyUser user, decimal?payMoney, int PaymentType)
        {
            var     f        = Hyt.DataAccess.Finance.IFnReceiptVoucherDao.Instance.GetEntity((int)Hyt.Model.WorkflowStatus.FinanceStatus.收款来源类型.销售单, entity.OrderSysNO);
            decimal havePaid = 0;

            if (f != null && f.Status != (int)Hyt.Model.WorkflowStatus.FinanceStatus.收款单状态.作废)
            {
                havePaid = f.ReceivedAmount;//预付金额
            }
            var delivery = new LgDelivery()
            {
                DeliveryUserSysNo = user.SysNo,
                DeliveryTypeSysNo = entity.DeliveryTypeSysNo,
                CreatedBy         = user.SysNo,
                CreatedDate       = DateTime.Now,
                Status            = (int)LogisticsStatus.配送单状态.已结算,
                StockSysNo        = entity.WarehouseSysNo,
                IsEnforceAllow    = 0,
                PaidAmount        = havePaid,
                CODAmount         = payMoney.HasValue ? payMoney.Value : 0
            };
            var deliverySysNo = Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.CreateLgDelivery(delivery);//生成结算单
            var deliveryItem  = new LgDeliveryItem()
            {
                DeliverySysNo    = deliverySysNo,
                NoteType         = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单据类型.出库单,
                NoteSysNo        = entity.SysNo,
                Status           = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.配送单明细状态.已签收,
                AddressSysNo     = entity.ReceiveAddressSysNo,
                TransactionSysNo = entity.TransactionSysNo,
                StockOutAmount   = entity.StockOutAmount,
                PaymentType      = payMoney.HasValue ? (int)Hyt.Model.WorkflowStatus.BasicStatus.支付方式类型.到付 : (int)Hyt.Model.WorkflowStatus.BasicStatus.支付方式类型.预付,
                Receivable       = payMoney.HasValue ? payMoney.Value : 0,
                IsCOD            = payMoney.HasValue ? (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.是 : (int)Hyt.Model.WorkflowStatus.LogisticsStatus.是否到付.否,
                Remarks          = "【门店自提系统自动创建】",
                CreatedBy        = user.SysNo,
                CreatedDate      = DateTime.Now
            };

            Hyt.DataAccess.Logistics.ILgDeliveryDao.Instance.AddDeliveryItem(deliveryItem);
            var settlement = new LgSettlement
            {
                AuditDate         = DateTime.Now,
                AuditorSysNo      = user.SysNo,
                CODAmount         = payMoney.HasValue ? payMoney.Value : 0,
                CreatedBy         = user.SysNo,
                CreatedDate       = DateTime.Now,
                DeliveryUserSysNo = user.SysNo,
                PaidAmount        = havePaid,
                TotalAmount       = payMoney.HasValue ? payMoney.Value : 0,
                Status            = (int)LogisticsStatus.结算单状态.已结算,
                WarehouseSysNo    = entity.WarehouseSysNo,
                Remarks           = "【门店自提系统自动创建】"
            };
            int settlementSysNo = Hyt.DataAccess.Logistics.ILgSettlementDao.Instance.Create(settlement);
            var settlementItem  = new LgSettlementItem
            {
                CreatedBy          = user.SysNo,
                CreatedDate        = DateTime.Now,
                DeliverySysNo      = deliverySysNo,
                DeliveryItemStatus = (int)LogisticsStatus.结算单状态.已结算,
                PayAmount          = payMoney.HasValue ? payMoney.Value : 0,
                SettlementSysNo    = settlementSysNo,
                TransactionSysNo   = entity.TransactionSysNo,
                Status             = (int)Hyt.Model.WorkflowStatus.LogisticsStatus.结算单明细状态.已结算,
                StockOutSysNo      = entity.SysNo,
                PayType            = PaymentType
            };

            Hyt.DataAccess.Logistics.ILgSettlementItemDao.Instance.Create(settlementItem);
        }
Beispiel #10
0
        /// <summary>
        /// 二期业务数据三段 仓库物流
        /// </summary>
        /// <param name="listObject"></param>
        private void AddBaseTaskObject2ToList4(List <BaseTask> listObject)
        {
            //BaseTask bsAT = new BsArea();

            //BaseTask crCustomer = new CrCustomer();
            //BaseTask crCL = new CrCustomerLevel();
            //BaseTask crCQ = new CrCustomerQuestion();
            //BaseTask crRA = new CrReceiveAddress();

            //BaseTask feArticle = new FeArticle();
            //BaseTask feAC = new FeArticleCategory();
            //BaseTask feCS = new FeCommentSupport();
            //BaseTask fepc = new FeProductComment();
            //BaseTask fePCI = new FeProductCommentImage();
            //BaseTask fePCR = new FeProductCommentReply();

            //BaseTask fninvoice = new FnInvoice();

            //BaseTask fnpv = new FnReceiptVoucher();
            //BaseTask fnReceiptVoucherItem = new FnReceiptVoucherItem();
            //BaseTask fnop = new FnOnlinePayment();
            //BaseTask fnPaymentVoucher = new FnPaymentVoucher();
            //BaseTask fnPaymentVoucherItem = new FnPaymentVoucherItem();

            //BaseTask lgDelivery = new LgDelivery();
            //BaseTask lgDI = new LgDeliveryItem();
            //BaseTask lgDS = new LgDeliveryScope();

            //BaseTask lgDUC = new LgDeliveryUserCredit();

            //BaseTask lgsettlement = new LgSettlement();
            //BaseTask lgSI = new LgSettlementItem();

            //BaseTask pdAttribute = new PdAttribute();
            //BaseTask pdAG = new PdAttributeGroup();
            //BaseTask pdAGA = new PdAttributeGroupAssociation();
            //BaseTask pdAO = new PdAttributeOption();
            //BaseTask pdBrand = new PdBrand();
            //BaseTask pdCGA = new PdCatAttributeGroupAso();
            //BaseTask pdCategory = new PdCategory();
            //BaseTask pdCA = new PdCategoryAssociation();
            //BaseTask pdPrice = new PdPrice();
            //BaseTask pdProduct = new PdProduct();
            //BaseTask pdPA = new PdProductAssociation();
            //BaseTask pdProductAttribute = new PdProductAttribute();
            //BaseTask pdPI = new PdProductImage();
            //BaseTask pdTemplate = new PdTemplate();

            //BaseTask soOrder = new SoOrder();
            //BaseTask soOrderItem = new SoOrderItem();
            //BaseTask soRA = new SoReceiveAddress();

            BaseTask lgDelivery = new LgDelivery();
            BaseTask lgDI       = new LgDeliveryItem();

            BaseTask lgsettlement = new LgSettlement();
            BaseTask lgSI         = new LgSettlementItem();

            BaseTask whStockOut     = new WhStockOut();
            BaseTask whStockOutItem = new WhstockOutItem();

            BaseTask whstockin     = new WhStockIn();
            BaseTask whstockinItem = new WHStockinItem();
            BaseTask rcReturn      = new RCReturn();
            BaseTask rcReturnItem  = new RcReturnItem();

            //listObject.Add(bsAT);

            ////listObject.Add(bsOrganization);
            //listObject.Add(crCustomer);
            //listObject.Add(crCL);
            //listObject.Add(crCQ);
            //listObject.Add(crRA);

            //listObject.Add(feArticle);
            //listObject.Add(feAC);
            //listObject.Add(feCS);
            //listObject.Add(fePCI);
            //listObject.Add(fePCR);
            //listObject.Add(fepc);

            //listObject.Add(fnpv);
            //listObject.Add(fnReceiptVoucherItem);
            //listObject.Add(fnop);
            //listObject.Add(fninvoice);

            //listObject.Add(fnPaymentVoucher);
            //listObject.Add(fnPaymentVoucherItem);

            //listObject.Add(lgDelivery);
            //listObject.Add(lgDI);
            //listObject.Add(lgDS);
            //listObject.Add(lgsettlement);
            //listObject.Add(lgSI);

            //listObject.Add(pdAttribute);
            //listObject.Add(pdAG);
            //listObject.Add(pdAGA);
            //listObject.Add(pdAO);
            //listObject.Add(pdBrand);
            //listObject.Add(pdCGA);
            //listObject.Add(pdCategory);
            //listObject.Add(pdCA);
            //listObject.Add(pdPrice);
            //listObject.Add(pdProduct);
            //listObject.Add(pdPA);
            //listObject.Add(pdProductAttribute);
            //listObject.Add(pdTemplate);
            //listObject.Add(pdPI);

            //listObject.Add(soOrder);
            //listObject.Add(soOrderItem);
            //listObject.Add(soRA);



            listObject.Add(whStockOut);
            listObject.Add(whStockOutItem);
            listObject.Add(whstockin);
            listObject.Add(whstockinItem);

            listObject.Add(rcReturn);
            listObject.Add(rcReturnItem);

            listObject.Add(lgDelivery);
            listObject.Add(lgDI);

            listObject.Add(lgsettlement);
            listObject.Add(lgSI);
        }
Beispiel #11
0
 /// <summary>
 /// 新增出库单
 /// </summary>
 /// <param name="model">用于新增出库单的实体</param>
 /// <returns>返回出库单系统编号</returns>
 /// <remarks>2013-06-08 周瑜 创建</remarks>
 public abstract int Insert(WhStockOut model);
Beispiel #12
0
 /// <summary>
 /// 修改出库单(用于事务处理)
 /// </summary>
 /// <param name="model">用于修改出库单的实体</param>
 /// <param name="status">状态</param>
 /// <returns>返回受影响的行数</returns>
 /// <remarks>2014-08-01 余勇 创建</remarks>
 public abstract int UpdateStockOutByStatus(WhStockOut model, int status);
Beispiel #13
0
 /// <summary>
 /// 修改出库单状态
 /// </summary>
 /// <param name="model">用于修改出库单的实体</param>
 /// <returns>返回受影响的行数</returns>
 /// <remarks>2013-06-08 周瑜 创建</remarks>
 public abstract int Update(WhStockOut model);
Beispiel #14
0
        /// <summary>
        /// 订单分配出库
        /// </summary>
        /// <param name="datas">出库商品列表:Model.Quantity 为出库数量</param>
        /// <param name="warehouseSysNo">仓库编号</param>
        /// <param name="user">操作人</param>
        /// <returns></returns>
        /// <remarks>
        /// 2013-07-16 黄伟 创建
        /// 2013-12-19 黄志勇 修改订单日志
        /// </remarks>
        private WhStockOut CreateOutStock(IList <Model.SoOrderItem> datas, int warehouseSysNo, SyUser user)
        {
            if (datas == null || !datas.Any())
            {
                return(null);
            }
            if (warehouseSysNo < 1)
            {
                throw new ArgumentNullException("warehouseSysNo", @"必需选择一个仓库");
            }
            var so      = SoOrderBo.Instance.GetEntity(datas[0].OrderSysNo);
            var soItems = SoOrderBo.Instance.GetOrderItemsByOrderId(so.SysNo);

            var whStockOut = new WhStockOut()
            {
                ContactBeforeDelivery = so.ContactBeforeDelivery,
                CreatedBy             = user.SysNo,
                CreatedDate           = DateTime.Now,
                ReceiveAddressSysNo   = so.ReceiveAddressSysNo,
                CustomerMessage       = so.CustomerMessage,
                DeliveryRemarks       = so.DeliveryRemarks,
                DeliveryTime          = so.DeliveryTime,
                DeliveryTypeSysNo     = so.DeliveryTypeSysNo,
                InvoiceSysNo          = so.InvoiceSysNo,
                IsCOD = 1,
                IsPrintedPackageCover = 1,
                IsPrintedPickupCover  = 1,
                LastUpdateBy          = user.SysNo,
                LastUpdateDate        = DateTime.Now,
                OrderSysNO            = so.SysNo,
                Receivable            = so.CashPay,
                Remarks          = so.Remarks,
                Status           = (int)WarehouseStatus.出库单状态.待配送,
                StockOutAmount   = so.OrderAmount,
                TransactionSysNo = so.TransactionSysNo,
                WarehouseSysNo   = warehouseSysNo,
                StockOutDate     = DateTime.Now,
                StockOutBy       = user.SysNo
            };

            //note:调用保存出库单主表的方法
            whStockOut.SysNo = IOutStockDao.Instance.InsertMain(whStockOut);

            foreach (var data in datas)
            {
                var whStockOutItem = new WhStockOutItem()
                {
                    CreatedBy        = user.SysNo,
                    CreatedDate      = DateTime.Now,
                    LastUpdateBy     = user.SysNo,
                    LastUpdateDate   = DateTime.Now,
                    Measurement      = "",
                    OrderSysNo       = so.SysNo,
                    OriginalPrice    = data.OriginalPrice,
                    ProductName      = data.ProductName,
                    ProductQuantity  = data.Quantity,
                    RealSalesAmount  = data.SalesAmount / data.Quantity * data.RealStockOutQuantity,
                    ProductSysNo     = data.ProductSysNo,
                    Status           = 1,
                    StockOutSysNo    = whStockOut.SysNo,
                    TransactionSysNo = so.TransactionSysNo,
                    Weight           = 0m,
                    OrderItemSysNo   = data.SysNo
                };

                //调用保存出库单明细表的方法
                IOutStockDao.Instance.InsertItem(whStockOutItem); //朱成果 添加
                var soItem = soItems.First(p => p.SysNo == data.SysNo);
                //更新当前出库明细中的出库数量
                soItem.RealStockOutQuantity += data.Quantity;
                //出库数量到数据库
                ISoOrderItemDao.Instance.UpdateOutStockQuantity(soItem.SysNo, soItem.RealStockOutQuantity);
            }

            //更新销售单主表
            so.Status       = (int)OrderStatus.销售单状态.已创建出库单;
            so.OnlineStatus = Constant.OlineStatusType.已发货;

            //调用更新销售单主表方法
            so.DefaultWarehouseSysNo = warehouseSysNo;

            SoOrderBo.Instance.UpdateOrder(so); //更新订单 余勇修改为调用业务层方法  ISoOrderDao.Instance.Update(so); //更新订单状态,默认出库仓库

            var warehouseName = WhWarehouseBo.Instance.GetWarehouseEntity(warehouseSysNo).WarehouseName;

            SoOrderBo.Instance.WriteSoTransactionLog(so.TransactionSysNo,
                                                     string.Format(Constant.ORDER_TRANSACTIONLOG_OUTSTOCK_CREATE,
                                                                   warehouseName, whStockOut.SysNo), user.UserName);

            return(whStockOut);
        }