| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | |
| | | import com.vincent.rsf.server.manager.service.CompanysService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | |
| | | |
| | | @Autowired |
| | | private CompanysService companysService; |
| | | |
| | | @Autowired |
| | | private DictDataService dictDataService; |
| | | |
| | | @Override |
| | | public R generateBarcode(List<Long> orders) { |
| | |
| | | if (Objects.isNull(date)) { |
| | | throw new CoolException("时间格式错误!!"); |
| | | } |
| | | if (Objects.isNull((OrderType.getTypeVal(template.getType())))) { |
| | | sbFaild.append(template.getCode()).append(",单据状态不存在!!"); |
| | | throw new CoolException(sbFaild.toString()); |
| | | } |
| | | if (Objects.isNull((OrderWorkType.getWorkType(template.getWkType())))) { |
| | | sbFaild.append(template.getCode()).append(",业务状态不存在!!"); |
| | | throw new CoolException(sbFaild.toString()); |
| | | } |
| | | |
| | | order.setCode(template.getCode()) |
| | | .setPoCode(template.getPoCode()) |
| | | .setMemo(template.getMemo()) |
| | |
| | | // } |
| | | //保存扩展字段 |
| | | try { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | Boolean fields = FieldsUtils.saveFields(params, uuid16); |
| | | if (fields) { |
| | | if (Objects.isNull(asnOrderItem.getFieldsIndex()) || StringUtils.isBlank(asnOrderItem.getFieldsIndex())) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (!asnOrderItem.getExtendFields().isEmpty()) { |
| | | Map<String, String> fields = asnOrderItem.getExtendFields(); |
| | | asnOrderItem.getExtendFields().keySet().forEach(key -> { |
| | | sb.append(fields.get(key)); |
| | | }); |
| | | } |
| | | sb.append(asnOrderItem.getAsnCode() + asnOrderItem.getMatnrId() + asnOrderItem.getSplrBatch() + asnOrderItem.getIsptResult$()); |
| | | //获取16位uuid |
| | | String uuid16 = Cools.md5Chinese(sb.toString()); |
| | | asnOrderItem.setFieldsIndex(uuid16); |
| | | if (FieldsUtils.saveFields(params, uuid16)) { |
| | | asnOrderItem.setFieldsIndex(uuid16); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |