|
|
|
@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.gaotao.common.exception.XJException; |
|
|
|
import com.gaotao.common.utils.HttpUtils; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.AnInventoryPartInStockVo; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.InventoryPartVo; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.IssueShopOrderDto; |
|
|
|
import com.gaotao.modules.api.entity.issueAndReturnVo.UnissueShopOrderDto; |
|
|
|
@ -46,6 +47,7 @@ import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@ -541,6 +543,7 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
return unitIdPrints; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
public String createNewReturnHandlingUnits(CreateHuRequestReturnIssueDto request) throws Exception{ |
|
|
|
|
|
|
|
@ -551,6 +554,31 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
|
|
|
|
// 1. 先创建packageCount个完整HU |
|
|
|
HandlingUnit onunit = productionReturnMapper.getOneHandlingUnit(request); |
|
|
|
List<AnInventoryPartInStockVo> partInStock = null; |
|
|
|
Date newReceiveDate = null; |
|
|
|
Date newManufactureDate = null; |
|
|
|
Date newExpireData = null; |
|
|
|
String newUmId = null; |
|
|
|
String newEngChgLevel = null; |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'-'HH.mm.ss"); |
|
|
|
if(onunit == null){ |
|
|
|
partInStock = ifsApiIssueAndReturnService.getAnInventoryPartInStock(request.getSite(), request.getPartNo()); |
|
|
|
if(partInStock == null || partInStock.size() == 0){ |
|
|
|
throw new Exception("无法获取物料信息"); |
|
|
|
}else{ |
|
|
|
newReceiveDate = sdf.parse(partInStock.get(0).getReceiptDate()); |
|
|
|
newManufactureDate = sdf.parse(partInStock.get(0).getReceiptDate()); |
|
|
|
newExpireData = sdf.parse(partInStock.get(0).getExpirationDate()); |
|
|
|
newUmId = "PSC"; |
|
|
|
newEngChgLevel = partInStock.get(0).getEngChgLevel(); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
newReceiveDate = onunit.getReceiveDate(); |
|
|
|
newManufactureDate = onunit.getManufactureDate(); |
|
|
|
newExpireData = onunit.getExpiredDate(); |
|
|
|
newUmId = onunit.getUmId(); |
|
|
|
newEngChgLevel = onunit.getEngChgLevel() != null ? onunit.getEngChgLevel() : "1"; |
|
|
|
} |
|
|
|
|
|
|
|
// 生成处理单元ID |
|
|
|
String unitId = handlingUnitIdGeneratorService.generateUnitId(request.getSite()); |
|
|
|
@ -593,7 +621,7 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
handlingUnit.setCreatedBy("SYSTEM"); |
|
|
|
handlingUnit.setSourceType("IFS_INIT"); |
|
|
|
handlingUnit.setOriginalQty(request.getQty()); // 使用计算后的数量 |
|
|
|
handlingUnit.setReceiveDate(onunit.getManufactureDate()); |
|
|
|
handlingUnit.setReceiveDate(newReceiveDate); |
|
|
|
handlingUnit.setHeight(request.getHeight()); |
|
|
|
|
|
|
|
// 根据料号和单位计算长宽 |
|
|
|
@ -621,10 +649,10 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
|
|
|
|
handlingUnit.setWidth(width); |
|
|
|
handlingUnit.setLength(length); |
|
|
|
handlingUnit.setManufactureDate(onunit.getManufactureDate()); |
|
|
|
handlingUnit.setExpiredDate(onunit.getExpiredDate()); |
|
|
|
handlingUnit.setUmId(onunit.getUmId()); |
|
|
|
handlingUnit.setEngChgLevel(onunit.getEngChgLevel() != null ? onunit.getEngChgLevel() : "1"); // 设置工程变更级别,默认1 |
|
|
|
handlingUnit.setManufactureDate(newManufactureDate); |
|
|
|
handlingUnit.setExpiredDate(newExpireData); |
|
|
|
handlingUnit.setUmId(newUmId); |
|
|
|
handlingUnit.setEngChgLevel(newEngChgLevel); // 设置工程变更级别,默认1 |
|
|
|
|
|
|
|
// 保存HandlingUnit |
|
|
|
boolean saveResult = handlingUnitService.save(handlingUnit); |
|
|
|
|