diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java index ca8a9aca4..b8947397b 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java @@ -229,6 +229,15 @@ public class CommonUtil { return preMonth; } + /** + * 数字前面自动补零 + * @param number 数字 + * @return + */ + public static String geFourNumberByString(String number,int num){ + return geFourNumber(Long.parseLong(number),num); + } + /** * 数字前面自动补零 * @param number 数字 @@ -259,6 +268,8 @@ public class CommonUtil { } + + public static Date getEndByDateStr(String endDate) { try { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); diff --git a/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java b/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java index 3b9fea2b3..454d59cd9 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java +++ b/blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java @@ -105,6 +105,11 @@ public class QRCodeUtil { return null; } + /** + * 条形码 + * @param content + * @return + */ public static String createCodeToFileType(String content) { try { //getResource("/")等同于到resource文件夹下 @@ -167,7 +172,7 @@ public class QRCodeUtil { hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); //EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近 - hints.put(EncodeHintType.MARGIN, 1); + hints.put(EncodeHintType.MARGIN, 0); MultiFormatWriter multiFormatWriter = new MultiFormatWriter(); BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints); diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java index e46a15b4c..02eabab71 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java @@ -18,6 +18,7 @@ public class BasicdataCodeRecordEntity extends TenantEntity { private String warehouseCode; private String year; private String month; + private String day; private Integer num; } diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java index f757fc7f3..73561109f 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java @@ -64,6 +64,9 @@ public class BasicdataFactoryCategoryEntity extends TenantEntity { @ApiModelProperty(value = "品牌id") private Long brandId; + @ApiModelProperty(value = "结算类型 1 收入 2 成本") + private Integer type; + diff --git a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java index f29a7c69a..6709f7ba3 100644 --- a/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java +++ b/blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java @@ -14,6 +14,8 @@ public class WarehouseTrayQRCode { private String trayCode; + private String palletName; + public Map toMap() throws IllegalAccessException { Map map = new HashMap<>(); diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java index 79af10590..69d362927 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java @@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface BasicdataCodeRecordMapper extends BaseMapper { - BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(@Param("type") Integer type, @Param("warehouseCode") String warehouseCode, @Param("year") String year, @Param("month") String month); + BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(@Param("type") Integer type, @Param("warehouseCode") String warehouseCode, @Param("year") String year, @Param("month") String month,@Param("day") String day); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml index c830f2a2e..67783327a 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml @@ -10,6 +10,7 @@ and warehouse_code = #{warehouseCode} and `year` = #{year} and `month` = #{month} + and `day` = #{day} diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml index 7c950352a..9e7095f0c 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml @@ -7,8 +7,23 @@ from logpm_basicdata_factory_category where 1=1 and is_deleted = 0 - - and brand = #{param.brand} + + and type = #{param.type} + + + and category = #{param.category} + + + + and firsts = #{param.firsts} + + + + and seconds = #{param.seconds} + + + + and thirds = #{param.thirds} @@ -18,6 +33,12 @@ where 1=1 and brand = #{param.brand} and is_deleted = 0 + + and type = #{param.type} + + + and category = #{param.category} + and (firsts is null or firsts = '') diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml index 3ff0cfc9a..6053b60ab 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml @@ -414,7 +414,7 @@ diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java index 3cbf815e6..3544353e7 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java @@ -4,5 +4,5 @@ import com.logpm.basicdata.entity.BasicdataCodeRecordEntity; import org.springblade.core.mp.base.BaseService; public interface IBasicdataCodeRecordService extends BaseService { - BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month); + BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month,String day); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java index e9637e558..b7534a05d 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java @@ -6,5 +6,5 @@ public interface IBasicdataCodeService { String getCodeByType(Integer type,String warehouseCode,String orderCode); - List getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num); + List getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) ; } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java index e1fef9497..f35f9d17e 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java @@ -13,7 +13,7 @@ import org.springframework.stereotype.Service; @AllArgsConstructor public class BasicdataCodeRecordServiceImpl extends BaseServiceImpl implements IBasicdataCodeRecordService { @Override - public BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month) { - return baseMapper.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year,month); + public BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month,String day) { + return baseMapper.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year,month,day); } } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java index cd31c6646..6fe073e11 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java @@ -7,6 +7,7 @@ import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.service.IBasicdataCodeRecordService; import com.logpm.basicdata.service.IBasicdataCodeService; import com.logpm.basicdata.service.IBasicdataWarehouseService; +import io.swagger.models.auth.In; import lombok.AllArgsConstructor; import lombok.extern.log4j.Log4j2; import org.springblade.common.constant.CodeDesEnum; @@ -38,15 +39,16 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { /** * 根据类型生成编号 + * * @param type * @return */ @Override - public String getCodeByType(Integer type,String warehouseCode,String orderCode) { + public String getCodeByType(Integer type, String warehouseCode, String orderCode) { String code = null; - switch (type){ + switch (type) { case CodeNumConstant.WAYBILL: - code = getWayBillNo(type,warehouseCode); + code = getWayBillNo(type, warehouseCode); break; // case CodeNumConstant.ORDER: // break; @@ -58,11 +60,11 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { // case CodeNumConstant.LOCATION: // break; case CodeNumConstant.TRAYS: - code = generateTraysCode(type,warehouseCode); + code = generateTraysCode(type, warehouseCode); break; case CodeNumConstant.PACKAGE: //包件号 - code = generatePackageCode(type,warehouseCode,orderCode); + code = generatePackageCode(type, warehouseCode, orderCode); break; // case CodeNumConstant.SHELF: // break; @@ -70,22 +72,22 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { // code = generateDeliveryCustomOrder(type,warehouseCode); // break; case CodeNumConstant.ABNORMAL_ORDER: - code = generateExOrderCode(type,warehouseCode,orderCode); + code = generateExOrderCode(type, warehouseCode, orderCode); break; case CodeNumConstant.TRUNKLINEBILLLADING: - code = generateTrunklineBillladingCode(type,warehouseCode,orderCode); + code = generateTrunklineBillladingCode(type, warehouseCode, orderCode); break; case CodeNumConstant.TRUNKLINE_CARS_LOAD: - code = generateTrunklineCarsLineCode(type,warehouseCode,orderCode); + code = generateTrunklineCarsLineCode(type, warehouseCode, orderCode); break; case CodeNumConstant.TRUNKLINE_TRIPARTITE_LOAD: - code = generateTrunklineTripartiteLoadCode(type,warehouseCode,orderCode); + code = generateTrunklineTripartiteLoadCode(type, warehouseCode, orderCode); break; case CodeNumConstant.TRUNKLINE_LOAD_SIGN: - code = generateTrunklineLoadSignCode(type,warehouseCode,orderCode); + code = generateTrunklineLoadSignCode(type, warehouseCode, orderCode); break; case CodeNumConstant.BALANCE_ORDER: - code = generateBalanceOrderCode(type,warehouseCode,orderCode); + code = generateBalanceOrderCode(type, warehouseCode, orderCode); break; default: log.info("##################getCodeByType: 暂不支持的编码类型 type={}", CodeDesEnum.getMes(type)); @@ -94,36 +96,23 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { } private String generateBalanceOrderCode(Integer type, String warehouseCode, String orderCode) { - if(!"BALANCE_ORDER".equals(warehouseCode)){ - log.warn("#########generateBalanceOrderCode: 仓库编码有误 warehouseCode={}",warehouseCode); + if (!"BALANCE_ORDER".equals(warehouseCode)) { + log.warn("#########generateBalanceOrderCode: 仓库编码有误 warehouseCode={}", warehouseCode); return null; } + BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); + return null; + } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(CodeNumConstant.PACKAGE,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(CodeNumConstant.PACKAGE); - basicdataCodeRecordEntity.setWarehouseName("全仓"); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer oldNum = basicdataCodeRecordEntity.getNum(); oldNum = oldNum + 1; - String packageCode = "JSD" + year + CommonUtil.geFourNumber(month.longValue(),2) + CommonUtil.geFourNumber(oldNum.longValue(),6); + String packageCode = "JSD" + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(oldNum.longValue(), 6); basicdataCodeRecordEntity.setNum(oldNum); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); @@ -131,52 +120,38 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { } @Override - public List getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############getBatchPackageCodeByType: 仓库编码为空warehouseCode={}",warehouseCode); + public List getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) { + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############getBatchPackageCodeByType: 仓库编码为空warehouseCode={}", warehouseCode); return null; } - if(!StringUtil.hasLength(orderCode)){ - log.warn("############getBatchPackageCodeByType: 订单号为空orderCode={}",orderCode); + if (!StringUtil.hasLength(orderCode)) { + log.warn("############getBatchPackageCodeByType: 订单号为空orderCode={}", orderCode); return null; } - - //包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引 - String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8); - BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } + //包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引CodeNumConstant.PACKAGE + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(CodeDesEnum.PACKAGE.getCodeNum(), basicdataWarehouseEntity); - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(CodeNumConstant.PACKAGE,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(CodeNumConstant.PACKAGE); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer oldNum = basicdataCodeRecordEntity.getNum(); List packageCodes = new ArrayList<>(); + int year =Integer.parseInt(basicdataCodeRecordEntity.getYear())%100; for (int i = 0; i < num; i++) { + //获取时间戳后面的时分秒 + try { + Thread.sleep(1); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + String time = new String(System.currentTimeMillis() + ""); + time=time.substring(4); oldNum = oldNum + 1; - String packageCode = "HT" + warehouseCode + year + CommonUtil.geFourNumber(month.longValue(),2) + haxCodeByLong + CommonUtil.geFourNumber(oldNum.longValue(),6); + String packageCode = "HT" + warehouseCode + year + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + basicdataCodeRecordEntity.getDay() + time; packageCodes.add(packageCode); } basicdataCodeRecordEntity.setNum(oldNum); @@ -187,328 +162,231 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { private String generateTrunklineLoadSignCode(Integer type, String warehouseCode, String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTrunklineLoadSignCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTrunklineLoadSignCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } + + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); + + + Integer inrc = basicdataCodeRecordEntity.getNum() + 1; + + basicdataCodeRecordEntity.setNum(inrc); + basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); + + return warehouseCode + "ZFQS" + basicdataCodeRecordEntity.getYear() + basicdataCodeRecordEntity.getMonth() + CommonUtil.geFourNumber(inrc.longValue(), 5); + + } + + /** + * 获取编码生成记录 + * + * @param type + * @param basicdataWarehouseEntity + * @return + */ + private BasicdataCodeRecordEntity getBasicdataCodeRecordEntity(Integer type, BasicdataWarehouseEntity basicdataWarehouseEntity) { Calendar calendar = Calendar.getInstance(); //获取年份 Integer year = calendar.get(Calendar.YEAR); // 获取月份(注意月份从0开始计数) Integer month = calendar.get(Calendar.MONTH) + 1; + Integer day = calendar.get(Calendar.DAY_OF_MONTH); + BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type, basicdataWarehouseEntity.getWarehouseCode(), year + "", month + "", day + ""); - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ + if (Objects.isNull(basicdataCodeRecordEntity)) { basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); basicdataCodeRecordEntity.setCodeType(type); basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); + basicdataCodeRecordEntity.setWarehouseCode(basicdataWarehouseEntity.getWarehouseCode()); + basicdataCodeRecordEntity.setYear(year + ""); + basicdataCodeRecordEntity.setMonth(month + ""); + basicdataCodeRecordEntity.setDay(day + ""); basicdataCodeRecordEntity.setNum(0); basicdataCodeRecordService.save(basicdataCodeRecordEntity); } - Integer inrc = basicdataCodeRecordEntity.getNum() + 1; - - basicdataCodeRecordEntity.setNum(inrc); - basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - - return warehouseCode+"ZFQS"+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5); - + return basicdataCodeRecordEntity; } private String generateTrunklineTripartiteLoadCode(Integer type, String warehouseCode, String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } String f = "ZZ"; BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return warehouseCode+f+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5); + return warehouseCode + f + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5); } private String generateTrunklineCarsLineCode(Integer type, String warehouseCode, String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } String f = ""; - if("1".equals(orderCode)){ + if ("1".equals(orderCode)) { f = "GX"; - }else if ("2".equals(orderCode)){ + } else if ("2".equals(orderCode)) { f = "ZX"; - }else if ("3".equals(orderCode)){ + } else if ("3".equals(orderCode)) { f = "ZC"; - }else { + } else { return null; } BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return warehouseCode+f+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5); + return warehouseCode + f + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5); } private String generateTrunklineBillladingCode(Integer type, String warehouseCode, String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTrunklineBillladingCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTrunklineBillladingCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return warehouseCode+"TH"+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5); + return warehouseCode + "TH" + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5); } private String generateExOrderCode(Integer type, String warehouseCode, String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } //HTEX+仓库code+年月日+(仓库当天的数量+1) BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - // 获取日期 - Integer day = calendar.get(Calendar.DAY_OF_MONTH); + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return "HTEX"+warehouseCode+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(day.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5); + return "HTEX" + warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getDay(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5); } private String generateTraysCode(Integer type, String warehouseCode) { BasicTenantCodeEntity basicTenantCode = tenantCodeClient.findBasicTenantCodeByCodeAndShowType(BasicCodeTypeConstant.TRAY_CODE.getValue(), BasicCodeShowConstant.QR_CODE.getValue()); - if(Objects.isNull(basicTenantCode)){ - log.warn("############generateTraysCode: 租户信息不存在basicTenantCode={}",basicTenantCode); + if (Objects.isNull(basicTenantCode)) { + log.warn("############generateTraysCode: 租户信息不存在basicTenantCode={}", basicTenantCode); return null; } String desName = basicTenantCode.getDesName(); String code = basicTenantCode.getCode(); - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } //托盘 HT+仓库拼音+ 年月 +【当前仓库总数+1(五位数 不足补零)】 BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } String abbreviation = basicdataWarehouseEntity.getAbbreviation(); - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(100000); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - String trayCode = code+ warehouseCode + (year%100) + inrc; + String trayCode = code + warehouseCode + (Integer.parseInt(basicdataCodeRecordEntity.getYear()) % 100) + inrc; String trayName = desName + abbreviation + inrc; - return trayCode+"&&"+trayName; + return trayCode + "&&" + trayName; } /** * 生成仓库对应的运单号 + * * @param type * @param warehouseCode * @return */ private String getWayBillNo(Integer type, String warehouseCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}",warehouseCode); + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}", warehouseCode); return null; } BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return warehouseCode+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5); + return warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5); } @@ -521,22 +399,23 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { String tenantCode = basicTenantCodeClient.shelfCode(tenantId, String.valueOf(type));//租户编码 //获得年月日短字符串 String dateShort = CommonUtil.dateToStringShort(new Date()); - String key = tenantId + ":" + warehouseCode + ":" + des+":"+dateShort; + String key = tenantId + ":" + warehouseCode + ":" + des + ":" + dateShort; //获得序号 Long incr = bladeRedis.incr(key); - if(1 == incr){ + if (1 == incr) { //如果为1就是刚刚才建立,给他一个过期时间 - bladeRedis.expireAt(key,CommonUtil.getDayEnd()); + bladeRedis.expireAt(key, CommonUtil.getDayEnd()); } - return tenantCode+warehouseCode+dateShort+CommonUtil.geFourNumber(incr,5); + return tenantCode + warehouseCode + dateShort + CommonUtil.geFourNumber(incr, 5); } /** * 生成配送车次号编码 + * * @param type */ - private String generateDeliveryTrainNumber(Integer type,String warehouseCode) { + private String generateDeliveryTrainNumber(Integer type, String warehouseCode) { String des = CodeDesEnum.getMes(type);//摘要 String tenantId = AuthUtil.getTenantId();//租户号 // String tenantId = "627683";//租户号 @@ -545,25 +424,25 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { String dateShort = CommonUtil.dateToStringShort(new Date()); //redis的key - String key = tenantId + ":" + warehouseCode + ":" + des+":"+dateShort; + String key = tenantId + ":" + warehouseCode + ":" + des + ":" + dateShort; //获得序号 Long incr = bladeRedis.incr(key); - if(1 == incr){ + if (1 == incr) { //如果为1就是刚刚才建立,给他一个过期时间 - bladeRedis.expireAt(key,CommonUtil.getDayEnd()); + bladeRedis.expireAt(key, CommonUtil.getDayEnd()); } - return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr,5); + return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr, 5); } - private String generatePackageCode(Integer type,String warehouseCode,String orderCode) { - if(!StringUtil.hasLength(warehouseCode)){ - log.warn("############generatePackageCode: 仓库编码为空warehouseCode={}",warehouseCode); + private String generatePackageCode(Integer type, String warehouseCode, String orderCode) { + if (!StringUtil.hasLength(warehouseCode)) { + log.warn("############generatePackageCode: 仓库编码为空warehouseCode={}", warehouseCode); return null; } - if(!StringUtil.hasLength(orderCode)){ - log.warn("############generatePackageCode: 订单号为空orderCode={}",orderCode); + if (!StringUtil.hasLength(orderCode)) { + log.warn("############generatePackageCode: 订单号为空orderCode={}", orderCode); return null; } @@ -571,37 +450,17 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService { String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8); BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode); - if(Objects.isNull(basicdataWarehouseEntity)){ - log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode); + if (Objects.isNull(basicdataWarehouseEntity)) { + log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode); return null; } - Calendar calendar = Calendar.getInstance(); - //获取年份 - Integer year = calendar.get(Calendar.YEAR); - - // 获取月份(注意月份从0开始计数) - Integer month = calendar.get(Calendar.MONTH) + 1; - - - BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+""); - - if(Objects.isNull(basicdataCodeRecordEntity)){ - basicdataCodeRecordEntity = new BasicdataCodeRecordEntity(); - basicdataCodeRecordEntity.setCodeType(type); - basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId()); - basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName()); - basicdataCodeRecordEntity.setWarehouseCode(warehouseCode); - basicdataCodeRecordEntity.setYear(year+""); - basicdataCodeRecordEntity.setMonth(month+""); - basicdataCodeRecordEntity.setNum(0); - basicdataCodeRecordService.save(basicdataCodeRecordEntity); - } + BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity); Integer inrc = basicdataCodeRecordEntity.getNum() + 1; basicdataCodeRecordEntity.setNum(inrc); basicdataCodeRecordService.updateById(basicdataCodeRecordEntity); - return "HT" + warehouseCode + year + CommonUtil.geFourNumber(month.longValue(),2) + haxCodeByLong + CommonUtil.geFourNumber(inrc.longValue(),6); + return "HT" + warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + haxCodeByLong + CommonUtil.geFourNumber(inrc.longValue(), 6); } } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java index d43c25166..50d9c6329 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java @@ -228,6 +228,7 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl map = JSONObject.parseObject(JSONObject.toJSONString(trayQRCode), Map.class); String filename = QRCodeUtil.createCodeToFile(trayQRCode.getTrayCode()); map.put("qrCode", QRCodeUtil.getEmpAutograph(filename)); + map.put("palletName", trayQRCode.getPalletName()); String fileTypeName = QRCodeUtil.createCodeToFileType(trayQRCode.getTrayCode()); map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName)); map.put("tenant","汇通物流"); diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java index ac084a41c..6176a9ded 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java @@ -715,7 +715,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService { Integer PUSH_STATUS_FAIL = 2; JSONObject jsonObject = JSONObject.parseObject(result); - if (jsonObject == null || jsonObject.isEmpty() || 0 != jsonObject.getInteger("code")) { + if (jsonObject == null || jsonObject.isEmpty() || 0 != jsonObject.getInteger("Result")) { mtOrderLogEntity.setPushStatus(PUSH_STATUS_FAIL); } else { mtOrderLogEntity.setPushStatus(PUSH_STATUS_SUCCESS); diff --git a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java index e42abf179..d1a15041a 100644 --- a/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java +++ b/blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java @@ -62,6 +62,7 @@ import org.springblade.core.redis.cache.BladeRedis; import org.springblade.core.test.BladeBootTest; import org.springblade.core.test.BladeSpringExtension; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.SpringUtil; import org.springblade.core.tool.utils.StringUtil; import org.springblade.resource.feign.IOssClient; @@ -76,6 +77,7 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.crypto.spec.PSource; +import javax.xml.crypto.Data; import java.io.*; import java.nio.charset.StandardCharsets; import java.security.NoSuchAlgorithmException; @@ -1100,34 +1102,43 @@ public class TestService { public static void main(String[] args) throws IOException, InterruptedException { + Date data1 = DateUtil.parse("2024-07-23 17:07:23.123","yyyy-MM-dd hh:mm:ss.SSS"); + Date data2 = DateUtil.parse("2024-07-24 17:07:23.123","yyyy-MM-dd hh:mm:ss.SSS"); - File file = new File("D:\\新建文件夹\\444.txt"); + System.out.println(data1.getTime()); + System.out.println(data2.getTime()); - BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); - List list = new ArrayList<>(); - while (bufferedReader.ready()) { - String line = bufferedReader.readLine(); - if(!list.contains(line)){ - list.add(line); - System.out.println(line); - } - } - // 获取token - String s = buildToken(); - - - for (String string : list) { - Thread.sleep(500); - System.out.println(string); - String url = "https://timsapi.oppein.com/tims_odata_api/api/odata/PackageFeedbackRecord"; - HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", s).body(string).execute(); - String result = httpResponse.body(); - System.out.println(result); - } +// File file = new File("D:\\新建文件夹\\444.txt"); +// +// BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); +// +// List list = new ArrayList<>(); +// +// while (bufferedReader.ready()) { +// String line = bufferedReader.readLine(); +// if(!list.contains(line)){ +// list.add(line); +// System.out.println(line); +// } +// } +// +// // 获取token +// String s = buildToken(); +// +// +// +// for (String string : list) { +// Thread.sleep(500); +// System.out.println(string); +// String url = "https://timsapi.oppein.com/tims_odata_api/api/odata/PackageFeedbackRecord"; +// HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", s).body(string).execute(); +// String result = httpResponse.body(); +// System.out.println(result); +// } } diff --git a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java index 6e72ba080..8bc0cc346 100644 --- a/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java +++ b/blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java @@ -53,16 +53,16 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_package_code",orderPackageCode) - .eq("warehouse_id",warehouseId) - .eq("is_deleted",0); + queryWrapper.eq("order_package_code", orderPackageCode) + .eq("warehouse_id", warehouseId) + .eq("is_deleted", 0); return baseMapper.selectOne(queryWrapper); } @@ -93,7 +93,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl pageList = baseMapper.advanceDetailPageList(page,advanceDetailDTO); + IPage pageList = baseMapper.advanceDetailPageList(page, advanceDetailDTO); return pageList; } @@ -101,7 +101,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_package_code",orderPackageCode); + queryWrapper.eq("order_package_code", orderPackageCode); return baseMapper.selectOne(queryWrapper); } @@ -113,10 +113,10 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("order_package_code",orderPackageCode) - .eq("order_code",orderCode) - .eq("train_number",trainNumber) - .eq("service_num",serviceNum); + queryWrapper.eq("order_package_code", orderPackageCode) + .eq("order_code", orderCode) + .eq("train_number", trainNumber) + .eq("service_num", serviceNum); return baseMapper.selectOne(queryWrapper); } @@ -129,6 +129,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl params) throws Exception { OrderPackgeCodeDataVO orderPackgeCodeDataVO = new OrderPackgeCodeDataVO(); List data = new ArrayList<>(); + List values = new ArrayList<>(); BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_10.getValue()); if (ObjectUtil.isEmpty(template)) { throw new ServiceException("模板内容未找到"); @@ -140,14 +141,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl Map map = BeanUtil.beanToMap(vo); - if(!Objects.isNull(advanceDetailEntity)){ - map.put("id",advanceDetailEntity.getId()); + if (!Objects.isNull(advanceDetailEntity)) { + map.put("id", advanceDetailEntity.getId()); } String filename = QRCodeUtil.createCodeToFile(vo.getQrCode()); map.put("img", QRCodeUtil.getEmpAutograph(filename)); @@ -203,9 +204,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl findListByAdvanceId(Long advanceId) { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("advance_id",advanceId); + queryWrapper.eq("advance_id", advanceId); return baseMapper.selectList(queryWrapper); } @@ -225,8 +231,8 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("advance_id",advanceId) - .eq("is_deleted",0); + queryWrapper.eq("advance_id", advanceId) + .eq("is_deleted", 0); baseMapper.delete(queryWrapper); } @@ -241,12 +247,12 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl strings = baseMapper.findOrderPackageCodesByAdvanceId(advanceId); - if(0 == strings.size()){ + if (0 == strings.size()) { //删除暂存单 List advanceIds = new ArrayList<>(); advanceIds.add(advanceId); advanceMapper.deletedAdvance(advanceIds); - }else{ + } else { //数量减一 advanceMapper.subTotalNumByAdvanceId(advanceId); } @@ -263,7 +269,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl findPackageCodeByCodes(Set orderPackageCodes) { + @Override + public Map findPackageCodeByCodes(Set orderPackageCodes) { List> packageCodeByCodes = baseMapper.findPackageCodeByCodes(orderPackageCodes); - if(CollUtil.isNotEmpty(packageCodeByCodes)){ + if (CollUtil.isNotEmpty(packageCodeByCodes)) { return packageCodeByCodes.stream().collect(Collectors.toMap(map -> map.get("code"), map -> String.valueOf(map.get("id")))); } return null; - } + } @Override public R findOrderDetails(OrderDetailsDTO orderDetailsDTO) { //判断orderDetailsDTO中的订单号 运单号 包件码 服务号 客户车次号至少有一个有值 - if(StringUtil.isBlank(orderDetailsDTO.getOrderCode()) && StringUtil.isBlank(orderDetailsDTO.getWaybillNo()) && StringUtil.isBlank(orderDetailsDTO.getOrderPackageCode()) && StringUtil.isBlank(orderDetailsDTO.getServiceNumber()) && StringUtil.isBlank(orderDetailsDTO.getTrunklineCarsNo())){ + if (StringUtil.isBlank(orderDetailsDTO.getOrderCode()) && StringUtil.isBlank(orderDetailsDTO.getWaybillNo()) && StringUtil.isBlank(orderDetailsDTO.getOrderPackageCode()) && StringUtil.isBlank(orderDetailsDTO.getServiceNumber()) && StringUtil.isBlank(orderDetailsDTO.getTrunklineCarsNo())) { return R.fail("订单号 运单号 包件码 服务号 客户车次号至少有一个有值"); } @@ -306,7 +312,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl pageList = baseMapper.findOrderDetails(page,orderDetailsDTO); + IPage pageList = baseMapper.findOrderDetails(page, orderDetailsDTO); return R.data(pageList); } @@ -327,7 +333,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl