示例#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 DeleteOutWarehouseBill(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())
                    {
                        //如果出库单是由出仓单自动生成的,则不允许手工删除
                        OutWarehouseBill bill = dao.LoadOutWarehouseBill(nId, nOpStaffId, strOpStaffName, out strErrText);
                        if (bill == null)
                        {
                            return false;
                        }
                        if (bill.ShipmentBillId > 0)
                        {
                            strErrText = InnoSoft.LS.Resources.Strings.CanNotDeleteOutWarehouseBillCreateByShipmentBill;
                            return false;
                        }

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

                        //删除出库单货物数据
                        if (!dao.DeleteOutWarehouseBillAllGoods(nId, nOpStaffId, strOpStaffName, out strErrText))
                        {
                            return false;
                        }
                    }
                    transScope.Complete();
                }
                return true;
            }
            catch (Exception e)
            {
                strErrText = e.Message;
                return false;
            }
        }
示例#2
0
        /// <summary>
        /// 读取出库单数据
        /// </summary>
        /// <param name="nId"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public OutWarehouseBill LoadOutWarehouseBill(long nId, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            try
            {
                OutWarehouseBill ret = null;

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