コード例 #1
0
        public ActionResult UptuarPiCiBaoCun(Array JieGoodsShuZu, Array JiePiCiChShuZu, Array CheckReIDShuZu,
                                             Array CheckReDetailIDShuZu, Array MumberOfPacShuZu, Array SubdivisiShuZu, bool state)
        {
            ReturnJsonVo returnJson   = new ReturnJsonVo();
            ReturnJsonVo ChreturnJson = new ReturnJsonVo();
            string       strMag       = "fali";

            try
            {
                //一
                string   Z      = ((string[])JieGoodsShuZu)[0];
                string[] intsid = Z.Split(',');
                //二
                string   M        = ((string[])JiePiCiChShuZu)[0];
                string[] intsPiCi = M.Split(',');
                //三
                string   X = ((string[])CheckReIDShuZu)[0];
                string[] intsFanChangID = X.Split(',');
                //四
                string   D = ((string[])CheckReDetailIDShuZu)[0];
                string[] intsFanChangMingXiID = D.Split(',');
                //五
                string   Mun = ((string[])MumberOfPacShuZu)[0];
                string[] intMumberJianShu = Mun.Split(',');
                //六
                string   Su            = ((string[])SubdivisiShuZu)[0];
                string[] intSubdiviShu = Su.Split(',');



                B_CheckRemerbenDetillList ConverDeTailList = new B_CheckRemerbenDetillList();
                strMag = "succsee";
                for (int H = 0; H < intsFanChangMingXiID.Length;)
                {
                    for (int E = 0; E < intsFanChangID.Length;)
                    {
                        for (int d = 0; d < intsid.Length;)
                        {
                            for (int i = 0; i < intsPiCi.Length;)
                            {
                                for (int JianShu = 0; JianShu < intMumberJianShu.Length;)
                                {
                                    for (int XiShu = 0; XiShu < intSubdiviShu.Length;)
                                    {
                                        ConverDeTailList.CheckRemerbenDetillD = Convert.ToInt32(intsFanChangMingXiID[H]); //返仓明细ID

                                        ConverDeTailList.CheckRermeberID  = Convert.ToInt32(intsFanChangID[E]);           //返仓ID
                                        ConverDeTailList.GoodsID          = Convert.ToInt32(intsid[d]);                   //商品ID
                                        ConverDeTailList.PiCiHao          = Convert.ToDecimal(intsPiCi[i]);               //批号
                                        ConverDeTailList.MumberOfPackages = Convert.ToDecimal(intMumberJianShu[JianShu]); //入库件数
                                        ConverDeTailList.Subdivision      = Convert.ToDecimal(intSubdiviShu[H]);          //入库细数

                                        MyModels.Entry(ConverDeTailList).State = System.Data.Entity.EntityState.Modified;
                                        MyModels.SaveChanges();//保存

                                        XiShu++;
                                        JianShu++;
                                        i++;
                                        d++;
                                        E++;
                                        H++;


                                        B_CheckRemerbenDetillList Goofrtbool = (from tbbool in MyModels.B_CheckRemerbenDetillList
                                                                                where tbbool.CheckRemerbenDetillD == ConverDeTailList.CheckRemerbenDetillD
                                                                                select tbbool).Single(); //查询原状态
                                        Goofrtbool.JiaZaiFou             = state;                        //改变是否为商品状态
                                        MyModels.Entry(Goofrtbool).State = EntityState.Modified;

                                        B_CheckRemerbenList CherGoofrtbool = (from tbbool in MyModels.B_CheckRemerbenList
                                                                              where tbbool.CheckRermeberID == ConverDeTailList.CheckRermeberID
                                                                              select tbbool).Single(); //查询原状态
                                        CherGoofrtbool.YiJiaZaiGoodsNot      = state;                  //改变是否为主单状态
                                        MyModels.Entry(CherGoofrtbool).State = EntityState.Modified;

                                        if (MyModels.SaveChanges() > 0)//保存
                                        {
                                            returnJson.State = true;
                                            returnJson.Text  = "修改成功";
                                        }
                                        else
                                        {
                                            returnJson.State = false;
                                            returnJson.Text  = "修改失败";
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(new { strMag, returnJson }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult InsectCher(B_CheckRemerbenDetillList Ok, Array JiShangPiID, Array JiRuJianShu, Array JiRuXiShu, bool state)
        {
            ReturnJsonVo returnJson = new ReturnJsonVo();
            string       strMag     = "fali";

            try
            {
                //一
                string   Z      = ((string[])JiShangPiID)[0];
                string[] intsid = Z.Split(',');
                //二
                string   M          = ((string[])JiRuJianShu)[0];
                string[] intsRuJian = M.Split(',');
                //三
                string   N          = ((string[])JiRuXiShu)[0];
                string[] intsNXiShu = N.Split(',');

                B_CheckRemerbenDetillList ConverDeTailList = new B_CheckRemerbenDetillList();

                for (int H = 0; H < intsNXiShu.Length;)
                {
                    for (int E = 0; E < intsRuJian.Length;)
                    {
                        for (int d = 0; d < intsid.Length; d++)
                        {
                            ConverDeTailList.CheckRermeberID  = Ok.CheckRermeberID;               //
                            ConverDeTailList.GoodsID          = Convert.ToInt32(intsid[d]);;      //商品ID
                            ConverDeTailList.Subdivision      = Convert.ToDecimal(intsNXiShu[H]); //入库细数
                            ConverDeTailList.MumberOfPackages = Convert.ToDecimal(intsRuJian[E]); //入库件数
                            MyModels.B_CheckRemerbenDetillList.Add(ConverDeTailList);
                            MyModels.SaveChanges();                                               //保存
                            H++;
                            E++;
                            strMag = "succsee";
                        }
                    }
                }

                B_CheckRemerbenList wafrtbool = (from tbbool in MyModels.B_CheckRemerbenList
                                                 where tbbool.CheckRermeberID == Ok.CheckRermeberID
                                                 select tbbool).Single();//查询原状态
                wafrtbool.GoodsNot = state;
                MyModels.Entry(wafrtbool).State = EntityState.Modified;

                if (MyModels.SaveChanges() > 0)//保存
                {
                    returnJson.State = true;
                    returnJson.Text  = "修改成功";
                }
                else
                {
                    returnJson.State = false;
                    returnJson.Text  = "修改失败";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(Json(new { strMag, returnJson }, JsonRequestBehavior.AllowGet));
        }