| | |
| | | import com.gs.xky.dto.XkyDetail; |
| | | import com.gs.xky.entity.DeliveryNotice; |
| | | import com.gs.xky.entity.DeliveryNoticeDetail; |
| | | import com.gs.xky.entity.MesInvItemArn; |
| | | import com.gs.xky.mapper.DeliveryNoticeMapper; |
| | | import com.gs.xky.service.DeliveryNoticeDetailService; |
| | | import com.gs.xky.service.DeliveryNoticeService; |
| | | import com.gs.xky.service.MesInvItemArnService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author 28567 |
| | |
| | | |
| | | private final DeliveryNoticeDetailService detailService; |
| | | |
| | | private final MesInvItemArnService invItemArnService; |
| | | |
| | | |
| | | @Override |
| | | public boolean saveDeliveryNotice(XkyDetail xkyDetail) { |
| | |
| | | |
| | | wrapper.eq(DeliveryNotice::getDeliveryNo, xkyDetail.getDeliveryNo()); |
| | | |
| | | long count = count(wrapper); |
| | | // long count = count(wrapper); |
| | | DeliveryNotice one = getOne(wrapper, false); |
| | | |
| | | if (count > 0) { |
| | | if (one != null) { |
| | | LambdaUpdateWrapper<DeliveryNotice> updateWrapper = new LambdaUpdateWrapper<>(); |
| | | updateWrapper.eq(DeliveryNotice::getDeliveryNo, xkyDetail.getDeliveryNo()); |
| | | remove(updateWrapper); |
| | | |
| | | LambdaUpdateWrapper<DeliveryNoticeDetail> updateWrapper1 = new LambdaUpdateWrapper<>(); |
| | | updateWrapper1.eq(DeliveryNoticeDetail::getPid, one.getId()); |
| | | detailService.remove(updateWrapper1); |
| | | } |
| | | |
| | | |
| | | DeliveryNotice deliveryNotice = new DeliveryNotice(); |
| | | BeanUtil.copyProperties(xkyDetail, deliveryNotice); |
| | |
| | | } |
| | | |
| | | List<DeliveryNoticeDetail> noticeDetails = new ArrayList<>(); |
| | | for (LineList list : lineList) { |
| | | |
| | | List<LineList> collect = lineList.stream().filter(s -> "1".equals(s.getStatus())).collect(Collectors.toList()); |
| | | for (LineList list : collect) { |
| | | DeliveryNoticeDetail detail = new DeliveryNoticeDetail(); |
| | | BeanUtil.copyProperties(list, detail); |
| | | detail.setPid(id); |
| | |
| | | if (StrUtil.isNotEmpty(detail.getPoLineNo())) { |
| | | String[] split = detail.getPoLineNo().split("-"); |
| | | detail.setPoLineNo(split[0]); |
| | | detail.setPlanLineNo(split[1] + "-" + detail.getDeliveryQty()); |
| | | } |
| | | |
| | | |
| | | noticeDetails.add(detail); |
| | | } |
| | | |
| | | return save(deliveryNotice) && detailService.saveBatch(noticeDetails); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void callPdaReceiptBtn(String inStr, String result) { |
| | | baseMapper.callPdaReceiptBtn(inStr, result); |
| | | } |
| | | |
| | | @Override |
| | | public Integer processMesInvItemArnStatus(String factory, String company, String userCode, Long id) { |
| | | Integer poResult = 1; |
| | | String poText = ""; |
| | | |
| | | // 调用存储过程 |
| | | baseMapper.callPrcMesInvItemArnStatus22(factory, company, userCode, id, poResult, poText); |
| | | |
| | | // 返回结果 |
| | | return poResult; |
| | | } |
| | | |
| | | // |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void processMesInvItemArnStatusAsync(List<MesInvItemArn> itemArnMinus) { |
| | | // 遍历每个 itemArn |
| | | itemArnMinus.forEach(itemArn -> { |
| | | try { |
| | | // 处理每个 itemArn |
| | | processMesInvItemArnStatus("1000", "1000", "PL017", itemArn.getId()); |
| | | } catch (Exception e) { |
| | | // 处理异常,例如记录日志 |
| | | System.err.println("Error processing itemArn: " + itemArn.getId()); |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | } |
| | | } |