|
|
@@ -17,6 +17,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
/**
|
|
|
* 发货提醒校验记录
|
|
|
@@ -51,9 +52,13 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
|
|
|
record.setEnUU(enterprise.getUu());
|
|
|
record.setKind("end");
|
|
|
List<NoticeRecordDetail> details = new ArrayList<>();
|
|
|
- int errorCount = 0;
|
|
|
- notifyList.forEach(notify -> details.add(covert(notify, errorCount)));
|
|
|
- record.setErrorCount(errorCount);
|
|
|
+ final int[] errorCount = {0};
|
|
|
+ notifyList.forEach(notify -> {
|
|
|
+ NoticeRecordDetail detail = covert(notify);
|
|
|
+ details.add(detail);
|
|
|
+ errorCount[0] += detail.getErrorCount();
|
|
|
+ });
|
|
|
+ record.setErrorCount(errorCount[0]);
|
|
|
record.setDetails(details);
|
|
|
recordDao.save(record);
|
|
|
}
|
|
|
@@ -62,15 +67,15 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
|
|
|
* 将ERP发货提醒明细转成B2B记录明细
|
|
|
*
|
|
|
* @param notify ERP发货提醒明细
|
|
|
- * @param errorCount 异常数
|
|
|
* @return NoticeRecordDetail
|
|
|
*/
|
|
|
- private NoticeRecordDetail covert(PurchaseNotify notify, int errorCount) {
|
|
|
+ private NoticeRecordDetail covert(PurchaseNotify notify) {
|
|
|
NoticeRecordDetail detail = new NoticeRecordDetail();
|
|
|
PurchaseNotice notice = noticeDao.findOne(notify.getPn_b2bid());
|
|
|
detail.setErpId(notify.getPn_id());
|
|
|
detail.setOkStatus(Constant.NO);
|
|
|
detail.setRemark(notify.getPn_remark());
|
|
|
+ detail.setErrorCount(0);
|
|
|
if (null != notice) {
|
|
|
detail.setB2bId(notice.getId());
|
|
|
detail.setNeedQty(notice.getQty());
|
|
|
@@ -79,10 +84,11 @@ public class NoticeRecordServiceImpl implements NoticeRecordService {
|
|
|
detail.setNoDate(notice.getDate());
|
|
|
if (detail.getSendQty() == 0) {
|
|
|
detail.setOkStatus(Constant.YES);
|
|
|
- } else {
|
|
|
- errorCount++;
|
|
|
}
|
|
|
}
|
|
|
+ if (Objects.equals(detail.getOkStatus(), Constant.NO)) {
|
|
|
+ detail.setErrorCount(1);
|
|
|
+ }
|
|
|
return detail;
|
|
|
}
|
|
|
|