@Override public void save(CtTmD entity) { List<CtTmD> list = this.ctTmDDao.findBy("DNo", entity.getDNo()); if (null != list && list.size() > 0) { // 如果存在此配送单号,则删除 for (int i = 0; i < list.size(); i++) { this.ctTmDDao.delete(list.get(i)); } } super.save(entity); }
// 作废EDI临时信息主表 public void deleteStatusCtTmD(Long dno) throws Exception { List<CtTmD> tmdlist = this.ctTmDDao.findBy("DNo", dno + ""); if (null == dno) { throw new ServiceException("配送单号为空!"); } if (null != tmdlist && tmdlist.size() > 0) { CtTmD tmd = tmdlist.get(0); tmd.setStatus(0l); // 0表示需要删除 this.ctTmDDao.save(tmd); } else { CtTmD tmd = new CtTmD(); OprFaxIn faxIn = this.oprFaxInService.get(dno); if (!this.edi_distributionMode.equals(faxIn.getDistributionMode())) { throw new ServiceException("配送单号为 " + dno + "的货物不是中转的货物!"); } try { tmd.setCtId(Long.valueOf(this.customerService.get(faxIn.getGoWhereId()).getEdiUserId())); } catch (Exception e) { throw new ServiceException("获取EDI编码获取失败!"); } tmd.setDNo(faxIn.getDno() + ""); tmd.setStopflag("0"); tmd.setGoodStatus("1"); tmd.setOkFlag("0"); tmd.setSignFlag("0"); tmd.setExceptionFlag("1"); // 1为否,0为是 tmd.setIsvaluables("0"); tmd.setCtName(faxIn.getGowhere()); tmd.setCubage(faxIn.getBulk()); tmd.setCustomerServiceName(faxIn.getCustomerService()); tmd.setDnAmt(faxIn.getConsigneeFee()); tmd.setDnAmtChange(0d); tmd.setEndpayAmt(faxIn.getPaymentCollection()); tmd.setFlyTime(faxIn.getFlightTime()); tmd.setGoods(faxIn.getGoods()); tmd.setPiece(faxIn.getPiece()); tmd.setReceAdd(faxIn.getAddr()); tmd.setReceCorp(""); tmd.setReceMan(faxIn.getConsignee()); tmd.setReceTel(faxIn.getConsigneeTel()); tmd.setShfNo(faxIn.getFlightNo()); tmd.setSustbillNo(faxIn.getSubNo()); tmd.setTakeMode(faxIn.getTakeMode().trim()); tmd.setTraAmt(faxIn.getTraFee()); tmd.setTraCost(faxIn.getTraFeeRate()); tmd.setWeight(faxIn.getCusWeight()); tmd.setYdNo(faxIn.getFlightMainNo()); tmd.setSignType(faxIn.getReceiptType()); // 签单类型 tmd.setDeptName(faxIn.getInDepartId() == 457l ? "广州" : "深圳"); tmd.setIsSp(faxIn.getSonderzug() == null ? "0" : faxIn.getSonderzug() + ""); // 是否专车 tmd.setIsurgent( faxIn.getUrgentService() == null ? "0" : faxIn.getUrgentService() + ""); // 是否加急 tmd.setStatus(0l); // STATUS 1:正常,0:保存时,需要删除的判断依据 this.save(tmd); } }