|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
import com.ruoyi.common.core.text.Convert; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.erp.domain.ErpBom; |
|
|
|
import com.ruoyi.erp.service.IErpBomService; |
|
|
|
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.mapper.SysMakeOrderMapper; |
|
|
|
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.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@ -30,6 +35,7 @@ import java.util.List; |
|
|
|
* @date 2023-12-18 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
|
{ |
|
|
|
@Autowired |
|
|
@ -279,4 +285,43 @@ public class SysMakeOrderServiceImpl implements ISysMakeOrderService |
|
|
|
List<SysMakeOrder> list=sysMakeOrderMapper.selectAllMakeNos(); |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|