public ActionResult ApproveContract(ContractViewModel model) { //创建数据 List<ContractDeliverPlan> listPlan = new List<ContractDeliverPlan>(); if (model.DeliverPlans != null) { foreach (ContractDeliverPlanViewModel m in model.DeliverPlans) { ContractDeliverPlan p = new ContractDeliverPlan(); p.Id = m.Id; p.ContractId = m.ContractId; p.PlanId = m.PlanId; p.Packages = m.Packages; p.Tunnages = m.Tunnages; p.Piles = m.Piles; p.TenThousands = m.TenThousands; p.TransportChargeExpression = m.TransportChargeExpression; p.TransportPriceExpression = m.TransportPriceExpression; p.KM = m.KM; p.TransportPrice = m.TransportPrice; p.TransportCharges = m.TransportCharges; p.ApprovedTransportPrice = m.ApprovedTransportPrice; p.ApprovedTransportCharges = m.ApprovedTransportCharges; listPlan.Add(p); } } //保存数据 string strMessage; ContractSystem contract = new ContractSystem(); bool bSuccess = contract.ApproveContract(model.Id, listPlan, LoginAccountId, LoginStaffName, out strMessage); var ret = new { Success = bSuccess, Message = strMessage }; return Json(ret); }
/// <summary> /// 修改合同发货数据 /// </summary> /// <param name="data"></param> /// <param name="listGoods"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateContractDeliverPlan(ContractDeliverPlan data, List<ContractGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText) { ContractRule rule = new ContractRule(); return rule.UpdateContractDeliverPlan(data, listGoods, nOpStaffId, strOpStaffName, out strErrText); }
public ActionResult NewContract(ContractViewModel model) { if (ModelState.IsValid) { //创建数据 Contract data = new Contract(); data.DispatchBillId = model.DispatchBillId; data.CarNo = model.CarNo; data.TrailerNo = model.TrailerNo; data.CarType = model.CarType; data.DriverName = model.DriverName; data.DriverLicenseNo = model.DriverLicenseNo; data.DriverMobileTel = model.DriverMobileTel; data.DriverHomeTel = model.DriverHomeTel; data.CarrierId = model.CarrierId; data.CarrierName = model.CarrierName; data.GoodsName = model.GoodsName; data.Packing = model.Packing; data.StartPlace = model.StartPlace; data.DestPlace = model.DestPlace; data.ShipmentTime = DateTime.Parse(model.ShipmentTime); data.ArrivalTime = DateTime.Parse(model.ArrivalTime); data.TotalPackages = model.TotalPackages; data.TotalTunnages = model.TotalTunnages; data.TotalPiles = model.TotalPiles; data.TotalTenThousands = model.TotalTenThousands; data.TotalTransportCharges = model.TotalTransportCharges; data.PrepayTransportCharges = model.PrepayTransportCharges; data.ResidualTransportCharges = model.ResidualTransportCharges; data.OriginalContractNo = model.OriginalContractNo; data.IsPrestowage = true; List<ContractDeliverPlan> listPlan = new List<ContractDeliverPlan>(); if (model.DeliverPlans != null) { foreach (ContractDeliverPlanViewModel m in model.DeliverPlans) { ContractDeliverPlan p = new ContractDeliverPlan(); p.PlanId = m.PlanId; p.Packages = m.Packages; p.Tunnages = m.Tunnages; p.Piles = m.Piles; p.TenThousands = m.TenThousands; p.TransportChargeExpression = m.TransportChargeExpression; p.TransportPriceExpression = m.TransportPriceExpression; p.KM = m.KM; p.TransportPrice = m.TransportPrice; p.TransportCharges = m.TransportCharges; p.Remark = m.Remark; listPlan.Add(p); } } //保存数据 string strErrText; ContractSystem contract = new ContractSystem(); if (contract.InsertContract(data, listPlan, LoginAccountId, LoginStaffName, out strErrText) > 0) { return Json(string.Empty); } else { return Json(strErrText); } } return View(model); }
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); }
/// <summary> /// 修改合同发货数据 /// </summary> /// <param name="data"></param> /// <param name="listGoods"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateContractDeliverPlan(ContractDeliverPlan data, List<ContractGoods> listGoods, long nOpStaffId, string strOpStaffName, out string strErrText) { try { using (TransactionScope transScope = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(2, 0, 0))) { using (ContractDAO dao = new ContractDAO()) { if (!dao.UpdateContractDeliverPlan(data, nOpStaffId, strOpStaffName, out strErrText)) { return false; } foreach (ContractGoods goods in listGoods) { if (!dao.UpdateContractGoods(goods, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } } using (DispatchDAO dao = new DispatchDAO()) { //检查调度单数据 if (!dao.CheckDispatchBill(data.DispatchBillId, nOpStaffId, strOpStaffName, out strErrText)) { return false; } } transScope.Complete(); } return true; } catch (Exception e) { strErrText = e.Message; return false; } }
/// <summary> /// 修改合同审批价格数据 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateContractDeliverPlanApprovedTransportPrice(ContractDeliverPlan data, long nOpStaffId, string strOpStaffName, out string strErrText) { //创建存储过程参数 SqlParameter[] Params = { MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.Id), MakeParam(CONTRACTID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.ContractId), MakeParam(PLANID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.PlanId), MakeParam(APPROVEDTRANSPORTPRICE_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.ApprovedTransportPrice), MakeParam(APPROVEDTRANSPORTCHARGES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.ApprovedTransportCharges), MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId), MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName), }; if (Execute("UpdateContractDeliverPlanApprovedTransportPrice", Params, out strErrText) >= 0) return true; else return false; }
/// <summary> /// 修改合同发货计划数据 /// </summary> /// <param name="data"></param> /// <param name="nOpStaffId"></param> /// <param name="strOpStaffName"></param> /// <param name="strErrText"></param> /// <returns></returns> public bool UpdateContractDeliverPlan(ContractDeliverPlan data, long nOpStaffId, string strOpStaffName, out string strErrText) { //创建存储过程参数 SqlParameter[] Params = { MakeParam(ID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.Id), MakeParam(CONTRACTID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.ContractId), MakeParam(PLANID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)data.PlanId), MakeParam(PACKAGES_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.Packages), 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(TRANSPORTCHARGEEXPRESSION_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.TransportChargeExpression??System.DBNull.Value), MakeParam(TRANSPORTPRICEEXPRESSION_PARAM, SqlDbType.NVarChar, 100, ParameterDirection.Input, (object)data.TransportPriceExpression??System.DBNull.Value), MakeParam(KM_PARAM, SqlDbType.Int, 4, ParameterDirection.Input, (object)data.KM), MakeParam(TRANSPORTPRICE_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TransportPrice), MakeParam(TRANSPORTCHARGES_PARAM, SqlDbType.Decimal, 13, ParameterDirection.Input, (object)data.TransportCharges), MakeParam(REMARK_PARAM, SqlDbType.NVarChar, 500, ParameterDirection.Input, (object)data.Remark??System.DBNull.Value), MakeParam(OPSTAFFID_PARAM, SqlDbType.BigInt, 8, ParameterDirection.Input, (object)nOpStaffId), MakeParam(OPSTAFFNAME_PARAM, SqlDbType.NVarChar, 50, ParameterDirection.Input, (object)strOpStaffName), }; if (Execute("UpdateContractDeliverPlan", Params, out strErrText) >= 0) return true; else return false; }