Exemplo n.º 1
0
        public Models.JyuucyuuModels convertCyu(Models.DBFCYUMNModels cyumn)
        {
            //Models.JyuucyuuModels result = new Models.JyuucyuuModels();

            //

            Models.JyuucyuuModels jyucyu = new Models.JyuucyuuModels();
            jyucyu.Jyuucyuno = "";


            jyucyu.Tokuicode  = "00" + cyumn.Tokcd;
            jyucyu.Nounyucode = "00" + cyumn.Noucd;

            string temp = this.findName(jyucyu.Tokuicode, jyucyu.Nounyucode);

            jyucyu.Tokuiname = temp.Split(new string[] { " - " }, StringSplitOptions.None)[0];
            jyucyu.Nonyuname = temp.Split(new string[] { " - " }, StringSplitOptions.None)[1];


            jyucyu.Seihinname  = cyumn.Sname;
            jyucyu.Seihinzuban = cyumn.Zuban;
            jyucyu.Seihinkisyu = cyumn.Kisyu;
            jyucyu.Quantity    = cyumn.Cyusu;
            jyucyu.Tanka       = cyumn.Tanka;

            //find by SQL
            DataTable dtResult = cyumn.findSehinCode();
            string    result   = "";

            var    rowC = dtResult.Rows.Count;
            string rtani;
            double rtanka, ctanka;


            if (rowC < 1)
            {
                result = "NG: Can not find this sehin";
            }

            if (rowC == 1)
            {
                jyucyu.Seihinname  = dtResult.Rows[0]["NAME"].ToString().Trim();
                jyucyu.Seihinkisyu = dtResult.Rows[0]["KISYU"].ToString().Trim();
                rtani  = dtResult.Rows[0]["TANI"].ToString().Trim();
                rtanka = double.Parse(dtResult.Rows[0]["TANKA"].ToString());

                if (cyumn.Sname == null)
                {
                    cyumn.Sname = "";
                }
                if (cyumn.Kisyu == null)
                {
                    cyumn.Kisyu = "";
                }
                if (cyumn.Tani == null)
                {
                    cyumn.Tani = "";
                }
                if (cyumn.Tanka == null)
                {
                    ctanka = 0;
                }
                else
                {
                    ctanka = double.Parse(cyumn.Tanka);
                }

                if (jyucyu.Seihinname != cyumn.Sname)
                {
                    result += "NG: Name is not correct, ";
                }
                if (jyucyu.Seihinkisyu != cyumn.Kisyu.ToString())
                {
                    result += "NG: Kisyu is not correct, ";
                }
                if (rtani != cyumn.Tani.ToString())
                {
                    result += "NG: Tani is not correct, ";
                }
                if (rtanka != ctanka)
                {
                    result += "NG: Tanka is not correct, ";
                }

                if (result != "")
                {
                    result = result.Substring(0, result.Length - 2);
                }

                jyucyu.Tanka      = rtanka.ToString();
                jyucyu.Seihincode = dtResult.Rows[0]["ZAICD"].ToString().Trim();
            }

            else
            {
                result = "NG: Have many sehin Code";
            }

            jyucyu.Nouki = cyumn.Nouki;

            jyucyu.Nounyu = new DateTime(Int32.Parse(cyumn.Nouki.Substring(0, 4)), Int32.Parse(cyumn.Nouki.Substring(4, 2)), Int32.Parse(cyumn.Nouki.Substring(6, 2))).AddDays(-2).ToString("yyyyMMdd");//early nouki 2 days

            jyucyu.Bumoncode  = "999";
            jyucyu.Bumonname  = "データCONV";
            jyucyu.Tantoucode = "209";   //by Login User
            jyucyu.Tantouname = "和久井清美"; //by Login User
            jyucyu.Cyumonno1  = cyumn.Cyuno;
            jyucyu.Cyumonno2  = "";
            jyucyu.Seizou     = "";
            jyucyu.Bikou      = "";
            jyucyu.Status     = result; //"Checking";

            return(jyucyu);
        }
Exemplo n.º 2
0
        public JsonResult convertCyuToJyu(Models.DBFCYUMNModels cyumn)
        {
            Models.JyuucyuuModels jyucyu = new Models.JyuucyuuModels();
            jyucyu.Jyuucyuno = "";


            jyucyu.Tokuicode  = "00001";
            jyucyu.Tokuiname  = "(株)玉吉製作所大田原工場";
            jyucyu.Nounyucode = "00001";
            jyucyu.Nonyuname  = "大田原工場";


            jyucyu.Seihinname  = cyumn.Sname;
            jyucyu.Seihinzuban = cyumn.Zuban;
            jyucyu.Seihinkisyu = cyumn.Kisyu;
            jyucyu.Quantity    = cyumn.Cyusu;
            jyucyu.Tanka       = cyumn.Tanka;

            //find by SQL

            DataTable dtResult = cyumn.findSehinCode();
            string    result   = "";

            var    rowC = dtResult.Rows.Count;
            string rtani;
            double rtanka, ctanka;


            if (rowC < 1)
            {
                result = "Error : Can not find this sehin";
            }

            if (rowC == 1)
            {
                jyucyu.Seihinname  = dtResult.Rows[0]["NAME"].ToString().Trim();
                jyucyu.Seihinkisyu = dtResult.Rows[0]["KISYU"].ToString().Trim();
                rtani  = dtResult.Rows[0]["TANI"].ToString().Trim();
                rtanka = double.Parse(dtResult.Rows[0]["TANKA"].ToString());

                if (cyumn.Sname == null)
                {
                    cyumn.Sname = "";
                }
                if (cyumn.Kisyu == null)
                {
                    cyumn.Kisyu = "";
                }
                if (cyumn.Tani == null)
                {
                    cyumn.Tani = "";
                }
                if (cyumn.Tanka == null)
                {
                    ctanka = 0;
                }
                else
                {
                    ctanka = double.Parse(cyumn.Tanka);
                }

                if (jyucyu.Seihinname != cyumn.Sname)
                {
                    result += "Name is not correct, ";
                }
                if (jyucyu.Seihinkisyu != cyumn.Kisyu.ToString())
                {
                    result += "Kisyu is not correct, ";
                }
                if (rtani != cyumn.Tani.ToString())
                {
                    result += "Tani is not correct, ";
                }
                if (rtanka != ctanka)
                {
                    result += "Tanka is not correct, ";
                }

                if (result != "")
                {
                    result = "Error: " + result.Substring(0, result.Length - 2);
                }

                jyucyu.Tanka      = rtanka.ToString();
                jyucyu.Seihincode = dtResult.Rows[0]["ZAICD"].ToString().Trim();
            }

            else
            {
                result = "Error : Have many sehin Code";
            }

            jyucyu.Nouki  = cyumn.Nouki;
            jyucyu.Nounyu = "";//early nouki 2 days

            jyucyu.Bumoncode  = "999";
            jyucyu.Bumonname  = "データCONV";
            jyucyu.Tantoucode = "209";   //by Login User
            jyucyu.Tantouname = "和久井清美"; //by Login User
            jyucyu.Cyumonno1  = cyumn.Cyuno;
            jyucyu.Cyumonno2  = "";
            jyucyu.Seizou     = "";
            jyucyu.Bikou      = "";
            jyucyu.Status     = result; //"Checking";

            return(Json(jyucyu, JsonRequestBehavior.AllowGet));
        }