Exemplo n.º 1
0
        public void UpdateDelivery(XMDelivery One, XMOrderInfo xMOrderInfo, string date)
        {
            xMOrderInfo.DeliveryTime = Convert.ToDateTime(date);//修改出库时间
            xMOrderInfo.OrderStatus  = "WAIT_GOODS_RECEIVE_CONFIRM";
            xMOrderInfo.UpdateID     = HozestERPContext.Current.User.CustomerID;
            xMOrderInfo.UpdateDate   = DateTime.Now;
            IoC.Resolve <IXMOrderInfoService>().UpdateXMOrderInfo(xMOrderInfo);

            //修改发货单 是否发货状态
            One.IsDelivery = true;//已发货
            One.UpdateDate = DateTime.Now;
            One.UpdateId   = HozestERPContext.Current.User.CustomerID;
            IoC.Resolve <IXMDeliveryService>().UpdateXMDelivery(One);
        }
        /// <summary>
        /// 从表
        /// </summary>
        public void BindGrid()
        {
            //刷单申请明细信息

            List <XMDeliveryDetails> xMDeliveryDetailsList = new List <XMDeliveryDetails>();

            HozestERP.BusinessLogic.ManageProject.XMDelivery xMDelivery = null;
            if (this.DeliveryId > 0)
            {
                //明细
                xMDeliveryDetailsList = base.XMDeliveryDetailsService.GetXMDeliveryDetailsByDeliveryId(this.DeliveryId);
                //主表信息
                xMDelivery = base.XMDeliveryService.GetXMDeliveryById(this.DeliveryId);
            }
            // 运营审核通过的赠品申请单 赠品明细不允许新增、修改、删除
            if (xMDelivery != null)
            {
                if (xMDelivery.IsDelivery.Value == true)
                {
                    this.grdXMDeliveryDetailsManage.EditIndex = this.RowEditIndex;
                }
                else
                {
                    //if (this.RowEditIndex == -1)
                    //{
                    //    this.grdXMDeliveryDetailsManage.EditIndex = xMDeliveryDetailsList.Count();
                    //    xMDeliveryDetailsList.Add(new XMDeliveryDetails()); //新增编辑行
                    //}
                    //else
                    //{
                    this.grdXMDeliveryDetailsManage.EditIndex = this.RowEditIndex;
                    //}
                }
            }
            else
            {
                //if (this.RowEditIndex == -1)
                //{
                //    this.grdXMDeliveryDetailsManage.EditIndex = xMDeliveryDetailsList.Count();
                //    xMDeliveryDetailsList.Add(new XMDeliveryDetails()); //新增编辑行
                //}
                //else
                //{
                this.grdXMDeliveryDetailsManage.EditIndex = this.RowEditIndex;
                //}
            }
            this.grdXMDeliveryDetailsManage.DataSource = xMDeliveryDetailsList;
            this.grdXMDeliveryDetailsManage.DataBind();
        }
        /// <summary>
        /// 数据
        /// </summary>
        public void loadDate()
        {
            if (this.DeliveryId > 0)
            {
                HozestERP.BusinessLogic.ManageProject.XMDelivery xMDelivery = base.XMDeliveryService.GetXMDeliveryById(this.DeliveryId);

                if (xMDelivery != null)
                {
                    // this.lblOrderCode.Text = xMDelivery.OrderCode;
                    this.lblDeliveryNumber.Text = xMDelivery.DeliveryNumber;
                }
            }

            BindGrid();
        }
Exemplo n.º 4
0
        public bool JingDong(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            int paramLogisticsId = int.Parse(One.LogisticsId.ToString());

            if (One.LogisticsId == 1)
            {
                paramLogisticsId = 2170;
            }
            if (One.LogisticsId == 500 || One.LogisticsId == 1499) //中通速递
            {
                paramLogisticsId = 1499;
            }
            if (One.LogisticsId == 3049)   //德邦速递
            {
                paramLogisticsId = 3049;
            }
            var outstorage = IoC.Resolve <IXMOrderInfoAPIService>().GetOutstorage(One.OrderCode, paramLogisticsId.ToString(), Waybill, xMorderInfoApp);

            if (outstorage != null)
            {
                if (!outstorage.IsError)
                {
                    UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                    Succed = true;
                }
                else
                {
                    //DeleteDelivery(One);
                }
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }
Exemplo n.º 5
0
        public void DeleteDelivery(XMDelivery One)
        {
            One.IsEnabled  = true;
            One.UpdateDate = DateTime.Now;
            One.UpdateId   = HozestERPContext.Current.User.CustomerID;
            IoC.Resolve <IXMDeliveryService>().UpdateXMDelivery(One);

            var Deatil = IoC.Resolve <IXMDeliveryDetailsService>().GetXMDeliveryDetailsByDeliveryId(One.Id);

            if (Deatil != null && Deatil.Count > 0)
            {
                foreach (XMDeliveryDetails info in Deatil)
                {
                    info.IsEnabled  = true;
                    info.UpdateDate = DateTime.Now;
                    info.UpdateID   = HozestERPContext.Current.User.CustomerID;
                    IoC.Resolve <IXMDeliveryDetailsService>().UpdateXMDeliveryDetails(info);
                }
            }
        }
        public HozestERP.BusinessLogic.ManageProject.XMDelivery ToInsertDelivery(XMOrderInfo Info, XMSpareAddress SpareAddress, int type)
        {
            HozestERP.BusinessLogic.ManageProject.XMDelivery info = new HozestERP.BusinessLogic.ManageProject.XMDelivery();
            info.DeliveryTypeId = 480;                                        //正常
            info.DeliveryNumber = DateTime.Now.ToString("yyyyMMddHHmmssfff"); //发货单号;
            info.OrderCode      = Info.OrderCode;
            if (type == 1 || type == 3)
            {
                info.FullName        = Info.FullName;
                info.Mobile          = Info.Mobile;
                info.Tel             = Info.Tel;
                info.Province        = Info.Province;
                info.City            = Info.City;
                info.County          = Info.County;
                info.DeliveryAddress = Info.DeliveryAddress;
            }
            else if (type == 2 || type == 4)
            {
                info.FullName        = SpareAddress.FullName;
                info.Mobile          = SpareAddress.Mobile;
                info.Tel             = SpareAddress.Tel;
                info.Province        = SpareAddress.Province;
                info.City            = SpareAddress.City;
                info.County          = SpareAddress.County;
                info.DeliveryAddress = SpareAddress.DeliveryAddress;
            }

            info.OrderRemarks  = Info.CustomerServiceRemark;
            info.Shipper       = 0;
            info.Price         = 0;
            info.PrintBatch    = 0;
            info.PrintQuantity = 0;
            info.IsDelivery    = false;
            info.IsEnabled     = false;
            info.CreateDate    = DateTime.Now;
            info.CreateId      = HozestERPContext.Current.User.CustomerID;
            info.UpdateDate    = DateTime.Now;
            info.UpdateId      = HozestERPContext.Current.User.CustomerID;
            //base.XMDeliveryService.InsertXMDelivery(info);
            return(info);
        }
Exemplo n.º 7
0
        public bool VPH(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo, string LogisticsName)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            var Success_num = IoC.Resolve <XMDeliveryImportDeliverAPI>().GetVPHAPIDelivery(One.OrderCode, One.LogisticsId.ToString(), Waybill, xMorderInfoApp, LogisticsName);

            if (Success_num != null)
            {
                UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                Succed = true;
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }
Exemplo n.º 8
0
        public bool SuNing(XMDelivery One, XMOrderInfoApp xMorderInfoApp, XMOrderInfo xMOrderInfo)
        {
            bool   Succed  = false;
            string Waybill = One.LogisticsNumber;

            if (Waybill == "")
            {
                Waybill = null;
            }
            var ModifiedDate = IoC.Resolve <XMDeliveryImportDeliverAPI>().GetSuNingAPIDelivery(One.OrderCode, One.LogisticsCode, Waybill, xMorderInfoApp);

            if (ModifiedDate != null)
            {
                UpdateDelivery(One, xMOrderInfo, DateTime.Now.ToString());
                Succed = true;
            }
            else
            {
                //DeleteDelivery(One);
            }
            return(Succed);
        }
        public bool GetPlanBillResult(List <XMOrderInfoProductDetails> list, XMOrderInfo Info, XMSpareAddress SpareAddress, int WarehouseID, int type)
        {
            ManufacturersCodeRecord = "";
            bool complete = true;

            HozestERP.BusinessLogic.ManageProject.XMDelivery delivery = ToInsertDelivery(Info, SpareAddress, type);
            delivery.XM_Delivery_Details = new List <XMDeliveryDetails>();

            foreach (var info in list)
            {
                var exist1 = base.XMInventoryInfoService.GetXMInventoryInfoByParm(info.TManufacturersCode, WarehouseID);//库存管理中的数据
                if (type == 1 || type == 2)
                {
                    var exist = base.XMXLMInventoryService.GetXMXLMInventoryListByParm(WarehouseID, info.TManufacturersCode, "");
                    if ((canXMLProject && exist.Count > 0 && exist[0].Inventory >= info.ProductNum) || (!canXMLProject && exist1 != null && exist1.StockNumber >= info.ProductNum))
                    {
                        if (delivery.Shipper == 0)
                        {
                            var product = base.XMProductDetailsService.GetXMProductListByTManufacturersCode(info.TManufacturersCode);
                            if (product != null && product.Count > 0)
                            {
                                delivery.Shipper = product[0].Shipper;
                            }
                        }

                        if (delivery.OrderRemarks == Info.CustomerServiceRemark && !string.IsNullOrEmpty(info.SpareRemarks))
                        {
                            delivery.OrderRemarks = info.SpareRemarks;
                        }

                        delivery.XM_Delivery_Details.Add(GetDeliveryDetails(info, Info.OrderCode, WarehouseID));
                        //减喜临门当日库存
                        if (canXMLProject)
                        {
                            InventoryList.Add((int)exist[0].Inventory - (int)info.ProductNum);
                            XLMInventoryList.Add(exist[0]);
                        }
                        else
                        {
                            InventoryList.Add((int)exist1.StockNumber - (int)info.ProductNum);
                            XMInventoryInfoList.Add(exist1);
                        }
                    }
                    else
                    {
                        complete = false;
                        ManufacturersCodeRecord += "产品编码:" + info.TManufacturersCode + ",";
                    }
                }

                if (type == 3 || type == 4)                                                                               //乳胶枕,U型枕,无备用地址
                {
                    var exist = base.XMXLMInventoryService.GetXMXLMInventoryListByParm(693, info.TManufacturersCode, ""); //南方仓库
                    if ((canXMLProject && exist.Count > 0 && exist[0].Inventory >= info.ProductNum) || (!canXMLProject && exist1 != null && exist1.StockNumber >= info.ProductNum))
                    {
                        if (delivery.Shipper == 0)
                        {
                            var product = base.XMProductDetailsService.GetXMProductListByTManufacturersCode(info.TManufacturersCode);
                            if (product != null && product.Count > 0)
                            {
                                delivery.Shipper = product[0].Shipper;
                            }
                        }

                        if (delivery.OrderRemarks == Info.CustomerServiceRemark && !string.IsNullOrEmpty(info.SpareRemarks))
                        {
                            delivery.OrderRemarks = info.SpareRemarks;
                        }

                        delivery.XM_Delivery_Details.Add(GetDeliveryDetails(info, Info.OrderCode, 693));
                        //减喜临门当日库存
                        if (canXMLProject)
                        {
                            InventoryList.Add((int)exist[0].Inventory - (int)info.ProductNum);
                            XLMInventoryList.Add(exist[0]);
                        }
                        else
                        {
                            InventoryList.Add((int)exist1.StockNumber - (int)info.ProductNum);
                            XMInventoryInfoList.Add(exist1);
                        }
                    }
                    else
                    {
                        complete = false;
                        ManufacturersCodeRecord += "产品编码:" + info.TManufacturersCode + ",";
                    }
                }
            }

            if (complete == true && delivery.XM_Delivery_Details != null && delivery.XM_Delivery_Details.Count > 0)
            {
                DeliveryList.Add(delivery);
            }

            return(complete);
        }
Exemplo n.º 10
0
        protected void btnIsSingleRow_Click(object sender, EventArgs e)
        {
            //事务
            using (TransactionScope scope = new TransactionScope())
            {
                List <int> IDs = this.Master.GetSelectedIds(this.grdvClients);
                if (IDs.Count <= 0)
                {
                    base.ShowMessage("你没有选择任何记录!");
                    return;
                }
                else
                {
                    //查询所有选中的发票信息
                    var InvoiceInfoList = base.XMInvoiceInfoService.GetXMInvoiceInfoListByIds(IDs);
                    var NotPassList     = InvoiceInfoList.Where(a => a.IsScrap == true || a.IsSingleRow == true).ToList();//已排单或已废弃
                    if (NotPassList.Count > 0)
                    {
                        base.ShowMessage("已排单或已废弃的发票不能再参加排单!");
                        return;
                    }

                    var NoTypeList = InvoiceInfoList.Where(a => a.InvoiceType == null).ToList();
                    if (NoTypeList.Count > 0)
                    {
                        base.ShowMessage("发票类型未确定的发票不能再参加排单!");
                        return;
                    }

                    #region 排单
                    foreach (var item in InvoiceInfoList)
                    {
                        if (item != null)
                        {
                            List <XMInvoiceInfoDetail> InvoiceDetailsList = base.XMInvoiceInfoDetailService.GetXMInvoiceInfoDetailListByInvoiceInfoID(item.ID);

                            if (InvoiceDetailsList.Count == 0)
                            {
                                base.ShowMessage("发票明细无数据!");
                                return;
                            }
                            else
                            {
                                #region
                                var DeliveryList = base.XMDeliveryService.GetXMDeliveryByOrderCodeAndDeliveryTypeId(item.OrderCode, 481)
                                                   .Where(x => x.IsDelivery == false && x.IsShelve != true).ToList();//赠品

                                if (DeliveryList != null && DeliveryList.Count > 0)
                                {
                                    XMDeliveryDetails deliverDetails = new XMDeliveryDetails();
                                    deliverDetails.OrderNo              = item.OrderCode;
                                    deliverDetails.DetailsTypeId        = 11;//赠品
                                    deliverDetails.DeliveryId           = DeliveryList[0].Id;
                                    deliverDetails.ProductlId           = 0;
                                    deliverDetails.PlatformMerchantCode = "";
                                    deliverDetails.PrdouctName          = "发票";
                                    deliverDetails.Specifications       = "";
                                    deliverDetails.ProductNum           = 1;
                                    deliverDetails.InvoiceInfoID        = item.ID;
                                    deliverDetails.IsEnabled            = false;
                                    deliverDetails.CreateID             = HozestERPContext.Current.User.CustomerID;
                                    deliverDetails.CreateDate           = DateTime.Now;
                                    deliverDetails.UpdateID             = HozestERPContext.Current.User.CustomerID;
                                    deliverDetails.UpdateDate           = DateTime.Now;
                                    base.XMDeliveryDetailsService.InsertXMDeliveryDetails(deliverDetails);
                                }
                                else
                                {
                                    //新增
                                    HozestERP.BusinessLogic.ManageProject.XMDelivery xd = new HozestERP.BusinessLogic.ManageProject.XMDelivery();
                                    xd.DeliveryTypeId = 722;                                               //发票
                                    xd.DeliveryNumber = "ZP" + DateTime.Now.ToString("yyyyMMddHHmmssfff"); //赠品发货单号(自动生成)
                                    xd.OrderCode      = item.OrderCode;
                                    xd.Price          = 0;                                                 //运费
                                    //xd.Shipper = Shipper;//发货方
                                    //备用地址
                                    var SpareAddress = base.XMSpareAddressService.GetXMSpareAddressByParm(item.ID, 721);
                                    if (SpareAddress != null)
                                    {
                                        xd.FullName        = SpareAddress.FullName;
                                        xd.Mobile          = SpareAddress.Mobile;
                                        xd.Tel             = SpareAddress.Tel;
                                        xd.Province        = SpareAddress.Province;
                                        xd.City            = SpareAddress.City;
                                        xd.County          = SpareAddress.County;
                                        xd.DeliveryAddress = SpareAddress.DeliveryAddress;
                                    }
                                    else
                                    {
                                        var OrderInfo = base.XMOrderInfoService.GetXMOrderByOrderCode(item.OrderCode);
                                        if (OrderInfo != null)
                                        {
                                            xd.FullName        = OrderInfo.FullName;
                                            xd.Mobile          = OrderInfo.Mobile;
                                            xd.Tel             = OrderInfo.Tel;
                                            xd.Province        = OrderInfo.Province;
                                            xd.City            = OrderInfo.City;
                                            xd.County          = OrderInfo.County;
                                            xd.DeliveryAddress = OrderInfo.DeliveryAddress;
                                        }
                                        else
                                        {
                                            base.ShowMessage("订单号:" + item.OrderCode + "不存在!");
                                            return;
                                        }
                                    }

                                    xd.IsDelivery    = false;//是否发货
                                    xd.IsEnabled     = false;
                                    xd.CreateId      = HozestERPContext.Current.User.CustomerID;
                                    xd.CreateDate    = DateTime.Now;
                                    xd.UpdateId      = HozestERPContext.Current.User.CustomerID;
                                    xd.UpdateDate    = DateTime.Now;
                                    xd.PrintQuantity = 0; //打印次数
                                    xd.PrintBatch    = 0; //打印批次
                                    base.XMDeliveryService.InsertXMDelivery(xd);

                                    XMDeliveryDetails deliverDetails = new XMDeliveryDetails();
                                    deliverDetails.OrderNo              = item.OrderCode;
                                    deliverDetails.DetailsTypeId        = 11;//赠品
                                    deliverDetails.DeliveryId           = xd.Id;
                                    deliverDetails.ProductlId           = 0;
                                    deliverDetails.PlatformMerchantCode = "";
                                    deliverDetails.PrdouctName          = "发票";
                                    deliverDetails.Specifications       = "";
                                    deliverDetails.ProductNum           = 1;
                                    deliverDetails.InvoiceInfoID        = item.ID;
                                    deliverDetails.IsEnabled            = false;
                                    deliverDetails.CreateID             = HozestERPContext.Current.User.CustomerID;
                                    deliverDetails.CreateDate           = DateTime.Now;
                                    deliverDetails.UpdateID             = HozestERPContext.Current.User.CustomerID;
                                    deliverDetails.UpdateDate           = DateTime.Now;
                                    base.XMDeliveryDetailsService.InsertXMDeliveryDetails(deliverDetails);
                                }
                                #endregion
                                #region 修改发票排单状态

                                item.IsSingleRow = true;
                                item.UpdateID    = HozestERPContext.Current.User.CustomerID;
                                item.UpdateDate  = DateTime.Now;
                                base.XMInvoiceInfoService.UpdateXMInvoiceInfo(item);

                                #endregion

                                this.BindGrid(this.Master.PageIndex, this.Master.PageSize);
                                base.ShowMessage("排单成功!");
                            }
                        }
                    }
                    #endregion
                }
                scope.Complete();
            }
        }
Exemplo n.º 11
0
        public string XMDelivery_ImportDeliver(string Shop, XMDelivery One, string LogisticsName)
        {
            string msg  = "";
            bool   pass = false;
            var    XMOrderInfoAppList = IoC.Resolve <IXMOrderInfoAppService>().GetXMOrderInfoAppList();
            var    xMOrderInfo        = IoC.Resolve <IXMOrderInfoService>().GetXMOrderInfoListByOrderEqs(One.OrderCode);

            XMOrderInfoApp xMorderInfoApp = new XMOrderInfoApp();

            if (xMOrderInfo != null && xMOrderInfo.Count > 0)
            {
                for (int i = 0; i < XMOrderInfoAppList.Count; i++)
                {
                    if (XMOrderInfoAppList[i].PlatformTypeId == xMOrderInfo[0].PlatformTypeId && XMOrderInfoAppList[i].NickId == xMOrderInfo[0].NickID)
                    {
                        xMorderInfoApp = XMOrderInfoAppList[i];
                        break;
                    }
                }

                if (xMorderInfoApp != null)
                {
                    if (One.LogisticsNumber != null && One.LogisticsId != null)
                    {
                        //京东
                        if (Shop.IndexOf("京东") != -1)
                        {
                            pass = JingDong(One, xMorderInfoApp, xMOrderInfo[0]);
                            if (!pass)
                            {
                                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",发货失败!\r";
                            }
                        }
                        //天猫
                        else if (Shop.IndexOf("天猫") != -1)
                        {
                            pass = TM(One, xMorderInfoApp, xMOrderInfo[0]);
                            if (!pass)
                            {
                                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",发货失败!\r";
                            }
                        }
                        //苏宁易购
                        else if (Shop.IndexOf("苏宁易购") != -1)
                        {
                            pass = SuNing(One, xMorderInfoApp, xMOrderInfo[0]);
                            if (!pass)
                            {
                                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",发货失败!\r";
                            }
                        }
                        //一号店
                        else if (Shop.IndexOf("一号店") != -1)
                        {
                            pass = YHD(One, xMorderInfoApp, xMOrderInfo[0]);
                            if (!pass)
                            {
                                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",发货失败!\r";
                            }
                        }
                        //唯品会
                        else if (Shop.IndexOf("唯品会") != -1)
                        {
                            pass = VPH(One, xMorderInfoApp, xMOrderInfo[0], LogisticsName);
                            if (!pass)
                            {
                                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",发货失败!\r";
                            }
                        }
                        else
                        {
                            DeleteDelivery(One);
                        }
                    }
                    else
                    {
                        msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",物流单号,物流公司不能为空!\r";
                    }
                }
                else
                {
                    msg = "京东appkey、appSecret、sessionKey 不能为空!\r";
                }
            }
            else
            {
                msg = "订单:" + xMOrderInfo[0].OrderCode.ToString() + ",在订单表中不存在!\r";
            }

            return(msg);
        }