| | |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.service.erp.dto.InStockDto; |
| | | import com.zy.common.service.erp.entity.*; |
| | | import lombok.Synchronized; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * 原材料入库单 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | @Synchronized |
| | | // @PostConstruct |
| | | public void inStockExecute(){ |
| | | // inStock的表头和表身 |
| | | List<InStockDto> readyInStock = erpService.getReadyInStock(); |
| | | |
| | | for (InStockDto dto : readyInStock) { |
| | | |
| | | //同一单号存在相同物料编码数据,该单号不予处理 |
| | |
| | | } |
| | | continue; |
| | | } |
| | | |
| | | log.info("走到一号位置"); |
| | | if (Cools.isEmpty(dto) || Cools.isEmpty(dto.getInStockBillEntries())) { |
| | | continue; |
| | | } |
| | | log.info("走到二号位置"); |
| | | for (InStockBillEntry entry : dto.getInStockBillEntries()) { |
| | | MatCode matCode = matCodeService.selectById(entry.getFnumber()); |
| | | if (null != matCode) { |
| | | // 生成入库通知单 |
| | | log.info("走到三号位置"); |
| | | WaitPakin waitPakin = new WaitPakin(); |
| | | waitPakin.setMemo("原材料"); |
| | | waitPakin.setStatus("Y"); // 状态 |
| | |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("fail", e); |
| | | e.printStackTrace(); |
| | | System.out.println(JSON.toJSON(waitPakin)); |
| | | } |
| | |
| | | /** |
| | | * 成品入库单 |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0/20 * * * * ? ") |
| | | @Synchronized |
| | | // @PostConstruct |
| | | public void inCPICMOExecute(){ |
| | | List<CPICMO> cpicmos = erpService.getReadyCPICMO(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | @Synchronized |
| | | public void syncMat(){ |
| | | List<M_item> items = erpService.getItem(); |
| | | for (M_item item : items) { |
| | |
| | | * 成品出库 发货通知单表头,表明细 |
| | | */ |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | @Synchronized |
| | | @Transactional |
| | | public void syncOutStock(){ |
| | | List<OutStockBill> outStockBills = erpService.syncOutStock(); |
| | |
| | | if (null == one) { |
| | | // String Fnumber = (Cools.isEmpty(outStockBillEntry.getFSourceBillNo())) ? outStockBillEntry.getFnumber() : outStockBillEntry.getFnumber()+"|"+outStockBillEntry.getFSourceBillNo(); |
| | | // outStockBillEntry.setFnumber(Fnumber); //产品代码|生产单号 |
| | | outStockBillEntry.setFAmount(new BigDecimal(0)); |
| | | if (!outStockService.insert(outStockBillEntry)) { |
| | | log.info("提取出库通知明细表OutStockBillEntry失败[FBrNo={},FInterID={},FEntryID={}]",outStockBillEntry.getFBrNo(), |
| | | outStockBillEntry.getFInterID(),outStockBillEntry.getFEntryID()); |
| | |
| | | } else { |
| | | // 数量有变化进行更新 |
| | | if (Double.doubleToLongBits(one.getFAuxQty().doubleValue()) != Double.doubleToLongBits(outStockBillEntry.getFAuxQty().doubleValue())) { |
| | | outStockBillEntry.setFAmount(new BigDecimal(0)); |
| | | if (!outStockService.update(outStockBillEntry, wrapper)) { |
| | | log.info("同步更新通知明细表OutStockBillEntry失败[FBrNo={},FInterID={},FEntryID={}]",outStockBillEntry.getFBrNo(), |
| | | outStockBillEntry.getFInterID(),outStockBillEntry.getFEntryID()); |