6 changed files with 252 additions and 5 deletions
-
130src/main/java/com/gaotao/modules/api/entity/issueAndReturnVo/AnInventoryPartInStockVo.java
-
2src/main/java/com/gaotao/modules/api/service/IfsApiIssueAndReturnService.java
-
22src/main/java/com/gaotao/modules/api/service/impl/IfsApiIssueAndReturnServiceImpl.java
-
17src/main/java/com/gaotao/modules/production/service/impl/ProductionIssueServiceImpl.java
-
7src/main/java/com/gaotao/modules/trans/service/ValidateInventoryPartInStockService.java
-
79src/main/java/com/gaotao/modules/trans/service/impl/ValidateInventoryPartInStockServiceImpl.java
@ -0,0 +1,130 @@ |
|||||
|
package com.gaotao.modules.api.entity.issueAndReturnVo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class AnInventoryPartInStockVo { |
||||
|
@JsonProperty("ActivitySeq") |
||||
|
private String activitySeq; |
||||
|
|
||||
|
@JsonProperty("AvailabilityControlId") |
||||
|
private String availabilityControlId; |
||||
|
|
||||
|
@JsonProperty("AvgUnitTransitCost") |
||||
|
private String avgUnitTransitCost; |
||||
|
|
||||
|
@JsonProperty("BayNo") |
||||
|
private String bayNo; |
||||
|
|
||||
|
@JsonProperty("BinNo") |
||||
|
private String binNo; |
||||
|
|
||||
|
@JsonProperty("CatchQtyInTransit") |
||||
|
private String catchQtyInTransit; |
||||
|
|
||||
|
@JsonProperty("CatchQtyOnhand") |
||||
|
private String catchQtyOnhand; |
||||
|
|
||||
|
@JsonProperty("ConditionCode") |
||||
|
private String conditionCode; |
||||
|
|
||||
|
@JsonProperty("ConfigurationId") |
||||
|
private String configurationId; |
||||
|
|
||||
|
@JsonProperty("Contract") |
||||
|
private String contract; |
||||
|
|
||||
|
@JsonProperty("CountVariance") |
||||
|
private String countVariance; |
||||
|
|
||||
|
@JsonProperty("EngChgLevel") |
||||
|
private String engChgLevel; |
||||
|
|
||||
|
@JsonProperty("ExpirationDate") |
||||
|
private String expirationDate; |
||||
|
|
||||
|
@JsonProperty("FreezeFlag") |
||||
|
private String freezeFlag; |
||||
|
|
||||
|
@JsonProperty("FreezeFlagDb") |
||||
|
private String freezeFlagDb; |
||||
|
|
||||
|
@JsonProperty("HandlingUnitId") |
||||
|
private String handlingUnitId; |
||||
|
|
||||
|
@JsonProperty("LastActivityDate") |
||||
|
private String lastActivityDate; |
||||
|
|
||||
|
@JsonProperty("LastCountDate") |
||||
|
private String lastCountDate; |
||||
|
|
||||
|
@JsonProperty("LocationNo") |
||||
|
private String locationNo; |
||||
|
|
||||
|
@JsonProperty("LocationType") |
||||
|
private String locationType; |
||||
|
|
||||
|
@JsonProperty("LocationTypeDb") |
||||
|
private String locationTypeDb; |
||||
|
|
||||
|
@JsonProperty("LotBatchNo") |
||||
|
private String lotBatchNo; |
||||
|
|
||||
|
@JsonProperty("Objid") |
||||
|
private String objid; |
||||
|
|
||||
|
@JsonProperty("Objkey") |
||||
|
private String objkey; |
||||
|
|
||||
|
@JsonProperty("Objversion") |
||||
|
private String objversion; |
||||
|
|
||||
|
@JsonProperty("OwningCustomerNo") |
||||
|
private String owningCustomerNo; |
||||
|
|
||||
|
@JsonProperty("OwningVendorNo") |
||||
|
private String owningVendorNo; |
||||
|
|
||||
|
@JsonProperty("PartNo") |
||||
|
private String partNo; |
||||
|
|
||||
|
@JsonProperty("PartOwnership") |
||||
|
private String partOwnership; |
||||
|
|
||||
|
@JsonProperty("PartOwnershipDb") |
||||
|
private String partOwnershipDb; |
||||
|
|
||||
|
@JsonProperty("ProjectId") |
||||
|
private String projectId; |
||||
|
|
||||
|
@JsonProperty("QtyInTransit") |
||||
|
private String qtyInTransit; |
||||
|
|
||||
|
@JsonProperty("QtyOnhand") |
||||
|
private String qtyOnhand; |
||||
|
|
||||
|
@JsonProperty("QtyReserved") |
||||
|
private String qtyReserved; |
||||
|
|
||||
|
@JsonProperty("ReceiptDate") |
||||
|
private String receiptDate; |
||||
|
|
||||
|
@JsonProperty("RowNo") |
||||
|
private String rowNo; |
||||
|
|
||||
|
@JsonProperty("SerialNo") |
||||
|
private String serialNo; |
||||
|
|
||||
|
@JsonProperty("Source") |
||||
|
private String source; |
||||
|
|
||||
|
@JsonProperty("TierNo") |
||||
|
private String tierNo; |
||||
|
|
||||
|
@JsonProperty("WaivDevRejNo") |
||||
|
private String waivDevRejNo; |
||||
|
|
||||
|
@JsonProperty("Warehouse") |
||||
|
private String warehouse; |
||||
|
} |
||||
@ -1,4 +1,11 @@ |
|||||
package com.gaotao.modules.trans.service; |
package com.gaotao.modules.trans.service; |
||||
|
|
||||
|
import com.gaotao.modules.trans.entity.TransCommonSubDto; |
||||
|
import com.gaotao.modules.trans.entity.TransDetailSub; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
public interface ValidateInventoryPartInStockService { |
public interface ValidateInventoryPartInStockService { |
||||
|
|
||||
|
String validateInventoryPartInStock(String partNo,String site,List<TransCommonSubDto> dto); |
||||
} |
} |
||||
@ -1,12 +1,89 @@ |
|||||
package com.gaotao.modules.trans.service.impl; |
package com.gaotao.modules.trans.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.gaotao.modules.api.entity.issueAndReturnVo.AnInventoryPartInStockVo; |
||||
|
import com.gaotao.modules.api.entity.issueAndReturnVo.InventoryPartInStockVo; |
||||
|
import com.gaotao.modules.api.service.IfsApiIssueAndReturnService; |
||||
|
import com.gaotao.modules.handlingunit.entity.HandlingUnit; |
||||
|
import com.gaotao.modules.trans.entity.TransCommonSubDto; |
||||
|
import com.gaotao.modules.trans.entity.TransDetail; |
||||
|
import com.gaotao.modules.trans.entity.TransDetailSub; |
||||
import com.gaotao.modules.trans.service.ValidateInventoryPartInStockService; |
import com.gaotao.modules.trans.service.ValidateInventoryPartInStockService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
@Service |
@Service |
||||
public class ValidateInventoryPartInStockServiceImpl implements ValidateInventoryPartInStockService { |
public class ValidateInventoryPartInStockServiceImpl implements ValidateInventoryPartInStockService { |
||||
|
|
||||
public String ValidateInventoryPartInStock(){ |
|
||||
|
@Autowired |
||||
|
private IfsApiIssueAndReturnService ifsApiIssueAndReturnService; |
||||
|
|
||||
|
/** |
||||
|
* 校验物料库存 |
||||
|
* @param partNo |
||||
|
* @param site |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public String validateInventoryPartInStock(String partNo,String site,List<TransCommonSubDto> dto){ |
||||
|
|
||||
|
List<TransDetailSub> detailSubs = new ArrayList<>(); |
||||
|
//保存sub |
||||
|
for (TransCommonSubDto subDto:dto){ |
||||
|
TransDetailSub detailSub = new TransDetailSub(); |
||||
|
detailSub.setSite(site); |
||||
|
detailSub.setItemNo(subDto.getItemNo()); |
||||
|
detailSub.setSubNo(subDto.getSubNo()); |
||||
|
detailSub.setSubQty(Double.valueOf(subDto.getTransQty())); |
||||
|
detailSub.setDirection(subDto.getDirection()); |
||||
|
detailSub.setPartNo(subDto.getPartNo()); |
||||
|
detailSub.setBatchNo(subDto.getBatchNo()); |
||||
|
detailSub.setLocationId(subDto.getLocationId()); |
||||
|
detailSub.setOrderRef3(subDto.getWdrNo()); |
||||
|
detailSub.setOrderRef4(subDto.getWarehouseId()); |
||||
|
detailSub.setSeqNo(subDto.getSqeNo()); |
||||
|
|
||||
|
detailSubs.add(detailSub); |
||||
|
} |
||||
|
|
||||
|
Map<List<String>, Double> collect = detailSubs.stream().collect(Collectors.groupingBy(item -> Arrays.asList(item.getSite(), item.getPartNo(), item.getBatchNo(), item.getLocationId(), item.getOrderRef3(),item.getOrderRef4()), Collectors.summingDouble(TransDetailSub::getSubQty))); |
||||
|
|
||||
|
List<AnInventoryPartInStockVo> inventoryPartInStock = ifsApiIssueAndReturnService.getAnInventoryPartInStock(site,partNo); |
||||
|
if(inventoryPartInStock==null || inventoryPartInStock.size()==0){ |
||||
|
return "400"; |
||||
|
} |
||||
|
|
||||
|
for (Map.Entry<List<String>, Double> entry : collect.entrySet()) { |
||||
|
List<String> key = entry.getKey(); |
||||
|
Double totalQty = entry.getValue(); |
||||
|
boolean flag = false; |
||||
|
for(AnInventoryPartInStockVo vo:inventoryPartInStock){ |
||||
|
if(vo.getContract().equals(key.get(0)) |
||||
|
&& vo.getPartNo().equals(key.get(1)) |
||||
|
&& vo.getLotBatchNo().equals(key.get(2)) |
||||
|
&& vo.getLocationNo().equals(key.get(3)) |
||||
|
&& vo.getWaivDevRejNo().equals(key.get(4)) |
||||
|
&& vo.getWarehouse().equals(key.get(5)) |
||||
|
){ |
||||
|
if(!"N".equals(vo.getFreezeFlagDb()) || (new BigDecimal(vo.getQtyOnhand()).subtract(new BigDecimal(vo.getQtyReserved())).compareTo(new BigDecimal(totalQty)))< 0){ |
||||
|
flag = true; |
||||
|
break; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
if(flag){ |
||||
|
return "400"; |
||||
|
} |
||||
|
} |
||||
return "200"; |
return "200"; |
||||
} |
} |
||||
} |
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue