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); }