Browse Source

出库事务分类+备件归还多种备件操作可以

master
songguoqiang 6 months ago
parent
commit
f0e3c1c7e1
  1. 7
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/ItemInLocationController.java
  2. 4
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationBaseVO.java
  3. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationCreateReqVO.java
  4. 7
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/ItemOutLocationController.java
  5. 4
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationBaseVO.java
  6. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationCreateReqVO.java
  7. 1
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/iteminlocation/ItemInLocationService.java
  8. 49
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/iteminlocation/ItemInLocationServiceImpl.java
  9. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationService.java
  10. 48
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationServiceImpl.java
  11. 2
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/transaction/TransactionServiceImpl.java
  12. 2
      win-server/src/main/resources/application.yaml

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

@ -56,6 +56,13 @@ public class ItemInLocationController {
return success(itemInLocationService.createItemInLocation(createReqVO)); return success(itemInLocationService.createItemInLocation(createReqVO));
} }
@PostMapping("/createPDA")
@Operation(summary = "PDA创建备件入库记录")
@PreAuthorize("@ss.hasPermission('item:itemInLocation:create')")
public CommonResult<Long> createPDA(@Valid @RequestBody ItemInLocationCreateReqVO createReqVO) {
return success(itemInLocationService.createPDA(createReqVO));
}
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新备件入库记录") @Operation(summary = "更新备件入库记录")
@PreAuthorize("@ss.hasPermission('item:itemInLocation:update')") @PreAuthorize("@ss.hasPermission('item:itemInLocation:update')")

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

@ -24,7 +24,7 @@ public class ItemInLocationBaseVO {
private String itemNumber; private String itemNumber;
@Schema(description = "库位编号", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "库位编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "库位编号不能为空") //@NotNull(message = "库位编号不能为空")
private String locationNumber; private String locationNumber;
@Schema(description = "入库类型", example = "1") @Schema(description = "入库类型", example = "1")
@ -34,7 +34,7 @@ public class ItemInLocationBaseVO {
private BigDecimal qty; private BigDecimal qty;
@Schema(description = "归还人id") @Schema(description = "归还人")
private String returner; private String returner;
@Schema(description = "归还人名称") @Schema(description = "归还人名称")

3
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/iteminlocation/vo/ItemInLocationCreateReqVO.java

@ -11,4 +11,7 @@ import javax.validation.constraints.*;
@ToString(callSuper = true) @ToString(callSuper = true)
public class ItemInLocationCreateReqVO extends ItemInLocationBaseVO { public class ItemInLocationCreateReqVO extends ItemInLocationBaseVO {
private String areaNumber; private String areaNumber;
@Schema(description = "库位备件和数量")
private List<Map<String, Object>> itemNumbers;
} }

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

@ -58,6 +58,13 @@ public class ItemOutLocationController {
return success(itemOutLocationService.createItemOutLocation(createReqVO)); return success(itemOutLocationService.createItemOutLocation(createReqVO));
} }
@PostMapping("/createPDA")
@Operation(summary = "PDA创建备件出库记录")
@PreAuthorize("@ss.hasPermission('item:itemOutLocation:create')")
public CommonResult<Long> createPDA(@Valid @RequestBody ItemOutLocationCreateReqVO createReqVO) {
return success(itemOutLocationService.createPDA(createReqVO));
}
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新备件出库记录") @Operation(summary = "更新备件出库记录")
@PreAuthorize("@ss.hasPermission('item:itemOutLocation:update')") @PreAuthorize("@ss.hasPermission('item:itemOutLocation:update')")

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

@ -20,11 +20,11 @@ public class ItemOutLocationBaseVO {
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)
@NotNull(message = "库位编号不能为空") //@NotNull(message = "库位编号不能为空")
private String locationNumber; private String locationNumber;
@Schema(description = "出库类型", example = "1") @Schema(description = "出库类型", example = "1")

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

@ -12,4 +12,7 @@ import javax.validation.constraints.*;
public class ItemOutLocationCreateReqVO extends ItemOutLocationBaseVO { public class ItemOutLocationCreateReqVO extends ItemOutLocationBaseVO {
private String areaNumber; private String areaNumber;
@Schema(description = "库位备件和数量")
private List<Map<String, Object>> itemNumbers;
} }

1
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/iteminlocation/ItemInLocationService.java

@ -26,6 +26,7 @@ public interface ItemInLocationService {
* @return 编号 * @return 编号
*/ */
Long createItemInLocation(@Valid ItemInLocationCreateReqVO createReqVO); Long createItemInLocation(@Valid ItemInLocationCreateReqVO createReqVO);
Long createPDA(@Valid ItemInLocationCreateReqVO createReqVO);
/** /**
* 更新备件入库记录 * 更新备件入库记录

49
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/iteminlocation/ItemInLocationServiceImpl.java

@ -1,5 +1,6 @@
package com.win.module.eam.service.iteminlocation; package com.win.module.eam.service.iteminlocation;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.iteminlocation.vo.ItemInLocationCreateReqVO; import com.win.module.eam.controller.iteminlocation.vo.ItemInLocationCreateReqVO;
@ -9,8 +10,10 @@ import com.win.module.eam.controller.iteminlocation.vo.ItemInLocationUpdateReqVO
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert; import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert;
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.itemorder.ItemOrderDetailDO;
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.iteminlocation.ItemInLocationMapper; import com.win.module.eam.dal.mysql.iteminlocation.ItemInLocationMapper;
import com.win.module.eam.dal.mysql.location.LocationMapper;
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum; import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum;
import com.win.module.eam.enums.transaction.TransactionEnum; import com.win.module.eam.enums.transaction.TransactionEnum;
import com.win.module.eam.service.transaction.TransactionService; import com.win.module.eam.service.transaction.TransactionService;
@ -19,9 +22,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@ -42,6 +47,9 @@ public class ItemInLocationServiceImpl implements ItemInLocationService {
@Resource @Resource
private TransactionService transactionService; private TransactionService transactionService;
@Resource
private LocationMapper locationMapper;
@Override @Override
@Transactional @Transactional
public Long createItemInLocation(ItemInLocationCreateReqVO createReqVO) { public Long createItemInLocation(ItemInLocationCreateReqVO createReqVO) {
@ -69,6 +77,47 @@ public class ItemInLocationServiceImpl implements ItemInLocationService {
return itemInLocation.getId(); return itemInLocation.getId();
} }
@Override
@Transactional
public Long createPDA(ItemInLocationCreateReqVO createReqVO) {
long i=0l;
List<Map<String, Object>> itemList = createReqVO.getItemNumbers();//备件号集合
List<TransactionCreateReqVO> list = new ArrayList<>();
if(createReqVO.getItemNumbers()!=null&& !createReqVO.getItemNumbers().isEmpty()){
for (Map<String, Object> map : itemList) {
String itemNumber = map.get("itemNumber").toString();//备件号
String qty = map.get("qty").toString();//入库数量
String locationNumber = map.get("locationNumber").toString();//库位
LocationDO byNumber = locationMapper.getByNumber(locationNumber);
// 插入
createReqVO.setAreaNumber(byNumber.getAreaNumber());
createReqVO.setItemNumber(itemNumber);
createReqVO.setLocationNumber(locationNumber);
createReqVO.setQty(new BigDecimal(qty));
ItemInLocationDO itemInLocation = ItemInLocationConvert.INSTANCE.convert(createReqVO);
itemInLocation.setType(TransactionEnum.RETURN_IN.getCode());
itemInLocationMapper.insert(itemInLocation);
i = itemInLocation.getId();
//添加库存事务
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
transactionCreateReqVO.setItemNumber(createReqVO.getItemNumber());
transactionCreateReqVO.setLocationNumber(createReqVO.getLocationNumber());
transactionCreateReqVO.setAreaNumber(createReqVO.getAreaNumber());
transactionCreateReqVO.setTransactionType("IN");
transactionCreateReqVO.setQty(createReqVO.getQty());
transactionCreateReqVO.setDescribes("备件归还");//描述
transactionCreateReqVO.setOperator(createReqVO.getReturner());
transactionCreateReqVO.setCreator(getLoginUserId().toString());
transactionCreateReqVO.setAssociatedNumber(null);
transactionCreateReqVO.setInventoryAction(TransactionEnum.RETURN_IN.getCode());
transactionCreateReqVO.setType(ItemAccountStatusEnum.OUT.getCode());
list.add(transactionCreateReqVO);
}
transactionService.create(list);
}
return i;
}
@Override @Override
public Integer updateItemInLocation(ItemInLocationUpdateReqVO updateReqVO) { public Integer updateItemInLocation(ItemInLocationUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationService.java

@ -27,6 +27,8 @@ public interface ItemOutLocationService {
*/ */
Long createItemOutLocation(@Valid ItemOutLocationCreateReqVO createReqVO); Long createItemOutLocation(@Valid ItemOutLocationCreateReqVO createReqVO);
Long createPDA(@Valid ItemOutLocationCreateReqVO createReqVO);
/** /**
* 更新备件出库记录 * 更新备件出库记录
* *

48
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemoutlocation/ItemOutLocationServiceImpl.java

@ -7,10 +7,13 @@ import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationExportReq
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationPageReqVO; import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationPageReqVO;
import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationUpdateReqVO; import com.win.module.eam.controller.itemoutlocation.vo.ItemOutLocationUpdateReqVO;
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert;
import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert; import com.win.module.eam.convert.itemoutlocation.ItemOutLocationConvert;
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO;
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.location.LocationDO;
import com.win.module.eam.dal.mysql.itemoutlocation.ItemOutLocationMapper; import com.win.module.eam.dal.mysql.itemoutlocation.ItemOutLocationMapper;
import com.win.module.eam.dal.mysql.location.LocationMapper;
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum; import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum;
import com.win.module.eam.enums.transaction.TransactionEnum; import com.win.module.eam.enums.transaction.TransactionEnum;
import com.win.module.eam.service.transaction.TransactionService; import com.win.module.eam.service.transaction.TransactionService;
@ -19,9 +22,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@ -42,6 +47,9 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService {
@Resource @Resource
private TransactionService transactionService; private TransactionService transactionService;
@Resource
private LocationMapper locationMapper;
@Override @Override
@Transactional @Transactional
public Long createItemOutLocation(ItemOutLocationCreateReqVO createReqVO) { public Long createItemOutLocation(ItemOutLocationCreateReqVO createReqVO) {
@ -69,6 +77,46 @@ public class ItemOutLocationServiceImpl implements ItemOutLocationService {
return itemOutLocation.getId(); return itemOutLocation.getId();
} }
@Override
public Long createPDA(ItemOutLocationCreateReqVO createReqVO) {
long i=0l;
List<Map<String, Object>> itemList = createReqVO.getItemNumbers();//备件号集合
List<TransactionCreateReqVO> list = new ArrayList<>();
if(createReqVO.getItemNumbers()!=null&& !createReqVO.getItemNumbers().isEmpty()){
for (Map<String, Object> map : itemList) {
String itemNumber = map.get("itemNumber").toString();//备件号
String qty = map.get("qty").toString();//入库数量
String locationNumber = map.get("locationNumber").toString();//库位
LocationDO byNumber = locationMapper.getByNumber(locationNumber);
// 插入
createReqVO.setAreaNumber(byNumber.getAreaNumber());
createReqVO.setItemNumber(itemNumber);
createReqVO.setLocationNumber(locationNumber);
createReqVO.setQty(new BigDecimal(qty));
ItemOutLocationDO outLocationDO = ItemOutLocationConvert.INSTANCE.convert(createReqVO);
outLocationDO.setType(TransactionEnum.RETURN_IN.getCode());
itemOutLocationMapper.insert(outLocationDO);
i = outLocationDO.getId();
//添加库存事务
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
transactionCreateReqVO.setItemNumber(createReqVO.getItemNumber());
transactionCreateReqVO.setLocationNumber(createReqVO.getLocationNumber());
transactionCreateReqVO.setAreaNumber(createReqVO.getAreaNumber());
transactionCreateReqVO.setTransactionType("OUT");
transactionCreateReqVO.setQty(createReqVO.getQty());
transactionCreateReqVO.setDescribes("备件出库");//描述
transactionCreateReqVO.setOperator(createReqVO.getReceiver());
transactionCreateReqVO.setCreator(getLoginUserId().toString());
transactionCreateReqVO.setAssociatedNumber(null);
transactionCreateReqVO.setInventoryAction(TransactionEnum.REQUISITION_OUT.getCode());
transactionCreateReqVO.setType(ItemAccountStatusEnum.IN.getCode());
list.add(transactionCreateReqVO);
}
transactionService.create(list);
}
return i;
}
@Override @Override
public Integer updateItemOutLocation(ItemOutLocationUpdateReqVO updateReqVO) { public Integer updateItemOutLocation(ItemOutLocationUpdateReqVO updateReqVO) {
// 校验存在 // 校验存在

2
win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/transaction/TransactionServiceImpl.java

@ -75,7 +75,7 @@ public class TransactionServiceImpl implements TransactionService {
for(TransactionDO en:transactionDOS){//循环出库存记录 for(TransactionDO en:transactionDOS){//循环出库存记录
TransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createReqVO); TransactionDO transactionDO = TransactionConvert.INSTANCE.convert(createReqVO);
transactionDO.setType(en.getType()); transactionDO.setType(en.getType());
transactionDO.setInventoryAction(en.getInventoryAction()); transactionDO.setInventoryAction(en.getInventoryAction()==null?transactionDO.getInventoryAction():en.getInventoryAction());
transactionDO.setQty(en.getQty()); transactionDO.setQty(en.getQty());
result += Mapper.insert(transactionDO); result += Mapper.insert(transactionDO);
} }

2
win-server/src/main/resources/application.yaml

@ -8,7 +8,7 @@ spring:
profiles: profiles:
include: druid include: druid
active: prod active: test
main: main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。

Loading…
Cancel
Save