Browse Source

[fix]生产管理 仓库管理

修复仓库入库单采购订单的入库问题
新增根据入库单号查询生产单号后端接口
修改入库-采购单(采购入库) 后端接口
dev
liuxiaoxu 5 months ago
parent
commit
8af73dacf5
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java
  2. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java
  3. 45
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java
  4. 2
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java
  5. 5
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java
  6. 39
      ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java
  7. 10
      ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml
  8. 3
      ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

6
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysMakeOrderMapper.java

@ -113,4 +113,10 @@ public interface SysMakeOrderMapper
* 根据生产单号查询生产单 * 根据生产单号查询生产单
* */ * */
SysMakeOrder selectMakeOrderByMakeNo(String makeNo); SysMakeOrder selectMakeOrderByMakeNo(String makeNo);
/*
* 根据入库单号查询生产单号
* */
String selectMakeByWarehouseStorageCode(String warehouseStorageCode);
} }

7
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysMakeOrderService.java

@ -2,6 +2,8 @@ package com.ruoyi.system.service;
import com.ruoyi.system.domain.SysMakeOrder; import com.ruoyi.system.domain.SysMakeOrder;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import java.util.List; import java.util.List;
@ -105,4 +107,9 @@ public interface ISysMakeOrderService
* 品质管理制程检验工序关联生产单号 * 品质管理制程检验工序关联生产单号
* */ * */
List<SysMakeOrder> selectAllMakeNos(); List<SysMakeOrder> selectAllMakeNos();
/*
* 仓库采购入库单进行入库的时候更新生产订单数据
* */
int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder, List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList);
} }

45
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysMakeOrderServiceImpl.java

@ -5,6 +5,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
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.erp.domain.ErpBom; import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.service.IErpBomService; import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.purchase.service.IPurchasePlanService; import com.ruoyi.purchase.service.IPurchasePlanService;
@ -15,12 +16,16 @@ import com.ruoyi.system.domain.SysSalesOrderVo;
import com.ruoyi.system.dto.SysMakeorderMaterialDto; import com.ruoyi.system.dto.SysMakeorderMaterialDto;
import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysMakeOrderMapper;
import com.ruoyi.system.service.*; import com.ruoyi.system.service.*;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -30,6 +35,7 @@ import java.util.List;
* @date 2023-12-18 * @date 2023-12-18
*/ */
@Service @Service
@Slf4j
public class SysMakeOrderServiceImpl implements ISysMakeOrderService public class SysMakeOrderServiceImpl implements ISysMakeOrderService
{ {
@Autowired @Autowired
@ -279,4 +285,43 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService
List<SysMakeOrder> list=sysMakeOrderMapper.selectAllMakeNos(); List<SysMakeOrder> list=sysMakeOrderMapper.selectAllMakeNos();
return list; return list;
} }
/*
* 仓库采购入库单进行入库的时候更新生产订单数据
* */
@Override
public int updateSysMakeOrderByWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder,List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList) {
SysMakeOrder sysMakeOrder = new SysMakeOrder();
sysMakeOrder.setUpdateBy(ShiroUtils.getLoginName());
sysMakeOrder.setUpdateTime(new Date());
//暂时假设全部入库
sysMakeOrder.setEceiptStatus("8");
//暂时假设全部品质
sysMakeOrder.setQualityStatus("2");
//查询生产订单数据 根据 入库单关联单号
String warehouseStorageCode = warehouseStorageOrder.getWarehouseStorageCode();
if (StringUtils.isEmpty(warehouseStorageCode)){
log.warn("更新生产订单相关的入库单号为空:{}",warehouseStorageCode);
}
//合计入库的时候所有物料信息的入库数量
int makeOrderStorageNum = warehouseStorageOrderDetailList.stream()
.mapToInt(WarehouseStorageOrderDetail::getStorageNum)
.sum();
String makeNo = sysMakeOrderMapper.selectMakeByWarehouseStorageCode(warehouseStorageCode);
if (StringUtils.isEmpty(makeNo)) {
log.warn("找不到与仓库存储单号[{}]相关的生产单号", warehouseStorageCode);
}
sysMakeOrder.setMakeNo(makeNo);
sysMakeOrder.setEceiptNum((long) makeOrderStorageNum);
//更新生产订单的数据
int updateResult = sysMakeOrderMapper.updateByMakeNo(sysMakeOrder);
if (updateResult <= 0){
log.warn("更新生产单失败,未影响任何行");
}
return updateResult;
}
} }

2
ruoyi-admin/src/main/java/com/ruoyi/warehouse/controller/WarehouseStorageOrderController.java

@ -318,7 +318,7 @@ public class WarehouseStorageOrderController extends BaseController
@ResponseBody @ResponseBody
public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) public AjaxResult storagePurchaseSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder)
{ {
return toAjax(warehouseStorageOrderService.updateWarehouseStorageOrder(warehouseStorageOrder)); return toAjax(warehouseStorageOrderService.storagePurchaseWarehouseStorageOrder(warehouseStorageOrder));
} }

5
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/IWarehouseStorageOrderService.java

@ -88,4 +88,9 @@ public interface IWarehouseStorageOrderService
int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder); int temporaryPurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder);
int updateWarehouseStorageOrderByQualityOrder(QualityOrder qualityOrder, List<QualityOrderDetail> qualityOrderDetailList); int updateWarehouseStorageOrderByQualityOrder(QualityOrder qualityOrder, List<QualityOrderDetail> qualityOrderDetailList);
/**
* 入库-采购单(采购入库)
* */
int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder);
} }

39
ruoyi-admin/src/main/java/com/ruoyi/warehouse/service/impl/WarehouseStorageOrderServiceImpl.java

@ -17,6 +17,7 @@ import com.ruoyi.quality.mapper.QualityOrderMapper;
import com.ruoyi.quality.mapper.QualityOrderReportMapper; import com.ruoyi.quality.mapper.QualityOrderReportMapper;
import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper; import com.ruoyi.quality.mapper.QualityOrderReportUnqualifiedMapper;
import com.ruoyi.quality.service.IQualityOrderService; import com.ruoyi.quality.service.IQualityOrderService;
import com.ruoyi.system.service.ISysMakeOrderService;
import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -50,6 +51,9 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
@Autowired @Autowired
private IQualityOrderService qualityOrderService; private IQualityOrderService qualityOrderService;
@Autowired
private ISysMakeOrderService sysMakeOrderService;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@ -195,6 +199,41 @@ public class WarehouseStorageOrderServiceImpl implements IWarehouseStorageOrderS
return updateResult; return updateResult;
} }
/**
* 入库-采购单(采购入库)
* */
@Transactional(rollbackFor = Exception.class)
@Override
public int storagePurchaseWarehouseStorageOrder(WarehouseStorageOrder warehouseStorageOrder) {
//假设全部入库
warehouseStorageOrder.setWarehouseStorageStatus("4");
warehouseStorageOrder.setUpdateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setUpdateTime(new Date());
//记录一下入库时间
warehouseStorageOrder.setStorageTime(new Date());
List<WarehouseStorageOrderDetail> warehouseStorageOrderDetailList = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if (StringUtils.isEmpty(warehouseStorageOrderDetailList)){
log.warn("入库单详情数据为空:{}",warehouseStorageOrderDetailList);
}
//更新生产单数据
sysMakeOrderService.updateSysMakeOrderByWarehouseStorageOrder(warehouseStorageOrder,warehouseStorageOrderDetailList);
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : warehouseStorageOrderDetailList) {
//更新入库单详情的数据
storageOrderDetailMapper.updateWarehouseStorageOrderDetail(warehouseStorageOrderDetail);
}
//更新入库单的数据
int updateResult = warehouseStorageOrderMapper.updateWarehouseStorageOrder(warehouseStorageOrder);
if (updateResult <= 0){
log.warn("更新入库单失败,未影响任何行");
}
return updateResult;
}
/* /*
* 更新仓库入库单详情的数据 * 更新仓库入库单详情的数据
* */ * */

10
ruoyi-admin/src/main/resources/mapper/system/SysMakeOrderMapper.xml

@ -269,4 +269,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where makeNo = #{makeNo} where makeNo = #{makeNo}
</select> </select>
<select id="selectMakeByWarehouseStorageCode" parameterType="String" resultType="String">
select sm.makeNo from sys_makeorder sm
left join purchase_plan pp on pp.correlation_code = sm.makeNo
left join purchase_order_child poc on poc.purchase_plan_code = pp.purchase_plan_code
left join warehouse_storage_order wso on related_order_code = poc.purchase_order_code
where wso.warehouse_storage_code = #{warehouseStorageCode}
</select>
</mapper> </mapper>

3
ruoyi-admin/src/main/resources/templates/warehouse/storageOrder/storagePurchase.html

@ -362,7 +362,8 @@
// 仓库ID // 仓库ID
selectElement.append('<option value="' + item.stockNO + '">' + item.stockNO + '</option>'); selectElement.append('<option value="' + item.stockNO + '">' + item.stockNO + '</option>');
}); });
// $('#warehouseCode').val(stockNO); //如果后端已经有值,回显
$('#warehouseCode').val(warehouseCode);
} else { } else {
$.modal.errMsg("数据为空"); $.modal.errMsg("数据为空");
} }

Loading…
Cancel
Save