/// <summary> /// 添加临时收费记录 /// </summary> public async Task <Response> AddTempLogAsync(TempUserChargeLog templog) { return(await templogManager.AddAsync(templog)); }
public async Task <JsonResult> TempUserOutCar() { Response resp = new Response(); Log log = LogFactory.GetLogger("TempUserOutCar"); #region try { string iccd = Request.Form["iccode"]; string isplate = Request.Form["isplate"]; string warehouse = Request.Form["wh"]; string hallID = Request.Form["hallID"]; string indate = Request.Form["indate"]; string spantime = Request.Form["spantime"]; string needfee = Request.Form["needfee"]; string actualfee = Request.Form["actualfee"]; string coinfee = Request.Form["coinfee"]; CWLocation cwlctn = new CWLocation(); Location loc = null; #region if (Convert.ToBoolean(isplate)) { //是车牌号 loc = await cwlctn.FindLocationAsync(l => l.PlateNum == iccd); } else { #region //ICCard icard = new CWICCard().Find(ic=>ic.UserCode==iccd); //if (icard == null) //{ // resp.Message = "不是本系统用卡,ICCode - " + iccd; // return Json(resp); //} //if(icard.Status==EnmICCardStatus.Lost|| // icard.Status == EnmICCardStatus.Disposed) //{ // resp.Message = "卡已挂失或注销,ICCode - " + iccd; // return Json(resp); //} #endregion //是卡号 loc = await cwlctn.FindLocationAsync(l => l.ICCode == iccd); } if (loc == null) { resp.Message = "找不到取车位,proof - " + iccd; return(Json(resp)); } #endregion int wh = Convert.ToInt16(warehouse); int hcode = Convert.ToInt32(hallID); Device hall = await new CWDevice().FindAsync(d => d.Warehouse == wh && d.DeviceCode == hcode); if (hall == null) { resp.Message = "找不到出库车厅,wh - " + warehouse + " , code - " + hallID; return(Json(resp)); } resp = new CWTaskTransfer(hcode, wh).OCreateTempUserOfOutCar(loc); if (resp.Code == 1) { string oprt = User.Identity.Name; //保存收费记录 TempUserChargeLog templog = new TempUserChargeLog { Proof = loc.ICCode, Plate = loc.PlateNum, Warehouse = wh, Address = loc.Address, InDate = loc.InDate.ToString(), OutDate = DateTime.Now.ToString(), SpanTime = spantime, NeedFee = needfee, ActualFee = actualfee, CoinChange = coinfee, OprtCode = oprt, RecordDTime = DateTime.Now }; await new CWTariffLog().AddTempLogAsync(templog); } } catch (Exception ex) { log.Error(ex.ToString()); resp.Message = "系统异常"; } #endregion return(Json(resp)); }