Esempio n. 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);
        }
Esempio n. 2
0
        public ActionResult ModifyContractGoods()
        {
            //传入参数
            var request = HttpContext.Request;

            string strId = request.QueryString["id"] ?? "0";
            string strContractId = request.QueryString["contractId"] ?? "0";
            string strDispatchBillId = request.QueryString["dispatchBillId"] ?? "0";
            string strPlanId = request.QueryString["planId"] ?? "0";
            string strPlanType = request.QueryString["planType"] ?? string.Empty;
            string strReceiveType = request.QueryString["receiveType"] ?? string.Empty;
            string strTransportChargeExpression = request.QueryString["transportChargeExpression"] ?? string.Empty;
            string strTransportPriceExpression = request.QueryString["transportPriceExpression"] ?? string.Empty;
            string strKM = request.QueryString["km"] ?? "0";
            string strTransportPrice = request.QueryString["transportPrice"] ?? "0";
            string strTransportCharges = request.QueryString["transportCharges"] ?? "0";
            string strRemark = request.QueryString["remark"] ?? string.Empty;

            //缓存参数
            ViewData["PlanType"] = strPlanType;
            ViewData["ReceiveType"] = strReceiveType;

            //生成Model
            ContractDeliverPlanViewModel model = new ContractDeliverPlanViewModel();
            model.Id = long.Parse(strId);
            model.ContractId = long.Parse(strContractId);
            model.DispatchBillId = long.Parse(strDispatchBillId);
            model.PlanId = long.Parse(strPlanId);
            model.TransportChargeExpression = strTransportChargeExpression;
            model.TransportPriceExpression = strTransportPriceExpression;
            model.KM = int.Parse(strKM);
            model.TransportPrice = decimal.Parse(strTransportPrice);
            model.TransportCharges = decimal.Parse(strTransportCharges);
            model.Remark = strRemark;

            return View(model);
        }