Exemple #1
0
        /// <summary>
        ///物料  供应商  批次/SN  数量  工位  生产线
        /// </summary>
        /// <returns>int</returns>

        public static bool OutOfStorage(string itemCode, string vendorCode, string SN, string locationCode, string plineCode, float itemQTY)
        {
            try
            {
                LineSideStockEntity temp  = new LineSideStockEntity();
                LineSideStockDal    lsDal = new LineSideStockDal();
                temp = lsDal.GetByItem(locationCode, plineCode, itemCode);
                if (temp == null)
                {
                    Rmes.Public.ErrorHandle.EH.LASTMSG = "没有物料" + itemCode + "的相关记录,无法进行出库操作!\n";
                    lsDal.DataBase.AbortTransaction();
                    return(false);
                }
                else
                {
                    temp.ITEM_QTY = temp.ITEM_QTY - itemQTY;
                    if (temp.ITEM_QTY < 0)
                    {
                        Rmes.Public.ErrorHandle.EH.LASTMSG = itemCode + "库存不足,无法进行出库操作!\n";
                        lsDal.DataBase.AbortTransaction();
                        return(false);
                    }

                    lsDal.Update(temp);
                    return(true);
                }
            }
            catch (Exception e)
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = e.Message;
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 函数说明:入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static bool Storage(string itemCode, string vendorCode, string SN, string locationCode, string plineCode, float itemQTY)
        {
            LineSideStockEntity item = new LineSideStockEntity()
            {
                COMPANY_CODE  = LoginInfo.UserInfo.COMPANY_CODE,
                LOCATION_CODE = locationCode,
                ITEM_CODE     = itemCode,
                VENDOR_CODE   = vendorCode,
                PLINE_CODE    = plineCode,
                ITEM_QTY      = itemQTY
            };
            LineSideStockEntity temp  = new LineSideStockEntity();
            LineSideStockDal    lsDal = new LineSideStockDal();

            temp = lsDal.GetByItem(locationCode, plineCode, itemCode);
            if (temp == null)
            {
                lsDal.Insert(item);
                return(true);
            }
            else
            {
                temp.ITEM_QTY += item.ITEM_QTY;
                lsDal.Update(temp);
                return(true);
            }
        }
Exemple #3
0
        /// <summary>
        /// 函数说明:入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static int Storage(LineSideStockEntity item)
        {
            int result;
            LineSideStockEntity temp  = new LineSideStockEntity();
            LineSideStockDal    lsDal = new LineSideStockDal();

            temp = lsDal.GetByItem(item.LOCATION_CODE, item.PLINE_CODE, item.ITEM_CODE);
            if (temp == null)
            {
                lsDal.Insert(item);
                result = 1;
            }
            else
            {
                temp.ITEM_QTY += item.ITEM_QTY;
                result         = lsDal.Update(temp);
            }
            //插入收料流水
            IssueReceivedEntity ent = new IssueReceivedEntity()
            {
                COMPANY_CODE        = item.COMPANY_CODE,
                WORKSHOP_CODE       = item.WORKSHOP_CODE,
                PLINE_CODE          = item.PLINE_CODE,
                LOCATION_CODE       = item.LOCATION_CODE,
                LINESIDE_STOCK_CODE = item.STORE_CODE,
                ITEM_CODE           = item.ITEM_CODE,
                ITEM_NAME           = item.ITEM_NAME,
                ITEM_QTY            = item.ITEM_QTY,
                WORK_TIME           = DateTime.Now,
                USER_ID             = LoginInfo.UserInfo.USER_ID
            };

            new IssueReceivedDal().Insert(ent);

            return(result);
        }
Exemple #4
0
        /// <summary>
        /// 函数说明:批量入库操作,返回影响的行数
        /// </summary>
        ///
        /// <returns>int</returns>
        public static int Storage(List <LineSideStockEntity> itemList)
        {
            int result             = 0;
            LineSideStockDal lsDal = new LineSideStockDal();

            lsDal.DataBase.BeginTransaction();
            foreach (LineSideStockEntity lsEntity in itemList)
            {
                LineSideStockEntity temp = new LineSideStockEntity();
                temp = lsDal.GetByItem(lsEntity.LOCATION_CODE, lsEntity.PLINE_CODE, lsEntity.ITEM_CODE);
                if (temp == null)
                {
                    lsDal.Insert(lsEntity);
                    result += 1;
                }
                else
                {
                    temp.ITEM_QTY += lsEntity.ITEM_QTY;
                    result        += lsDal.Update(temp);
                }
            }
            lsDal.DataBase.CompleteTransaction();
            return(result);
        }