Browse Source

备件台账

master
songguoqiang 7 months ago
parent
commit
736bac6eaf
  1. 1
      win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/DictTypeConstants.java
  2. 3
      win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java
  3. 47
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java
  4. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsBaseVO.java
  5. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsPageReqVO.java
  6. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsRespVO.java
  7. 139
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/ItemNewTurnInController.java
  8. 56
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInBaseVO.java
  9. 14
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInCreateReqVO.java
  10. 55
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExcelVO.java
  11. 15
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExportReqVO.java
  12. 17
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInPageReqVO.java
  13. 16
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInRespVO.java
  14. 14
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInUpdateReqVO.java
  15. 37
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/itemnewturnin/ItemNewTurnInConvert.java
  16. 4
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemaccounts/ItemAccountsDO.java
  17. 77
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemnewturnin/ItemNewTurnInDO.java
  18. 33
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemnewturnin/ItemNewTurnInMapper.java
  19. 41
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/itemAccount/ItemAccountStatusEnum.java
  20. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java
  21. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java
  22. 21
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java
  23. 141
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java
  24. 80
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInService.java
  25. 107
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInServiceImpl.java
  26. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java
  27. 9
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java
  28. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java
  29. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java

1
win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/DictTypeConstants.java

@ -101,4 +101,5 @@ public interface DictTypeConstants {
String CONTAINER_CONTENT_TYPE = "container_content_type"; // 器具内容类型 String CONTAINER_CONTENT_TYPE = "container_content_type"; // 器具内容类型
String EQUIPMENT_INDEX_NAME = "equipment_index_name"; //设备年度目标指标名称分类字段 String EQUIPMENT_INDEX_NAME = "equipment_index_name"; //设备年度目标指标名称分类字段
String FACTORY_TYPE = "factory_type"; // 月指标导入厂区字典 String FACTORY_TYPE = "factory_type"; // 月指标导入厂区字典
String ITEM_ACCOUNT_LOCATION_TYPE = "item_account_location_type"; // 备件台账库位类型
} }

3
win-module-eam/win-module-eam-api/src/main/java/com/win/module/eam/enums/ErrorCodeConstants.java

@ -157,5 +157,8 @@ public interface ErrorCodeConstants {
ErrorCode CLASS_TYPE_DATA_REPEAT = new ErrorCode(1_000_020_063, "厂区和班组固定,不能重复"); ErrorCode CLASS_TYPE_DATA_REPEAT = new ErrorCode(1_000_020_063, "厂区和班组固定,不能重复");
ErrorCode ITEM_TYPE_LOCATION_EXIST = new ErrorCode(1_000_020_063, "备件编码库位类型库位编码已存在,不能重复添加");
ErrorCode ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_020_063, "数据不能为空");
} }

47
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java

@ -7,8 +7,14 @@ import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog; import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.eam.controller.itemaccounts.vo.*; import com.win.module.eam.controller.itemaccounts.vo.*;
import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert; import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import com.win.module.eam.dal.dataobject.location.LocationDO;
import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO;
import com.win.module.eam.service.item.ItemService;
import com.win.module.eam.service.itemaccounts.ItemAccountsService; import com.win.module.eam.service.itemaccounts.ItemAccountsService;
import com.win.module.eam.service.location.LocationService;
import com.win.module.eam.service.locationarea.LocationAreaService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.Parameters;
@ -39,6 +45,15 @@ public class ItemAccountsController {
@Resource @Resource
private ItemAccountsService itemAccountsService; private ItemAccountsService itemAccountsService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@Resource
private LocationAreaService locationAreaService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建备件台账") @Operation(summary = "创建备件台账")
@PreAuthorize("@ss.hasPermission('item:itemAccounts:create')") @PreAuthorize("@ss.hasPermission('item:itemAccounts:create')")
@ -46,6 +61,20 @@ public class ItemAccountsController {
return success(itemAccountsService.createItemAccounts(createReqVO)); return success(itemAccountsService.createItemAccounts(createReqVO));
} }
// @PostMapping("/createIn")
// @Operation(summary = "增入库只能新增账内和新到货")
// @PreAuthorize("@ss.hasPermission('item:itemAccounts:createIn')")
// public CommonResult<Long> createIn(@Valid @RequestBody ItemAccountsCreateReqVO createReqVO) {
// return success(itemAccountsService.createIn(createReqVO));
// }
@PostMapping("/newTurnIn")
@Operation(summary = "新到货转账内")
@PreAuthorize("@ss.hasPermission('item:itemAccounts:newTurnIn')")
public CommonResult<Long> newTurnIn(@Valid @RequestBody ItemAccountsCreateReqVO createReqVO) {
return success(itemAccountsService.newTurnIn(createReqVO));
}
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新备件台账") @Operation(summary = "更新备件台账")
@PreAuthorize("@ss.hasPermission('item:itemAccounts:update')") @PreAuthorize("@ss.hasPermission('item:itemAccounts:update')")
@ -87,6 +116,16 @@ public class ItemAccountsController {
public CommonResult<PageResult<ItemAccountsRespVO>> getItemAccountsPage(@Valid ItemAccountsPageReqVO pageVO) { public CommonResult<PageResult<ItemAccountsRespVO>> getItemAccountsPage(@Valid ItemAccountsPageReqVO pageVO) {
PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsPage(pageVO); PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsPage(pageVO);
PageResult<ItemAccountsRespVO> result = ItemAccountsConvert.INSTANCE.convertPage(pageResult); PageResult<ItemAccountsRespVO> result = ItemAccountsConvert.INSTANCE.convertPage(pageResult);
for(ItemAccountsRespVO vo:result.getList()){
ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber());
vo.setAreaName(locationAreaDO.getName());
Boolean b = itemAccountsService.qtyZore(vo.getItemNumber());
vo.setDisplay(b);
}
return success(result); return success(result);
} }
@ -173,6 +212,14 @@ public class ItemAccountsController {
public CommonResult<PageResult<ItemAccountsRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) { public CommonResult<PageResult<ItemAccountsRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsSenior(conditions); PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsSenior(conditions);
PageResult<ItemAccountsRespVO> result = ItemAccountsConvert.INSTANCE.convertPage(pageResult); PageResult<ItemAccountsRespVO> result = ItemAccountsConvert.INSTANCE.convertPage(pageResult);
for(ItemAccountsRespVO vo:result.getList()){
ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber());
vo.setAreaName(locationAreaDO.getName());
}
return success(result); return success(result);
} }

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsBaseVO.java

@ -146,6 +146,9 @@ public class ItemAccountsBaseVO {
*/ */
@Schema(description = "类别") @Schema(description = "类别")
private String category; private String category;
@Schema(description = "库位类型")
private String type;
/** /**
* 描述 * 描述
*/ */

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsPageReqVO.java

@ -21,4 +21,7 @@ public class ItemAccountsPageReqVO extends PageParam {
@Schema(description = "是否可用") @Schema(description = "是否可用")
private String available; private String available;
@Schema(description = "库位类型")
private String type;
} }

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsRespVO.java

@ -16,4 +16,14 @@ public class ItemAccountsRespVO extends ItemAccountsBaseVO {
@Schema(description = "创建时间") @Schema(description = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
private String locationName;
private String areaName;
private String itemName;
/**
* 是否显示更换库位按钮
*/
private Boolean display;
} }

139
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/ItemNewTurnInController.java

@ -0,0 +1,139 @@
package com.win.module.eam.controller.itemnewturnin;
import com.win.module.eam.controller.itemnewturnin.vo.*;
import io.swagger.v3.oas.annotations.Parameters;
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.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
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.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
import com.win.module.eam.convert.itemnewturnin.ItemNewTurnInConvert;
import com.win.module.eam.service.itemnewturnin.ItemNewTurnInService;
import org.springframework.web.multipart.MultipartFile;
@Tag(name = "管理后台 - 备件台账新到货转账内变更记录")
@RestController
@RequestMapping("/eam/item-new-turn-in")
@Validated
public class ItemNewTurnInController {
@Resource
private ItemNewTurnInService itemNewTurnInService;
@PostMapping("/create")
@Operation(summary = "创建备件台账新到货转账内变更记录")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:create')")
public CommonResult<Long> createItemNewTurnIn(@Valid @RequestBody ItemNewTurnInCreateReqVO createReqVO) {
return success(itemNewTurnInService.createItemNewTurnIn(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新备件台账新到货转账内变更记录")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:update')")
public CommonResult<Boolean> updateItemNewTurnIn(@Valid @RequestBody ItemNewTurnInUpdateReqVO updateReqVO) {
int result = itemNewTurnInService.updateItemNewTurnIn(updateReqVO);
return success(result > 0);
}
@DeleteMapping("/delete")
@Operation(summary = "删除备件台账新到货转账内变更记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:delete')")
public CommonResult<Boolean> deleteItemNewTurnIn(@RequestParam("id") Long id) {
int result = itemNewTurnInService.deleteItemNewTurnIn(id);
return success(result > 0);
}
@GetMapping("/get")
@Operation(summary = "获得备件台账新到货转账内变更记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')")
public CommonResult<ItemNewTurnInRespVO> getItemNewTurnIn(@RequestParam("id") Long id) {
ItemNewTurnInDO itemNewTurnIn = itemNewTurnInService.getItemNewTurnIn(id);
return success(ItemNewTurnInConvert.INSTANCE.convert(itemNewTurnIn));
}
@GetMapping("/list")
@Operation(summary = "获得备件台账新到货转账内变更记录列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')")
public CommonResult<List<ItemNewTurnInRespVO>> getItemNewTurnInList(@RequestParam("ids") Collection<Long> ids) {
List<ItemNewTurnInDO> list = itemNewTurnInService.getItemNewTurnInList(ids);
return success(ItemNewTurnInConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得备件台账新到货转账内变更记录分页")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:query')")
public CommonResult<PageResult<ItemNewTurnInRespVO>> getItemNewTurnInPage(@Valid ItemNewTurnInPageReqVO pageVO) {
PageResult<ItemNewTurnInDO> pageResult = itemNewTurnInService.getItemNewTurnInPage(pageVO);
return success(ItemNewTurnInConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出备件台账新到货转账内变更记录 Excel")
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:export')")
@OperateLog(type = EXPORT)
public void exportItemNewTurnInExcel(@Valid ItemNewTurnInExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<ItemNewTurnInDO> list = itemNewTurnInService.getItemNewTurnInList(exportReqVO);
// 导出 Excel
List<ItemNewTurnInExcelVO> datas = ItemNewTurnInConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "备件台账新到货转账内变更记录.xls", "数据", ItemNewTurnInExcelVO.class, datas);
}
@GetMapping("/get-import-template")
@Operation(summary = "获得导入备件台账新到货转账内变更记录模板")
public void importTemplate(HttpServletResponse response) throws IOException {
List<ItemNewTurnInExcelVO> list = Arrays.asList();
// 输出
ExcelUtils.write(response, "备件台账新到货转账内变更记录基本信息导入模板.xls", "备件台账新到货转账内变更记录基本信息列表", ItemNewTurnInExcelVO.class, list);
}
@PostMapping("/import")
@Operation(summary = "导入备件台账新到货转账内变更记录基本信息")
@Parameters({
@Parameter(name = "file", description = "Excel 文件", required = true),
@Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"),
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")
})
@PreAuthorize("@ss.hasPermission('eam:item-new-turn-in:import')")
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response,
@RequestParam("file") MultipartFile file,
@RequestParam(value = "mode") Integer mode,
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception {
List<ItemNewTurnInExcelVO> list = ExcelUtils.read(file, ItemNewTurnInExcelVO.class);
List<ItemNewTurnInExcelVO> errorList = itemNewTurnInService.importItemNewTurnInList(list, mode, updatePart);
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("errorCount", errorList.size());
if(!errorList.isEmpty()) {
String url = ExcelUtils.writeLocalFile("备件台账新到货转账内变更记录基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList);
returnMap.put("errorFile", url);
}
return success(returnMap);
}
}

56
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInBaseVO.java

@ -0,0 +1,56 @@
package com.win.module.eam.controller.itemnewturnin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import javax.validation.constraints.*;
/**
* 备件台账新到货转账内变更记录 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class ItemNewTurnInBaseVO {
@Schema(description = "备件编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "备件编码不能为空")
private String itemNumber;
@Schema(description = "库位编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "库位编码不能为空")
private String locationNumber;
@Schema(description = "库区编码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "库区编码不能为空")
private String areaNumber;
@Schema(description = "描述", example = "随便")
private String description;
@Schema(description = "新到货数量")
private BigDecimal newQty;
@Schema(description = "账内数量")
private BigDecimal inQty;
@Schema(description = "转换后账内数量")
private BigDecimal qty;
@Schema(description = "地点ID", example = "4783")
private String siteId;
@Schema(description = "是否可用")
private String available;
@Schema(description = "变更操作字典")
private String type;
@Schema(description = "并发乐观锁")
private Integer concurrencyStamp;
}

14
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInCreateReqVO.java

@ -0,0 +1,14 @@
package com.win.module.eam.controller.itemnewturnin.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ItemNewTurnInCreateReqVO extends ItemNewTurnInBaseVO {
}

55
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExcelVO.java

@ -0,0 +1,55 @@
package com.win.module.eam.controller.itemnewturnin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 备件台账新到货转账内变更记录 Excel VO
*
* @author 超级管理员
*/
@Data
public class ItemNewTurnInExcelVO {
@ExcelProperty("备件编码")
private String itemNumber;
@ExcelProperty("库位编码")
private String locationNumber;
@ExcelProperty("库区编码")
private String areaNumber;
@ExcelProperty("描述")
private String description;
@ExcelProperty("新到货数量")
private BigDecimal newQty;
@ExcelProperty("账内数量")
private BigDecimal inQty;
@ExcelProperty("转换后账内数量")
private BigDecimal qty;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@ExcelProperty("地点ID")
private String siteId;
@ExcelProperty("是否可用")
private String available;
@ExcelProperty("并发乐观锁")
private Integer concurrencyStamp;
}

15
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExportReqVO.java

@ -0,0 +1,15 @@
package com.win.module.eam.controller.itemnewturnin.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,参数和 ItemNewTurnInPageReqVO 是一致的")
@Data
public class ItemNewTurnInExportReqVO {
@Schema(description = "备件编码")
private String itemNumber;
}

17
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInPageReqVO.java

@ -0,0 +1,17 @@
package com.win.module.eam.controller.itemnewturnin.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 ItemNewTurnInPageReqVO extends PageParam {
@Schema(description = "备件编码")
private String itemNumber;
}

16
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInRespVO.java

@ -0,0 +1,16 @@
package com.win.module.eam.controller.itemnewturnin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ItemNewTurnInRespVO extends ItemNewTurnInBaseVO {
@Schema(description = "创建时间")
private LocalDateTime createTime;
}

14
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInUpdateReqVO.java

@ -0,0 +1,14 @@
package com.win.module.eam.controller.itemnewturnin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 备件台账新到货转账内变更记录更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ItemNewTurnInUpdateReqVO extends ItemNewTurnInBaseVO {
}

37
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/itemnewturnin/ItemNewTurnInConvert.java

@ -0,0 +1,37 @@
package com.win.module.eam.convert.itemnewturnin;
import java.util.*;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInCreateReqVO;
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInExcelVO;
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInRespVO;
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInUpdateReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
/**
* 备件台账新到货转账内变更记录 Convert
*
* @author 超级管理员
*/
@Mapper
public interface ItemNewTurnInConvert {
ItemNewTurnInConvert INSTANCE = Mappers.getMapper(ItemNewTurnInConvert.class);
ItemNewTurnInDO convert(ItemNewTurnInCreateReqVO bean);
ItemNewTurnInDO convert(ItemNewTurnInUpdateReqVO bean);
ItemNewTurnInRespVO convert(ItemNewTurnInDO bean);
List<ItemNewTurnInRespVO> convertList(List<ItemNewTurnInDO> list);
PageResult<ItemNewTurnInRespVO> convertPage(PageResult<ItemNewTurnInDO> page);
List<ItemNewTurnInExcelVO> convertList02(List<ItemNewTurnInDO> list);
}

4
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemaccounts/ItemAccountsDO.java

@ -50,6 +50,10 @@ public class ItemAccountsDO extends BaseDO {
* 是否账内库TRUE账内FALSE账外 * 是否账内库TRUE账内FALSE账外
*/ */
private String isInAccount; private String isInAccount;
/**
* 库位类型
*/
private String type;
/** /**
* 地点ID * 地点ID
*/ */

77
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemnewturnin/ItemNewTurnInDO.java

@ -0,0 +1,77 @@
package com.win.module.eam.dal.dataobject.itemnewturnin;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 备件台账新到货转账内变更记录 DO
*
* @author 超级管理员
*/
@TableName("record_item_new_turn_in")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ItemNewTurnInDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 备件编码
*/
private String itemNumber;
/**
* 库位编码
*/
private String locationNumber;
/**
* 库区编码
*/
private String areaNumber;
/**
* 变更操作字典
*/
private String type;
/**
* 描述
*/
private String description;
/**
* 新到货数量
*/
private BigDecimal newQty;
/**
* 账内数量
*/
private BigDecimal inQty;
/**
* 转换后账内数量
*/
private BigDecimal qty;
/**
* 地点ID
*/
private String siteId;
/**
* 是否可用
*/
private String available;
/**
* 并发乐观锁
*/
private Integer concurrencyStamp;
}

33
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemnewturnin/ItemNewTurnInMapper.java

@ -0,0 +1,33 @@
package com.win.module.eam.dal.mysql.itemnewturnin;
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.eam.controller.itemnewturnin.vo.ItemNewTurnInExportReqVO;
import com.win.module.eam.controller.itemnewturnin.vo.ItemNewTurnInPageReqVO;
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 备件台账新到货转账内变更记录 Mapper
*
* @author 超级管理员
*/
@Mapper
public interface ItemNewTurnInMapper extends BaseMapperX<ItemNewTurnInDO> {
default PageResult<ItemNewTurnInDO> selectPage(ItemNewTurnInPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ItemNewTurnInDO>()
.eqIfPresent(ItemNewTurnInDO::getItemNumber, reqVO.getItemNumber())
.orderByDesc(ItemNewTurnInDO::getId));
}
default List<ItemNewTurnInDO> selectList(ItemNewTurnInExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ItemNewTurnInDO>()
.eqIfPresent(ItemNewTurnInDO::getItemNumber, reqVO.getItemNumber())
.orderByDesc(ItemNewTurnInDO::getId));
}
}

41
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/itemAccount/ItemAccountStatusEnum.java

@ -0,0 +1,41 @@
package com.win.module.eam.enums.itemAccount;
public enum ItemAccountStatusEnum {
IN("0", "账内"),
OUT("1", "账外"),
NEW("2", "新到货"),
;
private String code;
private String name;
ItemAccountStatusEnum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return this.code;
}
public String getName() {
return this.name;
}
/**
* 用状态值获取枚举
*
* @param code
* @return
*/
static ItemAccountStatusEnum getOrderStatusEnum(String code) {
for (ItemAccountStatusEnum orderStatusEnum : values()) {
if (orderStatusEnum.getCode().equals(code)) {
return orderStatusEnum;
}
}
return null;
}
}

8
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java

@ -136,4 +136,12 @@ public interface ItemService {
* @return 导入结果 * @return 导入结果
*/ */
public List<ItemExcelVO> importItemList(List<ItemExcelVO> datas, Integer mode, boolean updatePart); public List<ItemExcelVO> importItemList(List<ItemExcelVO> datas, Integer mode, boolean updatePart);
/**
*根据备件编码查询备件信息
* @param number
* @return
*/
ItemDO getByNumber(String number);
} }

10
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java

@ -281,4 +281,14 @@ public class ItemServiceImpl implements ItemService {
}); });
return errorList; return errorList;
} }
@Override
public ItemDO getByNumber(String number) {
QueryWrapper<ItemDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number",number);
queryWrapper.eq("available","TRUE");
return itemMapper.selectOne(queryWrapper);
}
} }

21
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java

@ -25,6 +25,20 @@ public interface ItemAccountsService {
*/ */
Long createItemAccounts(@Valid ItemAccountsCreateReqVO createReqVO); Long createItemAccounts(@Valid ItemAccountsCreateReqVO createReqVO);
/**
* 新增入库只能新增账内和新到货
* @param createReqVO
* @return
*/
Long createIn(@Valid ItemAccountsCreateReqVO createReqVO);
/**
* 新到货转账内
* @param createReqVO
* @return
*/
Long newTurnIn(@Valid ItemAccountsCreateReqVO createReqVO);
/** /**
* 更新备件台账 * 更新备件台账
* *
@ -118,4 +132,11 @@ public interface ItemAccountsService {
* @return 备件不分页 * @return 备件不分页
*/ */
List<ItemAccountsDO> getItemAccountsNoPage(ItemAccountsPageReqVO pageReqVO); List<ItemAccountsDO> getItemAccountsNoPage(ItemAccountsPageReqVO pageReqVO);
/**
* 根据当前备件编码查询所有库存是否为0
* @param number
* @return
*/
Boolean qtyZore(String number);
} }

141
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java

@ -9,15 +9,19 @@ import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult; import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.itemaccounts.vo.*; import com.win.module.eam.controller.itemaccounts.vo.*;
import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert; import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert;
import com.win.module.eam.dal.dataobject.devicemaintenancejob.DeviceMaintenanceJobMainDO;
import com.win.module.eam.dal.dataobject.item.ItemDO; import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import com.win.module.eam.dal.dataobject.itemlocationreplace.ItemLocationReplaceDO; import com.win.module.eam.dal.dataobject.itemlocationreplace.ItemLocationReplaceDO;
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
import com.win.module.eam.dal.dataobject.location.LocationDO; import com.win.module.eam.dal.dataobject.location.LocationDO;
import com.win.module.eam.dal.mysql.item.ItemMapper; import com.win.module.eam.dal.mysql.item.ItemMapper;
import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper; import com.win.module.eam.dal.mysql.itemaccounts.ItemAccountsMapper;
import com.win.module.eam.dal.mysql.itemlocationreplace.ItemLocationReplaceMapper; import com.win.module.eam.dal.mysql.itemlocationreplace.ItemLocationReplaceMapper;
import com.win.module.eam.dal.mysql.itemnewturnin.ItemNewTurnInMapper;
import com.win.module.eam.dal.mysql.location.LocationMapper; import com.win.module.eam.dal.mysql.location.LocationMapper;
import com.win.module.eam.enums.basic.BooleanTypeEnum; import com.win.module.eam.enums.basic.BooleanTypeEnum;
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -30,8 +34,9 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_CAN_NOT_REPLACE; import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_CAN_NOT_REPLACE2; import static com.win.module.eam.enums.ErrorCodeConstants.*;
import static com.win.module.eam.enums.ErrorCodeConstants.CLASSTYPR_NO_NOMAL;
/** /**
* 备件台账 Service 实现类 * 备件台账 Service 实现类
@ -54,13 +59,115 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
@Resource @Resource
private ItemMapper itemMapper; private ItemMapper itemMapper;
@Resource
private ItemNewTurnInMapper itemNewTurnInMapper;
@Override @Override
public Long createItemAccounts(ItemAccountsCreateReqVO createReqVO) { public Long createItemAccounts(ItemAccountsCreateReqVO createReqVO) {
long id = 0;
//校验
ItemAccountsDO itemAccountsDO = validateItemAndTypeAndLocation(createReqVO.getItemNumber(), createReqVO.getType(), createReqVO.getLocationNumber());
if(itemAccountsDO!=null){//存在则更新库存
ItemAccountsDO updateObj = ItemAccountsConvert.INSTANCE.convert(createReqVO);
BigDecimal qty = itemAccountsDO.getQty();
BigDecimal add = updateObj.getQty().add(qty);
updateObj.setQty(add);
updateObj.setId(itemAccountsDO.getId());
itemAccountsMapper.updateById(updateObj);
id = updateObj.getId();
}else{
// 插入
ItemAccountsDO itemAccounts = ItemAccountsConvert.INSTANCE.convert(createReqVO);
itemAccountsMapper.insert(itemAccounts);
id = itemAccounts.getId();
}
return id;
}
@Override
public Long createIn(ItemAccountsCreateReqVO createReqVO) {
long id = 0;
//校验
ItemAccountsDO itemAccountsDO = validateItemAndTypeAndLocation(createReqVO.getItemNumber(), createReqVO.getType(), createReqVO.getLocationNumber());
if(itemAccountsDO!=null){//存在则更新库存
ItemAccountsDO updateObj = ItemAccountsConvert.INSTANCE.convert(createReqVO);
BigDecimal qty = itemAccountsDO.getQty();
BigDecimal add = updateObj.getQty().add(qty);
updateObj.setQty(add);
updateObj.setId(itemAccountsDO.getId());
itemAccountsMapper.updateById(updateObj);
id = updateObj.getId();
}else{
// 插入 // 插入
ItemAccountsDO itemAccounts = ItemAccountsConvert.INSTANCE.convert(createReqVO); ItemAccountsDO itemAccounts = ItemAccountsConvert.INSTANCE.convert(createReqVO);
itemAccountsMapper.insert(itemAccounts); itemAccountsMapper.insert(itemAccounts);
// 返回 id = itemAccounts.getId();
return itemAccounts.getId(); }
return id;
}
@Override
@Transactional
public Long newTurnIn(ItemAccountsCreateReqVO createReqVO) {
long id = 0;
BigDecimal newqty = null;
ItemAccountsDO itemAccountsDO = itemAccountsMapper.selectById(createReqVO.getId());
if(itemAccountsDO==null){//
throw exception(ITEM_TYPE_LOCATION_EXIST);//新到货数据不存在
}
ItemNewTurnInDO itemNewTurnInDO = new ItemNewTurnInDO();//变更记录
newqty = createReqVO.getQty();
//查询有无账内库存
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number",itemAccountsDO.getItemNumber());
queryWrapper.eq("type", ItemAccountStatusEnum.IN.getCode());
queryWrapper.eq("location_number",itemAccountsDO.getLocationNumber());
queryWrapper.eq("available","TRUE");
List<ItemAccountsDO> itemAccountsDOS = itemAccountsMapper.selectList(queryWrapper);
if(!itemAccountsDOS.isEmpty()){//有数据更新
//往账内添加库存
BigDecimal qty = itemAccountsDOS.get(0).getQty();
BigDecimal add = newqty.add(qty);
ItemAccountsDO itemAccountsDO1 = new ItemAccountsDO();
itemAccountsDO1.setId(itemAccountsDOS.get(0).getId());
itemAccountsDO1.setQty(add);
int i = itemAccountsMapper.updateById(itemAccountsDO1);
//记录新到货转账内
id = itemAccountsDO1.getId();
itemNewTurnInDO.setType("3");
itemNewTurnInDO.setItemNumber(createReqVO.getItemNumber());
itemNewTurnInDO.setAreaNumber(createReqVO.getAreaNumber());
itemNewTurnInDO.setLocationNumber(createReqVO.getLocationNumber());
itemNewTurnInDO.setNewQty(newqty);
itemNewTurnInDO.setInQty(itemAccountsDOS.get(0).getQty());
itemNewTurnInDO.setQty(add);
}else{//无数据插入
ItemAccountsDO itemAccounts = ItemAccountsConvert.INSTANCE.convert(createReqVO);
itemAccounts.setType(ItemAccountStatusEnum.IN.getCode());
itemAccounts.setId(null);
itemAccountsMapper.insert(itemAccounts);
id = itemAccounts.getId();
itemNewTurnInDO.setType("2");
itemNewTurnInDO.setItemNumber(itemAccounts.getItemNumber());
itemNewTurnInDO.setAreaNumber(itemAccounts.getAreaNumber());
itemNewTurnInDO.setLocationNumber(itemAccounts.getLocationNumber());
itemNewTurnInDO.setNewQty(newqty);
itemNewTurnInDO.setQty(newqty);
}
//记录表
itemNewTurnInMapper.insert(itemNewTurnInDO);
//更新新到货数量
BigDecimal qty = itemAccountsDO.getQty();
if(qty.compareTo(newqty) == 0){//等于删除
itemAccountsMapper.deleteById(createReqVO.getId());
}else{//更新数量
BigDecimal difference = qty.subtract(newqty);
itemAccountsDO.setQty(difference);
itemAccountsMapper.updateById(itemAccountsDO);
}
//itemAccountsMapper.deleteById(createReqVO.getId());
return id;
} }
@Override @Override
@ -233,4 +340,30 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
return itemAccountsMapper.selectNoPage(pageReqVO); return itemAccountsMapper.selectNoPage(pageReqVO);
} }
@Override
public Boolean qtyZore(String number) {
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number",number);
queryWrapper.eq("available","TRUE");
queryWrapper.ne("qty","0.00");
List<ItemAccountsDO> itemDOS = itemAccountsMapper.selectList(queryWrapper);
if(itemDOS.isEmpty()){
return true;
}else{
return false;
}
}
/**
* 新增校验备件编号+类型+库位编码唯一
*/
private ItemAccountsDO validateItemAndTypeAndLocation(String itemNumber,String type,String locationNumber) {
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number",itemNumber);
queryWrapper.eq("type",type);
queryWrapper.eq("location_number",locationNumber);
queryWrapper.eq("available","TRUE");
return itemAccountsMapper.selectOne(queryWrapper);
}
} }

80
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInService.java

@ -0,0 +1,80 @@
package com.win.module.eam.service.itemnewturnin;
import java.util.*;
import javax.validation.*;
import com.win.module.eam.controller.itemnewturnin.vo.*;
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
import com.win.framework.common.pojo.PageResult;
/**
* 备件台账新到货转账内变更记录 Service 接口
*
* @author 超级管理员
*/
public interface ItemNewTurnInService {
/**
* 创建备件台账新到货转账内变更记录
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createItemNewTurnIn(@Valid ItemNewTurnInCreateReqVO createReqVO);
/**
* 更新备件台账新到货转账内变更记录
*
* @param updateReqVO 更新信息
*/
Integer updateItemNewTurnIn(@Valid ItemNewTurnInUpdateReqVO updateReqVO);
/**
* 删除备件台账新到货转账内变更记录
*
* @param id 编号
*/
Integer deleteItemNewTurnIn(Long id);
/**
* 获得备件台账新到货转账内变更记录
*
* @param id 编号
* @return 备件台账新到货转账内变更记录
*/
ItemNewTurnInDO getItemNewTurnIn(Long id);
/**
* 获得备件台账新到货转账内变更记录列表
*
* @param ids 编号
* @return 备件台账新到货转账内变更记录列表
*/
List<ItemNewTurnInDO> getItemNewTurnInList(Collection<Long> ids);
/**
* 获得备件台账新到货转账内变更记录分页
*
* @param pageReqVO 分页查询
* @return 备件台账新到货转账内变更记录分页
*/
PageResult<ItemNewTurnInDO> getItemNewTurnInPage(ItemNewTurnInPageReqVO pageReqVO);
/**
* 获得备件台账新到货转账内变更记录列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 备件台账新到货转账内变更记录列表
*/
List<ItemNewTurnInDO> getItemNewTurnInList(ItemNewTurnInExportReqVO exportReqVO);
/**
* 导入备件台账新到货转账内变更记录主信息
*
* @param datas 导入备件台账新到货转账内变更记录主信息列表
* @param mode 导入模式1更新2追加3覆盖
* @param updatePart 是否支持更新
* @return 导入结果
*/
public List<ItemNewTurnInExcelVO> importItemNewTurnInList(List<ItemNewTurnInExcelVO> datas, Integer mode, boolean updatePart);
}

107
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInServiceImpl.java

@ -0,0 +1,107 @@
package com.win.module.eam.service.itemnewturnin;
import cn.hutool.core.collection.CollUtil;
import com.win.module.eam.controller.itemnewturnin.vo.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import com.win.module.eam.dal.dataobject.itemnewturnin.ItemNewTurnInDO;
import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.convert.itemnewturnin.ItemNewTurnInConvert;
import com.win.module.eam.dal.mysql.itemnewturnin.ItemNewTurnInMapper;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.eam.enums.ErrorCodeConstants.*;
/**
* 备件台账新到货转账内变更记录 Service 实现类
*
* @author 超级管理员
*/
@Service
@Validated
public class ItemNewTurnInServiceImpl implements ItemNewTurnInService {
@Resource
private ItemNewTurnInMapper itemNewTurnInMapper;
@Override
public Long createItemNewTurnIn(ItemNewTurnInCreateReqVO createReqVO) {
// 插入
ItemNewTurnInDO itemNewTurnIn = ItemNewTurnInConvert.INSTANCE.convert(createReqVO);
itemNewTurnInMapper.insert(itemNewTurnIn);
// 返回
return itemNewTurnIn.getId();
}
@Override
public Integer updateItemNewTurnIn(ItemNewTurnInUpdateReqVO updateReqVO) {
// 校验存在
//validateItemNewTurnInExists(updateReqVO.getId());
// 更新
ItemNewTurnInDO updateObj = ItemNewTurnInConvert.INSTANCE.convert(updateReqVO);
return itemNewTurnInMapper.updateById(updateObj);
}
@Override
public Integer deleteItemNewTurnIn(Long id) {
// 校验存在
validateItemNewTurnInExists(id);
// 删除
return itemNewTurnInMapper.deleteById(id);
}
private void validateItemNewTurnInExists(Long id) {
if (itemNewTurnInMapper.selectById(id) == null) {
throw exception(ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY);
}
}
@Override
public ItemNewTurnInDO getItemNewTurnIn(Long id) {
return itemNewTurnInMapper.selectById(id);
}
@Override
public List<ItemNewTurnInDO> getItemNewTurnInList(Collection<Long> ids) {
return itemNewTurnInMapper.selectBatchIds(ids);
}
@Override
public PageResult<ItemNewTurnInDO> getItemNewTurnInPage(ItemNewTurnInPageReqVO pageReqVO) {
return itemNewTurnInMapper.selectPage(pageReqVO);
}
@Override
public List<ItemNewTurnInDO> getItemNewTurnInList(ItemNewTurnInExportReqVO exportReqVO) {
return itemNewTurnInMapper.selectList(exportReqVO);
}
@Override
public List<ItemNewTurnInExcelVO> importItemNewTurnInList(List<ItemNewTurnInExcelVO> datas, Integer mode, boolean updatePart) {
if (CollUtil.isEmpty(datas)) {
throw exception(ITEM_NEW_TURN_IN_IMPORT_LIST_IS_EMPTY);
}
List<ItemNewTurnInExcelVO> errorList = new ArrayList<>();
datas.forEach(item -> {
// if(errorList == null){
// // 判断如果不存在,在进行插入
// ItemNewTurnInDO obj = itemNewTurnInMapper.selectByCode(item.getCode());
// if (obj == null&& mode != 3) {
// itemNewTurnInMapper.insert(ItemNewTurnInConvert.INSTANCE.convert(item));
// }
// else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新
// ItemNewTurnInDO itemNewTurnInDO = ItemNewTurnInConvert.INSTANCE.convert(item);
// itemNewTurnInDO.setId(obj.getId());
// itemNewTurnInMapper.updateById(obj);
// }
// }
});
return errorList;
}
}

8
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java

@ -3,6 +3,7 @@ package com.win.module.eam.service.location;
import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult; import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.location.vo.*; import com.win.module.eam.controller.location.vo.*;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.location.LocationDO; import com.win.module.eam.dal.dataobject.location.LocationDO;
import javax.validation.Valid; import javax.validation.Valid;
@ -108,4 +109,11 @@ public interface LocationService {
* @return 分页列表 * @return 分页列表
*/ */
PageResult<LocationDO> getLocationSenior(CustomConditions conditions); PageResult<LocationDO> getLocationSenior(CustomConditions conditions);
/**
*根据编码查询信息
* @param number
* @return
*/
LocationDO getByNumber(String number);
} }

9
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java

@ -6,6 +6,7 @@ import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult; import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.location.vo.*; import com.win.module.eam.controller.location.vo.*;
import com.win.module.eam.convert.location.LocationConvert; import com.win.module.eam.convert.location.LocationConvert;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import com.win.module.eam.dal.dataobject.itemapplyrequest.ItemApplyRequestDetailDO; import com.win.module.eam.dal.dataobject.itemapplyrequest.ItemApplyRequestDetailDO;
import com.win.module.eam.dal.dataobject.location.LocationDO; import com.win.module.eam.dal.dataobject.location.LocationDO;
@ -211,5 +212,13 @@ public class LocationServiceImpl implements LocationService {
return locationMapper.selectSenior(conditions); return locationMapper.selectSenior(conditions);
} }
@Override
public LocationDO getByNumber(String number) {
QueryWrapper<LocationDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number",number);
queryWrapper.eq("available","TRUE");
return locationMapper.selectOne(queryWrapper);
}
} }

8
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java

@ -3,6 +3,7 @@ package com.win.module.eam.service.locationarea;
import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult; import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.locationarea.vo.*; import com.win.module.eam.controller.locationarea.vo.*;
import com.win.module.eam.dal.dataobject.location.LocationDO;
import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO; import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO;
import javax.validation.Valid; import javax.validation.Valid;
@ -77,4 +78,11 @@ public interface LocationAreaService {
* @return 分页列表 * @return 分页列表
*/ */
PageResult<LocationAreaDO> getLocationAreaSenior(CustomConditions conditions); PageResult<LocationAreaDO> getLocationAreaSenior(CustomConditions conditions);
/**
*根据编码查询信息
* @param number
* @return
*/
LocationAreaDO getByNumber(String number);
} }

8
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java

@ -117,4 +117,12 @@ public class LocationAreaServiceImpl implements LocationAreaService {
public PageResult<LocationAreaDO> getLocationAreaSenior(CustomConditions conditions) { public PageResult<LocationAreaDO> getLocationAreaSenior(CustomConditions conditions) {
return locationAreaMapper.selectSenior(conditions); return locationAreaMapper.selectSenior(conditions);
} }
@Override
public LocationAreaDO getByNumber(String number) {
QueryWrapper<LocationAreaDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number",number);
queryWrapper.eq("available","TRUE");
return locationAreaMapper.selectOne(queryWrapper);
}
} }

Loading…
Cancel
Save