Example #1
0
        public ActionResult Update()
        {
            string id         = Request["id"] ?? "";
            string quyuid     = Request["quyuid"] ?? "";
            string mingcheng  = Request["mingcheng"] ?? "";
            string huojia     = Request["huojia"] ?? "";
            string lieshu     = Request["lieshu"] ?? "";
            string censhu     = Request["censhu"] ?? "";
            string shangpinsl = Request["shangpinsl"] ?? "";
            string picisl     = Request["picisl"] ?? "";
            string maxweight  = Request["maxweight"] ?? "";
            string maxvolumn  = Request["maxvolumn"] ?? "";
            string qiyongsf   = Request["qiyongsf"] ?? "";
            string col1       = Request["col1"] ?? "";
            string col2       = Request["col2"] ?? "";
            string col3       = Request["col3"] ?? "";
            string makedate   = Request["makedate"] ?? "";
            string makeman    = Request["makeman"] ?? "";

            if (qiyongsf.IndexOf("true") > -1)
            {
                qiyongsf = "true";
            }
            else
            {
                qiyongsf = "false";
            }
            int uid = int.Parse(id);

            try
            {
                wms_kuwei p = ob_wms_kuweiservice.GetEntityById(wms_kuwei => wms_kuwei.ID == uid);
                p.QuyuID     = quyuid == "" ? 0 : int.Parse(quyuid);
                p.Mingcheng  = mingcheng.Trim();
                p.Huojia     = huojia == "" ? 0 : int.Parse(huojia);
                p.Lieshu     = lieshu == "" ? 0 : int.Parse(lieshu);
                p.Censhu     = censhu == "" ? 0 : int.Parse(censhu);
                p.ShangpinSL = shangpinsl == "" ? 0 : float.Parse(shangpinsl);
                p.PiciSL     = picisl == "" ? 0 : float.Parse(picisl);
                p.MaxWeight  = maxweight == "" ? 0 : float.Parse(maxweight);
                p.MaxVolumn  = maxvolumn == "" ? 0 : float.Parse(maxvolumn);
                p.QiyongSF   = qiyongsf == "" ? false : Boolean.Parse(qiyongsf);
                p.Col1       = col1.Trim();
                p.Col2       = col2.Trim();
                p.Col3       = col3.Trim();
                p.MakeDate   = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                p.MakeMan    = makeman == "" ? 0 : int.Parse(makeman);
                ob_wms_kuweiservice.UpdateEntity(p);
                ViewBag.saveok = ViewAddTag.ModifyOk;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                ViewBag.saveok = ViewAddTag.ModifyNo;
            }
            return(RedirectToAction("Index", new { id = uid }));
        }
Example #2
0
        public ActionResult Save()
        {
            string id         = Request["id"] ?? "";
            string quyuid     = Request["quyuid"] ?? "";
            string mingcheng  = Request["mingcheng"] ?? "";
            string huojia     = Request["huojia"] ?? "";
            string censhu     = Request["censhu"] ?? "";
            string shangpinsl = Request["shangpinsl"] ?? "";
            string picisl     = Request["picisl"] ?? "";
            string maxweight  = Request["maxweight"] ?? "";
            string maxvolumn  = Request["maxvolumn"] ?? "";
            string qiyongsf   = Request["qiyongsf"] ?? "";

            if (qiyongsf.IndexOf("true") > -1)
            {
                qiyongsf = "true";
            }
            else
            {
                qiyongsf = "false";
            }
            string col1     = Request["col1"] ?? "";
            string col2     = Request["col2"] ?? "";
            string col3     = Request["col3"] ?? "";
            string makedate = Request["makedate"] ?? "";
            string makeman  = Request["makeman"] ?? "";
            //列数
            string lieshu = Request["lieshu"] ?? "";

            try
            {
                wms_kuwei ob_wms_kuwei = new wms_kuwei();
                ob_wms_kuwei.QuyuID     = quyuid == "" ? 0 : int.Parse(quyuid);
                ob_wms_kuwei.Mingcheng  = mingcheng.Trim();
                ob_wms_kuwei.Huojia     = huojia == "" ? 0 : int.Parse(huojia);
                ob_wms_kuwei.Censhu     = censhu == "" ? 0 : int.Parse(censhu);
                ob_wms_kuwei.ShangpinSL = shangpinsl == "" ? 0 : float.Parse(shangpinsl);
                ob_wms_kuwei.PiciSL     = picisl == "" ? 0 : float.Parse(picisl);
                ob_wms_kuwei.MaxWeight  = maxweight == "" ? 0 : float.Parse(maxweight);
                ob_wms_kuwei.MaxVolumn  = maxvolumn == "" ? 0 : float.Parse(maxvolumn);
                ob_wms_kuwei.QiyongSF   = qiyongsf == "" ? false : Boolean.Parse(qiyongsf);
                ob_wms_kuwei.Col1       = col1.Trim();
                ob_wms_kuwei.Col2       = col2.Trim();
                ob_wms_kuwei.Col3       = col3.Trim();
                ob_wms_kuwei.MakeDate   = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                ob_wms_kuwei.MakeMan    = makeman == "" ? 0 : int.Parse(makeman);
                ob_wms_kuwei.Lieshu     = lieshu == "" ? 0 : int.Parse(lieshu);
                ob_wms_kuwei            = ob_wms_kuweiservice.AddEntity(ob_wms_kuwei);
                ViewBag.wms_kuwei       = ob_wms_kuwei;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult Edit(int id)
        {
            string quyu_id   = Request["quyu_id"] ?? "";
            string quyu_text = Request["quyu_text"] ?? "";

            ViewBag.quyu_id   = quyu_id;
            ViewBag.quyu_text = quyu_text;

            wms_kuwei tempData = ob_wms_kuweiservice.GetEntityById(wms_kuwei => wms_kuwei.ID == id && wms_kuwei.IsDelete == false);

            ViewBag.wms_kuwei = tempData;
            if (tempData == null)
            {
                return(View());
            }
            else
            {
                wms_kuweiViewModel wms_kuweiviewmodel = new wms_kuweiViewModel();
                wms_kuweiviewmodel.ID         = tempData.ID;
                wms_kuweiviewmodel.QuyuID     = tempData.QuyuID;
                wms_kuweiviewmodel.Mingcheng  = tempData.Mingcheng;
                wms_kuweiviewmodel.Huojia     = tempData.Huojia;
                wms_kuweiviewmodel.Lieshu     = tempData.Lieshu;
                wms_kuweiviewmodel.Censhu     = tempData.Censhu;
                wms_kuweiviewmodel.ShangpinSL = tempData.ShangpinSL;
                wms_kuweiviewmodel.PiciSL     = tempData.PiciSL;
                wms_kuweiviewmodel.MaxWeight  = tempData.MaxWeight;
                wms_kuweiviewmodel.MaxVolumn  = tempData.MaxVolumn;
                wms_kuweiviewmodel.QiyongSF   = tempData.QiyongSF;
                wms_kuweiviewmodel.Col1       = tempData.Col1;
                wms_kuweiviewmodel.Col2       = tempData.Col2;
                wms_kuweiviewmodel.Col3       = tempData.Col3;
                wms_kuweiviewmodel.MakeDate   = tempData.MakeDate;
                wms_kuweiviewmodel.MakeMan    = tempData.MakeMan;
                return(View(wms_kuweiviewmodel));
            }
        }
Example #4
0
        public ActionResult Savekw()
        {
            string quyuid = Request["quyuid"] ?? "";
            int?   huojiaxh;
            var    tempData = ob_wms_kuweiservice.LoadSortEntities(wms_kuwei => wms_kuwei.IsDelete == false && wms_kuwei.QuyuID == int.Parse(quyuid), false, wms_kuwei => wms_kuwei.Huojia);

            if (tempData.Count() != 0)
            {
                List <KuWei> _kwlist = new List <KuWei>();
                KuWei        _kw;
                foreach (var kw in tempData)
                {
                    _kw        = new KuWei();
                    _kw.Huojia = (int)kw.Huojia;
                    _kwlist.Add(_kw);
                }
                huojiaxh = _kwlist[0].Huojia;
            }
            else
            {
                huojiaxh = 0;
            }
            int _huojiaxh;
            int _lieshuxh;
            int _censhuxh;

            int    flag = -1;
            string id   = Request["id"] ?? "";
            //string quyuid = Request["quyuid"] ?? "";
            string mingcheng = Request["mingcheng"] ?? "";
            string qydaima   = Request["qydaima"] ?? "";
            //string huojia = Request["huojia"] ?? "";
            //string censhu = Request["censhu"] ?? "";
            string shangpinsl = Request["shangpinsl"] ?? "";
            string picisl     = Request["picisl"] ?? "";
            string maxweight  = Request["maxweight"] ?? "";
            string maxvolumn  = Request["maxvolumn"] ?? "";
            string qiyongsf   = Request["qiyongsf"] ?? "";

            if (qiyongsf.IndexOf("true") > -1)
            {
                qiyongsf = "true";
            }
            else
            {
                qiyongsf = "false";
            }
            string col1     = Request["col1"] ?? "";
            string col2     = Request["col2"] ?? "";
            string col3     = Request["col3"] ?? "";
            string makedate = Request["makedate"] ?? "";
            string makeman  = Request["makeman"] ?? "";
            string huojia   = Request["huojia"] ?? "";
            string lieshu   = Request["lieshu"] ?? "";
            string censhu   = Request["censhu"] ?? "";

            int _huojia = int.Parse(huojia);
            int _lieshu = int.Parse(lieshu);
            int _censhu = int.Parse(censhu);

            string hj  = Request["huojia1"] ?? "";
            string ls  = Request["lieshu1"] ?? "";
            string cs  = Request["censhu1"] ?? "";
            string hji = hj.ToString();
            string lsi = ls.ToString();
            string csi = cs.ToString();
            string _hj = "";
            string _ls = "";
            string _cs = "";
            int    zimu;
            char   tempchar;

            for (int g = 1; g <= int.Parse(col1); g++)
            {
                for (int i = 0; i < _huojia; i++)
                {
                    _huojiaxh = (int)huojiaxh + i + 1;
                    for (int j = 0; j < _lieshu; j++)
                    {
                        _lieshuxh = j + 1;
                        for (int k = 0; k < _censhu; k++)
                        {
                            _censhuxh = k + 1;
                            try
                            {
                                if (hji.Length == 1)
                                {
                                    zimu = hj[0];
                                    if (zimu >= 48 && zimu <= 57)
                                    {
                                        if ((int.Parse(hj) + i) < 10)
                                        {
                                            _hj = "0" + (int.Parse(hj) + i).ToString();
                                        }
                                        else
                                        {
                                            _hj = (int.Parse(hj) + i).ToString();
                                        }
                                    }
                                    else
                                    {
                                        tempchar = (char)(zimu + i); _hj = tempchar.ToString() + "1";
                                    }
                                }

                                else
                                {
                                    _hj = (int.Parse(hj) + i).ToString();
                                }

                                if (lsi.Length == 1)
                                {
                                    zimu = ls[0];
                                    if (zimu >= 48 && zimu <= 57)
                                    {
                                        if ((int.Parse(ls) + j) < 10)
                                        {
                                            _ls = "0" + (int.Parse(ls) + j).ToString();
                                        }
                                        else
                                        {
                                            _ls = (int.Parse(ls) + j).ToString();
                                        }
                                    }
                                    else
                                    {
                                        tempchar = (char)(zimu + j); _ls = tempchar.ToString() + "1";
                                    }
                                }

                                else
                                {
                                    _ls = (int.Parse(ls) + j).ToString();
                                }

                                if (csi.Length == 1)
                                {
                                    zimu = cs[0];
                                    if (zimu >= 48 && zimu <= 57)
                                    {
                                        _cs = (int.Parse(cs) + k).ToString();
                                    }
                                    else
                                    {
                                        tempchar = (char)(zimu + k); _cs = tempchar.ToString();
                                    }
                                }
                                else
                                {
                                    _cs = (int.Parse(cs) + k).ToString();
                                }


                                wms_kuwei ob_wms_kuwei = new wms_kuwei();
                                ob_wms_kuwei.Mingcheng = qydaima + "-" + _hj + "-" + _ls + "-" + _cs + g.ToString();

                                ob_wms_kuwei.QuyuID = quyuid == "" ? 0 : int.Parse(quyuid);
                                //ob_wms_kuwei.Mingcheng = mingcheng.Trim();
                                //ob_wms_kuwei.Huojia = huojia == "" ? 0 : int.Parse(huojia);
                                ob_wms_kuwei.Huojia = huojia == "" ? 1 : _huojiaxh;
                                //ob_wms_kuwei.Censhu = censhu == "" ? 0 : int.Parse(censhu);
                                ob_wms_kuwei.Censhu     = censhu == "" ? 1 : _censhuxh;
                                ob_wms_kuwei.ShangpinSL = shangpinsl == "" ? 0 : float.Parse(shangpinsl);
                                ob_wms_kuwei.PiciSL     = picisl == "" ? 0 : float.Parse(picisl);
                                ob_wms_kuwei.MaxWeight  = maxweight == "" ? 0 : float.Parse(maxweight);
                                ob_wms_kuwei.MaxVolumn  = maxvolumn == "" ? 0 : float.Parse(maxvolumn);
                                ob_wms_kuwei.QiyongSF   = qiyongsf == "" ? false : Boolean.Parse(qiyongsf);
                                ob_wms_kuwei.Col1       = col1.Trim();
                                ob_wms_kuwei.Col2       = col2.Trim();
                                ob_wms_kuwei.Col3       = col3.Trim();
                                ob_wms_kuwei.MakeDate   = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                                ob_wms_kuwei.MakeMan    = makeman == "" ? 0 : int.Parse(makeman);
                                //ob_wms_kuwei.Lieshu = lieshu == "" ? 0 : int.Parse(lieshu);
                                ob_wms_kuwei.Lieshu = lieshu == "" ? 1 : _lieshuxh;
                                ob_wms_kuwei        = ob_wms_kuweiservice.AddEntity(ob_wms_kuwei);
                                ViewBag.wms_kuwei   = ob_wms_kuwei;
                                flag = 1;
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                flag = -1;
                            }
                        }
                    }
                }
            }
            //return RedirectToAction("Index");
            return(Json(new { _flag = flag }));
        }
Example #5
0
        public JsonResult SaveUpload()
        {
            int    _userid   = (int)Session["user_id"];
            string _username = (string)Session["user_name"];
            var    _rkid     = Request["rkd"] ?? "";
            var    _kuwei    = Request["kw"] ?? "";
            var    _kwid     = Request["kwid"] ?? "";
            var    _ph1      = Request["pihao1"] ?? "";
            var    _phnum1   = Request["phnum1"] ?? "";
            var    _ph2      = Request["pihao2"] ?? "";
            var    _phnum2   = Request["phnum2"] ?? "";
            var    _ph3      = Request["pihao3"] ?? "";
            var    _phnum3   = Request["phnum3"] ?? "";
            var    _xlm1     = Request["xlm1"] ?? "";
            var    _xlnum1   = Request["xlnum1"] ?? "";
            var    _xlm2     = Request["xlm2"] ?? "";
            var    _xlnum2   = Request["xlnum2"] ?? "";
            var    _xlm3     = Request["xlm3"] ?? "";
            var    _xlnum3   = Request["xlnum3"] ?? "";

            if (string.IsNullOrEmpty(_rkid) || string.IsNullOrEmpty(_kuwei))
            {
                return(Json(-1));
            }
            wms_kuwei _kw = ServiceFactory.wms_kuweiservice.GetEntityById(p => p.Mingcheng == _kuwei.Trim() && p.IsDelete == false);

            if (_kw == null)
            {
                return(Json(-3));
            }
            _kwid = _kw.ID.ToString();
            if (!string.IsNullOrEmpty(_ph1))
            {
                _ph1 = BarcodeRead.BatchCode(_ph1.Trim());
                if (string.IsNullOrEmpty(_phnum1))
                {
                    _phnum1 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Pihao == _ph1 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_phnum1), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
                else
                {
                    foreach (var shmx in _sh)
                    {
                        if (shmx.Shuliang == float.Parse(_phnum1) && shmx.ShangjiaSL == 0)
                        {
                            wms_cunhuo _ch = AddUpload(shmx, int.Parse(_phnum1), _kuwei, int.Parse(_kwid), _userid, _username);
                            if (_ch == null)
                            {
                                return(Json(-2));
                            }
                            break;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(_ph2))
            {
                _ph2 = BarcodeRead.BatchCode(_ph2.Trim());
                if (string.IsNullOrEmpty(_phnum2))
                {
                    _phnum2 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Pihao == _ph2 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_phnum2), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
                else
                {
                    foreach (var shmx in _sh)
                    {
                        if (shmx.Shuliang == float.Parse(_phnum2) && shmx.ShangjiaSL == 0)
                        {
                            wms_cunhuo _ch = AddUpload(shmx, int.Parse(_phnum2), _kuwei, int.Parse(_kwid), _userid, _username);
                            if (_ch == null)
                            {
                                return(Json(-2));
                            }
                            break;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(_ph3))
            {
                _ph3 = BarcodeRead.BatchCode(_ph3.Trim());
                if (string.IsNullOrEmpty(_phnum3))
                {
                    _phnum3 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Pihao == _ph3 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_phnum3), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
                else
                {
                    foreach (var shmx in _sh)
                    {
                        if (shmx.Shuliang == float.Parse(_phnum3) && shmx.ShangjiaSL == 0)
                        {
                            wms_cunhuo _ch = AddUpload(shmx, int.Parse(_phnum3), _kuwei, int.Parse(_kwid), _userid, _username);
                            if (_ch == null)
                            {
                                return(Json(-2));
                            }
                            break;
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(_xlm1))
            {
                _xlm1 = BarcodeRead.SerialNumber(_xlm1.Trim());
                if (string.IsNullOrEmpty(_xlnum1))
                {
                    _xlnum1 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Xuliema == _xlm1 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1 && int.Parse(_xlnum1) > 0)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_xlnum1), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
            }
            if (!string.IsNullOrEmpty(_xlm2))
            {
                _xlm2 = BarcodeRead.SerialNumber(_xlm2.Trim());
                if (string.IsNullOrEmpty(_xlnum2))
                {
                    _xlnum2 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Xuliema == _xlm2 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1 && int.Parse(_xlnum2) > 0)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_xlnum2), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
            }
            if (!string.IsNullOrEmpty(_xlm3))
            {
                _xlm3 = BarcodeRead.SerialNumber(_xlm3.Trim());
                if (string.IsNullOrEmpty(_xlnum3))
                {
                    _xlnum3 = "1";
                }
                var _sh = ServiceFactory.wms_shouhuomxservice.LoadEntities(p => p.Xuliema == _xlm3 && p.IsDelete == false).ToList <wms_shouhuomx>();
                if (_sh.Count == 1 && int.Parse(_xlnum3) > 0)
                {
                    wms_cunhuo _ch = AddUpload(_sh[0], int.Parse(_xlnum3), _kuwei, int.Parse(_kwid), _userid, _username);
                    if (_ch == null)
                    {
                        return(Json(-2));
                    }
                }
            }
            return(Json(1));
        }