예제 #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);
        }
예제 #2
0
        public JsonResult AddCheckPart()
        {
            int    _userid   = (int)Session["user_id"];
            string _shmxid   = Request["shmx"] ?? "";
            string _ysslok   = Request["oknum"] ?? "";
            string _ysslng   = Request["ngnum"] ?? "";
            string _ysresult = Request["ys"] ?? "";
            string _ysren    = Request["ysr"] ?? "";
            string _yssm     = Request["yssm"] ?? "";

            try
            {
                if (int.Parse(_shmxid) == 0 || _shmxid.Length == 0)
                {
                    return(Json(-1));
                }
                wms_shouhuomx _orishmx = ServiceFactory.wms_shouhuomxservice.GetEntityById(p => p.ID == int.Parse(_shmxid));
                if (_orishmx == null)
                {
                    return(Json(-1));
                }
                wms_shouhuomx _newshmx = new wms_shouhuomx();
                _newshmx.BaozhuangDW = _orishmx.BaozhuangDW;
                _newshmx.Beizhu      = _orishmx.Beizhu;
                _newshmx.Chandi      = _orishmx.Chandi;
                _newshmx.Changjia    = _orishmx.Changjia;
                _newshmx.Guige       = _orishmx.Guige;
                _newshmx.Huansuanlv  = _orishmx.Huansuanlv;
                _newshmx.HuopinZT    = _orishmx.HuopinZT;
                _newshmx.JibenDW     = _orishmx.JibenDW;
                _newshmx.Jifeidun    = _orishmx.Jifeidun;
                _newshmx.Jingzhong   = _orishmx.Jingzhong;
                _newshmx.MakeDate    = _orishmx.MakeDate;
                _newshmx.MakeMan     = _orishmx.MakeMan;
                _newshmx.Pihao       = _orishmx.Pihao;
                _newshmx.Pihao1      = _orishmx.Pihao1;
                _newshmx.RKMXID      = _orishmx.RKMXID;
                _newshmx.RukuID      = _orishmx.RukuID;
                _newshmx.ShangpinDM  = _orishmx.ShangpinDM;
                _newshmx.ShangpinID  = _orishmx.ShangpinID;
                _newshmx.ShangpinMC  = _orishmx.ShangpinMC;
                _newshmx.ShangpinTM  = _orishmx.ShangpinTM;
                _newshmx.ShengchanRQ = _orishmx.ShengchanRQ;
                _newshmx.ShixiaoRQ   = _orishmx.ShixiaoRQ;
                _newshmx.Shuliang    = _orishmx.Shuliang;
                _newshmx.Tiji        = _orishmx.Tiji;
                _newshmx.Xuliema     = _orishmx.Xuliema;
                _newshmx.Yanshou     = _orishmx.Yanshou;
                _newshmx.Zhongliang  = _orishmx.Zhongliang;
                _newshmx.Zhucezheng  = _orishmx.Zhucezheng;
                _newshmx.IsDelete    = _orishmx.IsDelete;
                _newshmx.Col1        = _orishmx.Col1;
                _newshmx.Col2        = _orishmx.Col2;
                _newshmx.Col3        = _orishmx.Col3;
                _newshmx             = ServiceFactory.wms_shouhuomxservice.AddEntity(_newshmx);

                quan_rukuys ob_quan_rukuys = new quan_rukuys();
                ob_quan_rukuys.MingxiID   = _orishmx.ID;
                ob_quan_rukuys.YanshouSL  = _ysslok == "" ? 0 : float.Parse(_ysslok);
                ob_quan_rukuys.Yanshou    = 1;
                ob_quan_rukuys.Yanshouren = _ysren.Trim();
                ob_quan_rukuys.YanshouSM  = _yssm.Trim();
                ob_quan_rukuys.YanshouZT  = 3;
                ob_quan_rukuys.MakeDate   = DateTime.Now;
                ob_quan_rukuys.MakeMan    = _userid;
                ob_quan_rukuys            = ob_quan_rukuysservice.AddEntity(ob_quan_rukuys);

                _orishmx.Shuliang = _ysslok == "" ? 0 : float.Parse(_ysslok);
                ServiceFactory.wms_shouhuomxservice.UpdateEntity(_orishmx);

                quan_rukuys ob_quan_rukuys1 = new quan_rukuys();
                ob_quan_rukuys1.MingxiID   = _newshmx.ID;
                ob_quan_rukuys1.YanshouSL  = _ysslng == "" ? 0 : float.Parse(_ysslng);
                ob_quan_rukuys1.Yanshou    = 3;
                ob_quan_rukuys1.Yanshouren = _ysren.Trim();
                ob_quan_rukuys1.YanshouSM  = _yssm.Trim();
                ob_quan_rukuys1.YanshouZT  = 3;
                ob_quan_rukuys1.MakeDate   = DateTime.Now;
                ob_quan_rukuys1.MakeMan    = _userid;
                ob_quan_rukuys1            = ob_quan_rukuysservice.AddEntity(ob_quan_rukuys1);

                _newshmx.Shuliang = _ysslng == "" ? 0 : float.Parse(_ysslng);
                ServiceFactory.wms_shouhuomxservice.UpdateEntity(_newshmx);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(Json(-1));
            }
            return(Json(1));
        }
예제 #3
0
        public ActionResult SaveRecieve()
        {
            int _userid = (int)Session["user_id"];
            var _rkd    = Request["rkid"] ?? "";
            var _sp     = Request["shangpin"] ?? "";
            var _spnum  = Request["spnum"] ?? "";
            var _ph     = Request["pihao"] ?? "";
            var _phnum  = Request["phnum"] ?? "";
            var _xl     = Request["xlm"] ?? "";
            var _xlnum  = Request["xlnum"] ?? "";

            if (string.IsNullOrEmpty(_rkd))
            {
                _rkd = "0";
            }
            var _rkmx = ServiceFactory.wms_rukumxservice.LoadEntities(p => p.RukuID == int.Parse(_rkd) && p.IsDelete == false).ToList <wms_rukumx>();

            if (_rkmx == null)
            {
                return(RedirectToAction("Index"));
            }

            if (string.IsNullOrEmpty(_sp))
            {
                _spnum = "0";
            }
            else
            {
                //var _mxsp = from u in _rkmx
                //            group u by u.ShangpinTM into tb
                //            select new
                //            {
                //                sptm = tb.Key,
                //                spcount = tb.Count()
                //            };
                var _mxsp = _rkmx.Where(p => p.ShangpinTM == _sp).ToList <wms_rukumx>();
                if (_mxsp != null)
                {
                    if (string.IsNullOrEmpty(_spnum))
                    {
                        _spnum = "1";
                    }
                    if (_mxsp.Count() == 1 && int.Parse(_spnum) > 0)
                    {
                        wms_shouhuomx _sh = AddRecieveRec(_mxsp[0], int.Parse(_spnum), _userid);
                        if (_sh == null)
                        {
                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            return(RedirectToAction("Recieving", new { rkd = _rkd }));
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(_ph))
            {
                _phnum = "0";
            }
            else
            {
                _ph = BarcodeRead.BatchCode(_ph.Trim());
                var _mxph = _rkmx.Where(p => p.Pihao == _ph).ToList <wms_rukumx>();
                if (_mxph != null)
                {
                    if (string.IsNullOrEmpty(_phnum))
                    {
                        _phnum = "1";
                    }
                    if (_mxph.Count() == 1 && int.Parse(_phnum) > 0)
                    {
                        wms_shouhuomx _sh = AddRecieveRec(_mxph[0], int.Parse(_phnum), _userid);
                        if (_sh == null)
                        {
                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            return(RedirectToAction("Recieving", new { rkd = _rkd }));
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(_xl))
            {
                _xlnum = "0";
            }
            else
            {
                _xl = BarcodeRead.SerialNumber(_xl.Trim());
                var _mxxl = _rkmx.Where(p => p.Xuliema == _xl).ToList <wms_rukumx>();
                if (_mxxl != null)
                {
                    if (string.IsNullOrEmpty(_xlnum))
                    {
                        _xlnum = "1";
                    }
                    if (_mxxl.Count() == 1 && int.Parse(_xlnum) > 0)
                    {
                        wms_shouhuomx _sh = AddRecieveRec(_mxxl[0], int.Parse(_xlnum), _userid);
                        if (_sh == null)
                        {
                            return(RedirectToAction("Index"));
                        }
                        else
                        {
                            return(RedirectToAction("Recieving", new { rkd = _rkd }));
                        }
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
예제 #4
0
        private wms_shouhuomx AddRecieveRec(wms_rukumx rkmx, int recnum, int op)
        {
            if (rkmx == null)
            {
                return(null);
            }
            if (rkmx.YishouSL + recnum > rkmx.DaohuoSL)
            {
                return(null);
            }
            wms_shouhuomx _sh = new wms_shouhuomx();

            _sh.RukuID     = rkmx.RukuID;
            _sh.RKMXID     = rkmx.ID;
            _sh.ShangpinID = rkmx.ShangpinID;
            _sh.ShangpinDM = rkmx.ShangpinDM;
            _sh.ShangpinMC = rkmx.ShangpinMC;
            _sh.ShangpinTM = rkmx.ShangpinTM;
            if (rkmx.ShengchanRQ == null)
            {
                _sh.ShengchanRQ = DateTime.Now;
            }
            else
            {
                _sh.ShengchanRQ = rkmx.ShengchanRQ;
            }
            if (rkmx.ShixiaoRQ == null)
            {
                _sh.ShixiaoRQ = DateTime.Now;
            }
            else
            {
                _sh.ShixiaoRQ = rkmx.ShixiaoRQ;
            }
            _sh.Zhucezheng  = rkmx.Zhucezheng;
            _sh.Guige       = rkmx.Guige;
            _sh.Xuliema     = rkmx.Xuliema;
            _sh.Pihao       = rkmx.Pihao;
            _sh.Pihao1      = rkmx.Pihao1;
            _sh.JibenDW     = rkmx.JibenDW;
            _sh.BaozhuangDW = rkmx.BaozhuangDW;
            _sh.Chandi      = rkmx.Chandi;
            _sh.Changjia    = rkmx.Changjia;
            _sh.Huansuanlv  = rkmx.Huansuanlv;
            _sh.MakeMan     = op;
            _sh.MakeDate    = DateTime.Now;
            _sh.Shuliang    = recnum;
            _sh.Col1        = rkmx.Col1;
            _sh.Col2        = rkmx.Col2;
            _sh.Col3        = rkmx.Col3;
            if (rkmx.Zhongliang == null)
            {
                _sh.Zhongliang = 0;
            }
            else
            {
                _sh.Zhongliang = (recnum / rkmx.DaohuoSL) * rkmx.Zhongliang;
            }
            if (rkmx.Jingzhong == null)
            {
                _sh.Jingzhong = 0;
            }
            else
            {
                _sh.Jingzhong = (recnum / rkmx.DaohuoSL) * rkmx.Jingzhong;
            }
            if (rkmx.Tiji == null)
            {
                _sh.Tiji = 0;
            }
            else
            {
                _sh.Tiji = (recnum / rkmx.DaohuoSL) * rkmx.Tiji;
            }
            if (rkmx.Jifeidun == null)
            {
                _sh.Jifeidun = 0;
            }
            else
            {
                _sh.Jifeidun = (recnum / rkmx.DaohuoSL) * rkmx.Jifeidun;
            }
            _sh = ServiceFactory.wms_shouhuomxservice.AddEntity(_sh);

            return(_sh);
        }