Ejemplo n.º 1
0
        /// <summary>
        /// 删除入库单数据
        /// </summary>
        /// <param name="bill"></param>
        /// <param name="listGoods"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool DeleteEnterWarehouseBill(long nId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (StockDAO dao = new StockDAO())
                    {
                        //如果入库单是由划拨出库自动生成的,则不允许手工删除
                        EnterWarehouseBill bill = dao.LoadEnterWarehouseBill(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (bill == null)
                        {
                            return false;
                        }
                        if (bill.PlanId > 0)
                        {
                            strErrText = InnoSoft.LS.Resources.Strings.CanNotDeleteEnterWarehouseBillCreateByAllocateGoods;
                            return false;
                        }

                        //删除入库单货物数据
                        if (!dao.DeleteEnterWarehouseBillAllGoods(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }

                        //删除入库单数据
                        if (!dao.DeleteEnterWarehouseBill(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 读取入库单数据
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public EnterWarehouseBill LoadEnterWarehouseBill(long nId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                EnterWarehouseBill ret = null;

                using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0)))
                {
                    using (StockDAO dao = new StockDAO())
                    {
                        ret = dao.LoadEnterWarehouseBill(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (ret == null)
                            return null;
                    }
                    transScope.Complete();
                }
                return ret;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return null;
            }
        }