Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
潘荣晟
2025-11-04 16:48:17 +08:00
17 changed files with 368 additions and 209 deletions

View File

@@ -10,16 +10,17 @@ import com.zt.plat.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
// ========== 示例模块 1-001-000-000 ==========
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode COMPANY_RELATIVITY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode FACTORY_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode TAX_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料不存在");
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "金属元素不存在");
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "联系人不存在");
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "账户条款不存在");
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料回收率不存在");
ErrorCode MATERIAL_INFOMATION_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料信息不存在");
ErrorCode COMPANY_RELATIVITY_NOT_EXISTS = new ErrorCode(1_001_000_001, "公司关系不存在");
ErrorCode WAREHOUSE_NOT_EXISTS = new ErrorCode(1_001_000_001, "库位不存在");
ErrorCode WAREHOUSE_CODE_EXISTS = new ErrorCode(1_001_000_002, "库位编码已存在");
ErrorCode FACTORY_NOT_EXISTS = new ErrorCode(1_001_000_001, "工厂不存在");
ErrorCode TAX_NOT_EXISTS = new ErrorCode(1_001_000_001, "公司关系不存在");
ErrorCode BUSINESS_RULE_NOT_EXISTS = new ErrorCode(1_027_100_001, "规则模型不存在");

View File

@@ -33,4 +33,10 @@ public interface WarehouseMapper extends BaseMapperX<WarehouseDO> {
}
String selectMaxCode();
default WarehouseDO selectByCode(String code){
return selectOne(new LambdaQueryWrapperX<WarehouseDO>()
.eq(WarehouseDO::getCoding, code)
.last("LIMIT 1"));
};
}

View File

@@ -16,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.WAREHOUSE_CODE_EXISTS;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.WAREHOUSE_NOT_EXISTS;
/**
@@ -35,16 +36,17 @@ public class WarehouseServiceImpl implements WarehouseService {
// 插入
WarehouseDO warehouse = BeanUtils.toBean(createReqVO, WarehouseDO.class);
// 库位编码自动生成,格式 KW-0001,依次新增
String maxCode = warehouseMapper.selectMaxCode();
if (maxCode == null) {
warehouse.setCoding("KW-0001");
} else {
String prefix = "KW-";
String numberPart = maxCode.substring(prefix.length());
int nextNumber = Integer.parseInt(numberPart) + 1;
String nextCode = prefix + String.format("%04d", nextNumber);
warehouse.setCoding(nextCode);
}
// String maxCode = warehouseMapper.selectMaxCode();
// if (maxCode == null) {
// warehouse.setCoding("KW-0001");
// } else {
// String prefix = "KW-";
// String numberPart = maxCode.substring(prefix.length());
// int nextNumber = Integer.parseInt(numberPart) + 1;
// String nextCode = prefix + String.format("%04d", nextNumber);
// warehouse.setCoding(nextCode);
// }
validateWarehouseCodeExists(warehouse.getCoding());
warehouseMapper.insert(warehouse);
// 返回
return BeanUtils.toBean(warehouse, WarehouseRespVO.class);
@@ -68,12 +70,12 @@ public class WarehouseServiceImpl implements WarehouseService {
}
@Override
public void deleteWarehouseListByIds(List<Long> ids) {
public void deleteWarehouseListByIds(List<Long> ids) {
// 校验存在
validateWarehouseExists(ids);
// 删除
warehouseMapper.deleteByIds(ids);
}
}
private void validateWarehouseExists(List<Long> ids) {
List<WarehouseDO> list = warehouseMapper.selectByIds(ids);
@@ -88,6 +90,13 @@ public class WarehouseServiceImpl implements WarehouseService {
}
}
private void validateWarehouseCodeExists(String code) {
WarehouseDO warehouse = warehouseMapper.selectByCode(code);
if (warehouse != null) {
throw exception(WAREHOUSE_CODE_EXISTS);
}
}
@Override
public WarehouseDO getWarehouse(Long id) {
return warehouseMapper.selectById(id);
@@ -101,7 +110,7 @@ public class WarehouseServiceImpl implements WarehouseService {
@Override
public void enableWarehouseList(List<WarehouseRespVO> saveReqVOS) {
List<WarehouseDO> updateObj = BeanUtils.toBean(saveReqVOS, WarehouseDO.class);
List<BatchResult> count = warehouseMapper.updateById(updateObj);
List<BatchResult> count = warehouseMapper.updateById(updateObj);
if (CollUtil.isEmpty(count)) {
throw exception(WAREHOUSE_NOT_EXISTS);
}

View File

@@ -6,8 +6,24 @@ import lombok.Data;
@Data
public class IntContractPageReq extends PageParam {
@Schema(description = "合同编号")
private String contractCode;
// 合同名称:模糊搜索
@Schema(description = "合同名称")
private String contractName;
// 合同有效期起:日期选择
@Schema(description = "合同有效期起")
private String contractStartDate;
// 合同有效期止:日期选择
@Schema(description = "合同有效期止")
private String contractEndDate;
// 合同版本号:精确搜索 TODO 不确定
// 签约地:模糊搜索
@Schema(description = "签约地")
private String signSite;
// 经办人姓名:模糊搜索
@Schema(description = "经办人姓名")
private String createdUserName;
// 签约日期: 模糊搜索
@Schema(description = "签约日期")
private String signDate;
}

View File

@@ -1,6 +1,7 @@
package com.zt.plat.module.erp.api;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
@@ -12,6 +13,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.HashMap;
import java.util.Map;
@@ -30,7 +32,11 @@ public interface ErpExternalApi {
@Operation(summary = "erp数据查询")
HashMap<String, Object> queryDataToErp(@Valid @RequestBody ErpQueryReqDTO reqDTO);
@GetMapping(PREFIX + "/queryProductiveVersion")
@PostMapping(PREFIX + "/queryProductiveVersion")
@Operation(summary = "生产版本数据查询")
CommonResult<String> getErpProductiveVersionByFM(@Valid @RequestBody ErpProductiveVersionReqDTO reqDTO);
@GetMapping(PREFIX + "/getMaterialUnit")
@Operation(summary = "根据物料编码查询对应计量单位")
CommonResult<String> getMaterialUnit(@RequestParam("downCenterNumber") String downCenterNumber);
}

View File

@@ -0,0 +1,75 @@
package com.zt.plat.module.erp.api.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP物料数据 Response VO")
@Data
public class ErpMaterialDTO {
@Schema(description = "主键")
private Long id;
@Schema(description = "中铜物料编码;系统使用时使用该编码")
private String downCenterNumber;
@Schema(description = "物料编码")
private String materialNumber;
@Schema(description = "中铝物料编码")
private String centerNumber;
@Schema(description = "创建日期")
private LocalDateTime createDate;
@Schema(description = "物料类型", example = "2")
private String materialType;
@Schema(description = "物料大类组")
private String materialGroupDate;
@Schema(description = "外部物料小类组")
private String externalMaterialGroupDate;
@Schema(description = "计量单位编码")
private String unit;
@Schema(description = "计量单位描述")
private String unitDescription;
@Schema(description = "物料类型描述")
private String materialTypeDescription;
@Schema(description = "物料组描述")
private String materialGroupDescription;
@Schema(description = "外部物料小类组描述")
private String externalMaterialGroupDescription;
@Schema(description = "物料名称", example = "李四")
private String materialName;
@Schema(description = "物料长描述")
private String materialLengthDescription;
@Schema(description = "类型")
private String type;
@Schema(description = "金属元素缩写")
private String abbreviation;
@Schema(description = "金属元素名称", example = "赵六")
private String name;
@Schema(description = "金属元素编码")
private String coding;
@Schema(description = "品位单位")
private String gradeUnit;
@Schema(description = "小数位数")
private Long decimalValue;
}

View File

@@ -2,9 +2,12 @@ package com.zt.plat.module.erp.api;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.erp.api.dto.ErpMaterialDTO;
import com.zt.plat.module.erp.api.dto.ErpProductiveVersionReqDTO;
import com.zt.plat.module.erp.api.dto.ErpQueryReqDTO;
import com.zt.plat.module.erp.api.dto.ErpSubmitReqDTO;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpMaterialRespVO;
import com.zt.plat.module.erp.service.erp.ErpMaterialService;
import com.zt.plat.module.erp.service.erp.ErpProductiveVersionService;
import com.zt.plat.module.erp.utils.ErpConfig;
import jakarta.annotation.Resource;
@@ -34,6 +37,9 @@ public class ErpExternalApiImpl implements ErpExternalApi {
private ErpConfig erpConfig;
@Resource
private ErpProductiveVersionService erpProductiveVersionService;
@Resource
private ErpMaterialService erpMaterialService;
@Override
public HashMap<String, String> submitDataToErp(ErpSubmitReqDTO reqDTO) {
@@ -52,4 +58,10 @@ public class ErpExternalApiImpl implements ErpExternalApi {
String productiveVersionNumber = erpProductiveVersionService.getErpProductiveVersionByFM(reqDTO);
return success(productiveVersionNumber);
}
@Override
public CommonResult<String> getMaterialUnit(String materialNumber) {
String materialUnit = erpMaterialService.getMaterialUnit(materialNumber);
return success(materialUnit);
}
}

View File

@@ -2,6 +2,7 @@ package com.zt.plat.module.erp.controller.admin.erp.vo;
import com.zt.plat.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -14,9 +15,11 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
public class ErpProductiveOrderPageReqVO extends PageParam {
@Schema(description = "公司编号")
@NotEmpty(message = "公司编号不能为空")
private String companyNumber;
@Schema(description = "工厂编码")
@NotEmpty(message = "公司编号不能为空")
private String factoryNumber;
@Schema(description = "工厂名称", example = "赵六")
@@ -27,10 +30,12 @@ public class ErpProductiveOrderPageReqVO extends PageParam {
@Schema(description = "基本开始日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@NotEmpty(message = "公司编号不能为空")
private LocalDateTime[] startDate;
@Schema(description = "基本完成日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@NotEmpty(message = "公司编号不能为空")
private LocalDateTime[] endDate;
@Schema(description = "主产品物料编号")

View File

@@ -40,5 +40,11 @@ public interface ErpMaterialMapper extends BaseMapperX<ErpMaterialDO> {
String selectMaxCode();
Integer selectByErpMNumbers(List<String> erpMNumber);
Integer countByErpMNumbers(List<String> erpMNumber);
default String getMaterialUnit(String downCenterNumber) {
return selectOne(new LambdaQueryWrapperX<ErpMaterialDO>()
.eq(ErpMaterialDO::getDownCenterNumber, downCenterNumber)
.last("limit 1")).getUnit();
}
}

Some files were not shown because too many files have changed in this diff Show More