Esempio n. 1
0
        private wms_cunhuo AddUpload(wms_shouhuomx shmx, int upnum, string kuwei, int kwid, int userid, string username)
        {
            wms_cunhuo _ch = new wms_cunhuo();

            _ch.RKMXID     = shmx.ID;
            _ch.Kuwei      = kuwei;
            _ch.KuweiID    = kwid;
            _ch.HegeSF     = shmx.Yanshou;
            _ch.RenSJ      = username;
            _ch.SuodingSF  = false;
            _ch.JiahuoSF   = true;
            _ch.CunhuoSM   = "";
            _ch.MakeMan    = userid;
            _ch.MakeDate   = DateTime.Now;
            _ch.Shuliang   = upnum;
            _ch.Tiji       = (upnum / shmx.Shuliang) * shmx.Tiji;
            _ch.Zhongliang = (upnum / shmx.Shuliang) * shmx.Zhongliang;
            _ch.Jingzhong  = (upnum / shmx.Shuliang) * shmx.Jingzhong;
            _ch.Jifeidun   = (upnum / shmx.Shuliang) * shmx.Jifeidun;
            _ch            = ServiceFactory.wms_cunhuoservice.AddEntity(_ch);

            return(_ch);
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public JsonResult AddPickGoods()
        {
            int _userid    = (int)Session["user_id"];
            var _pickgoods = Request["pickgd"] ?? "";

            if (_pickgoods == "")
            {
                return(Json(-1));
            }
            foreach (var _pg in _pickgoods.Split(';'))
            {
                if (_pg.Length > 3)
                {
                    string[]    _rec    = _pg.Split(',');
                    int         _ckmx   = int.Parse(_rec[0]);
                    float       _pknum  = float.Parse(_rec[1]);
                    string      _pkmemo = _rec[2];
                    int         _chmx   = int.Parse(_rec[3]);
                    wms_chukumx _ck     = ServiceFactory.wms_chukumxservice.GetEntityById(p => p.ID == _ckmx);
                    if (_ck != null)
                    {
                        if (_ck.JianhuoSL == null)
                        {
                            _ck.JianhuoSL = 0;
                        }
                        if (_ck.ChukuSL >= _ck.JianhuoSL + _pknum)
                        {
                            //wms_cunhuo _ch = ServiceFactory.wms_cunhuoservice.GetEntityById(p => p.ID == _chmx);
                            wms_cunhuo _ch = ServiceFactory.wms_cunhuoservice.GetEntityByIdNoTracking(p => p.ID == _chmx);
                            if (_ch != null)
                            {
                                if (_pknum > _ch.Shuliang - _ch.DaijianSL)
                                {
                                    return(Json(-2));
                                }
                                var         _rt = _pknum / _ch.Shuliang;
                                wms_jianhuo _jh = new wms_jianhuo();
                                _jh.CKMXID     = _ckmx;
                                _jh.DaijianSL  = _pknum;
                                _jh.JianhuoRQ  = DateTime.Now;
                                _jh.JianhuoSM  = _pkmemo == "" ? _ck.Beizhu : _pkmemo;
                                _jh.KCID       = _chmx;
                                _jh.Fuhe       = _ch.HegeSF;
                                _jh.Kuwei      = _ch.Kuwei;
                                _jh.KuweiID    = _ch.KuweiID;
                                _jh.Zhongliang = (float)Math.Round((double)(_rt * _ch.Zhongliang), 3);
                                _jh.Jingzhong  = (float)Math.Round((double)(_rt * _ch.Jingzhong), 3);
                                _jh.Tiji       = (float)Math.Round((double)(_rt * _ch.Tiji), 3);
                                _jh.Jifeidun   = (float)Math.Round((double)(_rt * _ch.Jifeidun), 3);
                                _jh.MakeMan    = _userid;
                                //扫描拣货后去除
                                _jh.Jianhuoren = _userid;
                                //_jh.ShijianSL = _pknum;
                                _jh = ob_wms_jianhuoservice.AddEntity(_jh);

                                if (_jh != null)
                                {
                                    _ck.Jianhuo   = true;
                                    _ck.JianhuoSL = _ck.JianhuoSL + _pknum;
                                    ServiceFactory.wms_chukumxservice.UpdateEntity(_ck);
                                }
                            }
                        }
                    }
                }
            }
            return(Json(1));
        }