Example #1
0
 /**
  * Check if filled in all parts that should be filled on repair sheet
  *
  * @param repairNo Long Repair No
  * @return String false=Some blanks,true=All filled
  */
 public boolean checkRepairPartSn(Long repairNo) {
   boolean result = true;
   try {
     ArrayList partsList =
         (ArrayList)
             this.getDao()
                 .list(
                     " from  RepairPartForm p where p.repairNo="
                         + repairNo
                         + " and p.transferFlag<>'Y' and p.repairPartStatus='D' ");
     Iterator it = partsList.iterator();
     while (it.hasNext()) {
       RepairPartForm p = (RepairPartForm) it.next();
       if ("Y".equals(p.getIsHasSn())) {
         if (null == p.getSnNo() || "".equals(p.getSnNo())) {
           result = false;
           return result;
         }
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return result;
 }
Example #2
0
  /**
   * This method is for checking information of part which applied by repair sheet when repair
   * finished is all right,include(Part in PO,Part not repaired,Part to be allocated)
   *
   * @param repairNo Long Repair sheet ID
   * @param pcType String ASC type
   * @return boolean true=All right, false=Not
   */
  public boolean checkRepairPartsInfo(Long repairNo, String pcType) {
    boolean result = true;
    try {
      ArrayList partsList =
          (ArrayList)
              this.getDao()
                  .list(
                      " from  RepairPartForm p where p.repairNo="
                          + repairNo
                          + " and p.transferFlag<>'Y' ");

      Iterator it = partsList.iterator();

      while (it.hasNext()) {
        RepairPartForm p = (RepairPartForm) it.next();
        if ("PAOLRSME".indexOf(p.getRepairPartStatus()) != -1) {
          result = false;
          return result;
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return result;
  }
Example #3
0
  /**
   * Call method after controled part application approved
   *
   * @param ralpf Application details
   * @param approveFlag true:Approve passed,false:Approve failed
   */
  public void wbiBack(boolean approveFlag, RepairApplicationPRForm raprf, long userId) {
    try {
      RepairPartForm rpform =
          (RepairPartForm) this.getDao().findById(RepairPartForm.class, raprf.getPartsId());
      rpform.setPartRequestNo(raprf.getWorkflowId());
      this.getDao().update(rpform);
      // 将TD_UNREPAIR_STATUS置为完成
      try {
        List unRepairStatusForms =
            this.getDao()
                .list(
                    " from RepairUnRepairStatusInfoForm rursif where rursif.unRepairStatus='E' and rursif.repairNo="
                        + raprf.getRepairNo()
                        + " and rursif.workFlowNo="
                        + raprf.getWorkflowId());
        for (int i = 0; i < unRepairStatusForms.size(); i++) {
          RepairUnRepairStatusInfoForm rursif =
              (RepairUnRepairStatusInfoForm) unRepairStatusForms.get(i);
          rursif.setDbEndDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          rursif.setContinuanceDays(
              new Long(Operate.calculateDiffDays(rursif.getDbBeginDate(), rursif.getDbEndDate())));
          rursif.setContinuanceHours(
              new Long(Operate.calculateDiffHours(rursif.getDbBeginDate(), rursif.getDbEndDate())));

          rursif.setUpdateDate(
              new java.sql.Date(
                  ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate().getTime()));
          unRepairStatusForms.set(i, rursif);
        }
        this.getBatchDao().updateBatch(unRepairStatusForms);
      } catch (Exception e) {
        e.printStackTrace();
      }
      UserForm uf = (UserForm) this.getDao().findById(UserForm.class, userId);
      if (approveFlag) {

        // 取出此零件对应的维修单
        RepairServiceForm rsf =
            (RepairServiceForm)
                this.getDao().findById(RepairServiceForm.class, raprf.getRepairNo());
        // 取出此零件的基本信息

        // 根据PARTCODE查询RETURN PART 看是否RMA审批零件
        List returnPart =
            this.getDao()
                .list("from ReturnPartForm r where r.partCode='" + raprf.getPartCode() + "'");

        CommonSearch cs = ((CommonSearch) SpringContextUtil.getBean("commonSearch"));
        String pcType = cs.findPcTypeByOrgCode(rsf.getOrganizationCode());
        LimitPartApprove lpa = new LimitPartApprove();
        String[] approveRoles =
            lpa.getApproveRoles(
                "Y".equals(rpform.getPartFeeType()) ? "O" : "I",
                rsf.getManufacture(),
                rsf.getModelCode(),
                rpform.getPartCode(),
                pcType);

        if (!returnPart.isEmpty()) { // 如果符合RMA零件申请则自动启动RMA流程申请
          //			System.out.println("维修零件申请审批结束---系统自动启动RMA零件申请");
          RepairListBo rlb = new RepairListBo();
          RepairPartForm rpf = rlb.getRepairPartInfo(raprf.getPartsId());
          rpf.setRepairPartStatus("E");
          rpf.setRmaApply("Y");
          this.getDao().update(rpf);

          RepairApplicationRMAForm rmaForm = new RepairApplicationRMAForm();
          rmaForm.setRepairNo(rsf.getRepairNo());
          rmaForm.setServiceSheetNo(rsf.getServiceSheetNo());
          rmaForm.setModelCode(rsf.getModelCode());
          rmaForm.setSerialNo(rsf.getSerialNo());
          rmaForm.setPartsId(rpf.getPartsId());
          rmaForm.setPartCode(rpf.getPartCode());
          rmaForm.setOrganizationCode(rsf.getOrganizationCode());
          rmaForm.setModelName(rsf.getModelName());
          rmaForm.setCreateDate(
              ((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          rmaForm.setCreateBy(rpf.getUpdateBy());
          rmaForm.setApplyMan(rpf.getUpdateBy());
          repairApplicationRMABo.startRMA(rmaForm, uf);
        } else if (approveRoles != null) { // 如果符合受控零件申请则自动启动受控流程申请
          //			System.out.println("维修零件申请审批结束---系统自动启动受控零件申请");
          RepairListBo rlb = new RepairListBo();
          RepairPartForm rpf = rlb.getRepairPartInfo(raprf.getPartsId());
          rpf.setRepairPartStatus("E");
          rpf.setLimitApply("Y"); // 如果是受控零件,先更改零件申请类型
          this.getDao().update(rpf); // 更新维修零件表
          RepairApplicationLPForm ralpf = new RepairApplicationLPForm();
          ralpf.setRepairNo(rsf.getRepairNo());
          ralpf.setServiceSheetNo(rsf.getServiceSheetNo());
          ralpf.setModelCode(rsf.getModelCode());
          ralpf.setModelName(rsf.getModelName());
          ralpf.setSerialNo(rsf.getSerialNo());
          ralpf.setPartsId(rpf.getPartsId());
          ralpf.setPartCode(rpf.getPartCode());
          ralpf.setOrganizationCode(rsf.getOrganizationCode());
          ralpf.setCreateDate(((MultiDate) SpringContextUtil.getBean("multiDate")).getMultiDate());
          ralpf.setCreateBy(rpf.getUpdateBy());
          ralpf.setApplyMan(rpf.getUpdateBy());
          ralpf.setFactory(rsf.getManufacture());
          ralpf.setFee(rpf.getFee1());
          ralpf.setPartFeeType(rpf.getPartFeeType());

          repairApplicationLPBo.pageSave(ralpf, approveRoles, uf);
        } else {
          PartInfoForm pif =
              (PartInfoForm) this.getDao().findById(PartInfoForm.class, rpform.getPartCode());
          repairHandleBo.repairApproveAllocate(
              raprf.getWorkflowId(), raprf.getCreateBy(), rsf, rpform, pif);
        }
      } else {
        // 审批拒绝repair_part_info & partrequest update
        //			rpform.setRepairPartStatus("X");
        //			rpform.setCancelQty(new Long(1));
        //
        //	rpform.setUpdateDate(((MultiDate)SpringContextUtil.getBean("multiDate")).getMultiDate());
        //			this.getDao().update(rpform);
        repairHandleBo.processReject(rpform, raprf.getWorkflowId(), raprf.getCreateBy());
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Example #4
0
 /**
  * This method is for checking IRIS information is all right on repair sheet(missing IRIS,approve
  * refused part undeleted IRIS,canceled part undeleted IRIS)
  *
  * @param repairNo Long Repair sheet ID
  * @param pcType String ASC type
  * @return boolean true=All right,false=Not
  */
 public boolean checkRepairPartIris(Long repairNo, String pcType) {
   boolean result = true;
   try {
     if ("C".equals(pcType)) {
       // 查询维修单上的所有零件信息
       ArrayList partsList =
           (ArrayList)
               this.getDao()
                   .list(
                       " from  RepairPartForm p where p.repairNo="
                           + repairNo
                           + " and p.transferFlag<>'Y' ");
       if (null != partsList && partsList.size() > 0) {
         //	System.out.println("共查询到零件信息"+partsList.size()+"条......");
         for (int i = 0; i < partsList.size(); i++) {
           RepairPartForm pf = (RepairPartForm) partsList.get(i);
           //		System.out.println("零件号="+pf.getPartsId());
           // 查询该零件的的IRIS信息
           ArrayList partIrisList =
               (ArrayList)
                   this.getDao()
                       .list(
                           " from RepairIrisInfoForm i where i.repairNo="
                               + repairNo
                               + " and i.partsId="
                               + pf.getPartsId());
           // 如果该零件有IRIS
           if (null != partIrisList && partIrisList.size() > 0) {
             //			System.out.println("共查询到IRIS信息"+partIrisList.size()+"条......");
             int size = partIrisList.size();
             // IRIS只有一行
             if (size == 1) {
               //				System.out.println("只有一条IRIS信息....");
               // 如果零件的状态不是已领取则该零件的IRIS未删除
               if (!"D".equals(pf.getRepairPartStatus())) {
                 //					System.out.println("当前零件只有一条IRIS信息,但零件状态不在已领取.....");
                 result = false;
                 return result;
               }
               // 该零件的IRIS行数大于1属于多填写了IRIS
             } else {
               //				System.out.println("当前零件存在多条IRIS信息.....");
               result = false;
               return result;
             }
             // 如果该零件无IRIS信息
           } else {
             //			System.out.println("当前零件没有IRIS信息......");
             // 如果零件的状态是已领取,则说明该零件漏填了IRIS信息
             if ("D".equals(pf.getRepairPartStatus())) {
               //				System.out.println("当前零件状态为已领取,但未填写IRIS信息.......");
               result = false;
               return result;
             }
           }
         }
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return result;
 }