Browse Source

备件归还 备件出库

master
songguoqiang 6 months ago
parent
commit
b49a2d8bd6
  1. 16
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java
  2. 26
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/ItemInLocationController.java
  3. 11
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationBaseVO.java
  4. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationRespVO.java
  5. 27
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/ItemOutLocationController.java
  6. 8
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationBaseVO.java
  7. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationRespVO.java
  8. 6
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/iteminlocation/ItemInLocationDO.java
  9. 5
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/dataobject/itemoutlocation/ItemOutLocationDO.java
  10. 15
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java
  11. 29
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java

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

@ -219,6 +219,8 @@ public class ItemAccountsController {
vo.setLocationName(locationDO.getName()); vo.setLocationName(locationDO.getName());
LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber()); LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber());
vo.setAreaName(locationAreaDO.getName()); vo.setAreaName(locationAreaDO.getName());
Boolean b = itemAccountsService.qtyZore(vo.getItemNumber());
vo.setDisplay(b);
} }
return success(result); return success(result);
} }
@ -232,4 +234,18 @@ public class ItemAccountsController {
return success(ItemAccountsConvert.INSTANCE.convertList(pageResult)); 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);
}
} }

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.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.iteminlocation.vo.*; 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.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.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.iteminlocation.ItemInLocationService;
import com.win.module.eam.service.location.LocationService;
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.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -36,6 +41,12 @@ public class ItemInLocationController {
@Resource @Resource
private ItemInLocationService itemInLocationService; private ItemInLocationService itemInLocationService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建备件入库记录") @Operation(summary = "创建备件入库记录")
@PreAuthorize("@ss.hasPermission('item:itemInLocation:create')") @PreAuthorize("@ss.hasPermission('item:itemInLocation:create')")
@ -83,7 +94,14 @@ public class ItemInLocationController {
//@PreAuthorize("@ss.hasPermission('record:item-in-location:query')") //@PreAuthorize("@ss.hasPermission('record:item-in-location:query')")
public CommonResult<PageResult<ItemInLocationRespVO>> getItemInLocationPage(@Valid ItemInLocationPageReqVO pageVO) { public CommonResult<PageResult<ItemInLocationRespVO>> getItemInLocationPage(@Valid ItemInLocationPageReqVO pageVO) {
PageResult<ItemInLocationDO> pageResult = itemInLocationService.getItemInLocationPage(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") @GetMapping("/export-excel")
@ -112,6 +130,12 @@ public class ItemInLocationController {
public CommonResult<PageResult<ItemInLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) { public CommonResult<PageResult<ItemInLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemInLocationDO> pageResult = itemInLocationService.getItemInLocationSenior(conditions); PageResult<ItemInLocationDO> pageResult = itemInLocationService.getItemInLocationSenior(conditions);
PageResult<ItemInLocationRespVO> result = 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); 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; private Long id;
@Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "入库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "入库编号不能为空") //@NotNull(message = "入库编号不能为空")
private String number; private String number;
@Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "备件编号不能为空") //@NotNull(message = "备件编号不能为空")
private String itemNumber; private String itemNumber;
@Schema(description = "库位编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "库位编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ -33,4 +33,11 @@ public class ItemInLocationBaseVO {
@Schema(description = "数量") @Schema(description = "数量")
private BigDecimal qty; 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) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class ItemInLocationRespVO extends ItemInLocationBaseVO { public class ItemInLocationRespVO extends ItemInLocationBaseVO {
private String itemName;
private String locationName;
} }

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.common.pojo.PageResult;
import com.win.framework.excel.core.util.ExcelUtils; 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.ItemAccountsRespVO;
import com.win.module.eam.controller.itemoutlocation.vo.*; import com.win.module.eam.controller.itemoutlocation.vo.*;
import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert; 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.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.itemoutlocation.ItemOutLocationService;
import com.win.module.eam.service.location.LocationService;
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.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -36,6 +42,12 @@ public class ItemOutLocationController {
@Resource @Resource
private ItemOutLocationService itemOutLocationService; private ItemOutLocationService itemOutLocationService;
@Resource
private ItemService itemService;
@Resource
private LocationService locationService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建备件出库记录") @Operation(summary = "创建备件出库记录")
@PreAuthorize("@ss.hasPermission('item:itemOutLocation:create')") @PreAuthorize("@ss.hasPermission('item:itemOutLocation:create')")
@ -83,7 +95,14 @@ public class ItemOutLocationController {
// @PreAuthorize("@ss.hasPermission('record:item-out-location:query')") // @PreAuthorize("@ss.hasPermission('record:item-out-location:query')")
public CommonResult<PageResult<ItemOutLocationRespVO>> getItemOutLocationPage(@Valid ItemOutLocationPageReqVO pageVO) { public CommonResult<PageResult<ItemOutLocationRespVO>> getItemOutLocationPage(@Valid ItemOutLocationPageReqVO pageVO) {
PageResult<ItemOutLocationDO> pageResult = itemOutLocationService.getItemOutLocationPage(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") @GetMapping("/export-excel")
@ -112,6 +131,12 @@ public class ItemOutLocationController {
public CommonResult<PageResult<ItemOutLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) { public CommonResult<PageResult<ItemOutLocationRespVO>> getLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<ItemOutLocationDO> pageResult = itemOutLocationService.getItemOutLocationSenior(conditions); PageResult<ItemOutLocationDO> pageResult = itemOutLocationService.getItemOutLocationSenior(conditions);
PageResult<ItemOutLocationRespVO> result = 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); 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; private Long id;
@Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "出库编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出库编号不能为空") //@NotNull(message = "出库编号不能为空")
private String number; private String number;
@Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "备件编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ -33,4 +33,10 @@ public class ItemOutLocationBaseVO {
@Schema(description = "数量") @Schema(description = "数量")
private BigDecimal qty; 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) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class ItemOutLocationRespVO extends ItemOutLocationBaseVO { public class ItemOutLocationRespVO extends ItemOutLocationBaseVO {
private String itemName;
private String locationName;
} }

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

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

15
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 com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO;
import javax.validation.Valid; import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -61,6 +62,13 @@ public interface ItemAccountsService {
*/ */
ItemAccountsDO getItemAccounts(Long id); ItemAccountsDO getItemAccounts(Long id);
/**
* 根据库位编码查询备件信息
* @param locationNumber
* @return
*/
ItemAccountsDO getByLocationNumber(String locationNumber);
/** /**
* 获得备件台账列表 * 获得备件台账列表
* *
@ -139,4 +147,11 @@ public interface ItemAccountsService {
* @return * @return
*/ */
Boolean qtyZore(String number); Boolean qtyZore(String number);
/**
* 根据库位编码查询备件所有库存
* @param locationNumber
* @return
*/
BigDecimal getAllByLocation(String locationNumber);
} }

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

@ -198,6 +198,22 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
return itemAccountsMapper.selectById(id); 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 @Override
public List<ItemAccountsDO> getItemAccountsList(Collection<Long> ids) { public List<ItemAccountsDO> getItemAccountsList(Collection<Long> ids) {
return itemAccountsMapper.selectBatchIds(ids); return itemAccountsMapper.selectBatchIds(ids);
@ -354,6 +370,19 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
} }
} }
@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;
}
/** /**
* 新增校验备件编号+类型+库位编码唯一 * 新增校验备件编号+类型+库位编码唯一
*/ */

Loading…
Cancel
Save