Example #1
0
        public ActionResult ModifyContractGoods(ContractDeliverPlanViewModel model)
        {
            if (ModelState.IsValid)
            {
                //创建数据
                ContractDeliverPlan data = new ContractDeliverPlan();
                data.Id = model.Id;
                data.ContractId = model.ContractId;
                data.DispatchBillId = model.DispatchBillId;
                data.PlanId = model.PlanId;
                data.Packages = model.Packages;
                data.Tunnages = model.Tunnages;
                data.Piles = model.Piles;
                data.TenThousands = model.TenThousands;
                data.TransportChargeExpression = model.TransportChargeExpression;
                data.TransportPriceExpression = model.TransportPriceExpression;
                data.KM = model.KM;
                data.TransportPrice = model.TransportPrice;
                data.TransportCharges = model.TransportCharges;
                data.Remark = model.Remark;

                List<ContractGoods> listGoods = new List<ContractGoods>();
                if (model.Goods != null)
                {
                    foreach (ContractGoodsViewModel m in model.Goods)
                    {
                        ContractGoods g = new ContractGoods();
                        g.DispatchBillId = model.DispatchBillId;
                        g.PlanId = model.PlanId;
                        g.GoodsId = m.GoodsId;
                        g.GoodsNo = m.GoodsNo;
                        g.BatchNo = m.BatchNo;
                        g.Packing = m.Packing;
                        g.Location = m.Location;
                        g.Packages = m.Packages;
                        g.PieceWeight = m.PieceWeight;
                        g.Tunnages = m.Tunnages;
                        g.Piles = m.Piles;
                        g.TenThousands = m.TenThousands;
                        g.ProductionDate = m.ProductionDate;
                        g.EnterWarehouseBillId = m.EnterWarehouseBillId;
                        g.EnterWarehouseBillNo = m.EnterWarehouseBillNo;
                        listGoods.Add(g);
                    }
                }

                //保存数据
                string strErrText;
                ContractSystem contract = new ContractSystem();
                if (contract.UpdateContractDeliverPlan(data, listGoods, LoginAccountId, LoginStaffName, out strErrText))
                {
                    return Json(string.Empty);
                }
                else
                {
                    return Json(strErrText);
                }
            }
            return View(model);
        }