Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="billNo"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public bool ScanBillNo(string billNo, out string message)
        {
            SaleOrderEntity orderEntity = billNo.ToLower().StartsWith("so")
                ? _orderBll.GetSaleOrder(billNo)
                : _orderBll.GetSaleOrderByExpressNum(billNo);

            if (orderEntity == null)
            {
                message = string.Format("无效的物流单号或订单号[{0}]", billNo);
                return(false);
            }

            if (string.IsNullOrWhiteSpace(orderEntity.ExpressNum))
            {
                message = string.Format("订单[{0}]没有匹配物流单号不能出库校验", orderEntity.OrderNo);
                return(false);
            }

            if (orderEntity.Status != (int)OrderStatus.WaitOutStock)
            {
                message = string.Format("订单[{0}]不是待拣货状态,不能出库校验", orderEntity.OrderNo);
                return(false);
            }

            message = "";
            return(true);
        }
Exemplo n.º 2
0
        public ActionResult GetWayBill(string orderNo, string shipTypeCode)
        {
            SaleOrderBLL saleOrderBLL = new SaleOrderBLL();

            var saleOrder           = saleOrderBLL.GetSaleOrder(orderNo);
            var saleOrderItem       = saleOrderBLL.GetOrderItemList(orderNo).FirstOrDefault();
            var appId               = "1276314";
            var appKey              = "319ee1b5-d572-4eb6-b2b9-228076c48eec";
            var url                 = "http://api.kdniao.cc/api/eorderservice";
            var printServer         = ExpressDockingFactory.GetKdNiaoExpressDocking(url);
            KdNiaoRequestData kdnrd = new KdNiaoRequestData();

            kdnrd.AppKey      = appKey;
            kdnrd.EBusinessID = appId;
            kdnrd.DataType    = "2";
            kdnrd.RequestType = "1007";
            KdNiaoWaybillRequestDataContent kdnrdc = new KdNiaoWaybillRequestDataContent();

            kdnrdc.Receiver = new KdNiaoAddress()
            {
                ProvinceName = saleOrder.Province,
                CityName     = saleOrder.City,
                ExpAreaName  = saleOrder.County,
                Address      = saleOrder.ReceiveAddress,
                Name         = saleOrder.ReceiveContact,
                Mobile       = saleOrder.ReceiveCellPhone,
                PostCode     = saleOrder.ReceiveZip
            };
            var sendInfo        = new WarehouseBLL().GetWarehouse(saleOrder.WarehouseId);
            var provinceCityBll = new BaseProvinceCityBll();

            kdnrdc.Sender = new KdNiaoAddress()
            {
                ProvinceName = provinceCityBll.GetNameByCode(sendInfo.ProvinceId),
                CityName     = provinceCityBll.GetNameByCode(sendInfo.CityId),
                ExpAreaName  = provinceCityBll.GetNameByCode(sendInfo.CountyId),
                Address      = sendInfo.Address,
                Name         = sendInfo.Contact,
                Mobile       = sendInfo.Phone,
                PostCode     = sendInfo.PostalCode
            };

            kdnrdc.Commodity = new List <KdNiaoCommodity>()
            {
                new KdNiaoCommodity()
                {
                    GoodsName     = saleOrderItem.ProductName,
                    GoodsWeight   = saleOrderItem.Weight.ToString(),
                    Goodsquantity = saleOrderItem.QtyScaned.ToString(),
                    GoodsVol      = saleOrderItem.Volume.ToString()
                }
            };
            kdnrdc.ShipperCode           = shipTypeCode;
            kdnrdc.OrderCode             = saleOrder.OrderNo;
            kdnrdc.ExpType               = "1";
            kdnrdc.PayType               = "1";
            kdnrdc.IsNotice              = "1";
            kdnrdc.IsReturnPrintTemplate = "1";
            if (shipTypeCode == "YTO")
            {
                kdnrdc.CustomerName = "k210314881";
                kdnrdc.MonthCode    = "f2ar5n8b";
            }
            kdnrd.RequestData        = kdnrdc.ToJson();
            kdnrd.RequestDataContent = kdnrdc;
            kdnrd.DataSign           = Encrypt.KdNiaoSingEncrypt(kdnrd.RequestData, appKey, "UTF-8");
            var kdnrp = printServer.GetWayBill(kdnrd);

            //if (!kdnrp.Success)
            //{
            //    return Content(kdnrp.ToJson());
            //}
            return(Content(kdnrp.PrintTemplate));
        }