/// <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 long InsertMoveWarehouseBill(MoveWarehouseBill bill, List<MoveWarehouseBillGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText) { long nMoveWarehouseBillId = 0; try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (StockDAO dao = new StockDAO()) { //新增移库单数据 nMoveWarehouseBillId = dao.InsertMoveWarehouseBill(bill, nOpStaffId, strOpStaffName, out strErrText); if (nMoveWarehouseBillId <= 0) return 0; //新增移库货物数据 foreach (MoveWarehouseBillGoods goods in listGoods) { goods.MoveWarehouseBillId = nMoveWarehouseBillId; if (!dao.InsertMoveWarehouseBillGoods(goods, nOpStaffId, strOpStaffName, out strErrText)) { return 0; } } } transScope.Complete(); } return nMoveWarehouseBillId; } catch (Exception e) { strErrText = e.Message; return 0; } }