Browse Source

Merge branch 'master' of http://dev.ccwin-in.com:3000/tianhe_java/tianhe

# Conflicts:
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java
#	win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java
master
parent
commit
88a5ea139e
  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. 63
      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. 26
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/ItemInLocationController.java
  8. 11
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationBaseVO.java
  9. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationRespVO.java
  10. 139
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/ItemNewTurnInController.java
  11. 56
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInBaseVO.java
  12. 14
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInCreateReqVO.java
  13. 55
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExcelVO.java
  14. 15
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInExportReqVO.java
  15. 17
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInPageReqVO.java
  16. 16
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInRespVO.java
  17. 14
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemnewturnin/vo/ItemNewTurnInUpdateReqVO.java
  18. 27
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/ItemOutLocationController.java
  19. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationBaseVO.java
  20. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationRespVO.java
  21. 37
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/itemnewturnin/ItemNewTurnInConvert.java
  22. 4
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemaccounts/ItemAccountsDO.java
  23. 6
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/iteminlocation/ItemInLocationDO.java
  24. 77
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemnewturnin/ItemNewTurnInDO.java
  25. 5
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemoutlocation/ItemOutLocationDO.java
  26. 33
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemnewturnin/ItemNewTurnInMapper.java
  27. 41
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/enums/itemAccount/ItemAccountStatusEnum.java
  28. 9
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java
  29. 10
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java
  30. 36
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java
  31. 170
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java
  32. 80
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInService.java
  33. 107
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemnewturnin/ItemNewTurnInServiceImpl.java
  34. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java
  35. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java
  36. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java
  37. 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 EQUIPMENT_INDEX_NAME = "equipment_index_name"; //设备年度目标指标名称分类字段
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 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, "数据不能为空");
}

63
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.module.eam.controller.itemaccounts.vo.*;
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.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.location.LocationService;
import com.win.module.eam.service.locationarea.LocationAreaService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
@ -39,6 +45,15 @@ public class ItemAccountsController {
@Resource
private ItemAccountsService itemAccountsService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@Resource
private LocationAreaService locationAreaService;
@PostMapping("/create")
@Operation(summary = "创建备件台账")
@PreAuthorize("@ss.hasPermission('item:itemAccounts:create')")
@ -46,6 +61,20 @@ public class ItemAccountsController {
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")
@Operation(summary = "更新备件台账")
@PreAuthorize("@ss.hasPermission('item:itemAccounts:update')")
@ -87,6 +116,16 @@ public class ItemAccountsController {
public CommonResult<PageResult<ItemAccountsRespVO>> getItemAccountsPage(@Valid ItemAccountsPageReqVO pageVO) {
PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsPage(pageVO);
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);
}
@ -173,6 +212,16 @@ public class ItemAccountsController {
public CommonResult<PageResult<ItemAccountsRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemAccountsDO> pageResult = itemAccountsService.getItemAccountsSenior(conditions);
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);
}
@ -185,4 +234,18 @@ public class ItemAccountsController {
return success(ItemAccountsConvert.INSTANCE.convertList(pageResult));
}
@GetMapping("/getByLocationNumber")
@Operation(summary = "根据库位获取备件台账")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('eam:item-accounts:query')")
public CommonResult<ItemAccountsRespVO> getByLocationNumber(@RequestParam("locationNumber") String locationNumber) {
ItemAccountsDO itemAccounts = itemAccountsService.getByLocationNumber(locationNumber);
ItemAccountsRespVO convert = ItemAccountsConvert.INSTANCE.convert(itemAccounts);
if(convert!=null){
ItemDO itemDO = itemService.getByNumber(itemAccounts.getItemNumber());
convert.setItemName(itemDO==null?"":itemDO.getName());
}
return success(convert);
}
}

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 = "类别")
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 = "是否可用")
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 = "创建时间")
private LocalDateTime createTime;
private String locationName;
private String areaName;
private String itemName;
/**
* 是否显示更换库位按钮
*/
private Boolean display;
}

26
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/ItemInLocationController.java

@ -6,9 +6,14 @@ import com.win.framework.common.pojo.PageResult;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.eam.controller.iteminlocation.vo.*;
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationRespVO;
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO;
import com.win.module.eam.dal.dataobject.location.LocationDO;
import com.win.module.eam.service.item.ItemService;
import com.win.module.eam.service.iteminlocation.ItemInLocationService;
import com.win.module.eam.service.location.LocationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -36,6 +41,12 @@ public class ItemInLocationController {
@Resource
private ItemInLocationService itemInLocationService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@PostMapping("/create")
@Operation(summary = "创建备件入库记录")
@PreAuthorize("@ss.hasPermission('item:itemInLocation:create')")
@ -83,7 +94,14 @@ public class ItemInLocationController {
//@PreAuthorize("@ss.hasPermission('record:item-in-location:query')")
public CommonResult<PageResult<ItemInLocationRespVO>> getItemInLocationPage(@Valid ItemInLocationPageReqVO pageVO) {
PageResult<ItemInLocationDO> pageResult = itemInLocationService.getItemInLocationPage(pageVO);
return success(ItemInLocationConvert.INSTANCE.convertPage(pageResult));
PageResult<ItemInLocationRespVO> result = ItemInLocationConvert.INSTANCE.convertPage(pageResult);
for(ItemInLocationRespVO vo:result.getList()){
// ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
// vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
}
return success(result);
}
@GetMapping("/export-excel")
@ -112,6 +130,12 @@ public class ItemInLocationController {
public CommonResult<PageResult<ItemInLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemInLocationDO> pageResult = itemInLocationService.getItemInLocationSenior(conditions);
PageResult<ItemInLocationRespVO> result = ItemInLocationConvert.INSTANCE.convertPage(pageResult);
for(ItemInLocationRespVO vo:result.getList()){
// ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
// vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
}
return success(result);
}
}

11
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationBaseVO.java

@ -16,11 +16,11 @@ public class ItemInLocationBaseVO {
private Long id;
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "入库编号不能为空")
//@NotNull(message = "入库编号不能为空")
private String number;
@Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "备件编号不能为空")
//@NotNull(message = "备件编号不能为空")
private String itemNumber;
@Schema(description = "库位编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ -33,4 +33,11 @@ public class ItemInLocationBaseVO {
@Schema(description = "数量")
private BigDecimal qty;
@Schema(description = "归还人id")
private String returner;
@Schema(description = "归还人名称")
private String returnName;
}

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationRespVO.java

@ -9,5 +9,7 @@ import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ItemInLocationRespVO extends ItemInLocationBaseVO {
private String itemName;
private String locationName;
}

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 {
}

27
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/ItemOutLocationController.java

@ -5,10 +5,16 @@ import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsRespVO;
import com.win.module.eam.controller.itemoutlocation.vo.*;
import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert;
import com.win.module.eam.dal.dataobject.item.ItemDO;
import com.win.module.eam.dal.dataobject.itemoutlocation.ItemOutLocationDO;
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.itemoutlocation.ItemOutLocationService;
import com.win.module.eam.service.location.LocationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -36,6 +42,12 @@ public class ItemOutLocationController {
@Resource
private ItemOutLocationService itemOutLocationService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@PostMapping("/create")
@Operation(summary = "创建备件出库记录")
@PreAuthorize("@ss.hasPermission('item:itemOutLocation:create')")
@ -83,7 +95,14 @@ public class ItemOutLocationController {
// @PreAuthorize("@ss.hasPermission('record:item-out-location:query')")
public CommonResult<PageResult<ItemOutLocationRespVO>> getItemOutLocationPage(@Valid ItemOutLocationPageReqVO pageVO) {
PageResult<ItemOutLocationDO> pageResult = itemOutLocationService.getItemOutLocationPage(pageVO);
return success(ItemOutLocationConvert.INSTANCE.convertPage(pageResult));
PageResult<ItemOutLocationRespVO> result = ItemOutLocationConvert.INSTANCE.convertPage(pageResult);
for(ItemOutLocationRespVO vo:result.getList()){
ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
}
return success(result);
}
@GetMapping("/export-excel")
@ -112,6 +131,12 @@ public class ItemOutLocationController {
public CommonResult<PageResult<ItemOutLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemOutLocationDO> pageResult = itemOutLocationService.getItemOutLocationSenior(conditions);
PageResult<ItemOutLocationRespVO> result = ItemOutLocationConvert.INSTANCE.convertPage(pageResult);
for(ItemOutLocationRespVO vo:result.getList()){
ItemDO itemDO = itemService.getByNumber(vo.getItemNumber());
vo.setItemName(itemDO.getName());
LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber());
vo.setLocationName(locationDO.getName());
}
return success(result);
}
}

8
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationBaseVO.java

@ -16,7 +16,7 @@ public class ItemOutLocationBaseVO {
private Long id;
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库编号不能为空")
//@NotNull(message = "出库编号不能为空")
private String number;
@Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ -33,4 +33,10 @@ public class ItemOutLocationBaseVO {
@Schema(description = "数量")
private BigDecimal qty;
@Schema(description = "领用人id")
private String receiver;
@Schema(description = "领用人名称")
private String receiveName;
}

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationRespVO.java

@ -9,5 +9,6 @@ import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ItemOutLocationRespVO extends ItemOutLocationBaseVO {
private String itemName;
private String locationName;
}

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账外
*/
private String isInAccount;
/**
* 库位类型
*/
private String type;
/**
* 地点ID
*/

6
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/iteminlocation/ItemInLocationDO.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import com.win.framework.mybatis.core.dataobject.BaseDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.math.BigDecimal;
@ -35,10 +36,15 @@ public class ItemInLocationDO extends BaseDO {
* 备件编号
*/
private String itemNumber;
/**
* 库位编号
*/
private String locationNumber;
/**
* 归还人
*/
private String returner;
/**
* 入库类型
*/

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;
}

5
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemoutlocation/ItemOutLocationDO.java

@ -35,6 +35,7 @@ public class ItemOutLocationDO extends BaseDO {
* 备件编号
*/
private String itemNumber;
/**
* 库位编号
*/
@ -47,6 +48,10 @@ public class ItemOutLocationDO extends BaseDO {
* 数量
*/
private BigDecimal qty;
/**
* 领用人id
*/
private String receiver;
/**
* 地点ID
*/

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;
}
}

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

@ -135,5 +135,14 @@ public interface ItemService {
* @param updatePart 是否支持更新
* @return 导入结果
*/
public List<ItemExcelVO> importItemList(List<ItemExcelVO> datas, Integer mode, boolean updatePart);
/**
*根据备件编码查询备件信息
* @param number
* @return
*/
ItemDO getByNumber(String number);
public List<ItemImportErrorVO> importItemList(List<ItemImportExcelVo> importItembasics, Integer mode, boolean updatePart);
}

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

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

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

@ -6,6 +6,7 @@ import com.win.module.eam.controller.itemaccounts.vo.*;
import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -25,6 +26,20 @@ public interface ItemAccountsService {
*/
Long createItemAccounts(@Valid ItemAccountsCreateReqVO createReqVO);
/**
* 新增入库只能新增账内和新到货
* @param createReqVO
* @return
*/
Long createIn(@Valid ItemAccountsCreateReqVO createReqVO);
/**
* 新到货转账内
* @param createReqVO
* @return
*/
Long newTurnIn(@Valid ItemAccountsCreateReqVO createReqVO);
/**
* 更新备件台账
*
@ -47,6 +62,13 @@ public interface ItemAccountsService {
*/
ItemAccountsDO getItemAccounts(Long id);
/**
* 根据库位编码查询备件信息
* @param locationNumber
* @return
*/
ItemAccountsDO getByLocationNumber(String locationNumber);
/**
* 获得备件台账列表
*
@ -118,4 +140,18 @@ public interface ItemAccountsService {
* @return 备件不分页
*/
List<ItemAccountsDO> getItemAccountsNoPage(ItemAccountsPageReqVO pageReqVO);
/**
* 根据当前备件编码查询所有库存是否为0
* @param number
* @return
*/
Boolean qtyZore(String number);
/**
* 根据库位编码查询备件所有库存
* @param locationNumber
* @return
*/
BigDecimal getAllByLocation(String locationNumber);
}

170
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.module.eam.controller.itemaccounts.vo.*;
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.itemaccounts.ItemAccountsDO;
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.mysql.item.ItemMapper;
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.itemnewturnin.ItemNewTurnInMapper;
import com.win.module.eam.dal.mysql.location.LocationMapper;
import com.win.module.eam.enums.basic.BooleanTypeEnum;
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -30,8 +34,9 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_CAN_NOT_REPLACE;
import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_CAN_NOT_REPLACE2;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.eam.enums.ErrorCodeConstants.*;
import static com.win.module.eam.enums.ErrorCodeConstants.CLASSTYPR_NO_NOMAL;
/**
* 备件台账 Service 实现类
@ -54,13 +59,115 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
@Resource
private ItemMapper itemMapper;
@Resource
private ItemNewTurnInMapper itemNewTurnInMapper;
@Override
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);
itemAccountsMapper.insert(itemAccounts);
// 返回
return itemAccounts.getId();
id = 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
@ -91,6 +198,22 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
return itemAccountsMapper.selectById(id);
}
@Override
public ItemAccountsDO getByLocationNumber(String locationNumber) {
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_number",locationNumber);
queryWrapper.eq("available","TRUE");
List<ItemAccountsDO> itemAccountsDOS = itemAccountsMapper.selectList(queryWrapper);
if(itemAccountsDOS.isEmpty()){
return new ItemAccountsDO();
}else{//有数据查询所有的库存
ItemAccountsDO itemAccountsDO = itemAccountsDOS.get(0);
BigDecimal allByLocation = getAllByLocation(locationNumber);
itemAccountsDO.setQty(allByLocation);
return itemAccountsDO;
}
}
@Override
public List<ItemAccountsDO> getItemAccountsList(Collection<Long> ids) {
return itemAccountsMapper.selectBatchIds(ids);
@ -233,4 +356,43 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
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;
}
}
@Override
public BigDecimal getAllByLocation(String locationNumber) {
BigDecimal qty = BigDecimal.ZERO;
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("location_number",locationNumber);
queryWrapper.eq("available","TRUE");
List<ItemAccountsDO> itemDOS = itemAccountsMapper.selectList(queryWrapper);
for(ItemAccountsDO en:itemDOS){
qty = qty.add(en.getQty());
}
return qty;
}
/**
* 新增校验备件编号+类型+库位编码唯一
*/
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

@ -5,6 +5,7 @@ import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.item.vo.ItemImportErrorVO;
import com.win.module.eam.controller.item.vo.ItemImportExcelVo;
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 javax.validation.Valid;
@ -120,4 +121,11 @@ public interface LocationService {
* @return 导入结果
*/
List<LocationImportErrorVO> importLocationList(List<LocationImportExcelVo> importItembasics, Integer mode, boolean updatePart);
/**
*根据编码查询信息
* @param number
* @return
*/
LocationDO getByNumber(String number);
}

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

@ -261,5 +261,13 @@ public class LocationServiceImpl implements LocationService {
}
return massage.toString();
}
@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

@ -5,6 +5,7 @@ import com.win.framework.common.pojo.PageResult;
import com.win.module.eam.controller.item.vo.ItemImportErrorVO;
import com.win.module.eam.controller.item.vo.ItemImportExcelVo;
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 javax.validation.Valid;
@ -89,4 +90,11 @@ public interface LocationAreaService {
* @return 导入结果
*/
public List<LocationAreaImportErrorVO> importLocationAreaList(List<LocationAreaImportExcelVO> importLocationAreabasics, Integer mode, boolean updatePart);
/**
*根据编码查询信息
* @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

@ -166,4 +166,12 @@ public class LocationAreaServiceImpl implements LocationAreaService {
}
return massage.toString();
}
@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