Exemplo n.º 1
0
        public bool DeleteItemExt(Mes_Stock_InStockItem obj)
        {
            string sql = string.Format("DELETE FROM Mes_Stock_InStockItem WHERE ID={0}", obj.ID);

            this.CurDbSession.FromSql(sql).ExecuteNonQuery();
            return(true);
        }
Exemplo n.º 2
0
        public ActionResult InStockItemMgt_Save(Mes_Stock_InStockItem obj)
        {
            if (obj.InStockID <= 0)
            {
                return(Json(new { IsSuccess = false, Message = "请先选择一个进货单进行操作!" }));
            }
            if (string.IsNullOrEmpty(obj.MaterialProNo))
            {
                return(Json(new { IsSuccess = false, Message = "【物料编码】不能为空!" }));
            }
            Mes_Stock_InStock main = MesStockInStockDao.Instance.Find <Mes_Stock_InStock, int>(obj.InStockID.Value);

            if (main == null)
            {
                return(Json(new { IsSuccess = false, Message = "选择的进货单信息有误!" }));
            }

            Mes_Stock_InStockItem itemObj = null;

            if (obj.ID > 0)
            {
                itemObj = MesStockInStockDao.Instance.Find <Mes_Stock_InStockItem, int>(obj.ID);
                itemObj.CheckItemStatus = obj.CheckItemStatus;
            }
            else
            {
                itemObj                 = new Mes_Stock_InStockItem();
                itemObj.AcceptNum       = 0;
                itemObj.BackNum         = 0;
                itemObj.AcceptStatus    = YesNoType.No;
                itemObj.CheckItemStatus = CheckStatus.No;
                //生成订单行号
                itemObj.ResNum = MesStockInStockDao.Instance.GenResNum(main);
            }
            if (itemObj == null)
            {
                return(Json(new { IsSuccess = false, Message = "进货单明细信息有误,请刷新后重试!" }));
            }

            itemObj.InStockID     = obj.InStockID;
            itemObj.BillType      = main.BillType;
            itemObj.BillNo        = main.BillNo;
            itemObj.MaterialProNo = obj.MaterialProNo;
            itemObj.MaterialCode  = obj.MaterialCode;
            itemObj.Version       = obj.Version;
            itemObj.MaterialSize  = obj.MaterialSize;
            itemObj.Unit          = obj.Unit;
            itemObj.BatchNo       = obj.BatchNo;
            itemObj.AcceptNum     = obj.AcceptNum;
            itemObj.InStockNum    = obj.InStockNum;
            itemObj.AcceptDate    = obj.AcceptDate;
            itemObj.BackNum       = obj.BackNum;
            itemObj.StockID       = obj.StockID;
            int id = MesStockInStockDao.Instance.Save <Mes_Stock_InStockItem>(itemObj);

            return(Json(new { IsSuccess = true, Message = id.ToString() }));
        }
Exemplo n.º 3
0
        public ActionResult InStockItemMgt_FindByPage(Mes_Stock_InStockItem obj, int page, int rows)
        {
            var pager = new PagerBase()
            {
                CurrentPageIndex = page, PageSize = rows
            };
            var list = MesStockInStockDao.Instance.FindItemByPage(obj, ref pager);

            return(Json(new { total = pager.TotalItemCount, rows = list }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public ActionResult InStockItemMgt_Delete(int ID)
        {
            if (ID <= 0)
            {
                return(Json(new { IsSuccess = false, Message = "选择的记录有误,请刷新后重试!" }));
            }
            Mes_Stock_InStockItem obj = MesStockInStockDao.Instance.Find <Mes_Stock_InStockItem, int>(ID);

            if (obj == null)
            {
                return(Json(new { IsSuccess = false, Message = "进货单明细不存在,请刷新后重试!" }));
            }

            MesStockInStockDao.Instance.DeleteItemExt(obj);
            return(Json(new { IsSuccess = true, Message = "" }));
        }
Exemplo n.º 5
0
        public List <Mes_Stock_InStockItem> FindItemByPage(Mes_Stock_InStockItem obj, ref PagerBase pager)
        {
            string sql = @"SELECT T1.*,T2.StockName FROM Mes_Stock_InStockItem T1 WITH(NOLOCK) 
                        LEFT JOIN dbo.Mes_Sys_Stock T2 WITH(NOLOCK)  ON T1.StockID = T2.ID
                        WHERE 1=1 AND T1.InStockID = {0}";

            sql = string.Format(sql, obj.InStockID);
            string orderBy = pager.OrderBy;

            if (string.IsNullOrEmpty(orderBy))
            {
                orderBy = "ResNum ASC";
            }
            string cmdPageSql  = string.Format(BaseDao.PageSql, orderBy, sql, pager.StartNo, pager.EndNo);
            string cmdCountSql = string.Format(BaseDao.CountSql, sql.Substring(sql.ToLower().IndexOf("from", StringComparison.Ordinal)));

            //查询总记录数
            pager.TotalItemCount = this.CurDbSession.FromSql(cmdCountSql).ToScalar <int>();
            //返回当前页的记录数
            return(this.CurDbSession.FromSql(cmdPageSql).ToList <Mes_Stock_InStockItem>());
        }