public static string strCountDay(Model.C_Car car, string state) { string listchange2 = ""; if (state == "bx") { listchange2 = Convert.ToInt32((car.BXDate - DateTime.Now).TotalDays).ToString(); } if (state == "yy") { listchange2 = Convert.ToInt32((car.YYZDate - DateTime.Now).TotalDays).ToString(); } if (state == "by") { listchange2 = Convert.ToInt32((car.BYDate - DateTime.Now).TotalDays).ToString(); } if (state == "gj") { listchange2 = Convert.ToInt32((car.GJYDate - DateTime.Now).TotalDays).ToString(); } if (state == "aqf") { listchange2 = Convert.ToInt32((car.AQFDate - DateTime.Now).TotalDays).ToString(); } if (Convert.ToInt32(listchange2) <= 60) { listchange2 = "<span style='color:red;'>" + listchange2 + "</span>"; } return(listchange2); }
public static string strDQDate(Model.C_Car car, string state) { string listchange2 = ""; if (state == "bx") { listchange2 = car.BXDate.ToString("yyyy-MM-dd"); } if (state == "yy") { listchange2 = car.YYZDate.ToString("yyyy-MM-dd"); } if (state == "by") { listchange2 = car.BYDate.ToString("yyyy-MM-dd"); } if (state == "gj") { listchange2 = car.GJYDate.ToString("yyyy-MM-dd"); } if (state == "aqf") { listchange2 = car.AQFDate.ToString("yyyy-MM-dd"); } return(listchange2); }
protected override void SetValue(string id) { Model.C_Car c = BLL.C_Car.GetModel(int.Parse(id)); PZCode.Value = c.PZCode; CarType.Value = c.CarType; selYSJZ.Value = c.YSJZ; CarBrand.Value = c.CarBrand; CarEngine.Value = c.CarEngine; CarCJCode.Value = c.CarCJCode; CarXSZCode.Value = c.CarXSZCode; CarDW.Value = c.CarDW.ToString(); RYType.Value = c.RYType.ToString(); BXDate.Value = c.BXDate.ToString(); YYZDate.Value = c.YYZDate.ToString(); BYDate.Value = c.BYDate.ToString(); GJYDate.Value = c.GJYDate.ToString(); AQFDate.Value = c.AQFDate.ToString(); JQXDate.Value = c.JQXDate.ToString(); SZXDate.Value = c.SZXDate.ToString(); CYXDate.Value = c.CYXDate.ToString(); CLRHDate.Value = c.CLRHDate.ToString(); CLJJPDDate.Value = c.CLJJPDDate.ToString(); CarZLC.Value = c.CarZLC.ToString(); Remark.Value = c.Remark; CarYYZCode.Value = c.Spare2; CarGTRJ.Value = c.Spare3; CType.Value = c.CType.ToString(); fid.Value = c.ID.ToString(); }
protected override string btnModify_Click() { Model.C_Car c = new Model.C_Car(); c.PZCode = Request.Form["PZCode"]; c.CarType = Request.Form["CarType"]; c.CarBrand = Request.Form["CarBrand"]; c.CarEngine = Request.Form["CarEngine"]; c.CarCJCode = Request.Form["CarCJCode"]; c.CarXSZCode = Request.Form["CarXSZCode"]; c.CarDW = decimal.Parse(Request.Form["CarDW"]); c.RYType = Request.Form["RYType"]; c.YSJZ = Request.Form["selYSJZ"]; c.BXDate = DateTime.Parse(Request.Form["BXDate"]); c.YYZDate = DateTime.Parse(Request.Form["YYZDate"]); c.BYDate = DateTime.Parse(Request.Form["BYDate"]); c.GJYDate = DateTime.Parse(Request.Form["GJYDate"]); c.AQFDate = DateTime.Parse(Request.Form["AQFDate"]); c.JQXDate = DateTime.Parse(Request.Form["JQXDate"]); c.SZXDate = DateTime.Parse(Request.Form["SZXDate"]); c.CYXDate = DateTime.Parse(Request.Form["CYXDate"]); c.CLRHDate = DateTime.Parse(Request.Form["CLRHDate"]); c.CLJJPDDate = DateTime.Parse(Request.Form["CLJJPDDate"]); c.CarZLC = int.Parse(Request.Form["CarZLC"]); c.Remark = Request.Form["Remark"]; c.Spare2 = Request.Form["CarYYZCode"]; c.Spare3 = Request.Form["CarGTRJ"]; c.CType = Request.Form["CType"]; if (string.IsNullOrEmpty(Request.Form["fid"])) { if (BLL.C_Car.Add(c) > 0) { return("添加成功"); } else { return("添加失败"); } } else { c.ID = int.Parse(Request.Form["fid"]); if (BLL.C_Car.Update(c)) { return("修改成功"); } else { return("修改失败"); } } }
protected override string btnModify_Click() { Hashtable MyHs = new Hashtable(); Model.C_CarTast c = BLL.C_CarTast.GetModelname(Request.Form["Name"]); //Model.C_CarTast c = new Model.C_CarTast(); //c.Name = Request.Form["Name"]; c.TType = int.Parse(Request.Form["TType"]); if (c.TType == 1) { c.SupplierName = Request.Form["SupplierName"]; } else if (c.TType == 2) { c.SupplierName = Request.Form["SupplierName2"]; } else { c.SupplierName = Request.Form["SupplierName3"]; } c.SupplierAddress = Request.Form["SupplierAddress"]; c.SupplierTelName = Request.Form["SupplierTelName"]; c.SupplierTel = Request.Form["SupplierTel"]; c.Spare2 = Request.Form["Spare2"]; c.CSpare2 = Request.Form["CSpare2"]; c.CarSJ1 = Request.Form["CarSJ1"]; c.CarSJ2 = Request.Form["CarSJ2"]; //c.CostType = int.Parse(Request.Form["CostType"]); c.BDImg = Request.Form["uploadurl"]; c.OCode = Request.Form["ocode"]; c.Spare1 = Request.Form["Spare1"]; c.ComDate = DateTime.Parse(Request.Form["ComDate"]); #region 司机车辆验证 Model.C_Car car = BLL.C_Car.GetModelByCode(c.Spare2); if (car == null) { return("此牵引车不存在,请正确输入车辆牌照"); } //if (!string.IsNullOrEmpty(car.Spare1)&&car.ID!=c.ID) // return "此牵引车任务未完成,请选择别的车辆"; if (!string.IsNullOrEmpty(c.CSpare2)) { Model.C_Car car2 = BLL.C_Car.GetModelByCode(c.CSpare2); if (car2 == null) { return("此挂车不存在,请正确输入车辆牌照"); } //if (!string.IsNullOrEmpty(car2.Spare1) && car.ID != c.ID) // return "此挂车任务未完成,请选择别的车辆"; } //存在商品订单 if (!string.IsNullOrEmpty(c.OCode)) { Model.OrderDetail od = BLL.OrderDetail.GetModelCode(c.OCode); od.GId = Convert.ToInt32(Request.Form["txtGood"]); od.BuyPrice = Convert.ToDecimal(Request.Form["txtGoodPrice"]); od.GCount = Convert.ToDecimal(Request.Form["txtGoodCount"]); od.ReCount = Convert.ToDecimal(Request.Form["txtGoodCount"]); BLL.OrderDetail.Update(od, MyHs); } Model.Member siji1 = BLL.Member.GetModelByMID(c.CarSJ1); if (siji1 != null) { if (siji1.FMID != "1") { return("此司机不是主司机"); } } else { return("主司机不存在"); } if (!string.IsNullOrEmpty(c.CarSJ2)) { Model.Member siji2 = BLL.Member.GetModelByMID(c.CarSJ2); if (siji2 != null) { if (siji2.FMID != "2" && siji2.FMID != "3") { return("此司机不是押运员"); } } else { return("押运员不存在"); } } #endregion c.ID = int.Parse(Request.Form["fid"]); BLL.C_CarTast.Update(c, MyHs); if (BLL.CommonBase.RunHashtable(MyHs)) { return("修改成功"); } else { return("修改失败"); } }
protected override string btnModify_Click() { //Model.C_CarTast c = new Model.C_CarTast(); Model.C_CarTast c = BLL.C_CarTast.GetModel(int.Parse(Request.Form["fid"])); c.Name = Request.Form["Name"]; c.TType = int.Parse(Request.Form["TType"]); c.Spare2 = Request.Form["Spare2"]; c.CSpare2 = Request.Form["CSpare2"]; c.CarSJ1 = Request.Form["CarSJ1"]; c.CarSJ2 = Request.Form["CarSJ2"]; c.ComDate = DateTime.Parse(Request.Form["ComDate"]); #region 司机车辆验证 Model.C_Car car = BLL.C_Car.GetModelByCode(c.Spare2); Model.C_Car car2 = null; if (car == null) { return("此牵引车不存在,请正确输入车辆牌照"); } //if (!string.IsNullOrEmpty(car.Spare1)) // return "此牵引车任务未完成,请选择别的车辆"; if (!string.IsNullOrEmpty(c.CSpare2)) { car2 = BLL.C_Car.GetModelByCode(c.CSpare2); if (car2 == null) { return("此挂车不存在,请正确输入车辆牌照"); } //if (!string.IsNullOrEmpty(car2.Spare1)) // return "此挂车任务未完成,请选择别的车辆"; } Model.Member siji1 = BLL.Member.GetModelByMID(c.CarSJ1); if (siji1 != null) { if (siji1.FMID != "1") { return("此司机不是主司机"); } } else { return("主司机不存在"); } Model.Member siji2 = BLL.Member.GetModelByMID(c.CarSJ2); if (siji2 != null) { if (siji2.FMID != "2" && siji2.FMID != "3") { return("此司机不是押运员"); } } else { return("押运员不存在"); } #endregion c.TState = 0; c.DDMID = TModel.MID; if (BLL.C_CarTast.Update(c)) { return("调度成功"); } else { return("调度失败"); } }
protected override string btnAdd_Click() { lock (obj) { Model.C_CarTast cartast = BLL.C_CarTast.GetModel(int.Parse(Request.Form["cid"])); decimal retotalMoney = 0;//实际总额 if (cartast.TState == 1) { return("状态已改变,请勿重复提交"); } cartast.TState = 1; decimal recount = 0; decimal reprice = 0; if (cartast.TType == 1 || cartast.TType == 2) { if (string.IsNullOrEmpty(cartast.BDImg)) { return("请上传磅单图片"); } List <Model.OrderDetail> listord2 = null; if (!string.IsNullOrEmpty(cartast.OCode)) { order = BLL.Order.GetModel(cartast.OCode); listord2 = order.OrderDetail; Model.OrderDetail od = BLL.OrderDetail.GetModelCode(cartast.OCode); if (od != null) { retotalMoney = od.ReCount * od.BuyPrice; recount = od.ReCount; reprice = od.BuyPrice; } } //if (listord2.Sum(m => m.ReCount) <= 0) // return "未查询到实际装车/卸车数量,不能完成"; } Hashtable MyHs = new Hashtable(); Model.C_Car c1 = BLL.C_Car.GetModelByCode(cartast.Spare2); c1.Spare1 = ""; BLL.C_Car.Update(c1, MyHs); Model.C_Car c2 = BLL.C_Car.GetModelByCode(cartast.CSpare2); if (c2 != null) { c2.Spare1 = ""; BLL.C_Car.Update(c2, MyHs); } BLL.C_CarTast.Update(cartast, MyHs); if (cartast.TType == 1 || cartast.TType == 2) { Model.Account acc = new Model.Account(); acc.CID = cartast.ID; acc.CName = cartast.Name; acc.AType = cartast.TType == 1 ? 0 : 1; acc.SupplierID = Convert.ToInt32(cartast.SupplierName); supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName)); acc.SupplierName = supplier.Name; acc.TotalMoney = retotalMoney; acc.ReMoney = 0; acc.CreateDate = DateTime.Now; acc.AStutas = 0; acc.comDate = DateTime.MaxValue; acc.OrderCount = recount; acc.OrderPrice = reprice; BLL.Account.Add(acc, MyHs); } if (BLL.CommonBase.RunHashtable(MyHs)) { return("结束任务成功"); } else { return("数据有误,结束任务失败"); } } }