Exemple #1
0
        /// <summary>
        /// 下载配送区域表
        /// </summary>
        /// <returns></returns>
        public bool DownDistStationInfo()
        {
            bool tag = true;

            try
            {
                DataTable distStationTable = this.GetDistStationCode();
                string    distList         = UtinString.MakeString(distStationTable, "dist_code");
                DataTable distTable        = this.GetDistInfo(distList);
                if (distTable.Rows.Count > 0)
                {
                    DataSet distds = Insert(distTable);
                    this.Insert(distds);
                }
                else
                {
                    tag = false;
                }
            }
            catch (Exception e)
            {
                throw new Exception("下载区域表失败!原因:" + e.Message);
            }
            return(tag);
        }
Exemple #2
0
        /// <summary>
        /// 下载产品信息 同时上报
        /// </summary>
        /// <returns></returns>
        public bool DownProductInfo()
        {
            bool tag = true;

            try
            {
                DataTable codedt   = this.GetProductCode();
                string    codeList = UtinString.MakeString(codedt, "custom_code");
                codeList = "BRAND_CODE NOT IN (" + codeList + ")";
                DataTable bradCodeTable = this.GetProductInfo(codeList);
                if (bradCodeTable.Rows.Count > 0)
                {
                    DataSet brandCodeDs = this.Insert(bradCodeTable);
                    this.Insert(brandCodeDs);
                    //上报数据
                    //upload.InsertProduct(brandCodeDs);
                }
                else
                {
                    tag = false;
                }
            }
            catch (Exception e)
            {
                throw new Exception("下载卷烟失败!原因:" + e.Message);
            }
            return(tag);
        }
Exemple #3
0
        /// <summary>
        /// 下载客户信息
        /// </summary>
        /// <returns></returns>
        public bool DownCustomerInfo()
        {
            bool tag = true;

            try
            {
                this.DeleteCustomer();
                DataTable customerCodeDt = this.GetCustomerCode();
                string    CusromerList   = UtinString.MakeString(customerCodeDt, "customer_code");
                CusromerList = " CUST_CODE NOT IN (" + CusromerList + ")";
                DataTable customerDt = this.GetCustomerInfo(CusromerList);
                if (customerDt.Rows.Count > 0)
                {
                    DataSet custDs = this.Insert(customerDt);
                    this.Insert(custDs);
                    //上报客户信息数据
                    // upload.InsertCustom(custDs);
                }
            }
            catch (Exception e)
            {
                throw new Exception("下载客户失败!原因:" + e.Message);
            }
            return(tag);
        }
Exemple #4
0
        /// <summary>
        /// 下载单位数据
        /// </summary>
        /// <returns></returns>
        public bool DownUnitCodeInfo()
        {
            bool      tag             = true;
            DataTable unitProductDt   = this.GetUnitProduct();//取得中间表数据
            string    productcodeList = UtinString.MakeString(unitProductDt, "UNIT_LIST_CODE");

            productcodeList = "BRAND_N NOT IN(" + productcodeList + ")";

            DataTable Unitdt = this.GetUnitInfo(productcodeList);//下载数据

            if (Unitdt.Rows.Count > 0)
            {
                DataTable codedt        = this.GetUnitCode();                                      //取得单位
                DataSet   ds            = this.InsertTable(Unitdt);                                //把数据转化放到单位表和中间表
                DataTable unitTable     = ds.Tables["WMS_UNIT_INSERT"];                            //取得单位表
                DataTable unitListTable = ds.Tables["WMS_UNIT_PRODUCT"];                           //取得单位系列表
                string    codeList      = UtinString.MakeString(codedt, "unit_code");
                DataRow[] unitdr        = unitTable.Select("UNIT_CODE NOT IN (" + codeList + ")"); //把没有下载过的取出来
                DataSet   unitDs        = this.InsertUnit(unitdr);
                DataSet   unitlistds    = this.InsertProduct(unitListTable);
                if (unitDs.Tables["WMS_UNIT_INSERT"].Rows.Count > 0)
                {
                    this.Insert(unitDs.Tables["WMS_UNIT_INSERT"]);
                }
                if (unitlistds.Tables["WMS_UNIT_PRODUCT"].Rows.Count > 0)
                {
                    this.InsertLcUnit(unitlistds.Tables["WMS_UNIT_PRODUCT"]);
                }
            }
            return(tag);
        }
Exemple #5
0
        /// <summary>
        /// 从分拣下载线路信息
        /// </summary>
        /// <returns></returns>
        public bool DownSortRouteInfo()
        {
            bool tag = true;

            try
            {
                DataTable RouteCodeDt   = this.GetRouteCode();
                string    routeCodeList = UtinString.MakeString(RouteCodeDt, "deliver_line_code");
                //routeCodeList = UtinString.StringMake(routeCodeList);
                DataTable RouteDt = this.GetSortRouteInfo("");

                if (RouteDt.Rows.Count > 0)
                {
                    DataTable routeTable = this.InsertSortRouteCode(RouteDt).Tables["DWV_OUT_DELIVER_LINE"];
                    DataRow[] line       = routeTable.Select("DELIVER_LINE_CODE NOT IN(" + routeCodeList + ")");
                    if (line.Length > 0)
                    {
                        DataSet lineds = this.InsertRouteCode(line);
                        this.Insert(lineds);
                    }
                }
                else
                {
                    tag = false;
                }
            }
            catch (Exception e)
            {
                throw new Exception("从分拣下载线路信息失败!原因:" + e.Message);
            }
            return(tag);
        }
Exemple #6
0
        /// <summary>
        /// 根据日期下载入库数据 zxl   2012-09-14
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetInBillMiddle(string startDate, string endDate, string EmployeeCode, string wareCode, string billtype, out string errorInfo)
        {
            bool tag = false;

            Employee  = EmployeeCode;
            errorInfo = string.Empty;
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    DownDecidePlanDao dao            = new DownDecidePlanDao();
                    DataTable         emply          = dao.FindEmployee(EmployeeCode);
                    DataTable         inMasterBillNo = this.GetMiddleBillNo();
                    string            billnolist     = UtinString.MakeString(inMasterBillNo, "bill_no");
                    billnolist = string.Format("BB_INPUT_DATE >='{0}' AND BB_INPUT_DATE <='{1}' AND BB_UUID NOT IN({2})", startDate, endDate, billnolist);
                    DataTable masterdt = this.GetMiddleInBillMaster(billnolist);

                    string inDetailList = UtinString.MakeString(masterdt, "BILL_NO");
                    inDetailList = "BD_BB_UUID IN(" + inDetailList + ")";
                    DataTable detaildt = this.GetMiddleInBillDetail(inDetailList);

                    if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                    {
                        try
                        {
                            DataSet middleds = this.MiddleTable(masterdt);
                            DataSet masterds = this.MiddleInBillMaster(masterdt, emply.Rows[0]["employee_id"].ToString(), wareCode, billtype);
                            DataSet detailds = this.MiddleInBillDetail(detaildt);
                            this.Insert(masterds, detailds, middleds);
                            tag = true;
                        }
                        catch (Exception e)
                        {
                            errorInfo = "保存错误:" + e.Message;
                        }
                    }
                    else
                    {
                        errorInfo = "没有新的入库单下载!";
                    }
                }
                catch (Exception ex)
                {
                    errorInfo = "查询错误:" + ex.Message;
                }
            }
            return(tag);
        }
Exemple #7
0
        /// <summary>
        /// 下载配送区域表
        /// </summary>
        /// <returns></returns>
        public bool DownDistStationInfo()
        {
            bool      tag = true;
            DataTable distStationTable = this.GetDistStationCode();
            string    distList         = UtinString.MakeString(distStationTable, "dist_code");
            DataTable distTable        = this.GetDistInfo(distList);

            if (distTable.Rows.Count > 0)
            {
                DataSet distds = Insert(distTable);
                this.Insert(distds);
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #8
0
        /// <summary>
        /// 下载客户信息 创联
        /// </summary>
        /// <returns></returns>
        public bool DownCustomerInfos()
        {
            bool      tag            = true;
            DataTable customerCodeDt = this.GetCustomerCode();
            string    CusromerList   = UtinString.MakeString(customerCodeDt, "customer_code");

            CusromerList = " CUST_CODE NOT IN (" + CusromerList + ")";
            DataTable customerDt = this.GetCustomerInfo(CusromerList);

            if (customerDt.Rows.Count > 0)
            {
                DataSet custDs = this.Inserts(customerDt);
                this.Insert(custDs);
                //上报客户信息数据
                upload.InsertCustom(custDs);
            }
            return(tag);
        }
Exemple #9
0
        /// <summary>
        /// 下载配车单信息
        /// </summary>
        /// <returns></returns>
        public bool DownOrgDistBillInfo()
        {
            bool      tag          = true;
            DataTable orgTable     = this.QueryOrgDistCode();
            string    distCodeList = UtinString.MakeString(orgTable, "DIST_BILL_ID");

            distCodeList = "DIST_BILL_ID NOT IN (" + distCodeList + ")";
            DataTable bistBillMasterTable = this.GetDistBillMaster(distCodeList);

            if (bistBillMasterTable.Rows.Count > 0)
            {
                this.Insert(bistBillMasterTable);
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #10
0
        /// <summary>
        /// 选择日期从营销系统下载出库单据 创联
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetOutBills(string startDate, string endDate, string EmployeeCode, out string errorInfo, string wareCode, string billType)
        {
            bool tag = true;

            Employee  = EmployeeCode;
            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownOutBillDao dao            = new DownOutBillDao();
                DataTable      emply          = dao.FindEmployee(EmployeeCode);
                DataTable      outBillNoTable = this.GetOutBillNo(startDate);
                string         outBillList    = UtinString.MakeString(outBillNoTable, "bill_no");
                outBillList = string.Format("ORDER_DATE ='{0}' AND ORDER_ID NOT IN({1}) ", startDate, outBillList);
                DataTable masterdt = this.GetOutBillMasters(outBillList);

                string outDetailList = UtinString.MakeString(masterdt, "ORDER_ID");
                outDetailList = "ORDER_ID IN(" + outDetailList + ")";
                DataTable detaildt = this.GetOutBillDetail(outDetailList);

                if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                {
                    try
                    {
                        string  billno   = this.GetNewBillNo();
                        DataSet middleds = this.MiddleTable(masterdt, billno);
                        //DataSet masterds = this.OutBillMaster(masterdt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType);
                        DataSet detailds = this.OutBillDetail(detaildt, emply.Rows[0]["employee_id"].ToString(), wareCode, billType, startDate, billno);
                        this.Insert(detailds, middleds);
                    }
                    catch (Exception e)
                    {
                        errorInfo += e.Message;
                        tag        = false;
                    }
                }
                else
                {
                    errorInfo = "没有可下载的出库数据!";
                    tag       = false;
                }
            }
            return(tag);
        }
Exemple #11
0
        /// <summary>
        /// 下载入库主表 创联
        /// </summary>
        /// <param name="startDate"></param>
        /// <param name="endDate"></param>
        /// <param name="EmployeeCode"></param>
        /// <param name="wareCode"></param>
        /// <param name="billtype"></param>
        /// <param name="errorInfo"></param>
        /// <returns></returns>
        public bool GetInBills(string startDate, string endDate, string EmployeeCode, string wareCode, string billtype, out string errorInfo)
        {
            bool tag = false;

            Employee  = EmployeeCode;
            errorInfo = string.Empty;
            using (PersistentManager pm = new PersistentManager())
            {
                try
                {
                    DownInBillDao dao            = new DownInBillDao();
                    DataTable     emply          = dao.FindEmployee(EmployeeCode);
                    DataTable     inMasterBillNo = this.GetInBillNo();
                    string        billnolist     = UtinString.MakeString(inMasterBillNo, "bill_no");
                    string        billnolistStr  = string.Format("ORDER_DATE >='{0}' AND ORDER_DATE <='{1}'", startDate, endDate);
                    DataTable     masterdt       = this.InBillMaster(billnolistStr);
                    DataRow[]     masterdr       = masterdt.Select("ORDER_ID NOT IN(" + billnolist + ")");

                    string inDetailList = UtinString.MakeString(masterdr, "ORDER_ID");
                    inDetailList = "ORDER_ID IN(" + inDetailList + ")";
                    DataTable detaildt = this.InBillDetail(inDetailList);

                    if (masterdr.Length > 0 && detaildt.Rows.Count > 0)
                    {
                        DataSet masterds = this.InBillMaster(masterdr, emply.Rows[0]["employee_id"].ToString(), wareCode, billtype);

                        DataSet detailds = this.InBillDetail(detaildt);
                        this.Insert(masterds, detailds);
                        tag = true;
                    }
                    else
                    {
                        errorInfo = "没有新的入库单下载!";
                    }
                }
                catch (Exception e)
                {
                    errorInfo = "下载入库单失败!原因:" + e.Message;
                }
            }
            return(tag);
        }
Exemple #12
0
        /// <summary>
        /// 下载送货区域表
        /// </summary>
        /// <returns></returns>
        public bool DownReachInfo()
        {
            bool      tag           = true;
            DataTable reachCodeDt   = this.QueryReachCode();
            string    reachCodeList = UtinString.MakeString(reachCodeDt, "DIST_STA_CODE");

            reachCodeList = "DIST_STA_CODE NOT IN(" + reachCodeList + ")";
            DataTable reachDt = this.GetReachInfo(reachCodeList);

            if (reachDt.Rows.Count > 0)
            {
                this.Insert(reachDt);
            }
            else
            {
                tag = false;
            }

            return(tag);
        }
Exemple #13
0
        /// <summary>
        /// 下载厂商数据
        /// </summary>
        /// <returns></returns>
        public bool DownSupplierInfo()
        {
            bool      tag            = true;
            DataTable suppliercodedt = this.GetSupplierCode();
            string    codeList       = UtinString.MakeString(suppliercodedt, "SUPPLIERCODE");

            codeList = "FACTORY_CODE NOT IN (" + codeList + ")";
            DataTable spplierTable = this.GetSpplierInfo(codeList);

            if (spplierTable.Rows.Count > 0)
            {
                DataSet spplierds = this.Insert(spplierTable);
                this.InsertSpplier(spplierds);
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #14
0
        /// <summary>
        /// 下载部门信息
        /// </summary>
        /// <returns></returns>
        public bool DownDeptInfo()
        {
            bool      tag          = true;
            DataTable deptCodeDt   = this.GetDeptCode();
            string    deptCodeList = UtinString.MakeString(deptCodeDt, "DEPTCODE");

            deptCodeList = "DEPT_CODE NOT IN (" + deptCodeList + ")";
            DataTable deptDt = this.GetDeptInfo(deptCodeList);

            if (deptDt.Rows.Count > 0)
            {
                DataSet deptDs = this.Insert(deptDt);
                this.Insert(deptDs);
            }
            else
            {
                tag = false;
            }

            return(tag);
        }
        /// <summary>
        /// 选择日期从营销系统下载分拣信息 创联
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetSortingOrderDates(string orderDate, string endDate, out string errorInfo)
        {
            bool tag = false;

            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownSortingOrderDao dao = new DownSortingOrderDao();
                try
                {
                    //查询仓库7天内的订单号
                    DataTable orderdt       = this.GetOrderId(orderDate);
                    string    orderlist     = UtinString.MakeString(orderdt, "order_id");
                    string    orderlistDate = "ORDER_DATE ='" + orderDate + "' AND ORDER_ID NOT IN(" + orderlist + ")";
                    DataTable masterdt      = this.GetSortingOrders(orderlistDate);       //根据时间查询订单信息

                    string ordermasterlist = UtinString.MakeString(masterdt, "ORDER_ID"); //取得根据时间查询的订单号
                    ordermasterlist = "ORDER_ID IN (" + ordermasterlist + ")";
                    DataTable detaildt = this.GetSortingOrderDetails(ordermasterlist);    //根据订单号查询明细
                    if (masterdt.Rows.Count > 0 && detaildt.Rows.Count > 0)
                    {
                        DataSet masterds = this.SaveSortingOrders(masterdt);
                        DataSet detailds = this.SaveSortingOrderDetails(detaildt);
                        this.Insert(masterds, detailds);
                        //上报分拣订单
                        //upload.uploadSort(masterds, detailds);
                        tag = true;
                    }
                    else
                    {
                        errorInfo = "没有可用的数据下载!";
                    }
                }
                catch (Exception e)
                {
                    errorInfo = "错误:" + e.Message;
                }
            }
            return(tag);
        }
        /// <summary>
        /// 选择日期从营销系统下载分拣信息
        /// </summary>
        /// <param name="orderDate"></param>
        /// <param name="endDate"></param>
        /// <returns></returns>
        public bool GetSortingOrderDate(string orderDate, string endDate, out string errorInfo)
        {
            bool tag = false;

            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownSortingOrderDao dao = new DownSortingOrderDao();
                try
                {
                    //查询仓库7天内的订单号
                    DataTable orderdt         = this.GetOrderId(orderDate);
                    string    orderlist       = UtinString.MakeString(orderdt, "order_id");
                    string    orderlistDate   = "ORDER_DATE ='" + orderDate + "'";
                    DataTable masterdt        = this.GetSortingOrder(orderlistDate);                     //根据时间查询主表数据
                    DataRow[] masterdr        = masterdt.Select("ORDERID NOT IN(" + orderlist + ")");    //排除已经下载的数据
                    string    ordermasterlist = UtinString.MakeString(masterdr, "ORDERID");              //获取未下载主表单据的数据字符
                    DataTable detaildt        = this.GetSortingOrderDetail(orderlistDate);               //根据时间查询细表数据
                    DataRow[] detaildr        = detaildt.Select("ORDERID IN (" + ordermasterlist + ")"); //查询未下载的细单数据
                    if (masterdr.Length > 0 && detaildr.Length > 0)
                    {
                        DataSet masterds = this.SaveSortingOrder(masterdr);
                        DataSet detailds = this.SaveSortingOrderDetail(detaildr);
                        this.Insert(masterds, detailds);
                        //上报分拣订单
                        //upload.uploadSort(masterds, detailds);
                        tag = true;
                    }
                    else
                    {
                        errorInfo = "没有可用的数据下载!";
                    }
                }
                catch (Exception e)
                {
                    errorInfo = "下载分拣数据失败!原因:" + e.Message;
                }
            }
            return(tag);
        }
Exemple #17
0
        /// <summary>
        /// 下载单位数据
        /// </summary>
        /// <returns></returns>
        public bool DownUnitCodeInfo()
        {
            bool tag = true;

            try
            {
                DataTable Unitdt = this.GetUnitInfo("1=1");//下载数据
                if (Unitdt.Rows.Count > 0)
                {
                    DataTable codedt      = this.GetUnitCode();//取得单位
                    string    codeListstr = UtinString.MakeString(codedt, "UNIT_CODE");

                    DataTable unitProductDt = this.GetUnitProduct();//取得单位系列
                    string    unitListstr   = UtinString.MakeString(unitProductDt, "UNIT_LIST_CODE");

                    DataSet   ds            = this.InsertTable(Unitdt);                                         //把数据转化放到单位表和中间表
                    DataTable unitTable     = ds.Tables["WMS_UNIT_INSERT"];                                     //取得单位表
                    DataTable unitListTable = ds.Tables["WMS_UNIT_PRODUCT"];                                    //取得单位系列表

                    DataRow[] unitdr     = unitTable.Select("UNIT_CODE NOT IN (" + codeListstr + ")");          //获取没有下载的单位数据
                    DataRow[] unitListdr = unitListTable.Select("UNIT_LIST_CODE NOT IN (" + unitListstr + ")"); //获取没有下载的单位系列数据
                    DataSet   unitDs     = this.InsertUnit(unitdr);
                    DataSet   unitlistds = this.InsertProduct(unitListdr);
                    if (unitDs.Tables["WMS_UNIT_INSERT"].Rows.Count > 0)
                    {
                        this.Insert(unitDs.Tables["WMS_UNIT_INSERT"]);
                    }
                    if (unitlistds.Tables["WMS_UNIT_PRODUCT"].Rows.Count > 0)
                    {
                        this.InsertLcUnit(unitlistds.Tables["WMS_UNIT_PRODUCT"]);
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception("下载单位表失败!原因:" + e.Message);
            }
            return(tag);
        }
Exemple #18
0
        /// <summary>
        /// 下载单位数据 创联
        /// </summary>
        /// <returns></returns>
        public bool DownUnitInfo()
        {
            bool tag = true;
            //下载单位信息
            DataTable unitCodeTable = this.GetUnitCode();
            string    unitCodeList  = UtinString.MakeString(unitCodeTable, "unit_code");

            unitCodeList = "BRAND_UNIT_CODE NOT IN (" + unitCodeList + ")";
            DataTable brandUnitCodeTable = this.GetUnitInfos(unitCodeList);

            if (brandUnitCodeTable.Rows.Count > 0)
            {
                DataSet unitCodeDs = this.InsertUnit(brandUnitCodeTable);
                this.Insert(unitCodeDs);
            }
            else
            {
                tag = false;
            }

            //下载计量单位系列数据
            DataTable ulistCodeTable = this.GetUlistCode();
            string    ulistCodeList  = UtinString.MakeString(ulistCodeTable, "unit_list_code");

            ulistCodeList = "BRAND_ULIST_CODE NOT IN (" + ulistCodeList + ")";
            DataTable brandUlistCodeTable = this.GetBrandUlist(ulistCodeList);

            if (brandUlistCodeTable.Rows.Count > 0)
            {
                DataSet unitListCodeDs = this.InsertProducts(brandUlistCodeTable);
                this.InsertUlist(unitListCodeDs.Tables["WMS_UNIT_PRODUCT"]);
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #19
0
        /// <summary>
        /// 下载产品信息创联 同时上报
        /// </summary>
        /// <returns></returns>
        public bool DownProductInfos()
        {
            bool      tag      = true;
            DataTable codedt   = this.GetProductCode();
            string    codeList = UtinString.MakeString(codedt, "custom_code");

            codeList = "BRAND_CODE NOT IN (" + codeList + ")";
            DataTable bradCodeTable = this.GetProductInfo(codeList);

            if (bradCodeTable.Rows.Count > 0)
            {
                DataSet brandCodeDs = this.Inserts(bradCodeTable);
                DataSet brandCode   = this.InsertsUpload(bradCodeTable);
                this.Insert(brandCodeDs);
                //上报数据
                upload.InsertProduct(brandCode);
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #20
0
        /// <summary>
        /// 从营销系统下载线路信息 创联
        /// </summary>
        /// <returns></returns>
        public bool DownRouteInfos()
        {
            bool      tag           = true;
            DataTable RouteCodeDt   = this.GetRouteCode();
            string    routeCodeList = UtinString.MakeString(RouteCodeDt, "deliver_line_code");
            //routeCodeList = UtinString.StringMake(routeCodeList);
            DataTable RouteDt = this.GetRouteInfos("");

            if (RouteDt.Rows.Count > 0)
            {
                DataTable routeTable = this.InsertRouteCodes(RouteDt).Tables["DWV_OUT_DELIVER_LINE"];
                DataRow[] line       = routeTable.Select("DELIVER_LINE_CODE NOT IN(" + routeCodeList + ")");
                if (line.Length > 0)
                {
                    DataSet lineds = this.InsertRouteCode(line);
                    this.Insert(lineds);
                }
            }
            else
            {
                tag = false;
            }
            return(tag);
        }
Exemple #21
0
        //选择时间下载分拣数据
        public bool GetSortingOrderDate(string startDate, string endDate, string sortingLine, string batch, out string errorInfo)
        {
            bool tag = false;

            errorInfo = string.Empty;
            using (PersistentManager dbpm = new PersistentManager())
            {
                DownSortingInfoDao dao = new DownSortingInfoDao();
                try
                {
                    string sort = string.Empty;
                    if (sortingLine != string.Empty || sortingLine != null)
                    {
                        sort = " AND SORTINGLINECODE='" + sortingLine + "' AND BATCHID='" + batch + "'";
                    }
                    //查询仓库7天内的订单号
                    DataTable orderdt       = this.GetOrderId(startDate, endDate);
                    string    orderlist     = UtinString.MakeString(orderdt, "order_id");
                    string    orderlistDate = "ORDERDATE >='" + startDate + "' AND ORDERDATE <='" + endDate + "'" + sort;
                    DataTable masterdt      = this.GetSortingOrder(orderlistDate);
                    DataRow[] masterdr      = masterdt.Select("ORDERID NOT IN(" + orderlist + ")");

                    string ordermasterlist = UtinString.MakeString(masterdr, "OrderID");
                    ordermasterlist = "OrderID IN (" + ordermasterlist + ")";
                    DataTable detaildt = this.GetSortingOrderDetail(ordermasterlist);
                    if (masterdr.Count() > 0 && detaildt.Rows.Count > 0)
                    {
                        DataSet masterds = this.SaveSortingOrder(masterdr);
                        DataSet detailds = this.SaveSortingOrderDetail(detaildt);
                        this.Insert(masterds, detailds);
                        //上报分拣订单
                        //upload.uploadSort(masterds, detailds);
                        if (sort != string.Empty)
                        {
                            try
                            {
                                DataTable diapLine = this.GetDispatchLine(ordermasterlist);
                                DataSet   dispDs   = this.SaveDispatch(diapLine, sortingLine);
                                this.Insert(dispDs);
                                tag = true;
                            }
                            catch (Exception e)
                            {
                                errorInfo = "调度出错,请手动进行线路调度,出错原因:" + e.Message;
                            }
                        }
                        else
                        {
                            errorInfo = "没有选择分拣线!下载完成后,请手动进行线路调度!";
                        }
                        //tag = true;
                    }
                    else
                    {
                        errorInfo = "没有可用的数据下载!";
                    }
                }
                catch (Exception e)
                {
                    errorInfo = "下载错误:" + e.Message;
                }
            }
            return(tag);
        }