Browse Source

[fix]

仓库管理 库存报损
新增库存报损service及其接口按生产单号查找报损物料方法;
修改库存报损VO类,修改物料数合计和数量合计字段类型;
新增获取当前登录部门名称controller接口;
新增获取生产单关联仓库库存报损物料列表接口;
修改查询库存报损列表service接口,同时查询子表信息赋值给列表;
修改新增库存报损service接口,补全字段;
dev
王晓迪 3 months ago
parent
commit
77eb915a61
  1. 45
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryReportDamageController.java
  2. 13
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java
  3. 4
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryReportDamageService.java
  4. 40
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryReportDamageServiceImpl.java

45
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryReportDamageController.java

@ -1,15 +1,22 @@
package com.ruoyi.warehouse.controller; package com.ruoyi.warehouse.controller;
import java.util.List; import java.util.List;
import com.ruoyi.ck.utils.Result;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage; import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage;
@ -19,6 +26,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import javax.servlet.http.HttpServletRequest;
/** /**
* 仓库库存报损Controller * 仓库库存报损Controller
* *
@ -34,6 +43,12 @@ public class WarehouseInventoryReportDamageController extends BaseController
@Autowired @Autowired
private IWarehouseInventoryReportDamageService warehouseInventoryReportDamageService; private IWarehouseInventoryReportDamageService warehouseInventoryReportDamageService;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
@RequiresPermissions("warehouse:inventoryReportDamage:view") @RequiresPermissions("warehouse:inventoryReportDamage:view")
@GetMapping() @GetMapping()
public String inventoryReportDamage() public String inventoryReportDamage()
@ -84,7 +99,7 @@ public class WarehouseInventoryReportDamageController extends BaseController
@Log(title = "仓库库存报损", businessType = BusinessType.INSERT) @Log(title = "仓库库存报损", businessType = BusinessType.INSERT)
@PostMapping("/add") @PostMapping("/add")
@ResponseBody @ResponseBody
public AjaxResult addSave(WarehouseInventoryReportDamage warehouseInventoryReportDamage) public AjaxResult addSave(@RequestBody WarehouseInventoryReportDamage warehouseInventoryReportDamage)
{ {
return toAjax(warehouseInventoryReportDamageService.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage)); return toAjax(warehouseInventoryReportDamageService.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage));
} }
@ -136,5 +151,23 @@ public class WarehouseInventoryReportDamageController extends BaseController
return toAjax(warehouseInventoryReportDamageService.updateWarehouseInventoryReportDamage(warehouseInventoryReportDamage)); return toAjax(warehouseInventoryReportDamageService.updateWarehouseInventoryReportDamage(warehouseInventoryReportDamage));
} }
@GetMapping("/getUserDeptName")
@ResponseBody
public Result getUserDeptName(HttpServletRequest request) throws Exception {
SysUser curUser = ShiroUtils.getSysUser();
SysDept dept = sysDeptMapper.selectDeptById(curUser.getDeptId());
return Result.getSuccessResult(dept.getDeptName());
}
/**
* 仓库库存报损物料列表生产单关联
*/
@GetMapping("/materialInMakeOrderSelect/{makeNo}")
public String materialInMakeOrderSelect(@PathVariable("makeNo") String makeNo, ModelMap mmap)
{
List<WarehouseMaterialVO> warehouseMaterialVOS = warehouseInventoryReportDamageService.getMaterialListByMakeNo(makeNo);
mmap.put("materialList", warehouseMaterialVOS);
return "/warehouse/inventoryCheck/materialSelect";
}
} }

13
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryReportDamage.java

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.domain; package com.ruoyi.warehouse.domain;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -57,11 +58,11 @@ public class WarehouseInventoryReportDamage extends BaseEntity
/** 物料数合计 */ /** 物料数合计 */
@Excel(name = "物料数合计") @Excel(name = "物料数合计")
private String materialTotal; private int materialTotal;
/** 数量合计 */ /** 数量合计 */
@Excel(name = "数量合计") @Excel(name = "数量合计")
private String numTotal; private BigDecimal numTotal;
/** 仓库ID */ /** 仓库ID */
@Excel(name = "仓库ID") @Excel(name = "仓库ID")
@ -186,21 +187,21 @@ public class WarehouseInventoryReportDamage extends BaseEntity
{ {
return materialName; return materialName;
} }
public void setMaterialTotal(String materialTotal) public void setMaterialTotal(int materialTotal)
{ {
this.materialTotal = materialTotal; this.materialTotal = materialTotal;
} }
public String getMaterialTotal() public int getMaterialTotal()
{ {
return materialTotal; return materialTotal;
} }
public void setNumTotal(String numTotal) public void setNumTotal(BigDecimal numTotal)
{ {
this.numTotal = numTotal; this.numTotal = numTotal;
} }
public String getNumTotal() public BigDecimal getNumTotal()
{ {
return numTotal; return numTotal;
} }

4
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseInventoryReportDamageService.java

@ -1,6 +1,8 @@
package com.ruoyi.warehouse.service; package com.ruoyi.warehouse.service;
import java.util.List; import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage; import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage;
/** /**
@ -72,4 +74,6 @@ public interface IWarehouseInventoryReportDamageService
* @return * @return
*/ */
int restoreWarehouseInventoryReportDamageById(Long reportDamageId); int restoreWarehouseInventoryReportDamageById(Long reportDamageId);
public List<WarehouseMaterialVO> getMaterialListByMakeNo(String makeNo);
} }

40
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryReportDamageServiceImpl.java

@ -1,5 +1,6 @@
package com.ruoyi.warehouse.service.impl; package com.ruoyi.warehouse.service.impl;
import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -10,7 +11,12 @@ import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.erp.domain.ErpMaterialVo;
import com.ruoyi.system.domain.SysMakeorderBom;
import com.ruoyi.system.mapper.SysMakeorderBomMapper;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild; import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryReportDamageChildMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService; import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -35,6 +41,11 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
@Autowired @Autowired
private IWarehouseInventoryReportDamageChildService warehouseInventoryReportDamageChildService; private IWarehouseInventoryReportDamageChildService warehouseInventoryReportDamageChildService;
@Autowired
private WarehouseInventoryReportDamageChildMapper damageChildMapper;
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
/** /**
* 查询仓库库存报损 * 查询仓库库存报损
* *
@ -44,7 +55,12 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
@Override @Override
public WarehouseInventoryReportDamage selectWarehouseInventoryReportDamageById(Long reportDamageId) public WarehouseInventoryReportDamage selectWarehouseInventoryReportDamageById(Long reportDamageId)
{ {
return warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId); WarehouseInventoryReportDamage warehouseInventoryReportDamage = warehouseInventoryReportDamageMapper.selectWarehouseInventoryReportDamageById(reportDamageId);
List<WarehouseInventoryReportDamageChild> reportDamageChildList = damageChildMapper.selectWarehouseInventoryReportDamageChildByCode(warehouseInventoryReportDamage.getReportDamageCode());
if(StringUtils.isNotEmpty(reportDamageChildList)){
warehouseInventoryReportDamage.setWarehouseInventoryReportDamageChildList(reportDamageChildList);
}
return warehouseInventoryReportDamage;
} }
/** /**
@ -79,11 +95,14 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate()); warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate());
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
warehouseInventoryReportDamage.setCreateBy(loginName); warehouseInventoryReportDamage.setCreateBy(loginName);
warehouseInventoryReportDamage.setCreateTime(DateUtils.getNowDate());
BigDecimal sumTotal = BigDecimal.ZERO;
//报损子表数据 //报损子表数据
//判断子表数据是否为空 //判断子表数据是否为空
if(StringUtils.isNotEmpty(warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList())){ if(StringUtils.isNotEmpty(warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList())){
for(WarehouseInventoryReportDamageChild warehouseInventoryReportDamageChild:warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList()) { for(WarehouseInventoryReportDamageChild warehouseInventoryReportDamageChild:warehouseInventoryReportDamage.getWarehouseInventoryReportDamageChildList()) {
//子表数据不为空,则插入子表数据 //子表数据不为空,则插入子表数据
sumTotal = sumTotal.add(warehouseInventoryReportDamageChild.getActualScrapQuantity());
warehouseInventoryReportDamageChild.setMakeNo(warehouseInventoryReportDamage.getMakeNo()); warehouseInventoryReportDamageChild.setMakeNo(warehouseInventoryReportDamage.getMakeNo());
warehouseInventoryReportDamageChild.setReportDamageCode(newCode); warehouseInventoryReportDamageChild.setReportDamageCode(newCode);
warehouseInventoryReportDamageChild.setCreateTime(DateUtils.getNowDate()); warehouseInventoryReportDamageChild.setCreateTime(DateUtils.getNowDate());
@ -99,6 +118,7 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
//子表数据为空,则抛出异常 //子表数据为空,则抛出异常
throw new BusinessException("报损子表数据为空"); throw new BusinessException("报损子表数据为空");
} }
warehouseInventoryReportDamage.setNumTotal(sumTotal);
return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage); return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage);
} }
@ -195,6 +215,24 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
return warehouseInventoryReportDamageMapper.restoreWarehouseInventoryReportDamageById(reportDamageId); return warehouseInventoryReportDamageMapper.restoreWarehouseInventoryReportDamageById(reportDamageId);
} }
public List<WarehouseMaterialVO> getMaterialListByMakeNo(String makeNo) {
List<WarehouseMaterialVO> warehouseMaterialVOS = new ArrayList<>();
List<SysMakeorderBom> makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomByMakeNo(makeNo);
for (SysMakeorderBom makeorderBom : makeorderBoms) {
WarehouseMaterialVO warehouseMaterialVO = new WarehouseMaterialVO();
warehouseMaterialVO.setMaterialNo(makeorderBom.getMaterialNo());
warehouseMaterialVO.setMaterialName(makeorderBom.getMaterialName());
warehouseMaterialVO.setMaterialDescribe(makeorderBom.getDescribe());
warehouseMaterialVO.setMaterialUnit(makeorderBom.getUnit());
warehouseMaterialVO.setMaterialType(makeorderBom.getMaterialType());
warehouseMaterialVO.setProcessMethod(makeorderBom.getProcessMethod());
warehouseMaterialVO.setMaterialBrand(makeorderBom.getBrand());
warehouseMaterialVO.setMaterialphotoUrl(makeorderBom.getPhotoUrl());
warehouseMaterialVOS.add(warehouseMaterialVO);
}
return warehouseMaterialVOS;
}
/** /**
*报损单号生产规则 *报损单号生产规则

Loading…
Cancel
Save