Пример #1
0
 protected void processEditModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   workCenterMgr.setFunctionMode(Constant.UPDATE);
   String key = actionCode.split("-")[2];
   if (actionObject.equals("WorkCenter")) {
     WorkCenter workCenter =
         (WorkCenter)
             Utility.getObject(workCenterMgr.getCurrentWorkCenterMeta().getWorkCenterList(), key);
     workCenterMgr.setCurrentWorkCenter(workCenter);
   } else if (actionObject.equals("WorkerGroup")) {
     WorkerGroup workerGroup =
         (WorkerGroup)
             Utility.getObject(
                 workCenterMgr.getCurrentWorkerGroupMeta().getWorkerGroupList(), key);
     workCenterMgr.setCurrentWorkerGroup(workerGroup);
   } else if (actionObject.equals("Worker")) {
     Worker worker =
         (Worker)
             Utility.getObject(workCenterMgr.getCurrentWorkerGroupMeta().getWorkerList(), key);
     workCenterMgr.setCurrentWorker(worker);
     workCenterMgr
         .getCurrentWorkerGroupMeta()
         .refreshDepartment(worker.getEmployee().getEmployeeId());
     worker.setDepartment(
         (SelectionOption)
             Utility.getObject(
                 workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(),
                 worker.getDepartment().getAttributeId()));
   }
 }
Пример #2
0
 protected void processSendModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   if (actionObject.equals("Working")) {
     workCenterMgr.setFunctionMode(Constant.SEND);
     workCenterMgr
         .getCurrentWorking()
         .saveStatus(workCenterMgr.getFunctionMode(), this.getLogin(request));
   }
 }
Пример #3
0
 protected void forwardView(
     String actionEvent,
     String actionObject,
     HttpServletRequest request,
     HttpServletResponse response)
     throws ServletException, IOException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   String actionCode = actionEvent + actionObject;
   if (actionEvent.equals("find")) {
     if (workCenterMgr.getFoundMode().equals(Constant.FIND_EMPLOYEE)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/findEmployee.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getFoundMode().equals(Constant.FIND_WORKER_GROUP)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/findWorkerGroup.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getFoundMode().equals(Constant.FIND_WORKER)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/findWorker.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getFoundMode().equals(Constant.FIND_ASSIGNMENT)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/findWorkAssignment.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getFoundMode().equals(Constant.FIND_WORKING)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/findWorking.jsp")
           .forward(request, response);
     }
   } else {
     if (workCenterMgr.getEntryMode().equals(Constant.WORKCENTER)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/workCenter.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getEntryMode().equals(Constant.WORKER_GROUP)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/workerGroup.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getEntryMode().equals(Constant.CREATE_WORKER)) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/worker.jsp")
           .forward(request, response);
     } else if (workCenterMgr.getEntryMode().indexOf(Constant.WORKING) >= 0) {
       getServletContext()
           .getRequestDispatcher("/jsp/mfg/wo/working.jsp")
           .forward(request, response);
       //            } else if
       // (workCenterMgr.getEntryMode().equals(Constant.PAYMENT_WORKING_REPORT)) {
       //
       // getServletContext().getRequestDispatcher("/jsp/mfg/wo/workingReport.jsp").forward(request, response);
     }
   }
 }
Пример #4
0
 protected void processRefreshModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   if (workCenterMgr.getEntryMode().equals(Constant.WORKER_GROUP)) {
     this.setHttpParameterWorkerGroup(request, workCenterMgr);
   } else if (workCenterMgr.getEntryMode().equals(Constant.CREATE_WORKER)) {
     this.setHttpParameterWorker(request, workCenterMgr);
   } else if (workCenterMgr.getEntryMode().indexOf(Constant.WORKING) >= 0) {
     this.setHttpParameterWorking(request, workCenterMgr);
   }
 }
Пример #5
0
  private void setHttpRequestWorkCenter(HttpServletRequest request, WorkCenterMgr workCenterMgr) {
    WorkCenter workCenter = workCenterMgr.getCurrentWorkCenter();

    workCenter.setWorkCenterCode(request.getParameter("workCenterCode"));
    workCenter.setWorkCenterName(request.getParameter("workCenterName"));
    workCenter.setWorkCenterDescription(request.getParameter("workCenterDescription"));
    workCenter.setFactoryLocation(
        (SelectionOption)
            Utility.getObject(
                workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(),
                request.getParameter("factoryList")));
  }
Пример #6
0
 private void setHttpParameterWorker(HttpServletRequest request, WorkCenterMgr workCenterMgr) {
   Worker worker = workCenterMgr.getCurrentWorker();
   worker.setWorkerNo(request.getParameter("workerNo"));
   if (request.getParameter("isDisable") != null
       && request.getParameter("isDisable").equals("Y")) {
     worker.setDisable(true);
   } else {
     worker.setDisable(false);
   }
   worker.setDepartment(
       (SelectionOption)
           Utility.getObject(
               workCenterMgr.getCurrentWorkerGroupMeta().getDepartmentList(),
               request.getParameter("departmentList")));
 }
Пример #7
0
 private void setHttpParameterWorkerGroup(
     HttpServletRequest request, WorkCenterMgr workCenterMgr) {
   WorkerGroup workerGroup = workCenterMgr.getCurrentWorkerGroup();
   workerGroup.setWorkerGroupCode(request.getParameter("workerGroupCode"));
   workerGroup.setWorkerGroupName(request.getParameter("workerGroupName"));
   workerGroup.setWorkerGroupDescription(request.getParameter("description"));
   workerGroup.setFactoryLocation(
       (SelectionOption)
           Utility.getObject(
               workCenterMgr.getCurrentWorkCenterMeta().getFindFactoryList(),
               request.getParameter("factoryList")));
   if (request.getParameter("isDisable") != null
       && request.getParameter("isDisable").equals("Y")) {
     workerGroup.setIsDisable(true);
   } else {
     workerGroup.setIsDisable(false);
   }
 }
Пример #8
0
 private void setHttpParameterWorking(HttpServletRequest request, WorkCenterMgr workCenterMgr) {
   Iterator iterator = workCenterMgr.getCurrentWorking().getWorkingDetailList().iterator();
   while (iterator.hasNext()) {
     WorkingDetail workingDetail = (WorkingDetail) iterator.next();
     workingDetail.setSheetRate(request.getParameter("sheetRate" + workingDetail.getRowNo()));
     workingDetail.setAmount(request.getParameter("amount" + workingDetail.getRowNo()));
     //            workingDetail.setAssignmentDate(request.getParameter("assignmentDate" +
     // workingDetail.getRowNo()));
   }
 }
Пример #9
0
 protected void processDeleteModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   if (actionObject.equals("Assignment")) {
     String key = actionCode.split("-")[2];
     this.setHttpParameterWorking(request, workCenterMgr);
     WorkingDetail workingDetail =
         (WorkingDetail)
             Utility.getObject(workCenterMgr.getCurrentWorking().getWorkingDetailList(), key);
     workCenterMgr.getCurrentWorking().getWorkingDetailList().remove(workingDetail);
     workCenterMgr.getCurrentWorking().setDetailListRowNo();
   } else if (actionObject.equals("Working")) {
     workCenterMgr.setFunctionMode(Constant.DELETE);
     workCenterMgr
         .getCurrentWorking()
         .saveStatus(workCenterMgr.getFunctionMode(), this.getLogin(request));
   }
 }
Пример #10
0
  protected void processSaveModel(
      String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
    WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);

    if (actionObject.equals("WorkCenter")) {
      setHttpRequestWorkCenter(request, workCenterMgr);
      workCenterMgr.getCurrentWorkCenter().validate();
      if (workCenterMgr.getCurrentWorkCenter().isValid()) {
        workCenterMgr.getCurrentWorkCenter().save();
        if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) {
          ((LinkedList) workCenterMgr.getCurrentWorkCenterMeta().getWorkCenterList())
              .addFirst(workCenterMgr.getCurrentWorkCenter());
        }
      }
    } else if (actionObject.equals("WorkerGroup")) {
      this.setHttpParameterWorkerGroup(request, workCenterMgr);
      workCenterMgr.getCurrentWorkerGroup().validate();
      if (workCenterMgr.getCurrentWorkerGroup().isValid()) {
        workCenterMgr.getCurrentWorkerGroup().save(this.getLogin(request));
        if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) {
          ((LinkedList) workCenterMgr.getCurrentWorkerGroupMeta().getWorkerGroupList())
              .addFirst(workCenterMgr.getCurrentWorkerGroup());
        }
      }
    } else if (actionObject.equals("Worker")) {
      this.setHttpParameterWorker(request, workCenterMgr);
      workCenterMgr.getCurrentWorker().validate();
      if (workCenterMgr.getCurrentWorker().isValid()) {
        workCenterMgr.getCurrentWorker().save(this.getLogin(request));
        if (workCenterMgr.getFunctionMode().equals(Constant.CREATE)) {
          ((LinkedList) workCenterMgr.getCurrentWorkerGroupMeta().getWorkerList())
              .addFirst(workCenterMgr.getCurrentWorker());
        }
      }
    } else if (actionObject.equals("Working")) {
      this.setHttpParameterWorking(request, workCenterMgr);
      workCenterMgr.getCurrentWorking().validate();
      if (workCenterMgr.getCurrentWorking().isValid()) {
        workCenterMgr.getCurrentWorking().save(workCenterMgr, this.getLogin(request));
      }
    }
  }
Пример #11
0
 protected void processSelectModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   String serial = actionCode.split("-")[2];
   if (actionObject.equals("Employee")) {
     Employee employee =
         (Employee)
             Utility.getObject(
                 workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial);
     if (workCenterMgr.getEntryMode().equals(Constant.WORKER_GROUP)) {
       workCenterMgr.getCurrentWorkerGroup().setLeader(employee);
     } else if (workCenterMgr.getEntryMode().equals(Constant.CREATE_WORKER)) {
       workCenterMgr.getCurrentWorker().setEmployee(employee);
       workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(employee.getEmployeeId());
     }
   } else if (actionObject.equals("WorkerGroup")) {
     WorkerGroup workerGroup =
         (WorkerGroup)
             Utility.getObject(
                 workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial);
     workCenterMgr.getCurrentWorker().setWorkerGroup(workerGroup);
   } else if (actionObject.equals("Worker")) {
     Worker worker =
         (Worker)
             Utility.getObject(
                 workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial);
     workCenterMgr.getCurrentWorking().setWorker(worker);
     workCenterMgr.getCurrentWorking().getWorkingDetailList().clear();
   } else if (actionObject.equals("Assignment")) {
     WorkingAssignment workingAssignment =
         (WorkingAssignment)
             Utility.getObject(
                 workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial);
     if (workingAssignment != null && !workCenterMgr.getCurrentWorking().isSelected(serial)) {
       WorkingDetail workingDetail = new WorkingDetail();
       workingDetail.setWorkingAssignment(workingAssignment);
       workingDetail.setSheetQty(workingAssignment.getAssignmentQty());
       workCenterMgr.getCurrentWorking().getWorkingDetailList().add(workingDetail);
       workCenterMgr.getCurrentWorking().setDetailListRowNo();
     }
   } else if (actionObject.equals("Working")) {
     Working working =
         (Working)
             Utility.getObject(
                 workCenterMgr.getFindMeta(workCenterMgr.getFoundMode()).getFindList(), serial);
     workCenterMgr.setCurrentWorking(working);
     workCenterMgr.getCurrentWorking().populateWorkingDetailList();
     WorkingDetail workingDetail =
         (WorkingDetail)
             ((LinkedList) workCenterMgr.getCurrentWorking().getWorkingDetailList()).getFirst();
     workCenterMgr
         .getCurrentWorking()
         .populateWorker(workCenterMgr, workingDetail.getWorkingAssignment().getWorkerId());
   }
 }
Пример #12
0
 protected void processFindModel(
     String actionCode, String actionObject, HttpServletRequest request) throws SQLException {
   WorkCenterMgr workCenterMgr = (WorkCenterMgr) this.getManagerFromSession(request);
   if (actionObject.equals("Employee")) {
     workCenterMgr.setFoundMode(Constant.FIND_EMPLOYEE);
     workCenterMgr.putFindMeta(workCenterMgr.getFoundMode(), new FindMeta(this.getLogin(request)));
   } else if (actionObject.equals("WorkerGroup")) {
     workCenterMgr.setFoundMode(Constant.FIND_WORKER_GROUP);
     workCenterMgr.putFindMeta(workCenterMgr.getFoundMode(), new FindMeta(this.getLogin(request)));
     // workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerGroupList(workCenterMgr);
   } else if (actionObject.equals("Worker")) {
     workCenterMgr.setFoundMode(Constant.FIND_WORKER);
     workCenterMgr.putFindMeta(workCenterMgr.getFoundMode(), new FindMeta(this.getLogin(request)));
     // workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerList(workCenterMgr);
   } else if (actionObject.equals("Assignment")) {
     workCenterMgr.setFoundMode(Constant.FIND_ASSIGNMENT);
     workCenterMgr.putFindMeta(workCenterMgr.getFoundMode(), new FindMeta(this.getLogin(request)));
     // workCenterMgr.getCurrentWorkingMeta().populateAssignmentList(workCenterMgr);
   } else if (actionObject.equals("Working")) {
     workCenterMgr.setFoundMode(Constant.FIND_WORKING);
     workCenterMgr.putFindMeta(workCenterMgr.getFoundMode(), new FindMeta(this.getLogin(request)));
     // workCenterMgr.getCurrentWorkingMeta().populateWorkingList(workCenterMgr);
   }
 }
Пример #13
0
  protected void initModel(String page, HttpServletRequest request) throws SQLException {
    WorkCenterMgr workCenterMgr = new WorkCenterMgr();
    this.putManagerToSession(request, workCenterMgr);

    workCenterMgr.setFunctionMode(Constant.CREATE);
    if (page.equals("workCenter")) {
      workCenterMgr.setEntryMode(Constant.WORKCENTER);
      workCenterMgr.getCurrentWorkCenterMeta().refreshFactory();
      workCenterMgr.getCurrentWorkCenterMeta().populateWorkCenterList();
    } else if (page.equals("createWorkerGroup")) {
      workCenterMgr.setEntryMode(Constant.WORKER_GROUP);
      workCenterMgr.getCurrentWorkCenterMeta().refreshFactory();
      workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerGroupList(workCenterMgr);
    } else if (page.equals("createWorker")) {
      workCenterMgr.setEntryMode(Constant.CREATE_WORKER);
      workCenterMgr.getCurrentWorkCenterMeta().refreshFactory();
      workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(null);
      workCenterMgr.getCurrentWorkerGroupMeta().populateWorkerList(workCenterMgr);
    } else if (page.endsWith("Working")) {
      if (page.equals("createWorking")) {
        workCenterMgr.setEntryMode(Constant.CREATE_WORKING);
      } else if (page.equals("updateWorking")) {
        workCenterMgr.setEntryMode(Constant.UPDATE_WORKING);
      } else if (page.equals("deleteWorking")) {
        workCenterMgr.setEntryMode(Constant.DELETE_WORKING);
      } else if (page.equals("confirmWorking")) {
        workCenterMgr.setEntryMode(Constant.CONFIRM_WORKING);
      } else if (page.equals("reportWorking")) {
        workCenterMgr.setEntryMode(Constant.REPORT_WORKING);
      }
      workCenterMgr.getCurrentWorkCenterMeta().refreshFactory();
      workCenterMgr.getCurrentWorkerGroupMeta().refreshDepartment(null);
      //        } else if (page.equals("paymentReport")) {
      //            workCenterMgr.setEntryMode(Constant.PAYMENT_WORKING_REPORT);
      //            workCenterMgr.setCurrentWorkCenterMeta(new WorkCenterMeta());
      //            workCenterMgr.getCurrentWorkCenterMeta().refreshFactory();
    }
  }