//车辆入厂 public void InOutPlant(int doorId, string readingHead, int driverId, bool inPlant, string direction, bool onTime, ref string allocateOutDoor) { try { AscmDriver ascmDriver = Get(driverId); if (ascmDriver != null) { int batSumMainId = 0; string batSumDocNumber = string.Empty; string appointmentStartTime = string.Empty; string appointmentEndTime = string.Empty; SetSupplier(new List <AscmDriver> { ascmDriver }); List <AscmDeliBatSumMain> list = AscmDeliBatSumMainService.GetInstance().GetByDriverId(ascmDriver.id); if (list != null) { foreach (AscmDeliBatSumMain ascmDeliBatSumMain in list) { if (inPlant) { ascmDeliBatSumMain.status = AscmDeliBatSumMain.StatusDefine.inPlant; ascmDeliBatSumMain.toPlantTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ascmDeliBatSumMain.allocateOutDoor = "北门"; if (ascmDeliBatSumMain.warehouseId != "W112材料") { #region 取上一次送货合单 YnPage ynPage = new YnPage(); ynPage.SetPageSize(1); ynPage.SetCurrentPage(1); //string sort = " order by toPlantTime desc "; string where = " toPlantTime is not null and status='" + AscmDeliBatSumMain.StatusDefine.inPlant + "'"; List <AscmDeliBatSumMain> listAscmDeliBatSumMainPreviousInPlant = AscmDeliBatSumMainService.GetInstance().GetList(ynPage, "toPlantTime", "desc", where); if (listAscmDeliBatSumMainPreviousInPlant != null && listAscmDeliBatSumMainPreviousInPlant.Count > 0) { AscmDeliBatSumMain ascmDeliBatSumMain_tmp = listAscmDeliBatSumMainPreviousInPlant[0]; if (ascmDeliBatSumMain_tmp.allocateOutDoor == "北门") { ascmDeliBatSumMain.allocateOutDoor = "西门"; } } #endregion } batSumMainId = ascmDeliBatSumMain.id; batSumDocNumber = ascmDeliBatSumMain.docNumber; appointmentStartTime = ascmDeliBatSumMain.appointmentStartTime; appointmentEndTime = ascmDeliBatSumMain.appointmentEndTime; allocateOutDoor = ascmDeliBatSumMain.allocateOutDoor; } else { } DateTime createTime = DateTime.Now; string description = ascmDriver.supplierName + ":" + ascmDriver.name + ":" + ascmDriver.plateNumber; AscmTruckSwipeLog ascmTruckSwipeLog = AscmTruckSwipeLogService.GetInstance().GetAddLog(doorId, readingHead, ascmDriver.rfid, ascmDriver.supplierId, driverId, ascmDriver.supplierName, ascmDriver.name, ascmDriver.plateNumber, true, description, createTime, direction, batSumMainId, batSumDocNumber, onTime, appointmentStartTime, appointmentEndTime); using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { if (ascmTruckSwipeLog != null) { YnDaoHelper.GetInstance().nHibernateHelper.Save(ascmTruckSwipeLog); } if (ascmDeliBatSumMain != null) { YnDaoHelper.GetInstance().nHibernateHelper.Update(ascmDeliBatSumMain); } tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 throw ex; } } } } } } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //提取数据 string queryWord = ""; string whereOther = "", whereDoor = "", wherePlateNumber = ""; string whereStartCreateTime = "", whereEndCreateTime = ""; if (Request.QueryString["queryWord"] != null && Request.QueryString["queryWord"].Trim() != "" && Request.QueryString["queryWord"].Trim() != "null") { queryWord = Request.QueryString["queryWord"].Trim(); } if (Request.QueryString["doorId"] != null && Request.QueryString["doorId"].Trim() != "" && Request.QueryString["doorId"].Trim() != "null") { whereDoor = "doorId=" + Request.QueryString["doorId"].Trim(); } if (Request.QueryString["plateNumber"] != null && Request.QueryString["plateNumber"].Trim() != "" && Request.QueryString["plateNumber"].Trim() != "null") { wherePlateNumber = "plateNumber like '%" + Request.QueryString["plateNumber"].Trim() + "%'"; } DateTime dtStartCreateTime, dtEndCreateTime; if (!string.IsNullOrEmpty(Request.QueryString["queryStartTime"]) && DateTime.TryParse(Request.QueryString["queryStartTime"], out dtStartCreateTime)) { whereStartCreateTime = "createTime>='" + dtStartCreateTime.ToString("yyyy-MM-dd 00:00:00") + "'"; } if (!string.IsNullOrEmpty(Request.QueryString["queryEndTime"]) && DateTime.TryParse(Request.QueryString["queryEndTime"], out dtEndCreateTime)) { whereEndCreateTime = "createTime<'" + dtEndCreateTime.AddDays(1).ToString("yyyy-MM-dd 00:00:00") + "'"; } whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereDoor); whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, wherePlateNumber); whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereStartCreateTime); whereOther = YnBaseClass2.Helper.StringHelper.SqlWhereAndAdd(whereOther, whereEndCreateTime); YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage(); ynPage.SetPageSize(500); //pageRows; ynPage.SetCurrentPage(1); //pageNumber; List <AscmTruckSwipeLog> listAscmTruckSwipeLog = AscmTruckSwipeLogService.GetInstance().GetList(ynPage, "", "", queryWord, whereOther); ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = Server.MapPath("TruckSwipeLogReport.rdlc"); ReportDataSource rds1 = new ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = listAscmTruckSwipeLog; ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以 ReportViewer1.LocalReport.DataSources.Add(rds1); string companpyTitle = "美的中央空调"; string title = companpyTitle + "供应商车辆出入日志"; ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("ReportParameter_Title", title), new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd")) }; ReportViewer1.LocalReport.SetParameters(reportParameters); ReportViewer1.LocalReport.Refresh(); } }