Merge remote-tracking branch 'origin/dev' into test
This commit is contained in:
@@ -82,7 +82,7 @@ public class ContractApiImpl implements ContractApi {
|
||||
|
||||
@Override
|
||||
public ContractRespDTO getFormulasBySysNumber(String contractSysNumber) {
|
||||
return contractService.getFormulasByPaperNumber(contractSysNumber);
|
||||
return contractService.getFormulasBySysNumber(contractSysNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1301,7 +1301,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
// 通过合同编号查询合同信息
|
||||
ContractMainDO contractMainDO = contractMainMapper
|
||||
.selectOne(ContractMainDO::getSystemContractNumber, contractPaperNumber);
|
||||
.selectOne(TableFieldConstants.BSE_CTRT_MAIN_CTRT_PPR_NUM, contractPaperNumber);
|
||||
|
||||
// 合同不存在
|
||||
if (contractMainDO == null) {
|
||||
@@ -1394,7 +1394,7 @@ public class ContractServiceImpl implements ContractService {
|
||||
|
||||
// 通过合同编号查询合同信息
|
||||
ContractMainDO contractMainDO = contractMainMapper
|
||||
.selectOne(TableFieldConstants.BSE_CTRT_MAIN_CTRT_PPR_NUM, contractSysNumber);
|
||||
.selectOne(ContractMainDO::getSystemContractNumber, contractSysNumber);
|
||||
|
||||
// 合同不存在
|
||||
if (contractMainDO == null) {
|
||||
|
||||
@@ -57,4 +57,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ERP_PRODUCTIVE_ORDER_NOT_EXISTS = new ErrorCode(1_017_000_001, "ERP生产订单数据不存在");
|
||||
|
||||
ErrorCode MATERIAL_ERROR = new ErrorCode( 1_017_000_009, "主物料信息错误");
|
||||
|
||||
ErrorCode WAREHOUSE_FACTORY_NOT_EXISTS=new ErrorCode(1_017_000_010,"库位与工厂信息不存在");
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
||||
|
||||
@Override
|
||||
public CommonResult<ErpWarehouseDTO> getErpWarehouse(Long id) {
|
||||
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
||||
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id.toString());
|
||||
return success(BeanUtils.toBean(erpWarehouse, ErpWarehouseDTO.class));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,16 +76,16 @@ public class ErpWarehouseController {
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
||||
public CommonResult<ErpWarehouseRespVO> getErpWarehouse(@RequestParam("id") Long id) {
|
||||
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
||||
return success(BeanUtils.toBean(erpWarehouse, ErpWarehouseRespVO.class));
|
||||
ErpWarehouseRespVO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
||||
return success(erpWarehouse);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得ERP库位分页")
|
||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
||||
public CommonResult<PageResult<ErpWarehouseRespVO>> getErpWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) {
|
||||
PageResult<ErpWarehouseDO> pageResult = erpWarehouseService.getErpWarehousePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class));
|
||||
PageResult<ErpWarehouseRespVO> pageResult = erpWarehouseService.getErpWarehousePage(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@@ -95,7 +95,7 @@ public class ErpWarehouseController {
|
||||
public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<ErpWarehouseDO> list = erpWarehouseService.getErpWarehousePage(pageReqVO).getList();
|
||||
List<ErpWarehouseDO> list = BeanUtils.toBean(erpWarehouseService.getErpWarehousePage(pageReqVO).getList(), ErpWarehouseDO.class);
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class,
|
||||
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import com.zt.plat.framework.business.interceptor.BusinessControllerMarker;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryRespVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactorySaveReqVO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.WarehouseFactoryDO;
|
||||
import com.zt.plat.module.erp.service.erp.WarehouseFactoryService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 仓库工厂关系")
|
||||
@RestController
|
||||
@RequestMapping("/base/warehouse-factory")
|
||||
@Validated
|
||||
public class WarehouseFactoryController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private WarehouseFactoryService warehouseFactoryService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:create')")
|
||||
public CommonResult<WarehouseFactoryRespVO> createWarehouseFactory(@Valid @RequestBody WarehouseFactorySaveReqVO createReqVO) {
|
||||
return success(warehouseFactoryService.createWarehouseFactory(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:update')")
|
||||
public CommonResult<Boolean> updateWarehouseFactory(@Valid @RequestBody WarehouseFactorySaveReqVO updateReqVO) {
|
||||
warehouseFactoryService.updateWarehouseFactory(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除仓库工厂关系")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:delete')")
|
||||
public CommonResult<Boolean> deleteWarehouseFactory(@RequestParam("id") Long id) {
|
||||
warehouseFactoryService.deleteWarehouseFactory(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除仓库工厂关系")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:delete')")
|
||||
public CommonResult<Boolean> deleteWarehouseFactoryList(@RequestBody BatchDeleteReqVO req) {
|
||||
warehouseFactoryService.deleteWarehouseFactoryListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得仓库工厂关系")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:query')")
|
||||
public CommonResult<WarehouseFactoryRespVO> getWarehouseFactory(@RequestParam("id") Long id) {
|
||||
WarehouseFactoryDO warehouseFactory = warehouseFactoryService.getWarehouseFactory(id);
|
||||
return success(BeanUtils.toBean(warehouseFactory, WarehouseFactoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得仓库工厂关系分页")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:query')")
|
||||
public CommonResult<PageResult<WarehouseFactoryRespVO>> getWarehouseFactoryPage(@Valid WarehouseFactoryPageReqVO pageReqVO) {
|
||||
PageResult<WarehouseFactoryDO> pageResult = warehouseFactoryService.getWarehouseFactoryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, WarehouseFactoryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出仓库工厂关系 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('bse:warehouse-factory:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportWarehouseFactoryExcel(@Valid WarehouseFactoryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<WarehouseFactoryDO> list = warehouseFactoryService.getWarehouseFactoryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "仓库工厂关系.xls", "数据", WarehouseFactoryRespVO.class,
|
||||
BeanUtils.toBean(list, WarehouseFactoryRespVO.class));
|
||||
}
|
||||
|
||||
//通过主库位Id查询库位
|
||||
@GetMapping("/warehouse-factory-list-mainId")
|
||||
@Operation(summary = "通过主库位Id查询库位")
|
||||
public CommonResult<List<WarehouseFactoryRespVO>> getWarehouseFactoryListByMainId(@RequestParam("mainId") String mainId) {
|
||||
return success(warehouseFactoryService.getWarehouseFactoryByMainId(mainId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,9 @@ public class ErpWarehousePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "类型")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyNameCustom;
|
||||
@Schema(description = "公司编号")
|
||||
private String companyIdCustom;
|
||||
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - ERP库位 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@@ -42,4 +44,12 @@ public class ErpWarehouseRespVO {
|
||||
@Schema(description = "是否启用")
|
||||
private String isEnable;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyNameCustom;
|
||||
@Schema(description = "公司编号")
|
||||
private String companyIdCustom;
|
||||
|
||||
@Schema(description = "子物料列表")
|
||||
private List<WarehouseFactoryRespVO> warehouseFactories;
|
||||
|
||||
}
|
||||
@@ -33,5 +33,9 @@ public class ErpWarehouseSaveReqVO {
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private String isEnable;
|
||||
@Schema(description = "公司名称")
|
||||
private String companyNameCustom;
|
||||
@Schema(description = "公司编号")
|
||||
private String companyIdCustom;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
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 lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 仓库工厂关系分页 Request VO")
|
||||
@Data
|
||||
public class WarehouseFactoryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyNameCustom;
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
private String companyIdCustom;
|
||||
|
||||
@Schema(description = "操作类型", example = "2")
|
||||
private String operationType;
|
||||
|
||||
@Schema(description = "业务类型", example = "2")
|
||||
private String mMSIType;
|
||||
|
||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||
private String erpSourceFactoryName;
|
||||
|
||||
@Schema(description = "erp源工厂编码")
|
||||
private String erpSourceFactoryNumber;
|
||||
|
||||
@Schema(description = "erp源库位名称", example = "赵六")
|
||||
private String erpSourceWarehouseName;
|
||||
|
||||
@Schema(description = "erp源库位编码")
|
||||
private String erpSourceWarehouseNumber;
|
||||
|
||||
@Schema(description = "erp目标工厂名称", example = "赵六")
|
||||
private String erpTargetFactoryName;
|
||||
|
||||
@Schema(description = "erp目标工厂编码")
|
||||
private String erpTargetFactoryNumber;
|
||||
|
||||
@Schema(description = "erp目标库位名称", example = "ZT")
|
||||
private String erpTargetWarehouseName;
|
||||
|
||||
@Schema(description = "erp目标库位编码")
|
||||
private String erpTargetWarehouseNumber;
|
||||
|
||||
@Schema(description = "主库位ID")
|
||||
private Long mainWarehouseId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 仓库工厂关系 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WarehouseFactoryRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5015")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
@ExcelProperty("公司名称")
|
||||
private String companyNameCustom;
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
@ExcelProperty("公司编码")
|
||||
private String companyIdCustom;
|
||||
|
||||
@Schema(description = "操作类型", example = "2")
|
||||
@ExcelProperty("操作类型")
|
||||
private String operationType;
|
||||
|
||||
@Schema(description = "业务类型", example = "2")
|
||||
@ExcelProperty("业务类型")
|
||||
private String mMSIType;
|
||||
|
||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||
@ExcelProperty("erp源工厂名称")
|
||||
private String erpSourceFactoryName;
|
||||
|
||||
@Schema(description = "erp源工厂编码")
|
||||
@ExcelProperty("erp源工厂编码")
|
||||
private String erpSourceFactoryNumber;
|
||||
|
||||
@Schema(description = "erp源库位名称", example = "赵六")
|
||||
@ExcelProperty("erp源库位名称")
|
||||
private String erpSourceWarehouseName;
|
||||
|
||||
@Schema(description = "erp源库位编码")
|
||||
@ExcelProperty("erp源库位编码")
|
||||
private String erpSourceWarehouseNumber;
|
||||
|
||||
@Schema(description = "erp目标工厂名称", example = "赵六")
|
||||
@ExcelProperty("erp目标工厂名称")
|
||||
private String erpTargetFactoryName;
|
||||
|
||||
@Schema(description = "erp目标工厂编码")
|
||||
@ExcelProperty("erp目标工厂编码")
|
||||
private String erpTargetFactoryNumber;
|
||||
|
||||
@Schema(description = "erp目标库位名称", example = "ZT")
|
||||
@ExcelProperty("erp目标库位名称")
|
||||
private String erpTargetWarehouseName;
|
||||
|
||||
@Schema(description = "erp目标库位编码")
|
||||
@ExcelProperty("erp目标库位编码")
|
||||
private String erpTargetWarehouseNumber;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@Schema(description = "主库位ID")
|
||||
private Long mainWarehouseId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@Schema(description = "管理后台 - 仓库工厂关系新增/修改 Request VO")
|
||||
@Data
|
||||
@Validated
|
||||
public class WarehouseFactorySaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5015")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String companyNameCustom;
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
private String companyIdCustom;
|
||||
|
||||
@Schema(description = "操作类型", example = "2")
|
||||
private String operationType;
|
||||
|
||||
@Schema(description = "业务类型", example = "2")
|
||||
private String mMSIType;
|
||||
|
||||
@Schema(description = "erp源工厂名称", example = "赵六")
|
||||
private String erpSourceFactoryName;
|
||||
|
||||
@Schema(description = "erp源工厂编码")
|
||||
private String erpSourceFactoryNumber;
|
||||
|
||||
@Schema(description = "erp源库位名称", example = "赵六")
|
||||
private String erpSourceWarehouseName;
|
||||
|
||||
@Schema(description = "erp源库位编码")
|
||||
private String erpSourceWarehouseNumber;
|
||||
|
||||
@Schema(description = "erp目标工厂名称", example = "赵六")
|
||||
private String erpTargetFactoryName;
|
||||
|
||||
@Schema(description = "erp目标工厂编码")
|
||||
private String erpTargetFactoryNumber;
|
||||
|
||||
@Schema(description = "erp目标库位名称", example = "ZT")
|
||||
private String erpTargetWarehouseName;
|
||||
|
||||
@Schema(description = "erp目标库位编码")
|
||||
private String erpTargetWarehouseNumber;
|
||||
|
||||
@Schema(description = "主库位ID")
|
||||
@NotNull(message = "主库位ID不能为空")
|
||||
private Long mainWarehouseId;
|
||||
|
||||
}
|
||||
@@ -70,5 +70,15 @@ public class ErpWarehouseDO extends BusinessBaseDO {
|
||||
*/
|
||||
@TableField("IS_ENB")
|
||||
private String isEnable;
|
||||
/**
|
||||
* 公司编号
|
||||
*/
|
||||
@TableField("CPN_ID_CST")
|
||||
private String companyIdCustom;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@TableField("CPN_NAME_CST")
|
||||
private String companyNameCustom;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zt.plat.module.erp.dal.dataobject.erp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 仓库工厂关系 DO
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@TableName("bse_wrh_fact")
|
||||
@KeySequence("bse_wrh_fact_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class WarehouseFactoryDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@TableField("CPN_NAME_CST")
|
||||
private String companyNameCustom;
|
||||
/**
|
||||
* 公司编码
|
||||
*/
|
||||
@TableField("CPN_ID_CST")
|
||||
private String companyIdCustom;
|
||||
/**
|
||||
* 操作类型
|
||||
*/
|
||||
@TableField("OPTN_TP")
|
||||
private String operationType;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
@TableField("MMSI_TP")
|
||||
private String mMSIType;
|
||||
/**
|
||||
* erp源工厂名称
|
||||
*/
|
||||
@TableField("ERP_SRC_FACT_NAME")
|
||||
private String erpSourceFactoryName;
|
||||
/**
|
||||
* erp源工厂编码
|
||||
*/
|
||||
@TableField("ERP_SRC_FACT_NUM")
|
||||
private String erpSourceFactoryNumber;
|
||||
/**
|
||||
* erp源库位名称
|
||||
*/
|
||||
@TableField("ERP_SRC_WRH_NAME")
|
||||
private String erpSourceWarehouseName;
|
||||
/**
|
||||
* erp源库位编码
|
||||
*/
|
||||
@TableField("ERP_SRC_WRH_NUM")
|
||||
private String erpSourceWarehouseNumber;
|
||||
/**
|
||||
* erp目标工厂名称
|
||||
*/
|
||||
@TableField("ERP_TGT_FACT_NAME")
|
||||
private String erpTargetFactoryName;
|
||||
/**
|
||||
* erp目标工厂编码
|
||||
*/
|
||||
@TableField("ERP_TGT_FACT_NUM")
|
||||
private String erpTargetFactoryNumber;
|
||||
/**
|
||||
* erp目标库位名称
|
||||
*/
|
||||
@TableField("ERP_TGT_WRH_NAME")
|
||||
private String erpTargetWarehouseName;
|
||||
/**
|
||||
* erp目标库位编码
|
||||
*/
|
||||
@TableField("ERP_TGT_WRH_NUM")
|
||||
private String erpTargetWarehouseNumber;
|
||||
|
||||
@TableField("MAIN_WRH_ID")
|
||||
private Long mainWarehouseId;
|
||||
|
||||
}
|
||||
@@ -20,4 +20,16 @@ public interface ErpWarehouseMapper extends BaseMapperX<ErpWarehouseDO> {
|
||||
String selectMaxCode();
|
||||
|
||||
List<ErpWarehouseDO> getPageByReq(ErpWarehousePageReqVO pageReqVO);
|
||||
|
||||
|
||||
default PageResult<ErpWarehouseDO> selectPage(ErpWarehousePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ErpWarehouseDO>()
|
||||
.likeIfPresent(ErpWarehouseDO::getNumber, reqVO.getNumber())
|
||||
.likeIfPresent(ErpWarehouseDO::getName, reqVO.getName())
|
||||
.likeIfPresent(ErpWarehouseDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
|
||||
.likeIfPresent(ErpWarehouseDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
|
||||
.orderByDesc(ErpWarehouseDO::getId));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zt.plat.module.erp.dal.mysql.erp;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.WarehouseFactoryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 仓库工厂关系 Mapper
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Mapper
|
||||
public interface WarehouseFactoryMapper extends BaseMapperX<WarehouseFactoryDO> {
|
||||
|
||||
default PageResult<WarehouseFactoryDO> selectPage(WarehouseFactoryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<WarehouseFactoryDO>()
|
||||
.eqIfPresent(WarehouseFactoryDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
|
||||
.eqIfPresent(WarehouseFactoryDO::getCompanyIdCustom, reqVO.getCompanyIdCustom())
|
||||
.eqIfPresent(WarehouseFactoryDO::getOperationType, reqVO.getOperationType())
|
||||
.eqIfPresent(WarehouseFactoryDO::getMMSIType, reqVO.getMMSIType())
|
||||
.likeIfPresent(WarehouseFactoryDO::getErpSourceFactoryName, reqVO.getErpSourceFactoryName())
|
||||
.eqIfPresent(WarehouseFactoryDO::getErpSourceFactoryNumber, reqVO.getErpSourceFactoryNumber())
|
||||
.likeIfPresent(WarehouseFactoryDO::getErpSourceWarehouseName, reqVO.getErpSourceWarehouseName())
|
||||
.eqIfPresent(WarehouseFactoryDO::getErpSourceWarehouseNumber, reqVO.getErpSourceWarehouseNumber())
|
||||
.likeIfPresent(WarehouseFactoryDO::getErpTargetFactoryName, reqVO.getErpTargetFactoryName())
|
||||
.eqIfPresent(WarehouseFactoryDO::getErpTargetFactoryNumber, reqVO.getErpTargetFactoryNumber())
|
||||
.likeIfPresent(WarehouseFactoryDO::getErpTargetWarehouseName, reqVO.getErpTargetWarehouseName())
|
||||
.eqIfPresent(WarehouseFactoryDO::getErpTargetWarehouseNumber, reqVO.getErpTargetWarehouseNumber())
|
||||
.betweenIfPresent(WarehouseFactoryDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(WarehouseFactoryDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,15 +51,16 @@ public interface ErpWarehouseService {
|
||||
* @param id 编号
|
||||
* @return ERP库位
|
||||
*/
|
||||
ErpWarehouseDO getErpWarehouse(Long id);
|
||||
ErpWarehouseRespVO getErpWarehouse(Long id);
|
||||
|
||||
ErpWarehouseDO getErpWarehouse(String id);
|
||||
/**
|
||||
* 获得ERP库位分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return ERP库位分页
|
||||
*/
|
||||
PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO);
|
||||
PageResult<ErpWarehouseRespVO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO);
|
||||
|
||||
void callErpRfcInterface();
|
||||
|
||||
|
||||
@@ -46,6 +46,9 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
@Resource
|
||||
private ErpConfig erpConfig;
|
||||
|
||||
@Resource
|
||||
private WarehouseFactoryService warehouseFactoryService;
|
||||
|
||||
@Override
|
||||
public ErpWarehouseRespVO createErpWarehouse(ErpWarehouseSaveReqVO createReqVO) {
|
||||
// 校验存在
|
||||
@@ -125,7 +128,14 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErpWarehouseDO getErpWarehouse(Long id) {
|
||||
public ErpWarehouseRespVO getErpWarehouse(Long id) {
|
||||
ErpWarehouseRespVO erpWarehouseRespVO = BeanUtils.toBean(erpWarehouseMapper.selectById(id), ErpWarehouseRespVO.class);
|
||||
setWarehouseFactoryInfo(erpWarehouseRespVO);
|
||||
return erpWarehouseRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErpWarehouseDO getErpWarehouse(String id) {
|
||||
return erpWarehouseMapper.selectById(id);
|
||||
}
|
||||
|
||||
@@ -140,26 +150,41 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
||||
|
||||
|
||||
@Override
|
||||
public PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
|
||||
// 获取分页数据
|
||||
List<ErpWarehouseDO> list = erpWarehouseMapper.getPageByReq(pageReqVO);
|
||||
if (list == null) {
|
||||
list = CollUtil.newArrayList();
|
||||
public PageResult<ErpWarehouseRespVO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
|
||||
PageResult<ErpWarehouseRespVO> erpWarehouseRespVOPageResult = BeanUtils.toBean(erpWarehouseMapper.selectPage(pageReqVO), ErpWarehouseRespVO.class);
|
||||
if (erpWarehouseRespVOPageResult.getList() == null) {
|
||||
return erpWarehouseRespVOPageResult;
|
||||
}
|
||||
// 分页处理
|
||||
int pageNo = pageReqVO.getPageNo();
|
||||
int pageSize = pageReqVO.getPageSize();
|
||||
int total = list.size();
|
||||
// 计算分页起始和结束位置
|
||||
int fromIndex = (pageNo - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, total);
|
||||
// 如果起始位置超出范围,则返回空列表
|
||||
if (fromIndex >= total) {
|
||||
return new PageResult<>(new ArrayList<>(), (long) total);
|
||||
erpWarehouseRespVOPageResult.getList().forEach(this::setWarehouseFactoryInfo);
|
||||
return erpWarehouseRespVOPageResult;
|
||||
// // 获取分页数据
|
||||
// List<ErpWarehouseDO> list = erpWarehouseMapper.getPageByReq(pageReqVO);
|
||||
// if (list == null) {
|
||||
// list = CollUtil.newArrayList();
|
||||
// }
|
||||
// // 分页处理
|
||||
// int pageNo = pageReqVO.getPageNo();
|
||||
// int pageSize = pageReqVO.getPageSize();
|
||||
// int total = list.size();
|
||||
// // 计算分页起始和结束位置
|
||||
// int fromIndex = (pageNo - 1) * pageSize;
|
||||
// int toIndex = Math.min(fromIndex + pageSize, total);
|
||||
// // 如果起始位置超出范围,则返回空列表
|
||||
// if (fromIndex >= total) {
|
||||
// return new PageResult<>(new ArrayList<>(), (long) total);
|
||||
// }
|
||||
// // 截取当前页数据
|
||||
// List<ErpWarehouseDO> pageList = list.subList(fromIndex, toIndex);
|
||||
// return new PageResult<>(pageList, (long) total);
|
||||
}
|
||||
|
||||
// 设置主物料信息
|
||||
public void setWarehouseFactoryInfo(ErpWarehouseRespVO warehouse) {
|
||||
if (warehouse == null) {
|
||||
return;
|
||||
}
|
||||
// 截取当前页数据
|
||||
List<ErpWarehouseDO> pageList = list.subList(fromIndex, toIndex);
|
||||
return new PageResult<>(pageList, (long) total);
|
||||
warehouse.setWarehouseFactories(warehouseFactoryService.getWarehouseFactoryByMainId(warehouse.getId().toString()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zt.plat.module.erp.service.erp;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryRespVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactorySaveReqVO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.WarehouseFactoryDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 仓库工厂关系 Service 接口
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
public interface WarehouseFactoryService {
|
||||
|
||||
/**
|
||||
* 创建仓库工厂关系
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
WarehouseFactoryRespVO createWarehouseFactory(@Valid WarehouseFactorySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新仓库工厂关系
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateWarehouseFactory(@Valid WarehouseFactorySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除仓库工厂关系
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteWarehouseFactory(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除仓库工厂关系
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteWarehouseFactoryListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得仓库工厂关系
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 仓库工厂关系
|
||||
*/
|
||||
WarehouseFactoryDO getWarehouseFactory(Long id);
|
||||
|
||||
/**
|
||||
* 获得仓库工厂关系分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 仓库工厂关系分页
|
||||
*/
|
||||
PageResult<WarehouseFactoryDO> getWarehouseFactoryPage(WarehouseFactoryPageReqVO pageReqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 通过主库位查询子库位
|
||||
*
|
||||
* @param mainId 主库位Id
|
||||
* @return WarehouseFactoryRespVO
|
||||
*/
|
||||
List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zt.plat.module.erp.service.erp;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryRespVO;
|
||||
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactorySaveReqVO;
|
||||
import com.zt.plat.module.erp.dal.dataobject.erp.WarehouseFactoryDO;
|
||||
import com.zt.plat.module.erp.dal.mysql.erp.WarehouseFactoryMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
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.erp.enums.ErrorCodeConstants.WAREHOUSE_FACTORY_NOT_EXISTS;
|
||||
|
||||
|
||||
/**
|
||||
* 仓库工厂关系 Service 实现类
|
||||
*
|
||||
* @author 后台管理-1
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class WarehouseFactoryServiceImpl implements WarehouseFactoryService {
|
||||
|
||||
@Resource
|
||||
private WarehouseFactoryMapper warehouseFactoryMapper;
|
||||
|
||||
@Override
|
||||
public WarehouseFactoryRespVO createWarehouseFactory(WarehouseFactorySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
WarehouseFactoryDO warehouseFactory = BeanUtils.toBean(createReqVO, WarehouseFactoryDO.class);
|
||||
warehouseFactoryMapper.insert(warehouseFactory);
|
||||
// 返回
|
||||
return BeanUtils.toBean(warehouseFactory, WarehouseFactoryRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWarehouseFactory(WarehouseFactorySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateWarehouseFactoryExists(updateReqVO.getId());
|
||||
// 更新
|
||||
WarehouseFactoryDO updateObj = BeanUtils.toBean(updateReqVO, WarehouseFactoryDO.class);
|
||||
warehouseFactoryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWarehouseFactory(Long id) {
|
||||
// 校验存在
|
||||
validateWarehouseFactoryExists(id);
|
||||
// 删除
|
||||
warehouseFactoryMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteWarehouseFactoryListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateWarehouseFactoryExists(ids);
|
||||
// 删除
|
||||
warehouseFactoryMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateWarehouseFactoryExists(List<Long> ids) {
|
||||
List<WarehouseFactoryDO> list = warehouseFactoryMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(WAREHOUSE_FACTORY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateWarehouseFactoryExists(Long id) {
|
||||
if (warehouseFactoryMapper.selectById(id) == null) {
|
||||
throw exception(WAREHOUSE_FACTORY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarehouseFactoryDO getWarehouseFactory(Long id) {
|
||||
return warehouseFactoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<WarehouseFactoryDO> getWarehouseFactoryPage(WarehouseFactoryPageReqVO pageReqVO) {
|
||||
return warehouseFactoryMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId) {
|
||||
return BeanUtils.toBean(warehouseFactoryMapper.selectList(WarehouseFactoryDO::getMainWarehouseId, mainId), WarehouseFactoryRespVO.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zt.plat.module.erp.dal.mysql.erp.WarehouseFactoryMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user