| | |
| | | return ApiResponse.success(plansExtService.pageCount(param)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("一键报工") |
| | | @PostMapping("/autoWorkReport") |
| | | public ApiResponse autoWorkReport (@RequestBody AutoWorkReportDTO autoWorkReportDTO) { |
| | |
| | | @ApiOperation("根据对象信息查询") |
| | | @PostMapping("/queryOne") |
| | | @RequiresPermissions("business:salaryparam:query") |
| | | public ApiResponse queryOne(@RequestBody SalaryParam salaryParam) { |
| | | public ApiResponse<SalaryParam> queryOne(@RequestBody SalaryParam salaryParam) { |
| | | SalaryParam data = salaryParamService.findOne(salaryParam); |
| | | return ApiResponse.success(data); |
| | | } |
| | |
| | | if(com == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该账户异常!"); |
| | | } |
| | | if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过禁用!"); |
| | | } |
| | | // if(Constants.equalsInteger( com.getStatus(),Constants.ZERO) ){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过禁用!"); |
| | | // } |
| | | if(com.getOepnValidDate() != null && com.getOepnValidDate().before(new Date())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业已过使用有效期!"); |
| | | } |
| | |
| | | if(cu == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户不存在!"); |
| | | } |
| | | if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户已禁用!"); |
| | | } |
| | | // if(Constants.equalsInteger(cu.getStatus(),Constants.ONE)){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该企业用户已禁用!"); |
| | | // } |
| | | rootDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getRootDepartId()); |
| | | comDepart = departmentExtService.getModelById(c.getCompanyId(),cu.getComDepartId()); |
| | | depart = departmentExtService.getModelById(c.getCompanyId(),cu.getDepartmentId()); |
| | |
| | | |
| | | @ApiModelProperty(value = "已生产数量") |
| | | private Integer produceNum; |
| | | |
| | | @ApiModelProperty(value = "是否有bom配置 0无 1有", example = "1") |
| | | private Integer hasBom; |
| | | @ApiModelProperty(value = "bom投料方式 0推式 1拉式", example = "1") |
| | | private Integer bomType; |
| | | |
| | | } |
| | |
| | | WOutboundInBodyBean wOutboundInBodyBean = wOutboundInBodyBeans.get(Constants.ZERO); |
| | | //累计入库数量 |
| | | wOutboundInBodyBean.setNum(wOutboundInBodyBeans.stream().map(s -> s.getNum()).reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | if(wOutboundInBodyBean.getNum().compareTo(BigDecimal.ZERO)<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "数量异常,请检查数量!"); |
| | | } |
| | | WOutboundDetail wOutboundDetail = new WOutboundDetail(); |
| | | //查询物料数据 |
| | | MaterialDistribute materialDistribute = materialDistributeMapper.selectById(wOutboundInBodyBean.getMaterialId()); |
| | |
| | | import doumeemes.core.utils.excel.EasyExcelUtil; |
| | | import doumeemes.core.utils.redis.RedisUtil; |
| | | import doumeemes.dao.business.PlansMapper; |
| | | import doumeemes.dao.business.WorkorderMapper; |
| | | import doumeemes.dao.business.dto.*; |
| | | import doumeemes.dao.business.model.*; |
| | | import doumeemes.dao.ext.*; |
| | |
| | | private WorkorderHistoryExtMapper workorderHistoryExtMapper; |
| | | @Autowired |
| | | private WorkorderRecordExtMapper workorderRecordExtMapper; |
| | | |
| | | @Autowired |
| | | private WorkorderMapper workorderMapper; |
| | | @Autowired |
| | | private RouteProcedureExtMapper routeProcedureExtMapper; |
| | | @Autowired |
| | |
| | | // //统计已完工数量 |
| | | // param.setStatus(Constants.WORKORDER_STATUS.done); |
| | | // plan.setDoneNum(workorderExtMapper.sumOrderNum(param)); |
| | | QueryBomExtDTO bb = new QueryBomExtDTO(); |
| | | bb.setDepartId(plan.getDepartId()); |
| | | bb.setDeleted(Constants.ZERO); |
| | | bb.setRootDepartId(user.getRootDepartment().getId()); |
| | | bb.setMaterialId(plan.getMaterialId()); |
| | | bb.setProcedureId(plan.getProcedureId()); |
| | | BomExtListVO versionBom = bomExtMapper.selectByModel( bb); |
| | | if(versionBom == null || StringUtils.isBlank(versionBom.getVersion()) || versionBom.getBomVersionId() == null){ |
| | | plan.setHasBom(Constants.ZERO); |
| | | }else { |
| | | plan.setBomType(Constants.formatIntegerNum(versionBom.getType())); |
| | | plan.setHasBom(Constants.ONE); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | |
| | | if(Constants.equalsInteger(mp.getPaused(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,计划已暂停!"); |
| | | } |
| | | if(Constants.formatIntegerNum(mp.getDistributNum())+thisPlanNum > Constants.formatIntegerNum(mp.getNum())){ |
| | | if(Constants.formatIntegerNum(mp.getWorkorderDistributNum())+thisPlanNum > Constants.formatIntegerNum(mp.getNum())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,累计分配数量大于计划数量!"); |
| | | } |
| | | if(!Constants.equalsInteger(mp.getStatus(),Constants.PLAN_STATUS.publish)&&!Constants.equalsInteger(mp.getStatus(),Constants.PLAN_STATUS.distribute)){ |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"参数错误:产出数据"); |
| | | } |
| | | //查询工序计划已分配数量 |
| | | List<Workorder> workorderList = workorderExtMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId()).notIn("STATUS",7,8)); |
| | | List<Workorder> workorderList = workorderMapper.selectList(new QueryWrapper<Workorder>().eq("PLAN_ID",plans.getId()) |
| | | .notIn("STATUS",7,8)); |
| | | //本次产出数量 |
| | | BigDecimal num = autoWorkReportDTO.getCreateWorkorderRecordDTO().getQualifiedNum().add(autoWorkReportDTO.getCreateWorkorderRecordDTO().getUnQualifiedNum()); |
| | | if(num.compareTo(BigDecimal.ZERO)<=Constants.ZERO){ |
| | |
| | | workorderRecordStandardService.createMaterialStandard(createMaterialDTO); |
| | | } |
| | | //工单产出记录 |
| | | autoWorkReportDTO.getCreateWorkorderRecordDTO().setWorkorderId(workorder.getId()); |
| | | workorderRecordStandardService.createWorkorderRecord(autoWorkReportDTO.getCreateWorkorderRecordDTO(),user); |
| | | //工单报工 |
| | | workorderRecordStandardService.comfirmDone(workorder); |
| | |
| | | if (bomDetailList == null || bomDetailList.size() == 0) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,该生产物料的bom配置有误,请联系管理员!"); |
| | | } |
| | | for (BomDetailExtListVO i :bomDetailList) { |
| | | //查询是否投料 |
| | | if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>() |
| | | .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未投料BOM物料,无法进行报工"); |
| | | } |
| | | } |
| | | // for (BomDetailExtListVO i :bomDetailList) { |
| | | // //查询是否投料 |
| | | // if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>() |
| | | // .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在未投料BOM物料,无法进行报工"); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | WOutbound outbound = new WOutbound(); |
| | |
| | | } |
| | | //如果是产出 |
| | | mp.setHasProduceNum(Constants.formatBigdecimal(tModel.getNum()).intValue()+Constants.formatIntegerNum(mp.getHasProduceNum())); |
| | | if(tModel.getDoneType() == null){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,工装器具【"+tModel.getAmodel().getCode()+"】产出质量属性为空,无法报工!"); |
| | | } |
| | | if(!Constants.equalsInteger(tModel.getDoneType(),Constants.ZERO)){ |
| | | //如果不良,累计工单的不良产出 |
| | | mp.setUnqualifiedNum(Constants.formatIntegerNum(mp.getUnqualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue())); |
| | | }else{ |
| | | //如果是合格,累计工单的合格数量 |
| | | mp.setQualifiedNum(Constants.formatIntegerNum(mp.getQualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue())); |
| | | } |
| | | // if(tModel.getDoneType() == null){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "对不起,工装器具【"+tModel.getAmodel().getCode()+"】产出质量属性为空,无法报工!"); |
| | | // } |
| | | // if(!Constants.equalsInteger(tModel.getDoneType(),Constants.ZERO)){ |
| | | // //如果不良,累计工单的不良产出 |
| | | // mp.setUnqualifiedNum(Constants.formatIntegerNum(mp.getUnqualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue())); |
| | | // }else{ |
| | | // //如果是合格,累计工单的合格数量 |
| | | // mp.setQualifiedNum(Constants.formatIntegerNum(mp.getQualifiedNum())+(Constants.formatBigdecimal(tModel.getNum()).intValue())); |
| | | // } |
| | | |
| | | //物料+批次+工序+质量属性去重 |
| | | WOutboundDetail detail =getWoutbondDetailByList(tModel,detailList); |
| | |
| | | <select id="selectByModel" parameterType="doumeemes.dao.ext.dto.QueryPlansExtDTO" resultMap="PlansExtListVO"> |
| | | SELECT |
| | | `a`.* |
| | | ,( SELECT sum( b.PLAN_NUM ) FROM workorder b WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status !=6) AS workorderDistributNum |
| | | ,ifnull(( SELECT sum( b.PLAN_NUM ) FROM workorder b WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status not in (7,8) ),0) AS workorderDistributNum |
| | | from plans a |
| | | <where> |
| | | <if test="id != null"> |
| | |
| | | `usermodel`.`SYSTEMID` AS USERMODEL_SYSTEMID, |
| | | `usermodel`.`INVALID_TIME` AS USERMODEL_INVALID_TIME, |
| | | `usermodel`.`TYPE` AS USERMODEL_TYPE |
| | | ,( SELECT sum( b.PLAN_NUM ) FROM workorder b WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status !=6) AS workorderDistributNum , |
| | | , ifnull(( SELECT sum( b.PLAN_NUM ) FROM workorder b WHERE b.deleted = 0 AND b.PLAN_ID = a.id and b.status !=6),0) AS workorderDistributNum , |
| | | `mmodel`.name as materialName , `mmodel`.code as materialCode ,`fmodel`.name as factoryName , `pmodel`.name as produceName , |
| | | concat(`usermodel`.realname,' ',`usermodel`.mobile) as planUserName , `umodel`.name as unitName , |
| | | w.PLAN_CODE as workPlanCode , w.SALESORDER as salesOrder , |
| | |
| | | AND concat(#{planDateEnd},' 23:59:59') >= `a`.`PLAN_DATE` |
| | | </if> |
| | | </where> |
| | | order by a.PLAN_DATE desc, a.CREATE_TIME desc |
| | | order by a.START_DATE desc, a.CREATE_TIME desc |
| | | </select> |
| | | |
| | | |