예제 #1
0
파일: StockDAO.cs 프로젝트: zjchenxk/SYLS
        /// <summary>
        /// 新增移库记录
        /// </summary>
        /// <param name="bill"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public long InsertMoveWarehouseBill(MoveWarehouseBill bill, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Output, (object)bill.Id),
                    MakeParam(CUSTOMERID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)bill.CustomerId),
                    MakeParam(WAREHOUSE_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)bill.Warehouse),
                    MakeParam(CONSIGNEDDELIVERYNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)bill.ConsignedDeliveryNo??System.DBNull.Value),
                    MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 200, ParameterDirection.Input, (object)bill.Remark??System.DBNull.Value),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            SqlParameterCollection outParams;
            if (Execute("InsertMoveWarehouseBill", Params, out outParams, out strErrText) < 0)
            {
                return 0;
            }
            else
            {
                return (long)outParams[ID_PARAM].Value;
            }
        }
예제 #2
0
파일: StockRule.cs 프로젝트: zjchenxk/SYLS
        /// <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;
            }
        }
예제 #3
0
        public ActionResult MoveWarehouse(MoveWarehouseBillViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                MoveWarehouseBill bill = new MoveWarehouseBill();
                bill.Id = model.Id;
                bill.BillNo = model.BillNo;
                bill.CustomerId = model.CustomerId;
                bill.CustomerName = model.CustomerName;
                bill.Warehouse = model.Warehouse;
                bill.ConsignedDeliveryNo = model.ConsignedDeliveryNo;
                bill.Remark = model.Remark;

                List<MoveWarehouseBillGoods> listGoods = new List<MoveWarehouseBillGoods>();
                foreach (MoveWarehouseBillGoodsViewModel m in model.Goods)
                {
                    MoveWarehouseBillGoods g = new MoveWarehouseBillGoods();
                    g.Id = m.Id;
                    g.MoveWarehouseBillId = m.MoveWarehouseBillId;
                    g.GoodsId = m.GoodsId;
                    g.BatchNo = m.BatchNo;
                    g.Packing = m.Packing;
                    g.PieceWeight = m.PieceWeight;
                    g.Location = m.Location;
                    g.Packages = m.Packages;
                    g.Tunnages = m.Tunnages;
                    g.Piles = m.Piles;
                    g.TenThousands = m.TenThousands;
                    g.ProductionDate = m.ProductionDate;
                    g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                    g.NewLocation = m.NewLocation;
                    g.NewPackages = m.NewPackages;
                    g.NewTunnages = m.NewTunnages;
                    g.NewPiles = m.NewPiles;
                    g.NewTenThousands = m.NewTenThousands;
                    listGoods.Add(g);
                }

                //保存数据
                string strErrText;
                StockSystem stock = new StockSystem();
                if (stock.InsertMoveWarehouseBill(bill, listGoods, LoginAccountId, LoginStaffName, out strErrText) > 0)
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }
예제 #4
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 long InsertMoveWarehouseBill(MoveWarehouseBill bill, List<MoveWarehouseBillGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText)
 {
     StockRule rule = new StockRule();
     return rule.InsertMoveWarehouseBill(bill, listGoods, nOpStaffId, strOpStaffName, out strErrText);
 }