示例#1
0
    public void uploadOver(object sender, System.EventArgs e)
    {
        string errorMsg = "";

        try
        {
            string uploadFile = this.hiddenCostCenter.Value;
            string fullName = Server.MapPath("../") + uploadFile;
            DataTable dt = ExcelManager.getExcelSheetData(fullName);
            int i = 0;
            string DNShipment = "";
            bool bEmptyFile = true;
            string allErrors = string.Empty;
            IList<string> ret = new List<string>();

            this.gridview.DataSource = getNullDataTable(fullRowCount);
            this.gridview.DataBind();
            initTableColumnHeader();
            updatePanel1.Update();

            IList<uploadData> returnList = new List<uploadData>();
            foreach (DataRow dr in dt.Rows)
            {
                i++;
                if (i == 1)
                {
                    continue;
                }
                else if (i == 1002)
                {
                    break;
                }
                else
                {
                    DNShipment = dr[0].ToString();
                    if (DNShipment.Trim() == "")
                    {
                        continue;
                    }
                    else
                    {
                        bEmptyFile = false;
                        bool bExist = false;
                        string doc_type = this.cmbDocType.InnerDropDownList.SelectedValue.ToString();
                        string region = this.cmbRegion.InnerDropDownList.SelectedValue.ToString();
                        string carrier = this.cmbCarrier.InnerDropDownList.SelectedValue.ToString();

                        ArrayList serviceResult = new ArrayList();
                        try
                        {
                            serviceResult = iPackingList.PackingListForOBCheck("", Station, UserId, Customer,
                                                        DNShipment, doc_type, region, carrier, this.hidSessionKey.Value);
                                                        
                        }
                        catch (FisException ee)
                        {
                            allErrors = allErrors + ee.mErrmsg;                            
                            continue;
                        }
                        catch (Exception ex)
                        {
                            allErrors = allErrors + ex.Message;                            
                            continue;
                        }

                        //6.5
                        if (serviceResult[2].ToString() == "DN")
                        {
                            for (int j = 0; j < ret.Count; j++)
                            {
                                if (DNShipment.Substring(0, 10) == ret[j])
                                {
                                    bExist = true;
                                }
                            }
                        }
                        else
                        {
                            for (int j = 0; j < ret.Count; j++)
                            {
                                if (DNShipment == ret[j])
                                {
                                    bExist = true;
                                }
                            }
                        }

                        if (bExist == false)
                        {
                            //6.5
                            if (serviceResult[2].ToString() == "DN")
                            {
                                ret.Add(DNShipment.Substring(0, 10));
                            }
                            else
                            {
                                ret.Add(DNShipment);
                            }
                            this.hidRowCount.Value = ret.Count.ToString();

                            uploadData one = new uploadData();
                            //6.5
                            if (serviceResult[2].ToString() == "DN")
                            {
                                one.inputData = serviceResult[0].ToString().Substring(0, 10);
                            }
                            else
                            {
                                one.inputData = serviceResult[0].ToString();
                            }
                            one.info = new List<uploadDataInfo>();
                            //6.18 BOL
                            if (serviceResult[2].ToString() == "BOL")
                            {
                                ArrayList b1 = new ArrayList();
                                b1 = (ArrayList)serviceResult[1];
                                for (int bo = 0; bo < b1.Count; bo++)
                                {
                                    ArrayList a1 = new ArrayList();
                                    a1 = (ArrayList)b1[bo];
                                    for (int y = 0; y < a1.Count; y++)
                                    {
                                        uploadDataInfo one_info = new uploadDataInfo();
                                        one_info.internalID = (string)(((ArrayList)a1[y])[0]);
                                        one_info.xmlName = (string)(((ArrayList)a1[y])[1]);
                                        one_info.templateList = (IList<string>)(((ArrayList)a1[y])[2]);
                                        one_info.pdfList = (IList<string>)(((ArrayList)a1[y])[3]);

                                        one.info.Add(one_info);
                                    }
                                }
                                //6.18 BOL
                            }
                            else
                            {
                                ArrayList a1 = new ArrayList();
                                a1 = (ArrayList)serviceResult[1];
                                for (int y = 0; y < a1.Count; y++)
                                {
                                    uploadDataInfo one_info = new uploadDataInfo();
                                    one_info.internalID = (string)(((ArrayList)a1[y])[0]);
                                    one_info.xmlName = (string)(((ArrayList)a1[y])[1]);
                                    one_info.templateList = (IList<string>)(((ArrayList)a1[y])[2]);
                                    one_info.pdfList = (IList<string>)(((ArrayList)a1[y])[3]);

                                    one.info.Add(one_info);
                                }
                            }
                            returnList.Add(one);
                        }
                    }
                }
            }
            if (bEmptyFile)
            {
                //ITC-1360-1101 少资源
                errorMsg = this.GetLocalResourceObject(Pre + "_mesEmptyFile").ToString();
                writeToAlertMessage(errorMsg);
                endWaitingCoverDiv();             
            }
            else
            {
                if (allErrors != "")
                {
                    string tmp = fullName;
                    File.Delete(fullName);

                    this.gridview.DataSource = getDataTable(returnList.Count, returnList);
                    this.gridview.DataBind();
                    initTableColumnHeader();
                    updatePanel1.Update();
                    writeToAlertMessage(allErrors);
                    endWaitingCoverDiv();
                    FileProcess();
                }
                else
                {
                    string tmp = fullName;
                    File.Delete(fullName);

                    this.gridview.DataSource = getDataTable(returnList.Count, returnList);
                    this.gridview.DataBind();
                    initTableColumnHeader();
                    updatePanel1.Update();
                    FileProcess();
                    FileProcess2();
                }
            }            
        }
        catch (FisException ee)
        {
            writeToAlertMessage(ee.mErrmsg);
            endWaitingCoverDiv();
        }
        catch (Exception ex)
        {
            writeToAlertMessage(ex.Message);
            endWaitingCoverDiv();
        }

    }
示例#2
0
    public void uploadOver(object sender, System.EventArgs e)
    {
        string errorMsg = "";
        DataTable dt=null;
        string Succ_info = "Upload Success!";
        try
        {
            string uploadFile =  this.hiddenCostCenter.Value;
            string fullName = Server.MapPath("../") + uploadFile;

            dt = ExcelManager.getExcelSheetData(fullName);
            int i = 0;
            string DNShipment = "";
            bool bEmptyFile = true;
            string allErrors = string.Empty;
            IList<string> ret = new List<string>();

            IList<uploadData> returnList = new List<uploadData>();

            foreach (DataRow dr in dt.Rows)
            {
                i++;
                if (i == 1)
                {
                    continue;
                }
                else if (i == 1002)
                {
                    break;
                }
                else
                {
                    DNShipment = dr[0].ToString();
                    if (DNShipment.Trim() == "")
                    {
                        continue;
                    }
                    else
                    {
                        ArrayList serviceResult = new ArrayList();
                        string doc_type = this.CmbDocType1.InnerDropDownList.SelectedValue.ToString();
                        bEmptyFile = false;
                        bool bExist = false;
                        try
                        {
                            serviceResult =  iScanningList.ScanningListForCheck("", Station, UserId, Customer,DNShipment, doc_type);
                        }
                        catch (FisException ee)
                        {
                            allErrors = allErrors + ee.mErrmsg;
                            continue;
                        }
                        catch (Exception ex)
                        {
                            allErrors = allErrors + ex.Message;
                            continue;
                        }
                        DNShipment = (string)serviceResult[5];
                        for (int j = 0; j < ret.Count; j++)
                        {
                            if (DNShipment == ret[j])
                            {
                                bExist = true;
                            }
                        }
                        if (bExist == false)
                        {
                            ret.Add(DNShipment);
                            this.hidRowCount.Value = ret.Count.ToString();

                            uploadData one = new uploadData();
                            one.inputData = serviceResult[0].ToString();
                            one.info = new List<uploadDataInfo>();

                            ArrayList a1 = new ArrayList();
                            //a1 = (ArrayList)serviceResult[1];
                            //for (int y = 0; y < a1.Count; y++)
                            {
                                one.inputData = DNShipment;
                                uploadDataInfo one_info = new uploadDataInfo();
                                one_info.doc_type = (string)serviceResult[3];
                                one_info.path = (string)serviceResult[2];
                                one_info.xmlPara = (IList<string>)((IList<string>)serviceResult[0]);
                                one_info.pdfPara = (IList<string>)((IList<string>)serviceResult[1]);

                                one.info.Add(one_info);
                            }
                            returnList.Add(one);
                        }
                       
                    }
                }
            }
            if (bEmptyFile)
            {
                errorMsg = this.GetLocalResourceObject(Pre + "_mesEmptyFile").ToString();

                endWaitingCoverDiv();
                writeToAlertMessage(errorMsg);
               
            }
            else
            {
                if (allErrors != "")
                {
                    writeToAlertMessage(allErrors);
                    endWaitingCoverDiv();
                    FileProcess();
                }
                /*else
                {
                    writeToAlertMessage(Succ_info);
                }*/
                        string tmp = fullName;
                    File.Delete(fullName);

                    //this.gridview.DataSource = getDataTable(ret.Count, ret);
                    this.gridview.DataSource = getDataTable(returnList.Count, returnList);

                    this.gridview.DataBind();
                    initTableColumnHeader();
                    updatePanel1.Update();
                    FileProcess();
                    FileProcess2();
               
            }

        }
        catch (FisException ee)
        {
            writeToAlertMessage(ee.Message);
            endWaitingCoverDiv();
        }
        catch (Exception ex)
        {
            if (dt == null)
            {
                errorMsg = this.GetLocalResourceObject(Pre + "_mesEmptyFile").ToString();
                writeToAlertMessage(errorMsg);
            }
            else
            {
                writeToAlertMessage(ex.Message);
            }
            endWaitingCoverDiv();
        }

    }