public async Task <IHttpActionResult> GetAllWarehouses(stringReceiver sR) { string id = sR.decoded(); //without distinct to check errors var result = db.WAREHOUSE.Where(e => e.ID != id).Select(e => e.NAME) .OrderBy(item => item).ToList(); return(Ok(returnHelper.make(result))); }
public async Task <IHttpActionResult> DeleteCheckSheet(stringReceiver sR) { try { string id = sR.decoded(); PATROL_LOG patrol_log = await db.PATROL_LOG.FindAsync(id); if (patrol_log == null) { throw new ApplicationException(); } db.PATROL_LOG.Remove(patrol_log); await db.SaveChangesAsync(); NotificationController.NotificationCallbackMsg("删", "巡检单" + sR.decoded()); var checkSheets = GetCheckSheets().data.ToList(); return(Ok(returnHelper.make(checkSheets))); } catch (Exception) { return(Ok(returnHelper.fail())); } }
public async Task <IHttpActionResult> deleteWorkSheet(stringReceiver sR) { string id = sR.decoded(); try { WORK_ORDER wORK_ORDER = await db.WORK_ORDER.FindAsync(id); if (wORK_ORDER == null) { throw new ApplicationException(); } db.WORK_ORDER.Remove(wORK_ORDER); await db.SaveChangesAsync(); var workSheets = GetWorkSheets().data.ToList(); NotificationController.NotificationCallbackMsg("删除工单" + sR.decoded()); return(Ok(returnHelper.make(workSheets))); } catch (Exception) { return(Ok(returnHelper.fail())); } }
public async Task <IHttpActionResult> GetDetail(stringReceiver sR) { var warehouse = await db.WAREHOUSE.FindAsync(sR.decoded()); if (warehouse == null) { return(NotFound()); } db.Entry(warehouse).Reference(p => p.REGION).Load(); var dto = new WAREHOUSEDetailDto() { name = warehouse.NAME, address = warehouse.REGION.COUNTY, detailedAddress = warehouse.LOCATION }; return(Ok(returnHelper.make(dto))); }
public async Task <IHttpActionResult> GetEqUsingDetail(stringReceiver sR) { var id = sR.decoded(); var eq = await db.EQ_IN_USE.Include(e => e.EQ_TYPE).FirstOrDefaultAsync(e => e.ID == id); var result = new detailedEqInUseDto() { name = eq.EQ_TYPE.TYPE_NAME, factory_time = eq.PRODUCTION_TIME, install_time = eq.INSTALL_TIME, unit = eq.MANAGER, address = eq.ADDRESS, if_damage = eq.STATUS, QRcode = eq.QR_CODE, icon = eq.EQ_TYPE.PICTURE }; return(Ok(returnHelper.make(result))); }
public async Task <IHttpActionResult> GetStorage(stringReceiver sR) { //without distinct to check errors var warehouse = await db.WAREHOUSE.FindAsync(sR.decoded()); if (warehouse == null) { return(NotFound()); } var warehouseTable = new List <WAREHOUSE>(); warehouseTable.Add(warehouse); var accessories = GetStoredAccessories(warehouse); var eqs = GetStoredEQ(warehouse); var dto = new WAREHOUSEStorageDto() { accessory = accessories, equipment = eqs }; return(Ok(returnHelper.make(dto))); }
public async Task <IHttpActionResult> deleteStaffSheetRow(stringReceiver sR) { string id = sR.decoded(); try { var staff = await db.STAFF.FindAsync(id); if (staff == null || staff.IS_SUPER != "0") { throw new Exception(); } staff.IS_SUPER = "-1"; await db.SaveChangesAsync(); NotificationController.NotificationCallbackMsg("开除员工" + " 编号" + staff.ID); return(Ok(returnHelper.make(getDtoList()))); } catch (Exception) { return(Ok(returnHelper.fail())); } }