|
|
@ -19,6 +19,7 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -177,7 +178,7 @@ public class WorkOrderAllocServiceImpl implements WorkOrderAllocService { |
|
|
Map<String, List<UspWorkOrderAllocData>> groupedData = unSyncedList.stream() |
|
|
Map<String, List<UspWorkOrderAllocData>> groupedData = unSyncedList.stream() |
|
|
.collect(Collectors.groupingBy(item -> |
|
|
.collect(Collectors.groupingBy(item -> |
|
|
item.getErpOrderNo() + "_" + item.getErpOrderLineNo() + "_" + |
|
|
item.getErpOrderNo() + "_" + item.getErpOrderLineNo() + "_" + |
|
|
(item.getAllocDate() != null ? item.getAllocDate().getTime() : ""))); |
|
|
|
|
|
|
|
|
(item.getAllocDate() != null ? item.getAllocDate() : ""))); |
|
|
|
|
|
|
|
|
// 3. 逐组调用U8接口 |
|
|
// 3. 逐组调用U8接口 |
|
|
for (Map.Entry<String, List<UspWorkOrderAllocData>> entry : groupedData.entrySet()) { |
|
|
for (Map.Entry<String, List<UspWorkOrderAllocData>> entry : groupedData.entrySet()) { |
|
|
@ -189,21 +190,26 @@ public class WorkOrderAllocServiceImpl implements WorkOrderAllocService { |
|
|
try { |
|
|
try { |
|
|
// 构建U8请求参数 |
|
|
// 构建U8请求参数 |
|
|
U8WorkHourRequestDto requestDto = new U8WorkHourRequestDto(); |
|
|
U8WorkHourRequestDto requestDto = new U8WorkHourRequestDto(); |
|
|
requestDto.setMocode(firstItem.getErpOrderNo()); |
|
|
|
|
|
requestDto.setIrowNo(firstItem.getErpOrderLineNo()); |
|
|
|
|
|
requestDto.setDDate(firstItem.getAllocDate()); |
|
|
|
|
|
|
|
|
requestDto.setMocode(firstItem.getErpOrderNo() != null ? firstItem.getErpOrderNo() : ""); |
|
|
|
|
|
requestDto.setIrowNo(firstItem.getErpOrderLineNo() != null ? firstItem.getErpOrderLineNo() : ""); |
|
|
|
|
|
if (firstItem.getAllocDate() != null) { |
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
|
|
requestDto.setDDate(sdf.format(firstItem.getAllocDate())); |
|
|
|
|
|
} else { |
|
|
|
|
|
requestDto.setDDate(""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
List<U8WorkHourRequestDto.DetailItem> detailList = new ArrayList<>(); |
|
|
List<U8WorkHourRequestDto.DetailItem> detailList = new ArrayList<>(); |
|
|
for (UspWorkOrderAllocData item : groupItems) { |
|
|
for (UspWorkOrderAllocData item : groupItems) { |
|
|
U8WorkHourRequestDto.DetailItem detailItem = new U8WorkHourRequestDto.DetailItem(); |
|
|
U8WorkHourRequestDto.DetailItem detailItem = new U8WorkHourRequestDto.DetailItem(); |
|
|
detailItem.setMesIrowNo(item.getRowNo()); |
|
|
|
|
|
detailItem.setSortSeq(item.getItemNo()); |
|
|
|
|
|
|
|
|
detailItem.setMesIrowNo(item.getRowNo() != null ? item.getRowNo() : ""); |
|
|
|
|
|
detailItem.setSortSeq(item.getItemNo() != null ? item.getItemNo() : ""); |
|
|
detailItem.setEqId(""); |
|
|
detailItem.setEqId(""); |
|
|
detailItem.setDutyClassCode(""); |
|
|
detailItem.setDutyClassCode(""); |
|
|
detailItem.setEmployCode(item.getOperator()); |
|
|
|
|
|
detailItem.setQualifiedQty(item.getAllocApproveQty()); |
|
|
|
|
|
|
|
|
detailItem.setEmployCode(item.getOperator() != null ? item.getOperator() : ""); |
|
|
|
|
|
detailItem.setQualifiedQty(item.getAllocApproveQty() != null ? String.valueOf(item.getAllocApproveQty()) : ""); |
|
|
detailItem.setRefusedQty(""); |
|
|
detailItem.setRefusedQty(""); |
|
|
detailItem.setScrapQty(item.getAllocScrapQty()); |
|
|
|
|
|
|
|
|
detailItem.setScrapQty(item.getAllocScrapQty() != null ? String.valueOf(item.getAllocScrapQty()) : ""); |
|
|
|
|
|
|
|
|
// 计算工时:调机时长 + 制造时长 |
|
|
// 计算工时:调机时长 + 制造时长 |
|
|
BigDecimal workHr = BigDecimal.ZERO; |
|
|
BigDecimal workHr = BigDecimal.ZERO; |
|
|
@ -213,7 +219,7 @@ public class WorkOrderAllocServiceImpl implements WorkOrderAllocService { |
|
|
if (item.getAllocManfTime() != null) { |
|
|
if (item.getAllocManfTime() != null) { |
|
|
workHr = workHr.add(item.getAllocManfTime()); |
|
|
workHr = workHr.add(item.getAllocManfTime()); |
|
|
} |
|
|
} |
|
|
detailItem.setWorkHr(workHr); |
|
|
|
|
|
|
|
|
detailItem.setWorkHr(workHr.compareTo(BigDecimal.ZERO) == 0 ? "0" : workHr.toString()); |
|
|
|
|
|
|
|
|
detailList.add(detailItem); |
|
|
detailList.add(detailItem); |
|
|
} |
|
|
} |
|
|
|