| | |
| | | @Synchronized |
| | | // @PostConstruct |
| | | public void inStockExecute(){ |
| | | // inStock的表头和表身 |
| | | List<InStockDto> readyInStock = erpService.getReadyInStock(); |
| | | |
| | | for (InStockDto dto : readyInStock) { |
| | | |
| | | //同一单号存在相同物料编码数据,该单号不予处理 |
| | |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | if (Cools.isEmpty(dto)) { |
| | | if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getInStockBillEntries())) { |
| | | continue; |
| | | } |
| | | for (InStockBillEntry entry : dto.getInStockBillEntries()) { |
| | |
| | | try { |
| | | if (one == null) { |
| | | waitPakin.setAnfme(entry.getFAuxQty()); |
| | | waitPakin.setNqty(entry.getFAuxQty()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | log.error("提取原材料入库通知单InStockBillEntry失败[FBillNo={},Fnumber={}]", waitPakin.getSupplier(), waitPakin.getMatnr()); |
| | | } else { |
| | |
| | | } |
| | | } else { |
| | | waitPakin.setAnfme(entry.getFAuxQty()); |
| | | waitPakin.setNqty(entry.getFAuxQty()); |
| | | if (!waitPakinService.update(waitPakin, wrapper)) { |
| | | log.error("更新原材料入库通知单InStockBillEntry失败[FBillNo={},Fnumber={}]", waitPakin.getSupplier(), waitPakin.getMatnr()); |
| | | } else { |
| | |
| | | WaitPakin one = waitPakinService.selectOne(wrapper); |
| | | if (one == null) { |
| | | waitPakin.setAnfme(cpicmo.getFAuxQty()); |
| | | waitPakin.setNqty(cpicmo.getFAuxQty()); |
| | | if (!waitPakinService.insert(waitPakin)) { |
| | | log.error("提取成品入库通知单CPICMO失败[FBillNo={},Fnumber={}]", waitPakin.getSupplier(), waitPakin.getMatnr()); |
| | | } else { |
| | |
| | | } |
| | | } else { |
| | | waitPakin.setAnfme(cpicmo.getFAuxQty()); |
| | | waitPakin.setNqty(cpicmo.getFAuxQty()); |
| | | if (!waitPakinService.update(waitPakin, wrapper)) { |
| | | log.error("同步更新成品入库通知单CPICMO失败[FBillNo={},Fnumber={}]", waitPakin.getSupplier(), waitPakin.getMatnr()); |
| | | } else { |
| | |
| | | @Transactional |
| | | public void syncOutStock(){ |
| | | List<OutStockBill> outStockBills = erpService.syncOutStock(); |
| | | log.info("出库同步开始,ERP未读单数={}", outStockBills != null ? outStockBills.size() : 0); |
| | | if (outStockBills == null || outStockBills.isEmpty()) { |
| | | return; |
| | | } |
| | | for (Integer i = 0; i < outStockBills.size(); i++) { |
| | | OutStockBill outStockBill = outStockBills.get(i); |
| | | |
| | | //同一单号存在相同物料编码数据,该单号不予处理 |
| | | Number fnumberCount = erpService.QueryFnumberOutCount(outStockBill.getFInterID()); |
| | | if(fnumberCount.intValue() > 1){ |
| | | log.info("出库同步跳过:同一单号存在相同物料[FBillNo={},FInterID={}],不予同步", outStockBill.getFBillNo(), outStockBill.getFInterID()); |
| | | if (!erpService.haveReadOutBill(outStockBill.getFBillNo(),outStockBill.getFInterID(),-1)) { |
| | | log.error("更新出库通知单读取状态为-1失败[FBrNo={},FInterID={}]", outStockBill.getFBrNo(),outStockBill.getFInterID()); |
| | | } |
| | |
| | | |
| | | OutStockBill main = outStockMainService.selectOne(new EntityWrapper<OutStockBill>().eq("FBillNo",outStockBill.getFBillNo()).and().eq("FInterID", outStockBill.getFInterID())); |
| | | if (null == main) { |
| | | log.info("出库同步新单:FBillNo={}, FInterID={},从ERP同步到WMS", outStockBill.getFBillNo(), outStockBill.getFInterID()); |
| | | outStockBill.setFflag_rw(1); |
| | | if (!outStockMainService.insert(outStockBill)) { |
| | | log.info("同步出库通知主表OutStockBill失败"); |
| | | log.error("出库同步失败:同步出库通知主表OutStockBill失败[FBillNo={},FInterID={}]", outStockBill.getFBillNo(), outStockBill.getFInterID()); |
| | | exceptionHandle("同步出库通知主表OutStockBill失败[FBillNo={0},FInterID={1}]",outStockBill.getFBillNo(),outStockBill.getFInterID()); |
| | | }; |
| | | List<OutStockBillEntry> outStockBillEntries = erpService.syncOutStockDetail(outStockBill.getFInterID()); |
| | | if (outStockBillEntries == null || outStockBillEntries.isEmpty()) { |
| | | log.warn("出库同步:ERP该单明细数为0,FBillNo={}, FInterID={}(可能ERP条件FAuxCommitQty=0无数据)", outStockBill.getFBillNo(), outStockBill.getFInterID()); |
| | | } |
| | | if (outStockBillEntries != null) { |
| | | for (Integer j = 0; j < outStockBillEntries.size(); j++) { |
| | | OutStockBillEntry outStockBillEntry = outStockBillEntries.get(j); |
| | | Wrapper<OutStockBillEntry> wrapper = new EntityWrapper<OutStockBillEntry>().eq("FInterID", outStockBillEntry.getFInterID()). |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | |
| | | log.debug("出库同步:WMS已存在该单,跳过同步明细 FBillNo={}, FInterID={}", outStockBill.getFBillNo(), outStockBill.getFInterID()); |
| | | } |
| | | |
| | | if (!erpService.haveReadOutBill(outStockBill.getFBillNo(),outStockBill.getFInterID(),1)) { |