Browse Source

[fix]

仓库管理 库存盘点
新增库存盘点导出controller接口;
修改库存盘点新增和修改service接口方法;
修改库存盘点详情实体类,调整导出字段和顺序;
新增根据盘点单号删除详情信息和批量查找盘点详情信息mapper方法;
dev
王晓迪 3 months ago
parent
commit
fcd6fbd6e4
  1. 26
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java
  2. 39
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheckDetail.java
  3. 13
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckDetailMapper.java
  4. 78
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java
  5. 12
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckDetailMapper.xml

26
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseInventoryCheckController.java

@ -4,10 +4,14 @@ import java.util.List;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryCheckDetail;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryCheckDetailMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryCheckDetailService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
@ -33,6 +37,12 @@ public class WarehouseInventoryCheckController extends BaseController
@Autowired
private IWarehouseInventoryCheckService warehouseInventoryCheckService;
@Autowired
private IWarehouseInventoryCheckDetailService checkDetailService;
@Autowired
private WarehouseInventoryCheckDetailMapper checkDetailMapper;
@RequiresPermissions("warehouse:inventoryCheck:view")
@GetMapping()
public String inventoryCheck()
@ -60,11 +70,19 @@ public class WarehouseInventoryCheckController extends BaseController
@Log(title = "仓库库存盘点", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(WarehouseInventoryCheck warehouseInventoryCheck)
public AjaxResult export(WarehouseInventoryCheck warehouseInventoryCheck,String ids)
{
List<WarehouseInventoryCheck> list = warehouseInventoryCheckService.selectWarehouseInventoryCheckList(warehouseInventoryCheck);
ExcelUtil<WarehouseInventoryCheck> util = new ExcelUtil<WarehouseInventoryCheck>(WarehouseInventoryCheck.class);
return util.exportExcel(list, "仓库库存盘点数据");
if (StringUtils.isEmpty(ids)){
WarehouseInventoryCheckDetail checkDetail = new WarehouseInventoryCheckDetail();
List<WarehouseInventoryCheckDetail> list = checkDetailService.selectWarehouseInventoryCheckDetailList(checkDetail);
ExcelUtil<WarehouseInventoryCheckDetail> util = new ExcelUtil<WarehouseInventoryCheckDetail>(WarehouseInventoryCheckDetail.class);
return util.exportExcel(list, "仓库库存报损数据");
}else {
String[] checkCodes = ids.split(",");
List<WarehouseInventoryCheckDetail> list = checkDetailMapper.selectWarehouseInventoryCheckDetailByCodes(checkCodes);
ExcelUtil<WarehouseInventoryCheckDetail> util = new ExcelUtil<WarehouseInventoryCheckDetail>(WarehouseInventoryCheckDetail.class);
return util.exportExcel(list, ids);
}
}
/**

39
ruoyi-admin/src/main/java/com/ruoyi/warehouse/domain/WarehouseInventoryCheckDetail.java

@ -21,50 +21,55 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
private Long inventoryCheckDetailId;
/** 库存盘点单号 */
@Excel(name = "库存盘点单号", sort = 1)
private String inventoryCheckCode;
/** 库存盘点人名 */
@Excel(name = "盘点人", sort = 13)
private String inventoryCheckName;
/** 料号 */
@Excel(name = "料号")
@Excel(name = "料号", sort = 2)
private String materialNo;
/** 物料名称 */
@Excel(name = "物料名称")
@Excel(name = "物料名称", sort = 3)
private String materialName;
/** 物料单位 */
@Excel(name = "物料单位")
@Excel(name = "单位", sort = 10)
private String materialUnit;
/** 物料描述 */
@Excel(name = "物料描述")
@Excel(name = "物料描述", sort = 4)
private String materialDescribe;
/** 库存盘点数量 */
@Excel(name = "库存盘点数量")
@Excel(name = "盘点数量", sort = 11)
private Integer inventoryCheckNum;
/** 当时库存账上数量 */
@Excel(name = "当时库存账上数量")
@Excel(name = "当时库存账上数量", sort = 12)
private Integer inventoryAccountNum;
/** 仓库存放地址 */
@Excel(name = "仓库存放地址")
private String warehouseStoreAddress;
/** 批号 */
@Excel(name = "批号")
@Excel(name = "批号", sort = 5)
private Integer batchNumber;
/** 仓库号 */
@Excel(name = "仓库号", sort = 6)
private String warehouseCode;
/** 仓库名称 */
@Excel(name = "仓库名称", sort = 7)
private String warehouseName;
/** 仓库存放地址 */
@Excel(name = "仓库存放地址", sort = 8)
private String warehouseStoreAddress;
/** 库存盘点日期 */
@Excel(name = "库存盘点日期", sort = 9, dateFormat = "yyyy-MM-dd")
private Date inventoryCheckDate;
/** 物料数合计 */
@ -73,6 +78,8 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
/** 数量合计 */
private Integer numTotal;
@Excel(name = "备注", sort = 14)
private String remark;
public void setInventoryCheckDetailId(Long inventoryCheckDetailId)
{
this.inventoryCheckDetailId = inventoryCheckDetailId;
@ -218,6 +225,16 @@ public class WarehouseInventoryCheckDetail extends BaseEntity
return numTotal;
}
@Override
public String getRemark() {
return remark;
}
@Override
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

13
ruoyi-admin/src/main/java/com/ruoyi/warehouse/mapper/WarehouseInventoryCheckDetailMapper.java

@ -51,6 +51,14 @@ public interface WarehouseInventoryCheckDetailMapper
*/
public int deleteWarehouseInventoryCheckDetailById(Long inventoryCheckDetailId);
/**
* 删除仓库库存盘点详情
*
* @param inventoryCheckCode 仓库库存盘点详情ID
* @return 结果
*/
public int deleteWarehouseInventoryCheckDetailByCode(String inventoryCheckCode);
/**
* 批量删除仓库库存盘点详情
*
@ -79,4 +87,9 @@ public interface WarehouseInventoryCheckDetailMapper
* 根据盘点单号查找盘点详情信息
* */
List<WarehouseInventoryCheckDetail> selectInventoryCheckDetailListByCode(String inventoryCheckCode);
/**
* 根据盘点单号批量查找盘点详情信息
* */
List<WarehouseInventoryCheckDetail> selectWarehouseInventoryCheckDetailByCodes(String[] inventoryCheckCodes);
}

78
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryCheckServiceImpl.java

@ -87,28 +87,36 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
warehouseInventoryCheck.setInventoryCheckCode(newCode);
warehouseInventoryCheck.setCreateTime(DateUtils.getNowDate());
warehouseInventoryCheck.setCreateBy(loginName);
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
int numTotal = 0;
if (StringUtils.isEmpty(inventoryCheckDetails)){
log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails);
}else{
warehouseInventoryCheck.setMaterialTotal(inventoryCheckDetails.size());
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail();
inventoryCheckDetail.setInventoryCheckCode(newCode);
inventoryCheckDetail.setInventoryCheckName(warehouseInventoryCheck.getInventoryCheckName());
inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo());
inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName());
inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe());
inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit());
inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum());
numTotal += tempInventoryCheckDetail.getInventoryCheckNum();
inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum());
inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark());
inventoryCheckDetail.setWarehouseCode(warehouseInventoryCheck.getWarehouseCode());
inventoryCheckDetail.setWarehouseName(warehouseInventoryCheck.getWarehouseName());
inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress());
inventoryCheckDetail.setBatchNumber(tempInventoryCheckDetail.getBatchNumber());
inventoryCheckDetail.setCreateBy(loginName);
inventoryCheckDetail.setCreateTime(DateUtils.getNowDate());
inventoryCheckDetail.setInventoryCheckDate(warehouseInventoryCheck.getInventoryCheckDate());
inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail);
}
}
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail();
inventoryCheckDetail.setInventoryCheckCode(newCode);
inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo());
inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName());
inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe());
inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit());
inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum());
inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum());
inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark());
inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress());
inventoryCheckDetail.setCreateBy(loginName);
inventoryCheckDetail.setCreateTime(new Date());
inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail);
}
warehouseInventoryCheck.setNumTotal(numTotal);
return warehouseInventoryCheckMapper.insertWarehouseInventoryCheck(warehouseInventoryCheck);
}
@ -125,20 +133,38 @@ public class WarehouseInventoryCheckServiceImpl implements IWarehouseInventoryCh
String loginName = ShiroUtils.getLoginName();
warehouseInventoryCheck.setUpdateBy(loginName);
warehouseInventoryCheck.setUpdateTime(DateUtils.getNowDate());
int numTotal = 0;
List<WarehouseInventoryCheckDetail> inventoryCheckDetails = warehouseInventoryCheck.getInventoryCheckDetails();
if (StringUtils.isEmpty(inventoryCheckDetails)){
log.warn("仓库盘点物料相关信息为空:{}",inventoryCheckDetails);
}else{
inventoryCheckDetailMapper.deleteWarehouseInventoryCheckDetailByCode(warehouseInventoryCheck.getInventoryCheckCode());
warehouseInventoryCheck.setMaterialTotal(inventoryCheckDetails.size());
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
WarehouseInventoryCheckDetail inventoryCheckDetail = new WarehouseInventoryCheckDetail();
inventoryCheckDetail.setInventoryCheckCode(warehouseInventoryCheck.getInventoryCheckCode());
inventoryCheckDetail.setInventoryCheckName(warehouseInventoryCheck.getInventoryCheckName());
inventoryCheckDetail.setMaterialNo(tempInventoryCheckDetail.getMaterialNo());
inventoryCheckDetail.setMaterialName(tempInventoryCheckDetail.getMaterialName());
inventoryCheckDetail.setMaterialDescribe(tempInventoryCheckDetail.getMaterialDescribe());
inventoryCheckDetail.setMaterialUnit(tempInventoryCheckDetail.getMaterialUnit());
inventoryCheckDetail.setInventoryCheckNum(tempInventoryCheckDetail.getInventoryCheckNum());
numTotal += tempInventoryCheckDetail.getInventoryCheckNum();
inventoryCheckDetail.setInventoryAccountNum(tempInventoryCheckDetail.getInventoryAccountNum());
inventoryCheckDetail.setRemark(tempInventoryCheckDetail.getRemark());
inventoryCheckDetail.setWarehouseCode(warehouseInventoryCheck.getWarehouseCode());
inventoryCheckDetail.setWarehouseName(warehouseInventoryCheck.getWarehouseName());
inventoryCheckDetail.setWarehouseStoreAddress(tempInventoryCheckDetail.getWarehouseStoreAddress());
inventoryCheckDetail.setBatchNumber(tempInventoryCheckDetail.getBatchNumber());
inventoryCheckDetail.setCreateBy(loginName);
inventoryCheckDetail.setCreateTime(DateUtils.getNowDate());
inventoryCheckDetail.setInventoryCheckDate(warehouseInventoryCheck.getInventoryCheckDate());
inventoryCheckDetailMapper.insertWarehouseInventoryCheckDetail(inventoryCheckDetail);
}
}
for (WarehouseInventoryCheckDetail tempInventoryCheckDetail : inventoryCheckDetails) {
tempInventoryCheckDetail.setUpdateBy(loginName);
tempInventoryCheckDetail.setUpdateTime(new Date());
inventoryCheckDetailMapper.updateWarehouseInventoryCheckDetail(tempInventoryCheckDetail);
}
warehouseInventoryCheck.setNumTotal(numTotal);
return warehouseInventoryCheckMapper.updateWarehouseInventoryCheck(warehouseInventoryCheck);
}

12
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryCheckDetailMapper.xml

@ -143,4 +143,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update warehouse_inventory_check_detail set del_flag = '0' where inventory_check_detail_id = #{inventoryCheckDetailId}
</update>
<delete id="deleteWarehouseInventoryCheckDetailByCode" parameterType="String">
delete from warehouse_inventory_check_detail where inventory_check_code = #{inventoryCheckCode}
</delete>
<select id="selectWarehouseInventoryCheckDetailByCodes" parameterType="String" resultMap="WarehouseInventoryCheckDetailResult">
<include refid="selectWarehouseInventoryCheckDetailVo"/>
where inventory_check_code in
<foreach item="inventoryCheckCode" collection="array" open="(" separator="," close=")">
#{inventoryCheckCode}
</foreach>
</select>
</mapper>
Loading…
Cancel
Save