Browse Source

[feat]

仓库管理 库存报损
修改库存报损service方法,新增库存查询和库存历史操作;
修改请购单出库页面,实现出库操作;
dev
王晓迪 2 months ago
parent
commit
d13ce18996
  1. 56
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseInventoryReportDamageServiceImpl.java
  2. 14
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageMapper.xml
  3. 4
      ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html
  4. 33
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/requisitioningOutWarehouse.html
  5. 11
      ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/requisitioningOutWarehouseDetail.html

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

@ -14,14 +14,16 @@ 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.controller.WarehouseInventoryReportDamageController;
import com.ruoyi.warehouse.domain.*;
import com.ruoyi.warehouse.domain.VO.WarehouseMaterialVO;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamageChild;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper;
import com.ruoyi.warehouse.mapper.WarehouseInventoryReportDamageChildMapper;
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageChildService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.warehouse.mapper.WarehouseInventoryReportDamageMapper;
import com.ruoyi.warehouse.domain.WarehouseInventoryReportDamage;
import com.ruoyi.warehouse.service.IWarehouseInventoryReportDamageService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
@ -46,6 +48,12 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
@Autowired
private SysMakeorderBomMapper sysMakeorderBomMapper;
@Autowired
private WarehouseInventoryInquiryMapper inventoryInquiryMapper;
@Autowired
private WarehouseInventoryInquiryDetailMapper inventoryInquiryDetailMapper;
/**
* 查询仓库库存报损
*
@ -116,6 +124,10 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
warehouseInventoryReportDamageChild.setApplyDeptId(String.valueOf(ShiroUtils.getSysUser().getDeptId()));
warehouseInventoryReportDamageChild.setApplyDept(ShiroUtils.getSysUser().getDept().getDeptName());
warehouseInventoryReportDamageChildService.insertWarehouseInventoryReportDamageChild(warehouseInventoryReportDamageChild);
int inquiryUpdateResult = updateWarehouseInventoryInquiry(warehouseInventoryReportDamageChild);
if(inquiryUpdateResult<=0){
throw new BusinessException("更新库存查询失败!");
}
}
}else{
//子表数据为空,则抛出异常
@ -125,6 +137,46 @@ public class WarehouseInventoryReportDamageServiceImpl implements IWarehouseInve
return warehouseInventoryReportDamageMapper.insertWarehouseInventoryReportDamage(warehouseInventoryReportDamage);
}
public int updateWarehouseInventoryInquiry(WarehouseInventoryReportDamageChild damageChild){
WarehouseInventoryInquiry inventoryInquiry = inventoryInquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(damageChild.getMaterialNo());
if(inventoryInquiry == null){
throw new BusinessException("新增库存报损失败,该物料无库存数据");
}
WarehouseInventoryInquiryDetail inquiryDetail = createWarehouseInventoryInquiryDetail(damageChild);
inquiryDetail.setInventoryHistoricalType("9");
int detailInsertResult = inventoryInquiryDetailMapper.insertWarehouseInventoryInquiryDetail(inquiryDetail);
if(detailInsertResult<=0){
throw new BusinessException("新增库存历史失败!");
}
BigDecimal reportDamageNum = inventoryInquiry.getReportDamageNum();
reportDamageNum = reportDamageNum.add(damageChild.getActualScrapQuantity());
inventoryInquiry.setReportDamageNum(reportDamageNum);
BigDecimal availableNum = inventoryInquiry.getAvailableStockNum();
availableNum = availableNum.subtract(damageChild.getActualScrapQuantity());
inventoryInquiry.setAvailableStockNum(availableNum);
inventoryInquiry.setUpdateBy(ShiroUtils.getLoginName());
inventoryInquiry.setUpdateTime(DateUtils.getNowDate());
return inventoryInquiryMapper.updateWarehouseInventoryInquiry(inventoryInquiry);
}
// 根据报损单详情生成库存历史记录
public WarehouseInventoryInquiryDetail createWarehouseInventoryInquiryDetail(WarehouseInventoryReportDamageChild damageChild){
WarehouseInventoryInquiryDetail inquiryDetail = new WarehouseInventoryInquiryDetail();
inquiryDetail.setMaterialNo(damageChild.getMaterialNo());
inquiryDetail.setMaterialName(damageChild.getMaterialName());
inquiryDetail.setMaterialBrand(damageChild.getMaterialBrand());
inquiryDetail.setMaterialPhotourl(damageChild.getMaterialPhotourl());
inquiryDetail.setMaterialDescribe(damageChild.getMaterialDescribe());
inquiryDetail.setMaterialUnit(damageChild.getMaterialUnit());
inquiryDetail.setMaterialType(damageChild.getMaterialType());
inquiryDetail.setInventoryIncreaseDecrease("0");
BigDecimal decreaseNum = damageChild.getActualScrapQuantity();
inquiryDetail.setAvailableStockNum(decreaseNum);
inquiryDetail.setInventoryHistoricalTime(DateUtils.getNowDate());
inquiryDetail.setCreateBy(ShiroUtils.getLoginName());
inquiryDetail.setCreateTime(DateUtils.getNowDate());
return inquiryDetail;
}
/**
* 修改仓库库存报损
*

14
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseInventoryReportDamageMapper.xml

@ -33,13 +33,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWarehouseInventoryReportDamageList" parameterType="WarehouseInventoryReportDamage" resultMap="WarehouseInventoryReportDamageResult">
<include refid="selectWarehouseInventoryReportDamageVo"/>
<where>
<if test="reportDamageCode != null and reportDamageCode != ''"> and report_damage_code = #{reportDamageCode}</if>
<if test="reportDamageCode != null and reportDamageCode != ''"> and report_damage_code like concat('%', #{reportDamageCode}, '%')</if>
<if test="warehousScrapType != null and warehousScrapType != ''"> and warehous_scrap_type = #{warehousScrapType}</if>
<if test="makeNo != null and makeNo != ''"> and make_no = #{makeNo}</if>
<if test="makeNo != null and makeNo != ''"> and make_no like concat('%', #{makeNo}, '%')</if>
<if test="whetherMakeNo != null and whetherMakeNo != ''"> and whether_make_no = #{whetherMakeNo}</if>
<if test="applyDept != null and applyDept != ''"> and apply_dept = #{applyDept}</if>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<!-- <if test="materialNo != null and materialNo != ''"> and material_no like concat('%', #{materialNo}, '%')</if>-->
<!-- <if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>-->
<if test="materialNo != null and materialNo != ''">
and report_damage_code in ( select report_damage_code from warehouse_inventory_report_damage_child where material_no like concat('%', #{materialNo}, '%') )
</if>
<if test="materialName != null and materialName != ''">
and report_damage_code in ( select report_damage_code from warehouse_inventory_report_damage_child where material_name like concat('%', #{materialName}, '%') )
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
</select>

4
ruoyi-admin/src/main/resources/templates/warehouse/inventoryReportDamage/inventoryReportDamage.html

@ -143,11 +143,11 @@
let tipMsg = "确定导出当前所有数据吗?";
if ($.common.isNotEmpty(ids)) {
tipMsg = `确定导出当前勾选的 ${ids.length} 数据吗?`;
tipMsg = `确定导出 ${ids} 数据吗?`;
dataParam.push({ "name": "ids", "value": ids });
}
$.modal.loading("正在导出数据,请稍后...");
$.modal.confirm(tipMsg, function () {
$.modal.loading("正在导出数据,请稍后...");
$.post( prefix + "/export", dataParam, function (result) {
if (result.code === web_status.SUCCESS) {
window.location.href = ctx + "common/download?fileName="+ encodeURI(result.msg) + "&delete=" + true;

33
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/requisitioningOutWarehouse.html

@ -58,6 +58,8 @@
var warehouseOutOrder = [[${warehouseOutOrder}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-makeOutWarehouse-edit").validate({
@ -82,7 +84,8 @@
"outOrderCode":item.outOrderCode,
"materialNo": item.materialNo, // 假设id对应materialId
"prepareOutOrderSum":item.prepareOutOrderSum,
"actualOutOrderSum":item.actualOutOrderSum
"actualOutOrderSum":item.actualOutOrderSum,
"applyOutOrderSum": item.applyOutOrderSum
// ...其他字段
};
});
@ -91,10 +94,8 @@
warehouseOutOrderDetailList: materialDataList,
});
// 合并表单数据和表格数据
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/requisitioningOutWarehouse", jsonData);
}
@ -109,9 +110,7 @@
showToggle: false,
showColumns: false,
pagination: false, // 设置不分页
columns: [{
checkbox: true
},
columns: [
{
title: '出库单详情ID',
field: 'outOrderDetailId',
@ -130,6 +129,9 @@
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料名称',
@ -138,6 +140,9 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '描述',
@ -154,6 +159,9 @@
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '订单数量',
@ -170,7 +178,16 @@
{
title: '实际出库数',
field: 'actualOutOrderSum',
editable:true
editable: {
type: 'text',
mode:'inline',
validate: function (v,row) {
if (!v) return '数量不能为空';
if (isNaN(v)) return '数量必须是数字';
var actualOutOrderSum = parseInt(v);
if (actualOutOrderSum <= 0) return '数量必须是正整数';
}
}
}
]
};

11
ruoyi-admin/src/main/resources/templates/warehouse/warehouseOutOrder/requisitioningOutWarehouseDetail.html

@ -58,6 +58,8 @@
var warehouseOutOrder = [[${warehouseOutOrder}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var prefix = ctx + "warehouse/warehouseOutOrder";
$("#form-makeOutWarehouse-edit").validate({
@ -130,6 +132,9 @@
{
title: '图片',
field: 'materialPhotourl',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
title: '物料名称',
@ -138,6 +143,9 @@
{
title: '物料类型',
field: 'materialType',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
title: '描述',
@ -154,6 +162,9 @@
{
title: '加工方式',
field: 'materialProcessMethod',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
title: '订单数量',

Loading…
Cancel
Save