Пример #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);
        }
Пример #2
0
        /// <summary>
        /// 修改合同货物数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="nOpStaffId"></param>
        /// <param name="strOpStaffName"></param>
        /// <param name="strErrText"></param>
        /// <returns></returns>
        public bool UpdateContractGoods(ContractGoods data, long nOpStaffId, string strOpStaffName, out string strErrText)
        {
            //创建存储过程参数
            SqlParameter[] Params =
                {
                    MakeParam(DISPATCHBILLID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.DispatchBillId),
                    MakeParam(PLANID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.PlanId),
                    MakeParam(GOODSID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.GoodsId),
                    MakeParam(GOODSNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.GoodsNo),
                    MakeParam(BATCHNO_PARAM, SqlDbType.NVarChar, 20, ParameterDirection.Input, (object)data.BatchNo??string.Empty),
                    MakeParam(PACKING_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.Packing??string.Empty),
                    MakeParam(LOCATION_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.Location??string.Empty),
                    MakeParam(PACKAGES_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.Packages),
                    MakeParam(PIECEWEIGHT_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.PieceWeight),
                    MakeParam(TUNNAGES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.Tunnages),
                    MakeParam(PILES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.Piles),
                    MakeParam(TENTHOUSANDS_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TenThousands),
                    MakeParam(PRODUCTIONDATE_PARAM, SqlDbType.NVarChar, 10, ParameterDirection.Input, (object)data.ProductionDate??string.Empty),
                    MakeParam(ENTERWAREHOUSEBILLID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.EnterWarehouseBillId),
                    MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId),
                    MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName),
                };

            if (Execute("UpdateContractGoods", Params, out strErrText) >= 0)
                return true;
            else
                return false;
        }