From 76297f64d27e7842041314457e7a1399f414b475 Mon Sep 17 00:00:00 2001 From: chenfang Date: Thu, 26 Oct 2023 19:48:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=89=80=E6=9C=89=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../documentSwitch/SwitchController.java | 102 +++++++++++ .../documentSwitch/vo/SwitchBaseVO.java | 31 ++++ .../documentSwitch/vo/SwitchCreateReqVO.java | 12 ++ .../documentSwitch/vo/SwitchExcelVO.java | 32 ++++ .../documentSwitch/vo/SwitchExportReqVO.java | 24 +++ .../documentSwitch/vo/SwitchPageReqVO.java | 26 +++ .../documentSwitch/vo/SwitchRespVO.java | 15 ++ .../documentSwitch/vo/SwitchUpdateReqVO.java | 18 ++ .../convert/documentSwitch/SwitchConvert.java | 37 ++++ .../dataobject/documentSwitch/SwitchDO.java | 44 +++++ .../mysql/documentSwitch/SwitchMapper.java | 39 ++++ .../service/balance/BalanceServiceImpl.java | 53 +++++- .../businesstype/BusinesstypeService.java | 9 + .../businesstype/BusinesstypeServiceImpl.java | 12 ++ .../CurrencyexchangeService.java | 10 + .../CurrencyexchangeServiceImpl.java | 13 ++ .../wms/service/customer/CustomerService.java | 7 +- .../service/customer/CustomerServiceImpl.java | 5 +- .../customeritem/CustomeritemService.java | 9 + .../customeritem/CustomeritemServiceImpl.java | 14 +- .../service/documentSwitch/SwitchService.java | 82 +++++++++ .../documentSwitch/SwitchServiceImpl.java | 98 ++++++++++ .../DocumentsettingService.java | 9 + .../DocumentsettingServiceImpl.java | 12 ++ .../expectout/ExpectoutServiceImpl.java | 6 + .../service/jobsetting/JobsettingService.java | 9 + .../jobsetting/JobsettingServiceImpl.java | 12 ++ .../productionline/ProductionlineService.java | 14 +- .../ProductionlineServiceImpl.java | 15 +- .../ProductionlineitemService.java | 3 +- .../ProductionlineitemServiceImpl.java | 4 +- .../purchasePlan/PurchasePlanMainService.java | 11 ++ .../PurchasePlanMainServiceImpl.java | 33 +++- .../PurchasereceiptRecordMainService.java | 10 + .../PurchasereceiptRecordMainServiceImpl.java | 27 ++- .../recordsetting/RecordsettingService.java | 9 + .../RecordsettingServiceImpl.java | 12 ++ .../requestsetting/RequestsettingService.java | 9 + .../RequestsettingServiceImpl.java | 12 ++ .../service/saleprice/SalepriceService.java | 9 + .../saleprice/SalepriceServiceImpl.java | 51 +++--- .../stdcostprice/StdcostpriceService.java | 9 + .../stdcostprice/StdcostpriceServiceImpl.java | 18 +- .../supplieritem/SupplieritemService.java | 8 + .../supplieritem/SupplieritemServiceImpl.java | 15 +- .../TransactiontypeService.java | 9 + .../TransactiontypeServiceImpl.java | 17 +- .../wms/service/workshop/WorkshopService.java | 7 + .../service/workshop/WorkshopServiceImpl.java | 14 +- .../workstation/WorkstationService.java | 17 ++ .../workstation/WorkstationServiceImpl.java | 26 +++ .../win/module/wms/until/job/JobUtils.java | 129 ++++++++++--- .../mapper/documentSwitch/SwitchMapper.xml | 12 ++ .../documentSwitch/SwitchServiceImplTest.java | 171 ++++++++++++++++++ 54 files changed, 1328 insertions(+), 83 deletions(-) create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/SwitchController.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchBaseVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchCreateReqVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExcelVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExportReqVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchPageReqVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchRespVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchUpdateReqVO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/documentSwitch/SwitchConvert.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/documentSwitch/SwitchDO.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/documentSwitch/SwitchMapper.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchService.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchServiceImpl.java create mode 100644 win-module-wms/win-module-wms-biz/src/main/resources/mapper/documentSwitch/SwitchMapper.xml create mode 100644 win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/SwitchController.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/SwitchController.java new file mode 100644 index 00000000..1749e999 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/SwitchController.java @@ -0,0 +1,102 @@ +package com.win.module.wms.controller.documentSwitch; + +import com.win.module.wms.controller.documentSwitch.vo.*; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.common.pojo.CommonResult; +import static com.win.framework.common.pojo.CommonResult.success; + +import com.win.framework.excel.core.util.ExcelUtils; + +import com.win.framework.operatelog.core.annotations.OperateLog; +import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; + +import com.win.module.wms.controller.documentSwitch.vo.*; +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; +import com.win.module.wms.convert.documentSwitch.SwitchConvert; +import com.win.module.wms.service.documentSwitch.SwitchService; + +@Tag(name = "管理后台 - 单据开关") +@RestController +@RequestMapping("/wms/switch") +@Validated +public class SwitchController { + + @Resource + private SwitchService switchService; + + @PostMapping("/create") + @Operation(summary = "创建单据开关") + @PreAuthorize("@ss.hasPermission('wms:switch:create')") + public CommonResult createSwitch(@Valid @RequestBody SwitchCreateReqVO createReqVO) { + return success(switchService.createSwitch(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新单据开关") + @PreAuthorize("@ss.hasPermission('wms:switch:update')") + public CommonResult updateSwitch(@Valid @RequestBody SwitchUpdateReqVO updateReqVO) { + switchService.updateSwitch(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除单据开关") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('wms:switch:delete')") + public CommonResult deleteSwitch(@RequestParam("id") Long id) { + switchService.deleteSwitch(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得单据开关") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('wms:switch:query')") + public CommonResult getSwitch(@RequestParam("id") Long id) { + SwitchDO documentSwitch = switchService.getSwitch(id); + return success(SwitchConvert.INSTANCE.convert(documentSwitch)); + } + + @GetMapping("/list") + @Operation(summary = "获得单据开关列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('wms:switch:query')") + public CommonResult> getSwitchList(@RequestParam("ids") Collection ids) { + List list = switchService.getSwitchList(ids); + return success(SwitchConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得单据开关分页") + @PreAuthorize("@ss.hasPermission('wms:switch:query')") + public CommonResult> getSwitchPage(@Valid SwitchPageReqVO pageVO) { + PageResult pageResult = switchService.getSwitchPage(pageVO); + return success(SwitchConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出单据开关 Excel") + @PreAuthorize("@ss.hasPermission('wms:switch:export')") + @OperateLog(type = EXPORT) + public void exportSwitchExcel(@Valid SwitchExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = switchService.getSwitchList(exportReqVO); + // 导出 Excel + List datas = SwitchConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "单据开关.xls", "数据", SwitchExcelVO.class, datas); + } + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchBaseVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchBaseVO.java new file mode 100644 index 00000000..68ebee2d --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchBaseVO.java @@ -0,0 +1,31 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +/** + * 单据开关 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class SwitchBaseVO { + + @Schema(description = "代码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "代码不能为空") + private String code; + + @Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") + @NotNull(message = "描述不能为空") + private String description; + + @Schema(description = "有效设置值 TRUE FALSE", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "有效设置值 TRUE FALSE不能为空") + private String effectiveSetValue; + + @Schema(description = "是否可用", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "是否可用不能为空") + private String available; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchCreateReqVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchCreateReqVO.java new file mode 100644 index 00000000..58733ddc --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchCreateReqVO.java @@ -0,0 +1,12 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(description = "管理后台 - 单据开关创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SwitchCreateReqVO extends SwitchBaseVO { + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExcelVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExcelVO.java new file mode 100644 index 00000000..e6f2a95b --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExcelVO.java @@ -0,0 +1,32 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 单据开关 Excel VO + * + * @author 源码 + */ +@Data +public class SwitchExcelVO { + + @ExcelProperty("id") + private Long id; + + @ExcelProperty("代码") + private String code; + + @ExcelProperty("描述") + private String description; + + @ExcelProperty("有效设置值 TRUE FALSE") + private String effectiveSetValue; + + @ExcelProperty("是否可用") + private String available; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExportReqVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExportReqVO.java new file mode 100644 index 00000000..df76eaf7 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchExportReqVO.java @@ -0,0 +1,24 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 单据开关 Excel 导出 Request VO,参数和 SwitchPageReqVO 是一致的") +@Data +public class SwitchExportReqVO { + + @Schema(description = "代码") + private String code; + + @Schema(description = "描述", example = "你猜") + private String description; + + @Schema(description = "有效设置值 TRUE FALSE") + private String effectiveSetValue; + + @Schema(description = "是否可用") + private String available; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchPageReqVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchPageReqVO.java new file mode 100644 index 00000000..35617fa6 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchPageReqVO.java @@ -0,0 +1,26 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.win.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 单据开关分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SwitchPageReqVO extends PageParam { + + @Schema(description = "代码") + private String code; + + @Schema(description = "描述", example = "你猜") + private String description; + + @Schema(description = "有效设置值 TRUE FALSE") + private String effectiveSetValue; + + @Schema(description = "是否可用") + private String available; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchRespVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchRespVO.java new file mode 100644 index 00000000..757c9863 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchRespVO.java @@ -0,0 +1,15 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +@Schema(description = "管理后台 - 单据开关 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SwitchRespVO extends SwitchBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17760") + private Long id; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchUpdateReqVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchUpdateReqVO.java new file mode 100644 index 00000000..d5cefa43 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/documentSwitch/vo/SwitchUpdateReqVO.java @@ -0,0 +1,18 @@ +package com.win.module.wms.controller.documentSwitch.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 单据开关更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SwitchUpdateReqVO extends SwitchBaseVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17760") + @NotNull(message = "id不能为空") + private Long id; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/documentSwitch/SwitchConvert.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/documentSwitch/SwitchConvert.java new file mode 100644 index 00000000..dbdffcae --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/documentSwitch/SwitchConvert.java @@ -0,0 +1,37 @@ +package com.win.module.wms.convert.documentSwitch; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; + +import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchExcelVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchRespVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; + +/** + * 单据开关 Convert + * + * @author 源码 + */ +@Mapper +public interface SwitchConvert { + + SwitchConvert INSTANCE = Mappers.getMapper(SwitchConvert.class); + + SwitchDO convert(SwitchCreateReqVO bean); + + SwitchDO convert(SwitchUpdateReqVO bean); + + SwitchRespVO convert(SwitchDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/documentSwitch/SwitchDO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/documentSwitch/SwitchDO.java new file mode 100644 index 00000000..60380991 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/documentSwitch/SwitchDO.java @@ -0,0 +1,44 @@ +package com.win.module.wms.dal.dataobject.documentSwitch; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import com.win.framework.mybatis.core.dataobject.BaseDO; + +/** + * 单据开关 DO + * + * @author 源码 + */ +@TableName("document_switch") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SwitchDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 代码 + */ + private String code; + /** + * 描述 + */ + private String description; + /** + * 有效设置值 TRUE FALSE + */ + private String effectiveSetValue; + /** + * 是否可用 + */ + private String available; + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/documentSwitch/SwitchMapper.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/documentSwitch/SwitchMapper.java new file mode 100644 index 00000000..63d4b9ae --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/documentSwitch/SwitchMapper.java @@ -0,0 +1,39 @@ +package com.win.module.wms.dal.mysql.documentSwitch; + +import java.util.*; + +import com.win.framework.common.pojo.PageResult; +import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.win.framework.mybatis.core.mapper.BaseMapperX; +import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 单据开关 Mapper + * + * @author 源码 + */ +@Mapper +public interface SwitchMapper extends BaseMapperX { + + default PageResult selectPage(SwitchPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(SwitchDO::getCode, reqVO.getCode()) + .eqIfPresent(SwitchDO::getDescription, reqVO.getDescription()) + .eqIfPresent(SwitchDO::getEffectiveSetValue, reqVO.getEffectiveSetValue()) + .eqIfPresent(SwitchDO::getAvailable, reqVO.getAvailable()) + .orderByDesc(SwitchDO::getId)); + } + + default List selectList(SwitchExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(SwitchDO::getCode, reqVO.getCode()) + .eqIfPresent(SwitchDO::getDescription, reqVO.getDescription()) + .eqIfPresent(SwitchDO::getEffectiveSetValue, reqVO.getEffectiveSetValue()) + .eqIfPresent(SwitchDO::getAvailable, reqVO.getAvailable()) + .orderByDesc(SwitchDO::getId)); + } + +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/balance/BalanceServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/balance/BalanceServiceImpl.java index 4b44107f..ba09d52c 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/balance/BalanceServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/balance/BalanceServiceImpl.java @@ -1,5 +1,6 @@ package com.win.module.wms.service.balance; +import cn.hutool.core.exceptions.UtilException; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.win.framework.common.exception.ErrorCode; import com.win.module.wms.controller.balance.vo.BalanceCreateReqVO; @@ -90,8 +91,15 @@ public class BalanceServiceImpl implements BalanceService { return balanceMapper.selectList(exportReqVO); } - //跟据管理模式查询数量 - //按数量查找 TB2-BY_QUANTITY + /** + * TB----TB2----BY_QUANTITY + * 跟据管理模式查询数量 + * @author lianhongxi + * @param itemcode 物品code + * @param inventorystatus 库存状态 + * @param locationcode 库位code + * @return + */ @Override public List selectNumber(String itemcode, String inventorystatus, String locationcode) { QueryWrapper queryWrapper = new QueryWrapper(); @@ -102,11 +110,20 @@ public class BalanceServiceImpl implements BalanceService { if (!balanceDO.isEmpty()) { return balanceDO; } else { - throw exception(new ErrorCode(123, "物料号" + itemcode + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录")); + throw new UtilException( "物料号" + itemcode + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录"); } } - //按批次查找 TB2-BY_BATCH + /** + * 按批次查找 + * TB----TB2-----BY_BATCH + * @author lianhongxi + * @param itemcode 物品code + * @param batch 批次 + * @param inventorystatus 库存状态 + * @param locationcode 库位code + * @return + */ @Override public List selectBatch(String itemcode, String batch, String inventorystatus, String locationcode) { QueryWrapper queryWrapper = new QueryWrapper(); @@ -118,11 +135,23 @@ public class BalanceServiceImpl implements BalanceService { if (!balanceDO.isEmpty()) { return balanceDO; } else { - throw exception(new ErrorCode(124, "物料号" + itemcode + "批次" + batch + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录")); + throw new UtilException( "物料号" + itemcode + "批次" + batch + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录"); } } //按包裝查找 TB2-BY_PACKGING + + /** + * TB----TB2-----BY_PACKGING + * 按包装查找 + * @author lianhongxi + * @param itemcode 物品code + * @param packingnumber 包装号 + * @param batch 批次 + * @param inventorystatus 库存状态 + * @param locationcode 库位code + * @return + */ @Override public List selectPackaging(String itemcode, String packingnumber, String batch, String inventorystatus, String locationcode) { QueryWrapper queryWrapper = new QueryWrapper(); @@ -135,11 +164,19 @@ public class BalanceServiceImpl implements BalanceService { if (!balanceDO.isEmpty()) { return balanceDO; } else { - throw exception(new ErrorCode(128, "物料号" + itemcode + "箱码" + packingnumber + "批次" + batch + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录")); + throw new UtilException( "物料号" + itemcode + "箱码" + packingnumber + "批次" + batch + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录"); } } - //按唯一码查找 TB2-BY_UNIQUE_ID + /** + * TB----TB2-----BY_UNIQUE_ID + * 按唯一码查找 + * @author lianhongxi + * @param packingnumber 包装号 + * @param locationcode 库位code + * @param inventorystatus 库存状态 + * @return + */ @Override public List selectUniqueId(String packingnumber, String locationcode, String inventorystatus) { QueryWrapper queryWrapper = new QueryWrapper(); @@ -150,7 +187,7 @@ public class BalanceServiceImpl implements BalanceService { if (!balanceDO.isEmpty()) { return balanceDO; } else { - throw exception(new ErrorCode(129, "唯一码" + packingnumber + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录")); + throw new UtilException( "唯一码" + packingnumber + "库存状态" + inventorystatus + "在" + locationcode + "库位中未查找到库存记录"); } } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeService.java index 496a662a..0b09598b 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeService.java @@ -70,4 +70,13 @@ public interface BusinesstypeService { List getBusinesstypeList(BusinesstypeExportReqVO exportReqVO); List importBusinesstypeList(List businesstypes, Integer mode, Boolean updatePart); + + /** + * 查询业务类型是否存在 + * DBT-------DBT1 + * @author chenfang + * @param pcode code + * @return + */ + public BusinesstypeDO selectBusinesstypeExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeServiceImpl.java index 6680e61c..8babe7e9 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/businesstype/BusinesstypeServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.businesstype; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -211,4 +212,15 @@ public class BusinesstypeServiceImpl implements BusinesstypeService { throw exception(BUSINESSTYPE_AVAILABLE_NOT_EXISTS); } } + @Override + public BusinesstypeDO selectBusinesstypeExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + BusinesstypeDO businesstypeDO = businesstypeMapper.selectOne(queryWrapper); + if(businesstypeDO != null && "TRUE".equals(businesstypeDO.getAvailable())){ + return businesstypeDO; + }else { + throw exception(BUSINESSTYPE_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeService.java index 321d2240..98e1b024 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeService.java @@ -70,4 +70,14 @@ public interface CurrencyexchangeService { List getCurrencyexchangeList(CurrencyexchangeExportReqVO exportReqVO); List importCurrencyexchangeList(List currencyexchanges, Integer mode, Boolean updatePart); + + /** + * BQ-------CE + * 判断当前两种货币是否存在转换关系 + * @author chenfang + * @param pcurrency 货币 + * @param pbasiccurrency 基础货币 + * @return + */ + public CurrencyexchangeDO selectCurrencyexchangeExist(String pcurrency,String pbasiccurrency); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java index 5160c5ad..71e379b9 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/currencyexchange/CurrencyexchangeServiceImpl.java @@ -1,6 +1,7 @@ package com.win.module.wms.service.currencyexchange; import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -170,4 +171,16 @@ public class CurrencyexchangeServiceImpl implements CurrencyexchangeService { throw exception(CURRENCYEXCHANGE_AVAILABLE_NOT_EXISTS); } } + @Override + public CurrencyexchangeDO selectCurrencyexchangeExist(String pcurrency,String pbasiccurrency){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("currency",pcurrency); + queryWrapper.eq("basiccurrency",pbasiccurrency); + CurrencyexchangeDO currencyexchangeDO = currencyexchangeMapper.selectOne(queryWrapper); + if(currencyexchangeDO != null && "TRUE".equals(currencyexchangeDO.getAvailable())){ + return currencyexchangeDO; + }else { + throw exception(TWO_CURRENCIES_HAVE_NO_CONVERSION_RELATIONSHIP); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerService.java index 9124b999..06541fd6 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerService.java @@ -72,9 +72,10 @@ public interface CustomerService { List importCustomerList(List customers, Integer mode, Boolean updatePart); /** * 校验客户信息有效 - * @author chenfang - * @param pcustomerCode 客户代码 + * BQ-----QCus + * @author lianhongxi + * @param pcode 客户code * @return 客户列表 */ - public CustomerDO selectCustomerExist(String pcustomerCode); + public CustomerDO selectCustomerExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java index 7aaea3a3..9c3356d4 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customer/CustomerServiceImpl.java @@ -12,6 +12,7 @@ import com.win.module.wms.convert.customer.CustomerConvert; import com.win.module.wms.dal.dataobject.currencyexchange.CurrencyexchangeDO; import com.win.module.wms.dal.dataobject.customer.CustomerDO; import com.win.module.wms.dal.dataobject.customeritem.CustomeritemDO; +import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; import com.win.module.wms.dal.dataobject.warehouse.WarehouseDO; import com.win.module.wms.dal.mysql.customer.CustomerMapper; import org.springframework.stereotype.Service; @@ -173,9 +174,9 @@ public class CustomerServiceImpl implements CustomerService { } } @Override - public CustomerDO selectCustomerExist(String pcustomerCode) { + public CustomerDO selectCustomerExist(String pcode) { QueryWrapper queryWrapper = new QueryWrapper(); - queryWrapper.eq("customer_code",pcustomerCode); + queryWrapper.eq("code",pcode); CustomerDO customerDO = customerMapper.selectOne(queryWrapper); if(customerDO != null && "TRUE".equals(customerDO.getAvailable())){ return customerDO; diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemService.java index cc91e0d0..e5dbfd79 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemService.java @@ -70,4 +70,13 @@ public interface CustomeritemService { List getCustomeritemList(CustomeritemExportReqVO exportReqVO); List CustomeritemimportCustomeritemList(List customeritems, Integer mode, Boolean updatePart); + + /** + * 查询客户物品是否存在 + * BQ-----QCusI + * @param pcustomerCode 客户code + * @param pitemCode 物品code + * @return + */ + public CustomeritemDO selectCustomeritemExist(String pcustomerCode,String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java index fbeec24b..3b84acd5 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customeritem/CustomeritemServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.customeritem; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -197,5 +198,16 @@ public class CustomeritemServiceImpl implements CustomeritemService { throw exception(CUSTOMERITEM_AVAILABLE_NOT_EXISTS); } } - + @Override + public CustomeritemDO selectCustomeritemExist(String pcustomerCode,String pitemCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("customer_code",pcustomerCode); + queryWrapper.eq("itemcode",pitemCode); + CustomeritemDO customeritemDO = customeritemMapper.selectOne(queryWrapper); + if(customeritemDO != null && "TRUE".equals(customeritemDO.getAvailable())){ + return customeritemDO; + }else { + throw exception(CUSTOMERITEM_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchService.java new file mode 100644 index 00000000..9193c3bd --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchService.java @@ -0,0 +1,82 @@ +package com.win.module.wms.service.documentSwitch; + +import java.util.*; +import javax.validation.*; + +import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; +import com.win.framework.common.pojo.PageResult; + +/** + * 单据开关 Service 接口 + * + * @author 源码 + */ +public interface SwitchService { + + /** + * 创建单据开关 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createSwitch(@Valid SwitchCreateReqVO createReqVO); + + /** + * 更新单据开关 + * + * @param updateReqVO 更新信息 + */ + void updateSwitch(@Valid SwitchUpdateReqVO updateReqVO); + + /** + * 删除单据开关 + * + * @param id 编号 + */ + void deleteSwitch(Long id); + + /** + * 获得单据开关 + * + * @param id 编号 + * @return 单据开关 + */ + SwitchDO getSwitch(Long id); + + /** + * 获得单据开关列表 + * + * @param ids 编号 + * @return 单据开关列表 + */ + List getSwitchList(Collection ids); + + /** + * 获得单据开关分页 + * + * @param pageReqVO 分页查询 + * @return 单据开关分页 + */ + PageResult getSwitchPage(SwitchPageReqVO pageReqVO); + + /** + * 获得单据开关列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 单据开关列表 + */ + List getSwitchList(SwitchExportReqVO exportReqVO); + + /** + * Setting-----QSwitch + * 查询单据开关是否存在 + * @author chenfang + * @param pcode code + * @return + */ + public SwitchDO selectSwitchExist(String pcode); +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchServiceImpl.java new file mode 100644 index 00000000..7a9839bf --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentSwitch/SwitchServiceImpl.java @@ -0,0 +1,98 @@ +package com.win.module.wms.service.documentSwitch; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; + +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; +import com.win.framework.common.pojo.PageResult; + +import com.win.module.wms.convert.documentSwitch.SwitchConvert; +import com.win.module.wms.dal.mysql.documentSwitch.SwitchMapper; + +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.win.module.wms.enums.ErrorCodeConstants.*; + +/** + * 单据开关 Service 实现类 + * + * @author 源码 + */ +@Service +@Validated +public class SwitchServiceImpl implements SwitchService { + + @Resource + private SwitchMapper switchMapper; + + @Override + public Long createSwitch(SwitchCreateReqVO createReqVO) { + // 插入 + SwitchDO documentSwitch = SwitchConvert.INSTANCE.convert(createReqVO); + switchMapper.insert(documentSwitch); + // 返回 + return documentSwitch.getId(); + } + + @Override + public void updateSwitch(SwitchUpdateReqVO updateReqVO) { + // 校验存在 + validateSwitchExists(updateReqVO.getId()); + // 更新 + SwitchDO updateObj = SwitchConvert.INSTANCE.convert(updateReqVO); + switchMapper.updateById(updateObj); + } + + @Override + public void deleteSwitch(Long id) { + // 校验存在 + validateSwitchExists(id); + // 删除 + switchMapper.deleteById(id); + } + + private void validateSwitchExists(Long id) { + if (switchMapper.selectById(id) == null) { + throw exception(SWITCH_NOT_EXISTS); + } + } + + @Override + public SwitchDO getSwitch(Long id) { + return switchMapper.selectById(id); + } + + @Override + public List getSwitchList(Collection ids) { + return switchMapper.selectBatchIds(ids); + } + + @Override + public PageResult getSwitchPage(SwitchPageReqVO pageReqVO) { + return switchMapper.selectPage(pageReqVO); + } + + @Override + public List getSwitchList(SwitchExportReqVO exportReqVO) { + return switchMapper.selectList(exportReqVO); + } + + @Override + public SwitchDO selectSwitchExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + SwitchDO switchDO = switchMapper.selectOne(queryWrapper); + if(switchDO != null && "TRUE".equals(switchDO.getAvailable())){ + return switchDO; + }else { + throw exception(SWITCH_NOT_EXISTS); + } + } +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingService.java index 64c5eff0..7e09824f 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingService.java @@ -70,4 +70,13 @@ public interface DocumentsettingService { List getDocumentsettingList(DocumentsettingExportReqVO exportReqVO); List documentSettingimportDocumentList(List documentsettings, Integer mode, Boolean updatePart); + + /** + * Setting----QDS + * 查询单据设置是否存在 + * @author chenfang + * @param pcode + * @return + */ + public DocumentsettingDO selectDocumentsettingExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingServiceImpl.java index 27c04b29..b67f2817 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/documentsetting/DocumentsettingServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.documentsetting; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -223,4 +224,15 @@ public class DocumentsettingServiceImpl implements DocumentsettingService { throw exception(DOCUMENTSETTING_AVAILABLE_NOT_EXISTS); } } + @Override + public DocumentsettingDO selectDocumentsettingExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + DocumentsettingDO documentsettingDO = documentsettingMapper.selectOne(queryWrapper); + if(documentsettingDO != null && "TRUE".equals(documentsettingDO.getAvailable())){ + return documentsettingDO; + }else { + throw exception(DOCUMENTSETTING_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java index 1dcd1820..7d35d1f4 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/expectout/ExpectoutServiceImpl.java @@ -5,6 +5,9 @@ import com.win.module.wms.controller.expectout.vo.ExpectoutCreateReqVO; import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO; import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO; import com.win.module.wms.controller.expectout.vo.ExpectoutUpdateReqVO; +import com.win.module.wms.controller.rule.vo.RuleRespVO; +import com.win.module.wms.service.rule.RuleService; +import com.win.module.wms.service.rule.RuleServiceImpl; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -32,6 +35,9 @@ public class ExpectoutServiceImpl implements ExpectoutService { @Resource private ExpectoutMapper expectoutMapper; + @Resource + private RuleService ruleService; + @Override public String createExpectout(ExpectoutCreateReqVO createReqVO) { // 插入 diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingService.java index 82b0335b..84f011f0 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingService.java @@ -70,4 +70,13 @@ public interface JobsettingService { List getJobsettingList(JobsettingExportReqVO exportReqVO); List importJobsettingList(List jobsettings, Integer mode, Boolean updatePart); + + /** + * Setting------QJS + * 查询任务单设置是否存在 + * @author chenfang + * @param pcode code + * @return + */ + public JobsettingDO selectJobsettingExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingServiceImpl.java index 094ab0aa..aa7e170e 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/jobsetting/JobsettingServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.jobsetting; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -245,4 +246,15 @@ public class JobsettingServiceImpl implements JobsettingService { throw exception(JOBSETTING_AVAILABLE_NOT_EXISTS); } } + @Override + public JobsettingDO selectJobsettingExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + JobsettingDO jobsettingDO = jobsettingMapper.selectOne(queryWrapper); + if(jobsettingDO != null && "TRUE".equals(jobsettingDO.getAvailable())){ + return jobsettingDO; + }else { + throw exception(JOBSETTING_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineService.java index ad86920d..9034b9cf 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineService.java @@ -72,10 +72,20 @@ public interface ProductionlineService { List importProductionlineList(List productionlines, Integer mode, Boolean updatePart); /** - *生产线有效状态正确 + *查询生产线是否存在 + * BS-------QProdL * @author lianhongxi - * @param code + * @param code 代码 * @return */ public ProductionlineDO ProductionlineExist(String code); + + /** + * 判断车间与生产线关系是否存在 + * @author chenfang + * @param pworkshopCode 车间code + * @param productionLineCode 生产线code + * @return + */ + public boolean ifProductionPlaninWorkshop(String pworkshopCode,String productionLineCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineServiceImpl.java index 457988b2..179cfb56 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionline/ProductionlineServiceImpl.java @@ -9,7 +9,6 @@ import com.win.framework.common.pojo.PageResult; import com.win.framework.datapermission.core.util.DataPermissionUtils; import com.win.module.wms.controller.productionline.vo.*; import com.win.module.wms.convert.productionline.ProductionlineConvert; -import com.win.module.wms.dal.dataobject.customerdock.CustomerdockDO; import com.win.module.wms.dal.dataobject.owner.OwnerDO; import com.win.module.wms.dal.dataobject.productionline.ProductionlineDO; import com.win.module.wms.dal.mysql.productionline.ProductionlineMapper; @@ -174,7 +173,19 @@ public class ProductionlineServiceImpl implements ProductionlineService { if(productionlineDO != null&& "TRUE".equals(productionlineDO.getAvailable())){ return productionlineDO; }else { - throw exception(PRODUCTIONLINEITEM_PITEM_NOT_EXISTS); + throw exception(PRODUCTIONLINE_CODE_NOT_EXISTS); + } + } + @Override + public boolean ifProductionPlaninWorkshop(String pworkshopCode,String productionLineCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",productionLineCode); + queryWrapper.eq("workshop_code",pworkshopCode); + ProductionlineDO productionlineDO = productionlineMapper.selectOne(queryWrapper); + if(productionlineDO != null && "TRUE".equals(productionlineDO.getAvailable())){ + return true; + }else { + throw exception(PRODUCTIONLINE_AND_WORKSHOP_RELATION_ERROR); } } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemService.java index e39a9f41..5bb383d5 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemService.java @@ -72,10 +72,11 @@ public interface ProductionlineitemService { List importProductionlineItemList(List productionlineItems, Integer mode, Boolean updatePart); /** * 零件生产线关系有效 + * BQ-----QPLI * @author chenfang * @param pproductionLineCode 产线代码 * @param pitemCode 物品代码 * @return 生产线物料关系 */ - public List pProductionLineCodeAndpItemCodeExist(String pproductionLineCode,String pitemCode); + public List productionLineCodeAndpItemCodeExist(String pproductionLineCode,String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemServiceImpl.java index aeb09207..12dfa06e 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionlineitem/ProductionlineitemServiceImpl.java @@ -166,7 +166,7 @@ public class ProductionlineitemServiceImpl implements ProductionlineitemService } } //零件生产线关系有效 - public List pProductionLineCodeAndpItemCodeExist(String pproductionLineCode,String pitemCode) { + public List productionLineCodeAndpItemCodeExist(String pproductionLineCode,String pitemCode) { QueryWrapper queryWrapper = new QueryWrapper(); queryWrapper.eq("production_line_code",pproductionLineCode); queryWrapper.eq("item_code",pitemCode); @@ -178,7 +178,7 @@ public class ProductionlineitemServiceImpl implements ProductionlineitemService } } }else { - throw exception(PRODUCTIONLINEITEM_NOT_EXISTS); + throw exception(PRODUCTIONLINEITEM_PRODUCTIONLINECODE_AND_ITEMCODE_NOT_EXIST); } return productionlineitemDO; } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainService.java index 6b4354dd..22a86c78 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainService.java @@ -7,6 +7,7 @@ import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainCreateReqVO import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainExportReqVO; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainPageReqVO; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainUpdateReqVO; +import com.win.module.wms.dal.dataobject.purchasePlan.PurchasePlanDetailDO; import com.win.module.wms.dal.dataobject.purchasePlan.PurchasePlanMainDO; import com.win.framework.common.pojo.PageResult; @@ -71,4 +72,14 @@ public interface PurchasePlanMainService { */ List getPurchasePlanMainList(PurchasePlanMainExportReqVO exportReqVO); + /** + * PLAN----VPur + * @param pnubmer 单据号 + * @param psupplierCode 供应商code + * @param ppoNumber 订单号 + * @param ppoLine 订单行 + * @param pitemCode 物品code + * @return + */ + public PurchasePlanDetailDO selectPurchasePlan(String pnubmer, String psupplierCode, String ppoNumber, String ppoLine, String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java index 67c9002b..429fdcd8 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java @@ -1,9 +1,12 @@ package com.win.module.wms.service.purchasePlan; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainCreateReqVO; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainExportReqVO; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainPageReqVO; import com.win.module.wms.controller.purchasePlan.vo.PurchasePlanMainUpdateReqVO; +import com.win.module.wms.dal.dataobject.purchasePlan.PurchasePlanDetailDO; +import com.win.module.wms.dal.mysql.purchasePlan.PurchasePlanDetailMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -31,6 +34,9 @@ public class PurchasePlanMainServiceImpl implements PurchasePlanMainService { @Resource private PurchasePlanMainMapper purchasePlanMainMapper; + @Resource + private PurchasePlanDetailMapper purchasePlanDetailMapper; + @Override public Long createPurchasePlanMain(PurchasePlanMainCreateReqVO createReqVO) { // 插入 @@ -82,5 +88,30 @@ public class PurchasePlanMainServiceImpl implements PurchasePlanMainService { public List getPurchasePlanMainList(PurchasePlanMainExportReqVO exportReqVO) { return purchasePlanMainMapper.selectList(exportReqVO); } - + @Override + public PurchasePlanDetailDO selectPurchasePlan(String pnubmer,String psupplierCode,String ppoNumber,String ppoLine,String pitemCode){ + QueryWrapper queryWrapperMain = new QueryWrapper(); + queryWrapperMain.eq("number",pnubmer); + queryWrapperMain.eq("supplier_code",psupplierCode); + PurchasePlanMainDO purchasePlanMainDO = purchasePlanMainMapper.selectOne(queryWrapperMain); + if(purchasePlanMainDO != null && "TRUE".equals(purchasePlanMainDO.getAvailable())){ + if(!"CLOSED".equals(purchasePlanMainDO.getStatus())){ + QueryWrapper queryWrapperDetail = new QueryWrapper(); + queryWrapperDetail.eq("master_id",purchasePlanMainDO.getId()); + queryWrapperDetail.eq("number",ppoNumber); + queryWrapperDetail.eq("po_line",ppoLine); + queryWrapperDetail.eq("item_code",pitemCode); + PurchasePlanDetailDO purchasePlanDetailDO = purchasePlanDetailMapper.selectOne(queryWrapperDetail); + if(purchasePlanDetailDO != null && "TRUE".equals(purchasePlanDetailDO.getAvailable())){ + return purchasePlanDetailDO; + }else { + throw exception(PURCHASE_PLAN_DETAIL_PONUMBER_POLINE_ITEMCODE_INVALID); + } + }else { + throw exception(PURCHASE_PLAN_IS_CLOSED); + } + }else { + throw exception(PURCHASE_PLAN_MAIN_NUMBER_INVALID); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainService.java index b14dd8da..ab1c8ffd 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainService.java @@ -7,6 +7,7 @@ import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRec import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainExportReqVO; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainPageReqVO; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainUpdateReqVO; +import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordDetailDO; import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordMainDO; import com.win.framework.common.pojo.PageResult; @@ -71,4 +72,13 @@ public interface PurchasereceiptRecordMainService { */ List getPurchasereceiptRecordMainList(PurchasereceiptRecordMainExportReqVO exportReqVO); + /** + * 查询采购收货记录是否存在 + * Record-----VPur + * @param ppoNumber 订单号 + * @param ppoLine 订单行 + * @param pitemCode 零件号 + * @return + */ + public PurchasereceiptRecordDetailDO selectPurchasereceiptExist(String ppoNumber, String ppoLine, String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainServiceImpl.java index 65c83e9e..22abf9f1 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereceiptRecord/PurchasereceiptRecordMainServiceImpl.java @@ -1,9 +1,12 @@ package com.win.module.wms.service.purchasereceiptRecord; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainCreateReqVO; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainExportReqVO; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainPageReqVO; import com.win.module.wms.controller.purchasereceiptRecord.vo.PurchasereceiptRecordMainUpdateReqVO; +import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordDetailDO; +import com.win.module.wms.dal.mysql.purchasereceiptRecord.PurchasereceiptRecordDetailMapper; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -31,6 +34,9 @@ public class PurchasereceiptRecordMainServiceImpl implements PurchasereceiptReco @Resource private PurchasereceiptRecordMainMapper purchasereceiptRecordMainMapper; + @Resource + private PurchasereceiptRecordDetailMapper purchasereceiptRecordDetailMapper; + @Override public Long createPurchasereceiptRecordMain(PurchasereceiptRecordMainCreateReqVO createReqVO) { // 插入 @@ -82,5 +88,24 @@ public class PurchasereceiptRecordMainServiceImpl implements PurchasereceiptReco public List getPurchasereceiptRecordMainList(PurchasereceiptRecordMainExportReqVO exportReqVO) { return purchasereceiptRecordMainMapper.selectList(exportReqVO); } - + @Override + public PurchasereceiptRecordDetailDO selectPurchasereceiptExist(String ppoNumber,String ppoLine,String pitemCode){ + QueryWrapper queryWrapperMain = new QueryWrapper(); + queryWrapperMain.eq("asn_number",ppoNumber); + PurchasereceiptRecordMainDO purchasereceiptRecordMainDO = purchasereceiptRecordMainMapper.selectOne(queryWrapperMain); + if(purchasereceiptRecordMainDO != null && "TRUE".equals(purchasereceiptRecordMainDO.getAvailable())){ + QueryWrapper queryWrapperDetail = new QueryWrapper(); + queryWrapperDetail.eq("po_number",ppoNumber); + queryWrapperDetail.eq("po_line",ppoLine); + queryWrapperDetail.eq("item_code",pitemCode); + PurchasereceiptRecordDetailDO purchasereceiptRecordDetailDO = purchasereceiptRecordDetailMapper.selectOne(queryWrapperDetail); + if(purchasereceiptRecordDetailDO != null){ + return purchasereceiptRecordDetailDO; + }else { + throw exception(PURCHASERECEIPT_RECORD_DETAIL_PONUMBER_POLINE_ITEMCODE_INVALID); + } + }else { + throw exception(PURCHASERECEIPT_RECORD_MAIN_NUMBER_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingService.java index 7f72371a..81cd89da 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingService.java @@ -70,4 +70,13 @@ public interface RecordsettingService { List getRecordsettingList(RecordsettingExportReqVO exportReqVO); List importRecordsettingList(List recordsettings, Integer mode, Boolean updatePart); + + /** + * Setting-----QRS + * 查询记录单设置是否存在 + * @author chenfang + * @param pcode + * @return + */ + public RecordsettingDO selectRecordsettingExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingServiceImpl.java index ba7ba475..1509dac3 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/recordsetting/RecordsettingServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.recordsetting; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -165,4 +166,15 @@ public class RecordsettingServiceImpl implements RecordsettingService { throw exception(RECORDSETTING_AVAILABLE_NOT_EXISTS); } } + @Override + public RecordsettingDO selectRecordsettingExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + RecordsettingDO recordsettingDO = recordsettingMapper.selectOne(queryWrapper); + if(recordsettingDO != null && "TRUE".equals(recordsettingDO)){ + return recordsettingDO; + }else { + throw exception(RECORDSETTING_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingService.java index 775984f1..0803b1df 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingService.java @@ -70,4 +70,13 @@ public interface RequestsettingService { List getRequestsettingList(RequestsettingExportReqVO exportReqVO); List importRequestsettingList(List requestsettings, Integer mode, Boolean updatePart); + + /** + * Setting-----QRS + * 查询申请单设置是否存在 + * @author chenfang + * @param pcode + * @return + */ + public RequestsettingDO selectRequestsettingExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java index 5b27387a..4a3b8c5f 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/requestsetting/RequestsettingServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.requestsetting; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -196,4 +197,15 @@ public class RequestsettingServiceImpl implements RequestsettingService { throw exception(REQUESTSETTING_AVAILABLE_NOT_EXISTS); } } + @Override + public RequestsettingDO selectRequestsettingExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + RequestsettingDO requestsettingDO = requestsettingMapper.selectOne(queryWrapper); + if(requestsettingDO != null && "TRUE".equals(requestsettingDO.getAutoAgree())){ + return requestsettingDO; + }else { + throw exception(REQUESTSETTING_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceService.java index 89d7ec96..ec21591c 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceService.java @@ -74,4 +74,13 @@ public interface SalepriceService { List importSalepriceList(List importTeam, Integer mode, boolean updatePart); + /** + * 查询销售价格单 + * BQ------QSaleP + * @author chenfang + * @param pcustomerCode 客户code + * @param pitemCode 物品code + * @return + */ + public SalepriceDO selectItemPackagingExist(String pcustomerCode,String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java index 9e81291f..53a3a9c6 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleprice/SalepriceServiceImpl.java @@ -2,12 +2,14 @@ package com.win.module.wms.service.saleprice; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; import com.win.framework.datapermission.core.util.DataPermissionUtils; import com.win.module.wms.controller.saleprice.vo.*; import com.win.module.wms.convert.saleprice.SalepriceConvert; +import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; import com.win.module.wms.dal.dataobject.saleprice.SalepriceDO; import com.win.module.wms.dal.mysql.saleprice.SalepriceMapper; import org.springframework.stereotype.Service; @@ -37,8 +39,7 @@ public class SalepriceServiceImpl implements SalepriceService { @Override public Long createSaleprice(SalepriceCreateReqVO createReqVO) { - validateSalepriceForCreateOrUpdate(createReqVO.getId(),createReqVO.getCustomerCode(),createReqVO.getItemCode(),createReqVO.getCurrency() - ,createReqVO.getPrice(),createReqVO.getAvailable()); + validateSalepriceForCreateOrUpdate(createReqVO.getId(), createReqVO.getCustomerCode(), createReqVO.getItemCode(), createReqVO.getCurrency(), createReqVO.getPrice(), createReqVO.getAvailable()); // 插入 SalepriceDO saleprice = SalepriceConvert.INSTANCE.convert(createReqVO); salepriceMapper.insert(saleprice); @@ -49,8 +50,7 @@ public class SalepriceServiceImpl implements SalepriceService { @Override public void updateSaleprice(SalepriceUpdateReqVO updateReqVO) { // 校验存在 - validateSalepriceForCreateOrUpdate(updateReqVO.getId(),updateReqVO.getCustomerCode(),updateReqVO.getItemCode(),updateReqVO.getCurrency() - ,updateReqVO.getPrice(),updateReqVO.getAvailable()); + validateSalepriceForCreateOrUpdate(updateReqVO.getId(), updateReqVO.getCustomerCode(), updateReqVO.getItemCode(), updateReqVO.getCurrency(), updateReqVO.getPrice(), updateReqVO.getAvailable()); // 更新 SalepriceDO updateObj = SalepriceConvert.INSTANCE.convert(updateReqVO); salepriceMapper.updateById(updateObj); @@ -84,7 +84,7 @@ public class SalepriceServiceImpl implements SalepriceService { return salepriceMapper.selectList(exportReqVO); } - public List importSalepriceList(List saleprices, Integer mode, boolean updatePart) { + public List importSalepriceList(List saleprices, Integer mode, boolean updatePart) { if (CollUtil.isEmpty(saleprices)) { throw exception(SALEPRICE_IMPORT_LIST_IS_EMPTY); } @@ -92,9 +92,8 @@ public class SalepriceServiceImpl implements SalepriceService { saleprices.forEach(saleprice -> { // 校验,判断是否有不符合的原因 try { - if(mode != null){ - validateSalepriceForCreateOrUpdate(null,saleprice.getCustomerCode(),saleprice.getItemCode(),saleprice.getCurrency() - ,saleprice.getPrice(),saleprice.getAvailable()); + if (mode != null) { + validateSalepriceForCreateOrUpdate(null, saleprice.getCustomerCode(), saleprice.getItemCode(), saleprice.getCurrency(), saleprice.getPrice(), saleprice.getAvailable()); } } catch (ServiceException ex) { errorList.add(saleprice); @@ -103,29 +102,27 @@ public class SalepriceServiceImpl implements SalepriceService { // 判断如果不存在,在进行插入 SalepriceDO existSaleprice = salepriceMapper.selectByItemCode(saleprice.getItemCode()); - if (existSaleprice == null&& mode != 3) { + if (existSaleprice == null && mode != 3) { salepriceMapper.insert(SalepriceConvert.INSTANCE.convert(saleprice)); - } - else if (existSaleprice != null && mode != 2) {// 如果存在,判断是否允许更新 + } else if (existSaleprice != null && mode != 2) {// 如果存在,判断是否允许更新 SalepriceDO salepriceDO = SalepriceConvert.INSTANCE.convert(saleprice); salepriceDO.setId(existSaleprice.getId()); salepriceMapper.updateById(salepriceDO); } }); //错误不为空并非部分更新,手工回滚 - if(!errorList.isEmpty() && !updatePart) { + if (!errorList.isEmpty() && !updatePart) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); } return errorList; } - private void validateSalepriceForCreateOrUpdate(Long id, String customercode, String itemcode, String currency, - BigDecimal price, String available ) { + private void validateSalepriceForCreateOrUpdate(Long id, String customercode, String itemcode, String currency, BigDecimal price, String available) { // 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确 DataPermissionUtils.executeIgnore(() -> { validateSalepriceExists(id); // 校验code唯一 - validateCodeExists(id,itemcode); + validateCodeExists(id, itemcode); validateCustomerCodeExists(customercode); validateCurrencyExists(currency); validatePriceExists(price); @@ -133,6 +130,7 @@ public class SalepriceServiceImpl implements SalepriceService { }); } + @VisibleForTesting private void validateSalepriceExists(Long id) { if (id == null) { @@ -144,7 +142,7 @@ public class SalepriceServiceImpl implements SalepriceService { } @VisibleForTesting - private void validateCodeExists(Long id,String itemcode) { + private void validateCodeExists(Long id, String itemcode) { if (itemcode.isEmpty()) { throw exception(SALEPRICE_ITEM_CODE_NOT_EXISTS); } @@ -163,9 +161,10 @@ public class SalepriceServiceImpl implements SalepriceService { throw exception(SALEPRICE_ITEM_CODE_EXISTS); } } + @VisibleForTesting private void validatePriceExists(BigDecimal price) { - if (price ==null) { + if (price == null) { throw exception(SALEPRICE_PRICE_NOT_EXISTS); } } @@ -177,7 +176,6 @@ public class SalepriceServiceImpl implements SalepriceService { } } - @VisibleForTesting private void validateCustomerCodeExists(String customerCode) { if (customerCode.isEmpty()) { @@ -185,8 +183,6 @@ public class SalepriceServiceImpl implements SalepriceService { } } - - @VisibleForTesting private void validateAvailableExists(String available) { if (available == null) { @@ -194,7 +190,16 @@ public class SalepriceServiceImpl implements SalepriceService { } } - - - + @Override + public SalepriceDO selectItemPackagingExist(String pcustomerCode,String pitemCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("itemcode",pitemCode); + queryWrapper.eq("customer_code",pcustomerCode); + SalepriceDO salepriceDO = salepriceMapper.selectOne(queryWrapper); + if(salepriceDO != null && "TRUE".equals(salepriceDO.getAvailable())){ + return salepriceDO; + }else { + throw exception(SALEPRICE_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceService.java index 9415061e..8a71b52e 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceService.java @@ -75,4 +75,13 @@ public interface StdcostpriceService { List importStdcostpriceList(List importTeam, Integer mode, boolean updatePart); + /** + * 查询标准成本价格是否存在 + * BQ-----QSCP + * @author chenfang + * @param supplierCode + * @param pitemCode + * @return + */ + public StdcostpriceDO selectStdcostpriceExist(String supplierCode,String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceServiceImpl.java index 5be1cb39..1a6f09b5 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/stdcostprice/StdcostpriceServiceImpl.java @@ -2,12 +2,14 @@ package com.win.module.wms.service.stdcostprice; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; import com.win.framework.datapermission.core.util.DataPermissionUtils; import com.win.module.wms.controller.stdcostprice.vo.*; import com.win.module.wms.convert.stdcostprice.StdcostpriceConvert; +import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; import com.win.module.wms.dal.dataobject.stdcostprice.StdcostpriceDO; import com.win.module.wms.dal.mysql.stdcostprice.StdcostpriceMapper; import org.springframework.stereotype.Service; @@ -187,6 +189,16 @@ public class StdcostpriceServiceImpl implements StdcostpriceService { throw exception(STDCOSTPRICE_AVAILABLE_NOT_EXISTS); } } - - -} + @Override + public StdcostpriceDO selectStdcostpriceExist(String supplierCode,String pitemCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("itemcode",pitemCode); + queryWrapper.eq("supplier_code",supplierCode); + StdcostpriceDO stdcostpriceDO = stdcostpriceMapper.selectOne(queryWrapper); + if(stdcostpriceDO != null && "TRUE".equals(stdcostpriceDO.getAvailable())){ + return stdcostpriceDO; + }else { + throw exception(STDCOSTPRICE_NOT_EXISTS); + } + } + } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemService.java index 1cfdcc57..8c19d6e9 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemService.java @@ -74,4 +74,12 @@ public interface SupplieritemService { List importSupplieriteamList(List importTeam, Integer mode, boolean updatePart); + /** + * BQ----QSI + * 查询供应商物品是否存在 + * @param psupplierCode 供应商code + * @param pitemCode 物品code + * @return + */ + public SupplieritemDO selectSupplierItemExist(String psupplierCode,String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java index a53433d7..14d88033 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplieritem/SupplieritemServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.supplieritem; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -194,8 +195,18 @@ public class SupplieritemServiceImpl implements SupplieritemService { throw exception(SUPPLIERITEM_AVAILABLE_NOT_EXISTS); } } - - + @Override + public SupplieritemDO selectSupplierItemExist(String psupplierCode,String pitemCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("itemcode",pitemCode); + queryWrapper.eq("supplier_code",psupplierCode); + SupplieritemDO supplieritemDO = supplieritemMapper.selectOne(queryWrapper); + if(supplieritemDO != null && "TRUE".equals(supplieritemDO.getAvailable())){ + return supplieritemDO; + }else { + throw exception(SUPPLIERITEM_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeService.java index 10b4403e..341c7b8d 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeService.java @@ -76,6 +76,15 @@ public interface TransactiontypeService { List importTransactiontypeList(List importWarehouse, Integer mode, boolean updatePart); + + /** + * 查询事务类型是否存在 + * Setting-----QTT + * @author chenfang + * @param pcode code + * @return + */ + public TransactiontypeDO selectTransactiontype(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeServiceImpl.java index de0653ad..bc3c57c0 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/transactiontype/TransactiontypeServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.transactiontype; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -160,9 +161,15 @@ public class TransactiontypeServiceImpl implements TransactiontypeService { throw exception(TRANSACTIONTYPE_AVAIABLE_NOT_EXISTS); } } - - - - - + @Override + public TransactiontypeDO selectTransactiontype(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + TransactiontypeDO transactiontypeDO = transactiontypeMapper.selectOne(queryWrapper); + if(transactiontypeDO != null && "TRUE".equals(transactiontypeDO.getAvailable())){ + return transactiontypeDO; + }else { + throw exception(TRANSACTIONTYPE_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopService.java index 11e8b827..5e303599 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopService.java @@ -71,4 +71,11 @@ public interface WorkshopService { List importUserList(List importWorkshop, Integer mode, boolean updatePart); + /** + * 查询车间是否存在 + * BQ-----QWShop + * @param pcode 代码 + * @return + */ + public WorkshopDO selectWorkshopExist(String pcode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java index 2be995f2..bcc767cd 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workshop/WorkshopServiceImpl.java @@ -2,12 +2,14 @@ package com.win.module.wms.service.workshop; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; import com.win.framework.datapermission.core.util.DataPermissionUtils; import com.win.module.wms.controller.workshop.vo.*; import com.win.module.wms.convert.workshop.WorkshopConvert; +import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; import com.win.module.wms.dal.dataobject.workshop.WorkshopDO; import com.win.module.wms.dal.mysql.workshop.WorkshopMapper; import org.springframework.stereotype.Service; @@ -160,5 +162,15 @@ public class WorkshopServiceImpl implements WorkshopService { throw exception(WORKSHOP_AVAIABLE_NOT_EXISTS); } } - + @Override + public WorkshopDO selectWorkshopExist(String pcode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("code",pcode); + WorkshopDO workshopDO = workshopMapper.selectOne(queryWrapper); + if(workshopDO != null && "TRUE".equals(workshopDO.getAvailable())){ + return workshopDO; + }else { + throw exception(WORKSHOP_NOT_EXISTS); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationService.java index 5092dc29..df832fb2 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationService.java @@ -70,4 +70,21 @@ public interface WorkstationService { List getWorkstationList(WorkstationExportReqVO exportReqVO); List importWorkstationList(List workstations, Integer mode,Boolean updatePart); + + /** + * BQ-----QWStation + * 查询工位是否存在 + * @param pcode 工位code + * @return + */ + public WorkstationDO selectWorkstationExist(String pcode); + + /** + * 校验工位与生产线关系是否存在 + * @author chenfang + * @param pcode 工位code + * @param pructionLineCode 生产线code + * @return + */ + public boolean ifInPructionLine(String pcode,String pructionLineCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java index 6e374473..71735fbb 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/workstation/WorkstationServiceImpl.java @@ -1,13 +1,16 @@ package com.win.module.wms.service.workstation; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; import com.win.framework.datapermission.core.util.DataPermissionUtils; import com.win.module.wms.controller.workstation.vo.*; import com.win.module.wms.convert.workstation.WorkstationConvert; +import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; import com.win.module.wms.dal.dataobject.workstation.WorkstationDO; import com.win.module.wms.dal.mysql.workstation.WorkstationMapper; import org.springframework.stereotype.Service; @@ -179,4 +182,27 @@ public class WorkstationServiceImpl implements WorkstationService { throw exception(WORKSTATION_AVAIABLE_NOT_EXISTS); } } + @Override + public WorkstationDO selectWorkstationExist(String pcode){ + QueryWrapper queryWrapperWorkstation = new QueryWrapper(); + queryWrapperWorkstation.eq("code",pcode); + WorkstationDO workstationDO = workstationMapper.selectOne(queryWrapperWorkstation); + if(workstationDO != null && "TRUE".equals(workstationDO.getAvailable())){ + return workstationDO; + }else { + throw exception(WORKSTATION_NOT_EXISTS); + } + } + @Override + public boolean ifInPructionLine(String pcode,String pructionLineCode){ + QueryWrapper queryWrapperWorkstation = new QueryWrapper(); + queryWrapperWorkstation.eq("code",pcode); + queryWrapperWorkstation.eq("pruction_line_code",pructionLineCode); + WorkstationDO workstationDO = workstationMapper.selectOne(queryWrapperWorkstation); + if(workstationDO != null && "TRUE".equals(workstationDO.getAvailable())){ + return true; + }else { + throw exception(WORKSTATION_PRODUECTION_LINE_CODE_AND_WORKSTATION_RELATION_ERROR); + } + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java index 3e131ec8..3d01ccc9 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/until/job/JobUtils.java @@ -17,7 +17,6 @@ import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; import com.win.module.wms.dal.mysql.location.LocationMapper; import com.win.module.wms.service.balance.BalanceService; import com.win.module.wms.service.expectout.ExpectoutService; -import com.win.module.wms.service.expectout.ExpectoutServiceImpl; import com.win.module.wms.service.itembasic.ItembasicService; import com.win.module.wms.service.location.LocationService; import com.win.module.wms.service.rule.RuleService; @@ -141,7 +140,7 @@ public class JobUtils { /** * 校验物料有效,状态正确 - * + * @author chenfang * @param itemCode 物品代码 * @return 物品基本信息列表 * @author chenfang @@ -157,7 +156,7 @@ public class JobUtils { /** * 校验供应商有效,状态正确 - * + * @author chenfang * @param supplierCode 代码 * @return 供应商列表 * @author chenfang @@ -193,7 +192,7 @@ public class JobUtils { * 从库位号有效,状态正确,开关正确 * 到库位号有效,状态正确,开关正确 * 共用同一个方法 - * + * @author chenfang * @param locationCode 库位 * @return 库位信息 * @author chenfang @@ -221,7 +220,7 @@ public class JobUtils { /** * 零件库位关系有效 - * + * @author chenfang * @param pitemCode 物品代码 * @return 上架策略信息 * @author chenfang @@ -348,54 +347,98 @@ public class JobUtils { } // TB1 查询库存 - public List selectlocation(String itemcode, String packingnumber, String batch, String locationcode, String status) { + + /** + * TB-------TB1 + * 查询库存返回管理精度 + * @author lianhongxi + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位号 + * @param inventoryStatus 入库库存状态 + * @return + */ + public List selectlocation(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, null, locationcode, null, null); List balanceDO = null; if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) { - balanceDO = balanceService.selectNumber(itemcode, status, locationcode); + balanceDO = balanceService.selectNumber(itemcode, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) { - balanceDO = balanceService.selectBatch(itemcode, batch, status, locationcode); + balanceDO = balanceService.selectBatch(itemcode, batch, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { - balanceDO = balanceService.selectPackaging(itemcode, packingnumber, batch, status, locationcode); + balanceDO = balanceService.selectPackaging(itemcode, packingnumber, batch, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { - balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, status); + balanceDO = balanceService.selectUniqueId(packingnumber, locationcode, inventoryStatus); } return balanceDO; } - //跟据管理模式查询预计库存 TEO1 - public List selectLocatioNew(String itemcode, String packingnumber, String batch, String locationcode, String status) { + // + + /** + * 跟据管理模式查询预计库存 + * TB-----TB3-----TEO----TEO1 + * @author lianhongxi + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位号 + * @param inventoryStatus 入库库存状态 + * @return + */ + public List selectLocatioNew(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { RuleRespVO managementtRule = ruleService.management(null, null, null, null, null, null, itemcode, null, null, null, locationcode, null, null); List expectoutDO = null; if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(managementtRule.getConfiguration())) { - expectoutDO = expectoutService.selectNumberNew(itemcode, status, locationcode); + expectoutDO = expectoutService.selectNumberNew(itemcode, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(managementtRule.getConfiguration())) { - expectoutDO = expectoutService.selectBatchNew(itemcode, batch, status, locationcode); + expectoutDO = expectoutService.selectBatchNew(itemcode, batch, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(managementtRule.getConfiguration())) { - expectoutDO = expectoutService.selectPackingNew(itemcode, packingnumber, batch, status, locationcode); + expectoutDO = expectoutService.selectPackingNew(itemcode, packingnumber, batch, inventoryStatus, locationcode); } else if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(managementtRule.getConfiguration())) { - expectoutDO = expectoutService.selectUniqeIdNew(packingnumber, locationcode, status); + expectoutDO = expectoutService.selectUniqeIdNew(packingnumber, locationcode, inventoryStatus); } return expectoutDO; } - //查询可用库存 TB3 - public BigDecimal CountLocaltion(String itemcode, String packingnumber, String batch, String locationcode, String status) { - List expectoutDO = selectLocatioNew(itemcode, packingnumber, batch, locationcode, status); - List balanceDO = selectlocation(itemcode, packingnumber, batch, locationcode, status); + /** + * 查询可用库存 + * TB----TB3 + * @author lianhongxi + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位好 + * @param inventoryStatus 入库库存状态 + * @return + */ + public BigDecimal CountLocaltion(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus) { + List balanceDO = selectlocation(itemcode, packingnumber, batch, locationcode, inventoryStatus); + List expectoutDO = selectLocatioNew(itemcode, packingnumber, batch, locationcode, inventoryStatus); BigDecimal esum = BigDecimal.valueOf(expectoutDO.stream().mapToDouble(expectoutDO1 -> expectoutDO1.getQty().doubleValue()).sum()); BigDecimal bsum = BigDecimal.valueOf(balanceDO.stream().mapToDouble(balanceDO1 -> balanceDO1.getQty().doubleValue()).sum()); BigDecimal sum = bsum.subtract(esum); return sum; } - //有无库存效验 - public String LocaltionExist(String itemcode, String packingnumber, String batch, String locationcode, String status, BigDecimal requstqty) { - BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, status); + /** + * 请求库存校验是否有库存余额 + * @author lianhongxi + * @param itemcode 零件号 + * @param packingnumber 包装号 + * @param batch 批次 + * @param locationcode 库位好 + * @param inventoryStatus 入库库存状态 + * @param requstqty 请求数量 + * @return + */ + public String LocaltionExist(String itemcode, String packingnumber, String batch, String locationcode, String inventoryStatus, BigDecimal requstqty) { + BigDecimal enableqty = CountLocaltion(itemcode, packingnumber, batch, locationcode, inventoryStatus); if (requstqty.compareTo(enableqty) > 0) { throw exception(new ErrorCode(1256, "请求数量" + requstqty + "大于库存数量" + enableqty)); } else { @@ -441,17 +484,51 @@ public class JobUtils { } //从库位未被其他任务占用,有可用库存 - public String locationExistnew(String itemcode, String packingnumber, String batch, String fromlocationcode, String status, BigDecimal requstqty) { + public String locationExistnew(String itemcode, String packingnumber, String batch, String fromlocationcode, String inventoryStatus, BigDecimal requstqty) { if (fromlocationcode.isEmpty()) { return "不需要其他校验"; } String Yesorno = selectlocation(fromlocationcode); if ("TURE".equals(Yesorno)) { - - String END = LocaltionExist(itemcode, packingnumber, batch, fromlocationcode, status, requstqty); + String END = LocaltionExist(itemcode, packingnumber, batch, fromlocationcode, inventoryStatus, requstqty); return END; } else { return "效验通过"; } } + + /** + * 根据管理模式查询预计出库存 + * TEO----TEO1 + * @author lianhongxi + * @param pitemcode 零件号 + * @param ppackingnumber 包装号 + * @param pbatch 批次 + * @param pinventorystatus 入库库存状态 + * @param plocationcode 库位号 + * @return + */ + public List selectExpectort(String pitemcode, String ppackingnumber, String pbatch, String pinventorystatus, String plocationcode){ + RuleRespVO management = ruleService.management(null, null, null, null, null, null, pitemcode, + null, null, null, plocationcode, null, null); + List expectoutDO = null; + if(management != null){ + String[] splits = management.getConfiguration().split("\""); + for (String split : splits) { + if ("{\"ManagementPrecision\":\"BY_QUANTITY\"}".equals(management.getConfiguration())) { + expectoutService.selectNumberNew(pitemcode, pinventorystatus, plocationcode); + } else if ("{\"ManagementPrecision\":\"BY_BATCH\"}".equals(management.getConfiguration())) { + expectoutDO = expectoutService.selectBatchNew(pitemcode, pbatch, pinventorystatus, plocationcode); + } else if ("{\"ManagementPrecision\":\"BY_PACKAGING\"}".equals(management.getConfiguration())) { + expectoutDO = expectoutService.selectPackingNew(pitemcode, ppackingnumber, pbatch, pinventorystatus, plocationcode); + } else if ("{\"ManagementPrecision\":\"BY_UNIQUE_ID\"}".equals(management.getConfiguration())) { + expectoutDO = expectoutService.selectUniqeIdNew(ppackingnumber, plocationcode, pinventorystatus); + } + return expectoutDO; + } + }else { + throw exception(RULE_NOT_EXISTS); + } + return expectoutDO; + } } diff --git a/win-module-wms/win-module-wms-biz/src/main/resources/mapper/documentSwitch/SwitchMapper.xml b/win-module-wms/win-module-wms-biz/src/main/resources/mapper/documentSwitch/SwitchMapper.xml new file mode 100644 index 00000000..cd95f64d --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/resources/mapper/documentSwitch/SwitchMapper.xml @@ -0,0 +1,12 @@ + + + + + + + diff --git a/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java b/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java new file mode 100644 index 00000000..9a504816 --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java @@ -0,0 +1,171 @@ +package com.win.module.wms.service.documentSwitch; + +import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; +import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import javax.annotation.Resource; + +import com.win.framework.test.core.ut.BaseDbUnitTest; + +import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; +import com.win.module.wms.dal.mysql.documentSwitch.SwitchMapper; +import com.win.framework.common.pojo.PageResult; + +import org.springframework.context.annotation.Import; +import java.util.*; + +import static com.win.module.wms.enums.ErrorCodeConstants.*; +import static com.win.framework.test.core.util.AssertUtils.*; +import static com.win.framework.test.core.util.RandomUtils.*; +import static com.win.framework.common.util.object.ObjectUtils.*; +import static org.junit.jupiter.api.Assertions.*; + +/** + * {@link SwitchServiceImpl} 的单元测试类 + * + * @author 源码 + */ +@Import(SwitchServiceImpl.class) +public class SwitchServiceImplTest extends BaseDbUnitTest { + + @Resource + private SwitchServiceImpl switchService; + + @Resource + private SwitchMapper switchMapper; + + @Test + public void testCreateSwitch_success() { + // 准备参数 + SwitchCreateReqVO reqVO = randomPojo(SwitchCreateReqVO.class); + + // 调用 + Long switchId = switchService.createSwitch(reqVO); + // 断言 + assertNotNull(switchId); + // 校验记录的属性是否正确 + SwitchDO switch = switchMapper.selectById(switchId); + assertPojoEquals(reqVO, switch); + } + + @Test + public void testUpdateSwitch_success() { + // mock 数据 + SwitchDO dbSwitch = randomPojo(SwitchDO.class); + switchMapper.insert(dbSwitch);// @Sql: 先插入出一条存在的数据 + // 准备参数 + SwitchUpdateReqVO reqVO = randomPojo(SwitchUpdateReqVO.class, o -> { + o.setId(dbSwitch.getId()); // 设置更新的 ID + }); + + // 调用 + switchService.updateSwitch(reqVO); + // 校验是否更新正确 + SwitchDO switch = switchMapper.selectById(reqVO.getId()); // 获取最新的 + assertPojoEquals(reqVO, switch); + } + + @Test + public void testUpdateSwitch_notExists() { + // 准备参数 + SwitchUpdateReqVO reqVO = randomPojo(SwitchUpdateReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> switchService.updateSwitch(reqVO), SWITCH_NOT_EXISTS); + } + + @Test + public void testDeleteSwitch_success() { + // mock 数据 + SwitchDO dbSwitch = randomPojo(SwitchDO.class); + switchMapper.insert(dbSwitch);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbSwitch.getId(); + + // 调用 + switchService.deleteSwitch(id); + // 校验数据不存在了 + assertNull(switchMapper.selectById(id)); + } + + @Test + public void testDeleteSwitch_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> switchService.deleteSwitch(id), SWITCH_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetSwitchPage() { + // mock 数据 + SwitchDO dbSwitch = randomPojo(SwitchDO.class, o -> { // 等会查询到 + o.setCode(null); + o.setDescription(null); + o.setEffectiveSetValue(null); + o.setAvailable(null); + }); + switchMapper.insert(dbSwitch); + // 测试 code 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setCode(null))); + // 测试 description 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setDescription(null))); + // 测试 effectiveSetValue 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setEffectiveSetValue(null))); + // 测试 available 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setAvailable(null))); + // 准备参数 + SwitchPageReqVO reqVO = new SwitchPageReqVO(); + reqVO.setCode(null); + reqVO.setDescription(null); + reqVO.setEffectiveSetValue(null); + reqVO.setAvailable(null); + + // 调用 + PageResult pageResult = switchService.getSwitchPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbSwitch, pageResult.getList().get(0)); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetSwitchList() { + // mock 数据 + SwitchDO dbSwitch = randomPojo(SwitchDO.class, o -> { // 等会查询到 + o.setCode(null); + o.setDescription(null); + o.setEffectiveSetValue(null); + o.setAvailable(null); + }); + switchMapper.insert(dbSwitch); + // 测试 code 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setCode(null))); + // 测试 description 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setDescription(null))); + // 测试 effectiveSetValue 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setEffectiveSetValue(null))); + // 测试 available 不匹配 + switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setAvailable(null))); + // 准备参数 + SwitchExportReqVO reqVO = new SwitchExportReqVO(); + reqVO.setCode(null); + reqVO.setDescription(null); + reqVO.setEffectiveSetValue(null); + reqVO.setAvailable(null); + + // 调用 + List list = switchService.getSwitchList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbSwitch, list.get(0)); + } + +} From aea15a985a2b44e8294feeb0db2ac2fe762f5a81 Mon Sep 17 00:00:00 2001 From: chenfang Date: Thu, 26 Oct 2023 19:49:13 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=89=80=E6=9C=89=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=BC=96=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/wms/enums/ErrorCodeConstants.java | 17 +++++++++++++---- .../itempackaging/ItempackagingService.java | 9 +++++++++ .../itempackaging/ItempackagingServiceImpl.java | 12 ++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java b/win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java index f1c1acd9..70082a09 100644 --- a/win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java +++ b/win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java @@ -35,11 +35,12 @@ public interface ErrorCodeConstants { ErrorCode ITEMPACKAGING_NOT_EXISTS = new ErrorCode(1_000_021_000, "物品包装信息 不存在"); ErrorCode ITEMPACKAGING_ITEM_CODE_NOT_EXISTS = new ErrorCode(1_000_021_001, "code不存在"); ErrorCode ITEMPACKAGING_ITEM_CODE_EXISTS = new ErrorCode(1_000_021_002, "code已存在"); - ErrorCode ITEMPACKAGING_UOM_NOT_EXISTS = new ErrorCode(1_000_021_003, "物品包装信息不存在"); + ErrorCode ITEMPACKAGING_UOM_NOT_EXISTS = new ErrorCode(1_000_021_003, "计量单位不存在"); ErrorCode ITEMPACKAGING_STD_PACK_UNIT_NOT_EXISTS = new ErrorCode(1_000_021_004, "包装单位不存在"); ErrorCode ITEMPACKAGING_STD_PACK_QTY_NOT_EXISTS = new ErrorCode(1_000_021_005, "包装数量不存在"); ErrorCode ITEMPACKAGING_AVAILABLE_NOT_EXISTS = new ErrorCode(1_000_021_006, "是否可用不存在"); ErrorCode ITEMPACKAGING_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_021_007, "导入物品包装信息不能为空"); + ErrorCode ITEMPACKAGING_NULL = new ErrorCode(1_000_021_008, "物品包装信息无效"); //物料清单ErrorCode ErrorCode BOM_NOT_EXISTS = new ErrorCode(1_000_022_000, "物料清单不存在"); ErrorCode BOM_PRODUCT_ITEM_CODE_NOT_EXISTS = new ErrorCode(1_000_022_001, "父物料代码不存在"); @@ -65,6 +66,7 @@ public interface ErrorCodeConstants { ErrorCode PRODUCTIONLINEITEM_PRODUCT_LINE_COED_NOT_EXISTS = new ErrorCode(1_000_024_003, "产线代码不存在"); ErrorCode PRODUCTIONLINEITEM_ITEM_CODE_NOT_EXISTS = new ErrorCode(1_000_024_004, "物品代码不存在"); ErrorCode PRODUCTIONLINEITEM_AVAILABLE_NOT_EXISTS = new ErrorCode(1_000_024_005, "是否可用不存在"); + ErrorCode PRODUCTIONLINEITEM_PRODUCTIONLINECODE_AND_ITEMCODE_NOT_EXIST = new ErrorCode(1_000_024_006, "生产线于零件关系无效"); //采购价格单ErrorCode ErrorCode SUPPLIER_NOT_EXISTS = new ErrorCode(1_000_025_000, "供应商不存在"); ErrorCode SUPPLIER_NOT_EXISTSNO = new ErrorCode(1_000_025_001, "code已存在"); @@ -188,6 +190,7 @@ public interface ErrorCodeConstants { ErrorCode PRODUCTIONLINE_CODE_NOT_EXISTS = new ErrorCode(1_000_039_003, "code不存在"); ErrorCode PRODUCTIONLINE_WORKSHOP_CODE_NOT_EXISTS = new ErrorCode(1_000_039_004, "车间代码不存在"); ErrorCode PRODUCTIONLINE_AVAILABLE_NOT_EXISTS = new ErrorCode(1_000_039_005, "是否可用不存在"); + ErrorCode PRODUCTIONLINE_AND_WORKSHOP_RELATION_ERROR = new ErrorCode(1_000_039_004, "未查到该生产线与车间的关系"); //工序ErrorCode ErrorCode WORKSTATION_NOT_EXISTS = new ErrorCode(1_000_040_000, "工位不存在"); ErrorCode WORKSTATION_CODE_NOT_EXISTS = new ErrorCode(1_000_040_001, "code不存在"); @@ -196,6 +199,7 @@ public interface ErrorCodeConstants { ErrorCode WORKSTATION_WORKSHOP_CODE_NOT_EXISTS = new ErrorCode(1_000_040_004, "车间代码不存在"); ErrorCode WORKSTATION_PRODUECTION_LINE_CODE_NOT_EXISTS = new ErrorCode(1_000_040_005, "生产线代码不存在"); ErrorCode WORKSTATION_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_040_006, "导入工序不能为空"); + ErrorCode WORKSTATION_PRODUECTION_LINE_CODE_AND_WORKSTATION_RELATION_ERROR = new ErrorCode(1_000_040_007, "生产线代码与工位不匹配"); //工序ErrorCode ErrorCode PROCESS_NOT_EXISTS = new ErrorCode(1_000_041_000, "工序不存在"); ErrorCode PROCESS_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_041_001, "导入工序数据不能为空"); @@ -220,6 +224,7 @@ public interface ErrorCodeConstants { ErrorCode CURRENCYEXCHANGE_RATE_NOT_EXISTS = new ErrorCode(1_000_044_003, "比率不存在"); ErrorCode CURRENCYEXCHANGE_AVAILABLE_NOT_EXISTS = new ErrorCode(1_000_044_004, "是否可用不存在"); ErrorCode CURRENCYEXCHANGE_CURRENCY_NOT_EXISTS = new ErrorCode(1_000_044_005, "货币不存在"); + ErrorCode TWO_CURRENCIES_HAVE_NO_CONVERSION_RELATIONSHIP = new ErrorCode(1_000_044_006, "当前两种货币没有转换关系"); //规则ErrorCode ErrorCode RULE_NOT_EXISTS = new ErrorCode(1_000_045_000, "规则不存在"); ErrorCode RULE_CODE_EXISTS = new ErrorCode(1_000_045_001, "code已存在"); @@ -403,6 +408,9 @@ public interface ErrorCodeConstants { ErrorCode PURCHASE_PLAN_MAIN_NOT_EXISTS = new ErrorCode(1_000_069_000, "要货计划主不存在"); //要货计划子ErrorCode ErrorCode PURCHASE_PLAN_DETAIL_NOT_EXISTS = new ErrorCode(1_000_069_001, "要货计划子不存在"); + ErrorCode PURCHASE_PLAN_DETAIL_PONUMBER_POLINE_ITEMCODE_INVALID = new ErrorCode(1_000_069_002, "要货计划明细:订单号,订单行,零件号无效"); + ErrorCode PURCHASE_PLAN_IS_CLOSED = new ErrorCode(1_000_069_003, "要货计划已经关闭"); + ErrorCode PURCHASE_PLAN_MAIN_NUMBER_INVALID = new ErrorCode(1_000_069_004, "要货计划number无效"); //供应商发货申请主ErrorCode ErrorCode SUPPLIERDELIVER_REQUEST_MAIN_NOT_EXISTS = new ErrorCode(1_000_070_000, "供应商发货申请主不存在"); //供应商发货申请子ErrorCode @@ -426,6 +434,8 @@ public interface ErrorCodeConstants { ErrorCode PURCHASERECEIPT_RECORD_MAIN_NOT_EXISTS = new ErrorCode(1_000_074_000, "采购收货记录主不存在"); //采购收货记录子ErrorCode ErrorCode PURCHASERECEIPT_RECORD_DETAIL_NOT_EXISTS = new ErrorCode(1_000_074_001, "采购收货记录子不存在"); + ErrorCode PURCHASERECEIPT_RECORD_MAIN_NUMBER_NOT_EXISTS = new ErrorCode(1_000_074_002, "采购收货记录无效,number无效"); + ErrorCode PURCHASERECEIPT_RECORD_DETAIL_PONUMBER_POLINE_ITEMCODE_INVALID = new ErrorCode(1_000_074_003, "采购收货记录明细:订单号,订单行,零件号无效"); //采购退货申请主ErrorCode ErrorCode PURCHASERETURN_REQUEST_MAIN_NOT_EXISTS = new ErrorCode(1_000_075_000, "采购退货申请主不存在"); //采购退货申请子ErrorCode @@ -797,8 +807,7 @@ public interface ErrorCodeConstants { ErrorCode TRANSACTION_NOT_EXISTS = new ErrorCode(1_000_164_000, "库存事务不存在"); //库存事务ErrorCode ErrorCode TRANSFERLOG_NOT_EXISTS = new ErrorCode(1_000_165_000, "库存转移日志不存在"); - //生产线与零件关系ErrorCode - ErrorCode PRODUCTIONLINEITEM_PITEM_NOT_EXISTS = new ErrorCode(1_000_166_000, "生产线与零件关系无效"); - + //单据开关ErrorCode + ErrorCode SWITCH_NOT_EXISTS = new ErrorCode(1_000_166_000, "单据开关不存在"); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingService.java index aa5072ab..4fd0153d 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingService.java @@ -70,4 +70,13 @@ public interface ItempackagingService { List getItempackagingList(ItempackagingExportReqVO exportReqVO); List itempackagingimportDocumentList(List itempackagings, Integer mode, Boolean updatePart); + + /** + * BQ----QIP + * 查询物品标包信息 + * @author chenfang + * @param pitemCode 物品code + * @return + */ + public ItempackagingDO selectItemPackagingExist(String pitemCode); } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingServiceImpl.java index 0c16ba46..76223868 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/itempackaging/ItempackagingServiceImpl.java @@ -2,6 +2,7 @@ package com.win.module.wms.service.itempackaging; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.annotations.VisibleForTesting; import com.win.framework.common.exception.ServiceException; import com.win.framework.common.pojo.PageResult; @@ -183,4 +184,15 @@ public class ItempackagingServiceImpl implements ItempackagingService { throw exception(ITEMPACKAGING_AVAILABLE_NOT_EXISTS); } } + @Override + public ItempackagingDO selectItemPackagingExist(String pitemCode){ + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.eq("itemcode",pitemCode); + ItempackagingDO itempackagingDO = itempackagingMapper.selectOne(queryWrapper); + if(itempackagingDO != null && "TRUE".equals(itempackagingDO.getAvailable())){ + return itempackagingDO; + }else { + throw exception(ITEMPACKAGING_NULL); + } + } } From e9e960ad09feb48cd0d9b1e0dcb2524f0fd9ca9b Mon Sep 17 00:00:00 2001 From: chenfang Date: Thu, 26 Oct 2023 19:49:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84test=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../documentSwitch/SwitchServiceImplTest.java | 171 ------------------ 1 file changed, 171 deletions(-) delete mode 100644 win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java diff --git a/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java b/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java deleted file mode 100644 index 9a504816..00000000 --- a/win-module-wms/win-module-wms-biz/src/test/java/com/win/module/wms/service/documentSwitch/SwitchServiceImplTest.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.win.module.wms.service.documentSwitch; - -import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; -import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; -import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; -import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -import javax.annotation.Resource; - -import com.win.framework.test.core.ut.BaseDbUnitTest; - -import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; -import com.win.module.wms.dal.mysql.documentSwitch.SwitchMapper; -import com.win.framework.common.pojo.PageResult; - -import org.springframework.context.annotation.Import; -import java.util.*; - -import static com.win.module.wms.enums.ErrorCodeConstants.*; -import static com.win.framework.test.core.util.AssertUtils.*; -import static com.win.framework.test.core.util.RandomUtils.*; -import static com.win.framework.common.util.object.ObjectUtils.*; -import static org.junit.jupiter.api.Assertions.*; - -/** - * {@link SwitchServiceImpl} 的单元测试类 - * - * @author 源码 - */ -@Import(SwitchServiceImpl.class) -public class SwitchServiceImplTest extends BaseDbUnitTest { - - @Resource - private SwitchServiceImpl switchService; - - @Resource - private SwitchMapper switchMapper; - - @Test - public void testCreateSwitch_success() { - // 准备参数 - SwitchCreateReqVO reqVO = randomPojo(SwitchCreateReqVO.class); - - // 调用 - Long switchId = switchService.createSwitch(reqVO); - // 断言 - assertNotNull(switchId); - // 校验记录的属性是否正确 - SwitchDO switch = switchMapper.selectById(switchId); - assertPojoEquals(reqVO, switch); - } - - @Test - public void testUpdateSwitch_success() { - // mock 数据 - SwitchDO dbSwitch = randomPojo(SwitchDO.class); - switchMapper.insert(dbSwitch);// @Sql: 先插入出一条存在的数据 - // 准备参数 - SwitchUpdateReqVO reqVO = randomPojo(SwitchUpdateReqVO.class, o -> { - o.setId(dbSwitch.getId()); // 设置更新的 ID - }); - - // 调用 - switchService.updateSwitch(reqVO); - // 校验是否更新正确 - SwitchDO switch = switchMapper.selectById(reqVO.getId()); // 获取最新的 - assertPojoEquals(reqVO, switch); - } - - @Test - public void testUpdateSwitch_notExists() { - // 准备参数 - SwitchUpdateReqVO reqVO = randomPojo(SwitchUpdateReqVO.class); - - // 调用, 并断言异常 - assertServiceException(() -> switchService.updateSwitch(reqVO), SWITCH_NOT_EXISTS); - } - - @Test - public void testDeleteSwitch_success() { - // mock 数据 - SwitchDO dbSwitch = randomPojo(SwitchDO.class); - switchMapper.insert(dbSwitch);// @Sql: 先插入出一条存在的数据 - // 准备参数 - Long id = dbSwitch.getId(); - - // 调用 - switchService.deleteSwitch(id); - // 校验数据不存在了 - assertNull(switchMapper.selectById(id)); - } - - @Test - public void testDeleteSwitch_notExists() { - // 准备参数 - Long id = randomLongId(); - - // 调用, 并断言异常 - assertServiceException(() -> switchService.deleteSwitch(id), SWITCH_NOT_EXISTS); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetSwitchPage() { - // mock 数据 - SwitchDO dbSwitch = randomPojo(SwitchDO.class, o -> { // 等会查询到 - o.setCode(null); - o.setDescription(null); - o.setEffectiveSetValue(null); - o.setAvailable(null); - }); - switchMapper.insert(dbSwitch); - // 测试 code 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setCode(null))); - // 测试 description 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setDescription(null))); - // 测试 effectiveSetValue 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setEffectiveSetValue(null))); - // 测试 available 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setAvailable(null))); - // 准备参数 - SwitchPageReqVO reqVO = new SwitchPageReqVO(); - reqVO.setCode(null); - reqVO.setDescription(null); - reqVO.setEffectiveSetValue(null); - reqVO.setAvailable(null); - - // 调用 - PageResult pageResult = switchService.getSwitchPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbSwitch, pageResult.getList().get(0)); - } - - @Test - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 - public void testGetSwitchList() { - // mock 数据 - SwitchDO dbSwitch = randomPojo(SwitchDO.class, o -> { // 等会查询到 - o.setCode(null); - o.setDescription(null); - o.setEffectiveSetValue(null); - o.setAvailable(null); - }); - switchMapper.insert(dbSwitch); - // 测试 code 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setCode(null))); - // 测试 description 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setDescription(null))); - // 测试 effectiveSetValue 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setEffectiveSetValue(null))); - // 测试 available 不匹配 - switchMapper.insert(cloneIgnoreId(dbSwitch, o -> o.setAvailable(null))); - // 准备参数 - SwitchExportReqVO reqVO = new SwitchExportReqVO(); - reqVO.setCode(null); - reqVO.setDescription(null); - reqVO.setEffectiveSetValue(null); - reqVO.setAvailable(null); - - // 调用 - List list = switchService.getSwitchList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbSwitch, list.get(0)); - } - -}