示例#1
0
        private XSDJ GetXSDJ()
        {
            strBiao biao = this.JieXiShuXing();
            XSDJ    xsdj = new XSDJ();

            if (biao.str.Count > 0)
            {
                xsdj.Bdbs = biao.str[0];
                if (biao.str.Count > 2)
                {
                    xsdj.Bdmc = biao.str[1];
                    xsdj.Bdfz = biao.str[2];
                }
            }
            for (int i = 0; i < biao.danju.Count; i++)
            {
                TempXSDJ item = new TempXSDJ();
                item = this.GetTempXSDJ(biao.danju[i]);
                if (item != null)
                {
                    xsdj.Dj.Add(item);
                }
            }
            return(xsdj);
        }
示例#2
0
        protected int ValidHead(TempXSDJ XSDJtemp)
        {
            if (string.IsNullOrEmpty(XSDJtemp.Djh))
            {
                this.ErrorAdd("没有单据号", "", 0, false);
                this.errorResolver.AbandonCount++;
                return(2);
            }
            if (string.IsNullOrEmpty(XSDJtemp.Gfmc))
            {
                this.ErrorAdd("没有购方名称", XSDJtemp.Djh, 0, true);
                return(1);
            }
            if ((this.Fplx == InvType.Special) && string.IsNullOrEmpty(XSDJtemp.Gfsh))
            {
                this.ErrorAdd("没有税号", XSDJtemp.Djh, 0, true);
                return(1);
            }
            FPLX fplx = 2;

            if (this.Fplx == InvType.Common)
            {
                fplx = 2;
            }
            else if (this.Fplx == InvType.Special)
            {
                fplx = 0;
            }
            else if (this.Fplx == InvType.transportation)
            {
                fplx = 11;
            }
            else if (this.Fplx == InvType.vehiclesales)
            {
                fplx = 12;
            }
            bool sFZJY = XSDJtemp.SFZJY == "0";

            if (!this.check.CheckTaxCode(this.Fplx, XSDJtemp.Gfsh, sFZJY, fplx))
            {
                this.ErrorAdd("税号有错误", XSDJtemp.Djh, 0, true);
                return(1);
            }
            return(0);
        }
示例#3
0
        protected XSDJ GetXSDJ()
        {
            XSDJ xsdj = new XSDJ {
                Bdbs = "SJJK0101",
                Bdmc = "Excel数据导入",
                Bdfz = "Excel数据导入"
            };
            DataTable table = this.ExcelLoad();

            foreach (DataRow row in table.Rows)
            {
                string   iD       = Convert.ToString(row["DanJuHaoMa"]);
                TempXSDJ tempXSDJ = this.GetTempXSDJ(iD, xsdj);
                if (tempXSDJ == null)
                {
                    tempXSDJ = new TempXSDJ {
                        Djh    = iD,
                        Sphs   = 0,
                        Gfmc   = Convert.ToString(row["GouFangMingCheng"]),
                        Gfsh   = Convert.ToString(row["GouFangShuiHao"]),
                        Gfdzdh = Convert.ToString(row["GouFangDiZhiDianHua"]),
                        Gfyhzh = Convert.ToString(row["GouFangYinHangZhangHao"]),
                        Bz     = Convert.ToString(row["BeiZhu"]),
                        Fhr    = Convert.ToString(row["FuHeRen"]),
                        Skr    = Convert.ToString(row["ShouKuanRen"]),
                        Qdspmc = Convert.ToString(row["QingDanHangShangPinMingCheng"])
                    };
                    DateTime result = new DateTime(0x76c, 1, 1);
                    if (DateTime.TryParse(row["DanJuRiQi"].ToString(), out result))
                    {
                        tempXSDJ.Djrq = result;
                    }
                    else
                    {
                        tempXSDJ.Djrq = DateTime.Now.Date;
                    }
                    tempXSDJ.Xfyhzh = Convert.ToString(row["XiaoFangYinHangZhangHao"]);
                    tempXSDJ.Xfdzdh = Convert.ToString(row["XiaoFangDiZhiDianHua"]);
                    tempXSDJ.SFZJY  = CommonTool.ToStringBool(row["ShenFenZhengJiaoYan"].ToString());
                    string str2 = Convert.ToString(row["HaiYangShiYou"]);
                    tempXSDJ.HYSY = CommonTool.ToBoolString(str2);
                    xsdj.Dj.Add(tempXSDJ);
                }
                TempXSDJ_MX item = new TempXSDJ_MX {
                    Hwmc    = Convert.ToString(row["HuoWuMingCheng"]),
                    Jldw    = Convert.ToString(row["JiLiangDanWei"]),
                    Gg      = Convert.ToString(row["GuiGe"]),
                    Sl      = CommonTool.TodoubleNew(Convert.ToString(row["ShuLiang"])),
                    Bhsje   = CommonTool.TodoubleNew_x(row["BuHanShuiJinE"].ToString()),
                    Slv     = CommonTool.ToSlv(row["ShuiLv"].ToString()),
                    Spsm    = Convert.ToString(row["ShangPinShuiMu"]),
                    Zkje    = new double?(CommonTool.TodoubleNew(row["ZheKouJinE"].ToString())),
                    Se      = CommonTool.TodoubleNew_x(row["ShuiE"].ToString()),
                    Zkse    = CommonTool.ToZKSE(row["ZheKouShuiE"].ToString()),
                    Zkl     = CommonTool.ToZKL(row["ZheKouLv"].ToString()),
                    Dj      = CommonTool.Todouble(row["DanJia"].ToString()),
                    Jgfs    = CommonTool.ToStringBool(row["JiaGeFangShi"].ToString()),
                    HangShu = tempXSDJ.Mingxi.Count + 1,
                    DJBH    = tempXSDJ.Djh
                };
                tempXSDJ.Mingxi.Add(item);
            }
            base.errorResolver.ImportTotal = xsdj.Dj.Count;
            return(xsdj);
        }
示例#4
0
        protected TempXSDJ GetTempXSDJ(strDanju danju)
        {
            int num;

            if (danju.str.Count < 7)
            {
                for (num = danju.str.Count; num < 7; num++)
                {
                    danju.str.Add("");
                }
            }
            TempXSDJ pxsdj = new TempXSDJ {
                Djh = danju.str[0]
            };
            int result = 0;

            if (!int.TryParse(danju.str[1], out result))
            {
                throw new CustomException("传入txt格式不正确");
            }
            pxsdj.Sphs   = result;
            pxsdj.Gfmc   = danju.str[2];
            pxsdj.Gfsh   = danju.str[3];
            pxsdj.Gfdzdh = danju.str[4];
            pxsdj.Gfyhzh = danju.str[5];
            pxsdj.Bz     = danju.str[6];
            if (danju.str.Count > 7)
            {
                pxsdj.Fhr = danju.str[7];
            }
            if (danju.str.Count > 8)
            {
                pxsdj.Skr = danju.str[8];
            }
            if (danju.str.Count > 9)
            {
                pxsdj.Qdspmc = danju.str[9];
            }
            if ((danju.str.Count > 10) && !string.IsNullOrEmpty(danju.str[10]))
            {
                DateTime now = DateTime.Now;
                DateTime.TryParse(danju.str[10], out now);
                pxsdj.Djrq = now.Date;
            }
            if (danju.str.Count > 11)
            {
                pxsdj.Xfyhzh = danju.str[11];
            }
            if (danju.str.Count > 12)
            {
                pxsdj.Xfdzdh = danju.str[12];
            }
            if (danju.str.Count > 13)
            {
                pxsdj.SFZJY = CommonTool.ToStringBool(danju.str[13]);
            }
            if (danju.str.Count > 14)
            {
                pxsdj.HYSY = CommonTool.ToBoolString(danju.str[14]);
            }
            for (num = 0; num < danju.mingxi.Count; num++)
            {
                TempXSDJ_MX item = this.GetTempXSDJ_MX(danju.mingxi[num], pxsdj.Djh, num + 1);
                if (item != null)
                {
                    pxsdj.Mingxi.Add(item);
                }
            }
            return(pxsdj);
        }