Merge branch '0.8.X' of https://gitee.com/hdka/klp-oa into 0.8.X

This commit is contained in:
砂糖
2025-07-30 10:53:10 +08:00
5 changed files with 70 additions and 11 deletions

View File

@@ -43,6 +43,21 @@ module.exports = {
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
} }
},
// 直接代理WebSocket相关路径
'/websocket': {
target: `http://localhost:8080`,
changeOrigin: true
},
// 直接代理测试路径
'/test': {
target: `http://localhost:8080`,
changeOrigin: true
},
// 直接代理actuator路径
'/actuator': {
target: `http://localhost:8080`,
changeOrigin: true
} }
}, },
disableHostCheck: true disableHostCheck: true

View File

@@ -73,5 +73,16 @@ public class WmsPurchasePlanDetailVo {
@ExcelProperty(value = "原材料编码") @ExcelProperty(value = "原材料编码")
private String rawMaterialCode; private String rawMaterialCode;
/**
* 需求量
*/
private BigDecimal demand;
/**
* 库存量
*/
private BigDecimal inventory;
/**
* 在途量
*/
private BigDecimal onTheWay;
} }

View File

@@ -9,6 +9,8 @@ import com.klp.domain.vo.WmsPurchasePlanDetailVo;
import com.klp.common.core.mapper.BaseMapperPlus; import com.klp.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
/** /**
* 采购计划明细Mapper接口 * 采购计划明细Mapper接口
* *
@@ -18,4 +20,9 @@ import org.apache.ibatis.annotations.Param;
public interface WmsPurchasePlanDetailMapper extends BaseMapperPlus<WmsPurchasePlanDetailMapper, WmsPurchasePlanDetail, WmsPurchasePlanDetailVo> { public interface WmsPurchasePlanDetailMapper extends BaseMapperPlus<WmsPurchasePlanDetailMapper, WmsPurchasePlanDetail, WmsPurchasePlanDetailVo> {
Page<WmsPurchasePlanDetailVo> selectVoPagePlus(Page<?> page, @Param("ew") Wrapper<WmsPurchasePlanDetail> wrapper); Page<WmsPurchasePlanDetailVo> selectVoPagePlus(Page<?> page, @Param("ew") Wrapper<WmsPurchasePlanDetail> wrapper);
/**
* 查在途的原材料
*/
BigDecimal getByRawMaterialIdAndOnTheWay(Long rawMaterialId);
} }

View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.klp.common.utils.StringUtils; import com.klp.common.utils.StringUtils;
import com.klp.domain.WmsProductBom; import com.klp.domain.WmsProductBom;
import com.klp.domain.WmsPurchasePlanDetail; import com.klp.domain.WmsPurchasePlanDetail;
import com.klp.domain.WmsRawMaterial;
import com.klp.domain.vo.WmsOrderDetailVo; import com.klp.domain.vo.WmsOrderDetailVo;
import com.klp.domain.vo.WmsPurchasePlanDetailVo; import com.klp.domain.vo.WmsPurchasePlanDetailVo;
import com.klp.mapper.WmsPurchasePlanDetailMapper; import com.klp.mapper.WmsPurchasePlanDetailMapper;
@@ -80,23 +81,38 @@ public class WmsPurchasePlanServiceImpl implements IWmsPurchasePlanService {
List<WmsProductBom> bomList = wmsProductBomService.listByProductId(detail.getProductId()); List<WmsProductBom> bomList = wmsProductBomService.listByProductId(detail.getProductId());
for (WmsProductBom bom : bomList) { for (WmsProductBom bom : bomList) {
BigDecimal needQty = bom.getQuantity().multiply(detail.getQuantity()); BigDecimal needQty = bom.getQuantity().multiply(detail.getQuantity());
WmsPurchasePlanDetailVo vo = materialMap.getOrDefault(bom.getRawMaterialId(), new WmsPurchasePlanDetailVo()); WmsPurchasePlanDetailVo vo =
materialMap.getOrDefault(bom.getRawMaterialId(), new WmsPurchasePlanDetailVo());
vo.setRawMaterialId(bom.getRawMaterialId()); vo.setRawMaterialId(bom.getRawMaterialId());
vo.setQuantity(vo.getQuantity() == null ? needQty : vo.getQuantity().add(needQty)); vo.setQuantity(vo.getQuantity() == null ? needQty : vo.getQuantity().add(needQty));
vo.setUnit(bom.getUnit()); vo.setUnit(bom.getUnit());
vo.setRawMaterialName(wmsRawMaterialMapper.selectById(bom.getRawMaterialId()).getRawMaterialName()); // 挂载原材料名称编号
vo.setRawMaterialCode(wmsRawMaterialMapper.selectById(bom.getRawMaterialId()).getRawMaterialCode()); WmsRawMaterial wmsRawMaterial = wmsRawMaterialMapper.selectById(bom.getRawMaterialId());
vo.setRawMaterialName(wmsRawMaterial.getRawMaterialName());
vo.setRawMaterialCode(wmsRawMaterial.getRawMaterialCode());
materialMap.put(bom.getRawMaterialId(), vo); materialMap.put(bom.getRawMaterialId(), vo);
} }
} }
// 3. 查询库存并计算推荐采购量 // 3. 查询库存并计算推荐采购量
for (WmsPurchasePlanDetailVo vo : materialMap.values()) { for (WmsPurchasePlanDetailVo vo : materialMap.values()) {
// 需求量
vo.setDemand(vo.getQuantity());
BigDecimal stockQty = wmsStockService.getStockByItemId(vo.getRawMaterialId()); BigDecimal stockQty = wmsStockService.getStockByItemId(vo.getRawMaterialId());
// 要是物料不是产品 // 库存量
BigDecimal recommendQty = BigDecimal.ZERO; if(stockQty == null){
if (stockQty != null) { stockQty = BigDecimal.ZERO;
recommendQty = vo.getQuantity().subtract(stockQty);
} }
vo.setInventory(stockQty);
// 在途量
BigDecimal onTheWayQty = BigDecimal.ZERO;
BigDecimal byRawMaterialIdAndOnTheWay =
wmsPurchasePlanDetailMapper.getByRawMaterialIdAndOnTheWay(vo.getRawMaterialId());
if (byRawMaterialIdAndOnTheWay != null) {
onTheWayQty = byRawMaterialIdAndOnTheWay;
}
vo.setOnTheWay(onTheWayQty);
// 计算推荐采购量
BigDecimal recommendQty = vo.getQuantity().subtract(onTheWayQty).subtract(stockQty);
vo.setQuantity(recommendQty.compareTo(BigDecimal.ZERO) > 0 ? recommendQty : BigDecimal.ZERO); vo.setQuantity(recommendQty.compareTo(BigDecimal.ZERO) > 0 ? recommendQty : BigDecimal.ZERO);
} }
// 4. 组装主VO // 4. 组装主VO
@@ -182,9 +198,11 @@ public class WmsPurchasePlanServiceImpl implements IWmsPurchasePlanService {
*/ */
@Override @Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){ // 逻辑删除采购明细
//TODO 做一些业务上的校验,判断是否需要校验 LambdaQueryWrapper<WmsPurchasePlanDetail> lqw = Wrappers.lambdaQuery();
} lqw.in(WmsPurchasePlanDetail::getPlanId, ids);
wmsPurchasePlanDetailMapper.delete(lqw);
// 逻辑删除采购计划主表
return baseMapper.deleteBatchIds(ids) > 0; return baseMapper.deleteBatchIds(ids) > 0;
} }
} }

View File

@@ -31,5 +31,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${ew.customSqlSegment} ${ew.customSqlSegment}
</select> </select>
<select id="getByRawMaterialIdAndOnTheWay" resultType="java.math.BigDecimal">
select sum(wpd.quantity)
from wms_purchase_plan_detail wpd
where wpd.raw_material_id = #{rawMaterialId}
and wpd.status = 1
and wpd.del_flag = 0
</select>
</mapper> </mapper>