bug
jiangping
2023-11-07 64b432916af9c9218ab3f3eca614e26c542142ae
server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordExtServiceImpl.java
@@ -157,6 +157,9 @@
                //查询生产人员姓名
//                model.setUserName(initProUser(user,model.getUserId(),allDepartList));
                    model.setUserInfo(initProUser(user,model.getUserId(),allDepartList));
                    model.setJijianSalary(model.getJijianSalary().divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
                    model.setJishiSalary(model.getJishiSalary().divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
                    model.setTotalSalary(model.getTotalSalary().divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
            }
        }
        return PageData.from(new PageInfo<>(result));
@@ -492,6 +495,7 @@
        }
        if(!Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.create)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.material)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.producing)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.check)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.done)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该工单状态已流转,不能进行该操作!");
@@ -529,6 +533,7 @@
        }
        if(!Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.create)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.material)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.producing)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.check)
                && !Constants.equalsInteger(model.getWorkorderStatus(),Constants.WORKORDER_STATUS.done)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该工单状态已流转,不能进行该操作!");
@@ -832,9 +837,11 @@
                if(!Constants.equalsInteger(tModel.getDoneType(),Constants.ZERO)){
                    //如果不良,累计工单的不良产出
                    mp.setUnqualifiedNum(Constants.formatIntegerNum(mp.getUnqualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
//                    mp.setUnqualifiedNum(mp.getUnqualifiedNum().add(tModel.getNum()));
                }else{
                    //如果是合格,累计工单的合格数量
                    mp.setQualifiedNum(Constants.formatIntegerNum(mp.getQualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue()));
//                    mp.setUnqualifiedNum(mp.getQualifiedNum().add(tModel.getNum()));
                }
                //检查篮筐是否被作为产出篮筐,如果是,则需要判断该篮筐是否投料余额为0
                Appliances curUpdateModel = getApplianceFromList(tModel.getAppliancesId(),updateApplianceList);
@@ -1579,6 +1586,7 @@
        }
        if(!Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.create)
                && !Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.material)
                && !Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.producing)
                && !Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.check)
                && !Constants.equalsInteger(mp.getStatus(),Constants.WORKORDER_STATUS.done)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该工单状态已流转,不能进行该操作!");
@@ -1679,10 +1687,13 @@
            if(model.getUserInfo()!=null){
                model.setUserName(model.getUserInfo().getUserName());
                model.setDepartName(model.getUserInfo().getDepartName());
                model.setNum(Constants.formatBigdecimalFloat(model.getNum(),2));
                model.setQualifiedNum(Constants.formatBigdecimalFloat(model.getQualifiedNum(),2));
                model.setUnQualifiedNum(Constants.formatBigdecimalFloat(model.getUnQualifiedNum(),2));
                model.setRate(Constants.formatBigdecimalFloat(model.getRate(),2));
            }
        }
        ExcelExporter.build(UserSalaryListVO.class).export(result, "员工绩效明细"+System.currentTimeMillis(), response);
    }
    @Override
    public void exportSalaryStatistics(PageWrap<QuerySalaryStatisticDTO> pageWrap, HttpServletResponse response){
@@ -1726,45 +1737,91 @@
                unintname = re.getUmodel().getName();
            }
            if (re.getPmodel() != null) {
                Integer pmodelnum = re.getPmodel().getNum() != null ? re.getPmodel().getNum() : 0;
                BigDecimal pmodelnum = re.getNum() != null ? re.getNum() : new BigDecimal("0");
               // wreev.setPlanNum( new BigDecimal(pmodelnum).stripTrailingZeros().toPlainString() + unintname);
                wreev.setPlanNum( new BigDecimal(pmodelnum).stripTrailingZeros().toPlainString() );
            }
            if (re.getDoneType() != null) {
                switch (re.getDoneType()) {
                    case 0:
                        wreev.setDoneType("合格");
                        break;
                    case 1:
                        wreev.setDoneType("不良");
                        break;
                    case 2:
                        wreev.setDoneType("报废");
                        break;
                    default:
                        break;
                }
                wreev.setPlanNum( re.getNum().stripTrailingZeros().toPlainString()+unintname);
            }
                wreev.setProcedureName(re.getProcedureName());
                wreev.setUnintname(unintname);
                if(re.getNum()!=null){
                    wreev.setAppliancenum(re.getNum().stripTrailingZeros().toPlainString() );
                    wreev.setAppliancenum(re.getNum().stripTrailingZeros().toPlainString()+unintname );
                }
                wreev.setUnintname(unintname);
                if (re.getAmodel() != null) {
                    wreev.setAppliancecode(re.getAmodel().getCode());
                }
                wreev.setDeviceCode(re.getDeviceCode()+"|"+re.getDeviceName());
                wreev.setCreateTime(format.format(re.getCreateTime()));
                wreev.setQualifiedNum( (Objects.nonNull(re.getQualifiedNum()) ? re.getQualifiedNum() : 0)+unintname);
                wreev.setUnqualifiedNum((Objects.nonNull(re.getUnqualifiedNum()) ? re.getUnqualifiedNum() : 0)+unintname);
                Integer duration = re.getDuration();
                if (Objects.nonNull(duration)){
                    Integer h = duration/3600;
                    Integer m = (duration%3600)/60;
                    Integer s = ((duration%3600)%60);
                    wreev.setDuration(h+"小时"+m+"分钟"+s+"秒");
                }else {
                    wreev.setDuration("-");
                }
                wreev.setSalaryType(re.getSalaryType());
                wreev.setSalaryPrice(re.getSalaryYuan());
                list.add(wreev);
        }
        ExcelExporter.build(WorkorderRecordExportExtListVO.class).export(list, "工单生产过程记录"+System.currentTimeMillis(), response);
        ExcelExporter.build(WorkorderRecordExportExtListVO.class).export(list, "生产产出明细"+System.currentTimeMillis(), response);
       // EasyExcelUtil.exportExcel(list, "工单生产过程记录","工单生产过程记录",WorkorderRecordExportExtListVO.class,"工单生产过程记录"+System.currentTimeMillis()+".xls", response);
    }
    @Override
    public void exportExcel2(PageWrap<QueryWorkorderRecordExtDTO> pageWrap, HttpServletResponse response) {
        List<WorkorderRecordExtListVO> result=this.findPage(pageWrap).getRecords();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        List<WorkorderRecordBathExportExtListVO> list=new ArrayList<>();
        for(int i=0;i<result.size();i++) {
            WorkorderRecordExtListVO re = result.get(i);
            WorkorderRecordBathExportExtListVO wreev = new WorkorderRecordBathExportExtListVO();
            if (re.getOmodel() != null) {
                wreev.setWorkordercode(re.getOmodel().getCode());
                if (re.getOmodel().getStatus() != null) {
                    String status = Constants.WORKORDER_STATUS.getTitleByStatus(null, re.getOmodel().getStatus());
                    wreev.setStatus(status);
                }
            }
            if (re.getMmodel() != null) {
                wreev.setMaterialcode(re.getMmodel().getCode());
                wreev.setMaterialname(re.getMmodel().getName());
            }
            wreev.setBatch(re.getBatch());
            if (re.getPromodel() != null) {
                wreev.setProceduresname(re.getPromodel().getName());
            }
            String unintname = "";
            if (re.getUmodel() != null) {
                unintname = re.getUmodel().getName();
            }
            if (re.getNum() != null) {
                BigDecimal pmodelnum = re.getNum() != null ? re.getNum() : new BigDecimal("0");
                // wreev.setPlanNum( new BigDecimal(pmodelnum).stripTrailingZeros().toPlainString() + unintname);
                wreev.setNum( pmodelnum.stripTrailingZeros().toPlainString()+unintname);
            }
            wreev.setProcedureName(re.getProcedureName());
            wreev.setUnintname(unintname);
            if(re.getOmodel().getPlanNum() != null){
                wreev.setPlanNum(re.getOmodel().getPlanNum().toString() );
            }
            wreev.setMaterialDonetype(re.getMaterialDonetype());
            wreev.setDeviceCode(re.getDeviceCode()+"|"+re.getDeviceName());
            wreev.setCreateTime(format.format(re.getCreateTime()));
            list.add(wreev);
        }
        ExcelExporter.build(WorkorderRecordBathExportExtListVO.class).export(list, "生产投料明细"+System.currentTimeMillis(), response);
    }
}