Browse Source

备件台账查询方法

master
songguoqiang 6 months ago
parent
commit
f96069bcfe
  1. 17
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java
  2. 3
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemoutlocation/vo/ItemOutLocationBaseVO.java
  3. 7
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java
  4. 35
      win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java

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

@ -5,7 +5,9 @@ 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.item.vo.ItemRespVO;
import com.win.module.eam.controller.itemaccounts.vo.*;
import com.win.module.eam.convert.item.ItemConvert;
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;
@ -244,6 +246,21 @@ public class ItemAccountsController {
if(convert!=null){
ItemDO itemDO = itemService.getByNumber(itemAccounts.getItemNumber());
convert.setItemName(itemDO==null?"":itemDO.getName());
convert.setLocationNumber(locationNumber);
}
return success(convert);
}
@GetMapping("/getByItemNumber")
@Operation(summary = "根据备件编码查询库位信息")
// @PreAuthorize("@ss.hasPermission('basic:item:query')")
public CommonResult<ItemAccountsRespVO> scanCodeByNumber(@RequestParam("itemNumber") String itemNumber) {
ItemAccountsRespVO convert = ItemAccountsConvert.INSTANCE.convert(itemAccountsService.getByItemNumber(itemNumber));
if(convert!=null){
ItemDO itemDO = itemService.getByNumber(itemNumber);
convert.setItemName(itemDO==null?"":itemDO.getName());
convert.setItemNumber(itemNumber);
}
return success(convert);
}

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

@ -39,4 +39,7 @@ public class ItemOutLocationBaseVO {
@Schema(description = "领用人名称")
private String receiveName;
// @Schema(description = "库区", requiredMode = Schema.RequiredMode.REQUIRED)
// private String areaNumber;
}

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

@ -69,6 +69,13 @@ public interface ItemAccountsService {
*/
ItemAccountsDO getByLocationNumber(String locationNumber);
/**
* 根据备件号查询库位信息
* @param itemNumber
* @return
*/
ItemAccountsDO getByItemNumber(String itemNumber);
/**
* 获得备件台账列表
*

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

@ -81,6 +81,8 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
itemAccountsMapper.insert(itemAccounts);
id = itemAccounts.getId();
}
return id;
}
@ -159,13 +161,16 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
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);
}
// if(qty.compareTo(newqty) == 0){//等于删除
// itemAccountsMapper.deleteById(createReqVO.getId());
// }else{//更新数量
// BigDecimal difference = qty.subtract(newqty);
// itemAccountsDO.setQty(difference);
// itemAccountsMapper.updateById(itemAccountsDO);
// }
BigDecimal difference = qty.subtract(newqty);
itemAccountsDO.setQty(difference);
itemAccountsMapper.updateById(itemAccountsDO);
//itemAccountsMapper.deleteById(createReqVO.getId());
return id;
}
@ -214,6 +219,22 @@ public class ItemAccountsServiceImpl implements ItemAccountsService {
}
}
@Override
public ItemAccountsDO getByItemNumber(String itemNumber) {
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("item_number",itemNumber);
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(itemAccountsDO.getLocationNumber());
itemAccountsDO.setQty(allByLocation);
return itemAccountsDO;
}
}
@Override
public List<ItemAccountsDO> getItemAccountsList(Collection<Long> ids) {
return itemAccountsMapper.selectBatchIds(ids);

Loading…
Cancel
Save