示例#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
        private List <XSDJMXModel> ConvertImportXSDJ(XSDJ XsdjImport)
        {
            List <XSDJMXModel> list = new List <XSDJMXModel>();

            for (int i = 0; i < XsdjImport.Dj.Count; i++)
            {
                XSDJMXModel item = new XSDJMXModel {
                    BH      = XsdjImport.Dj[i].Djh,
                    GFMC    = XsdjImport.Dj[i].Gfmc,
                    GFSH    = XsdjImport.Dj[i].Gfsh,
                    GFDZDH  = XsdjImport.Dj[i].Gfdzdh,
                    GFYHZH  = XsdjImport.Dj[i].Gfyhzh,
                    XSBM    = "",
                    YDXS    = false,
                    DJRQ    = XsdjImport.Dj[i].Djrq.Date,
                    DJYF    = XsdjImport.Dj[i].Djrq.Month,
                    DJZT    = XsdjImport.Dj[i].DJZT,
                    KPZT    = "N",
                    BZ      = XsdjImport.Dj[i].Bz,
                    FHR     = XsdjImport.Dj[i].Fhr,
                    SKR     = XsdjImport.Dj[i].Skr,
                    QDHSPMC = XsdjImport.Dj[i].Qdspmc,
                    XFYHZH  = XsdjImport.Dj[i].Xfyhzh,
                    XFDZDH  = XsdjImport.Dj[i].Xfdzdh,
                    CFHB    = false,
                    DJZL    = XsdjImport.Dj[i].Djzl,
                    SFZJY   = false,
                    HYSY    = XsdjImport.Dj[i].HYSY
                };
                double num2 = 0.0;
                for (int j = 0; j < XsdjImport.Dj[i].Mingxi.Count; j++)
                {
                    XSDJ_MXModel model2 = new XSDJ_MXModel {
                        XSDJBH = XsdjImport.Dj[i].Mingxi[j].DJBH,
                        XH     = Convert.ToInt16((int)(j + 1)),
                        SL     = XsdjImport.Dj[i].Mingxi[j].Sl,
                        DJ     = XsdjImport.Dj[i].Mingxi[j].Dj,
                        JE     = Convert.ToDouble(XsdjImport.Dj[i].Mingxi[j].Bhsje),
                        SLV    = Convert.ToDouble(XsdjImport.Dj[i].Mingxi[j].Slv),
                        SE     = Convert.ToDouble(XsdjImport.Dj[i].Mingxi[j].Se),
                        SPMC   = XsdjImport.Dj[i].Mingxi[j].Hwmc,
                        SPSM   = XsdjImport.Dj[i].Mingxi[j].Spsm,
                        GGXH   = XsdjImport.Dj[i].Mingxi[j].Gg,
                        JLDW   = XsdjImport.Dj[i].Mingxi[j].Jldw,
                        HSJBZ  = (XsdjImport.Dj[i].Mingxi[j].Jgfs == "0") ? false : true,
                        DJHXZ  = XsdjImport.Dj[i].Mingxi[j].Djhxz,
                        FPZL   = XsdjImport.Dj[i].Mingxi[j].Fpzl.ToString(),
                        FPDM   = "",
                        FPHM   = 0,
                        SCFPXH = 0
                    };
                    num2 += Convert.ToDouble(XsdjImport.Dj[i].Mingxi[j].Bhsje);
                    item.ListXSDJ_MX.Add(model2);
                }
                item.JEHJ = num2;
                list.Add(item);
            }
            return(list);
        }
示例#3
0
        public void ImportTxt(string Path, PriceType JGFS, InvType FPLX)
        {
            this.path       = Path;
            base.Pricemode  = JGFS;
            base.FaPiaomode = FPLX;
            XSDJ xSDJ = this.GetXSDJ();

            base.SaveImport(xSDJ);
        }
示例#4
0
        public void ImportExcel(string File1Path, string File2Path, PriceType JiaGeFangShi, InvType FaPiaoLeiXing)
        {
            this.File1      = File1Path;
            this.File2      = File2Path;
            base.Pricemode  = JiaGeFangShi;
            base.FaPiaomode = FaPiaoLeiXing;
            XSDJ xSDJ = this.GetXSDJ();

            base.SaveImport(xSDJ);
        }
示例#5
0
 protected TempXSDJ GetTempXSDJ(string ID, XSDJ Xsdj)
 {
     foreach (TempXSDJ pxsdj in Xsdj.Dj)
     {
         if (pxsdj.Djh == ID)
         {
             return(pxsdj);
         }
     }
     return(null);
 }
示例#6
0
 protected void FanSuan(XSDJ xsdj)
 {
     if (xsdj.Dj.Count == 0)
     {
         this.ErrorAdd("无被接受的销售单据", "无单据被接收", 0, true);
     }
     else
     {
         for (int i = 0; i < xsdj.Dj.Count; i++)
         {
             xsdj.Dj[i].Djzl = CommonTool.GetInvTypeStr(this.Fplx);
             int num2 = this.ValidHead(xsdj.Dj[i]);
             if (num2 == 2)
             {
                 xsdj.Dj.RemoveAt(i);
                 i--;
             }
             else
             {
                 if (num2 == 1)
                 {
                     xsdj.Dj[i].DJZT = "N";
                 }
                 else
                 {
                     xsdj.Dj[i].DJZT = "Y";
                 }
                 this.hysy_x = xsdj.Dj[i].HYSY;
                 if (this.Jesm == PriceType.HanShui)
                 {
                     this.JesmTemp = true;
                 }
                 else
                 {
                     this.JesmTemp = false;
                 }
                 if (this.FanSuanMX(xsdj.Dj[i].Mingxi, xsdj.Dj[i].Djh))
                 {
                     xsdj.Dj[i].DJZT = this.DJZT;
                     xsdj.Dj.RemoveAt(i);
                     i--;
                 }
                 else
                 {
                     xsdj.Dj[i].DJZT = this.DJZT;
                 }
             }
         }
     }
     this.HeBingZheKouHang(xsdj);
 }
示例#7
0
        private void CreateZheKouHang(XSDJ xsdjt, int i, int j, double JE, double SE, double ZKL, int ZKHCount)
        {
            TempXSDJ_MX item = new TempXSDJ_MX {
                Hwmc  = CommonTool.GetDisCountMC(ZKL, ZKHCount),
                Zkl   = new double?(ZKL),
                Bhsje = new double?(-1.0 * JE),
                Se    = new double?(-1.0 * SE),
                DJBH  = xsdjt.Dj[i].Djh,
                Slv   = xsdjt.Dj[i].Mingxi[j - 1].Slv,
                Jgfs  = xsdjt.Dj[i].Mingxi[j - 1].Jgfs,
                Spsm  = xsdjt.Dj[i].Mingxi[j - 1].Spsm,
                Fpzl  = xsdjt.Dj[i].Mingxi[j - 1].Fpzl,
                Djhxz = 4,
                Sl    = 0.0,
                Dj    = 0.0
            };

            xsdjt.Dj[i].Mingxi.Insert(j, item);
        }
示例#8
0
 public void SaveImport(XSDJ xsdj)
 {
     try
     {
         MessageHelper.MsgWait("正在导入单据,请稍候...");
         int count = xsdj.Dj.Count;
         this.FanSuan(xsdj);
         ErrorResolver      errorResolver = this.errorResolver;
         XSDJ               xsdjImport    = xsdj;
         List <XSDJMXModel> listXSDJandMX = this.ConvertImportXSDJ(xsdjImport);
         this.imsaveDAL.SaveImportXSDJ(listXSDJandMX, errorResolver);
     }
     catch (Exception exception)
     {
         HandleException.HandleError(exception);
     }
     finally
     {
         Thread.Sleep(100);
         MessageHelper.MsgWait();
     }
 }
示例#9
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);
        }
示例#10
0
 internal void HeBingZheKouHang(XSDJ xsdjt)
 {
     for (int i = 0; i < xsdjt.Dj.Count; i++)
     {
         int    zKHCount = 1;
         bool   flag     = false;
         double jE       = 0.0;
         double sE       = 0.0;
         double zKL      = 0.0;
         double round    = 0.0;
         double num7     = 0.0;
         double num8     = 0.0;
         for (int j = 0; j < (xsdjt.Dj[i].Mingxi.Count + 1); j++)
         {
             if (round < 0.0)
             {
                 round = SaleBillCtrl.GetRound(Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Bhsje), 2);
                 num7  = SaleBillCtrl.GetRound(Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Se), 2);
                 num8  = Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Sl);
                 jE    = SaleBillCtrl.GetRound(Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkje), 2);
                 sE    = SaleBillCtrl.GetRound(Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkse), 2);
                 if (flag)
                 {
                     this.CreateZheKouHang(xsdjt, i, j, jE, sE, zKL, zKHCount);
                 }
                 flag  = false;
                 round = SaleBillCtrl.GetRound((double)(round + Math.Abs(jE)), 2);
                 num7  = SaleBillCtrl.GetRound((double)(num7 + Math.Abs(sE)), 2);
                 if ((Math.Abs(num8) > base.DataPrecision) && !xsdjt.Dj[i].Mingxi[j].DanJiaError)
                 {
                     if (((Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Slv) == 0.05) && (this.Fplx == InvType.Special)) && xsdjt.Dj[i].HYSY)
                     {
                         xsdjt.Dj[i].Mingxi[j].Dj = SaleBillCtrl.GetRound((double)((round + num7) / num8), 2);
                     }
                     else if (xsdjt.Dj[i].Mingxi[j].Jgfs == "1")
                     {
                         xsdjt.Dj[i].Mingxi[j].Dj = SaleBillCtrl.GetRound((double)((round + num7) / num8), 2);
                     }
                     else
                     {
                         xsdjt.Dj[i].Mingxi[j].Dj = SaleBillCtrl.GetRound((double)(round / num8), 2);
                     }
                 }
                 xsdjt.Dj[i].Mingxi[j].Bhsje = new double?(round);
                 xsdjt.Dj[i].Mingxi[j].Se    = new double?(num7);
                 jE  = 0.0;
                 sE  = 0.0;
                 zKL = 0.0;
             }
             else
             {
                 if (j == xsdjt.Dj[i].Mingxi.Count)
                 {
                     if (flag)
                     {
                         this.CreateZheKouHang(xsdjt, i, j, jE, sE, zKL, zKHCount);
                     }
                     break;
                 }
                 if (xsdjt.Dj[i].Mingxi[j].Zkje != 0.0)
                 {
                     if ((j > 0) && flag)
                     {
                         bool flag2 = xsdjt.Dj[i].Mingxi[j].Zkl == xsdjt.Dj[i].Mingxi[j - 1].Zkl;
                         bool flag3 = xsdjt.Dj[i].Mingxi[j].Slv == xsdjt.Dj[i].Mingxi[j - 1].Slv;
                         if (flag2 && flag3)
                         {
                             jE += Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkje);
                             sE += Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkse);
                             zKHCount++;
                             goto Label_062A;
                         }
                         this.CreateZheKouHang(xsdjt, i, j, jE, sE, zKL, zKHCount);
                         j++;
                         jE       = 0.0;
                         sE       = 0.0;
                         zKL      = 0.0;
                         zKHCount = 1;
                     }
                     zKL  = Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkl);
                     jE   = Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkje);
                     sE   = Convert.ToDouble(xsdjt.Dj[i].Mingxi[j].Zkse);
                     flag = true;
                 }
                 else if (flag)
                 {
                     this.CreateZheKouHang(xsdjt, i, j, jE, sE, zKL, zKHCount);
                     j++;
                     jE   = 0.0;
                     sE   = 0.0;
                     zKL  = 0.0;
                     flag = false;
                 }
                 Label_062A :;
             }
         }
     }
 }