| | |
| | | if(entryRecord.getNum()>hazmatBasic.getMaxEntry()){ |
| | | throw new ApiException("数量超过单次入库最大数量<"+hazmatBasic.getMaxEntry()+">"); |
| | | } |
| | | if (!Objects.equals(existEr.getNum(),entryRecord.getNum())) { |
| | | generateCode2(entryRecord); |
| | | } |
| | | entryRecord.setUpdateBy(currentUser.getUsername()); |
| | | int row=baseMapper.updateById(entryRecord); |
| | | if(row<1){ |
| | |
| | | return row; |
| | | } |
| | | |
| | | private void generateCode2(HzEntryRecord entryRecord) { |
| | | SysCompany company=companyMapper.selectById(entryRecord.getCompanyId()); |
| | | String code=company.getCode(); |
| | | if(StringUtils.isBlank(code)){ |
| | | throw new ApiException("公司两位编码为空"); |
| | | } |
| | | String currentDate= DateUtil.format(new Date(), DatePattern.PURE_DATE_FORMAT); |
| | | StringBuilder prefixBuilder=new StringBuilder().append(CodePrexEnum.MATERIAL.getCode()) |
| | | .append(code) |
| | | .append(currentDate); |
| | | |
| | | HzEntryRecord er=baseMapper.selectLastEndCodeEntryRecord(prefixBuilder.toString(),entryRecord.getCompanyId()); |
| | | int startCode=1; |
| | | int endCode=startCode+entryRecord.getNum()-1; |
| | | if(er!=null){ |
| | | startCode=er.getEndCode()+1; |
| | | endCode=startCode+entryRecord.getNum()-1; |
| | | } |
| | | entryRecord.setCodePrex(prefixBuilder.toString()); |
| | | entryRecord.setStartCode(startCode); |
| | | entryRecord.setEndCode(endCode); |
| | | entryRecord.setState(EntryStateEnum.UNENTER.getCode()); |
| | | } |
| | | |
| | | @Override |
| | | public CommonPage selectHazmatListByEntryId(Long entryId) { |
| | | SysUser currentUser = SecurityUtils.getLoginUser().getUser(); |