public void removeSWMtpactionhead(IFWUserInfo userInfo, String[] IDList, double mweight) { try { for (int i = 0; i < IDList.length; i++) { Tpactionline tpactionlineparams = new Tpactionline(); tpactionlineparams.setMheadguid(IDList[i]); tpactionlineparams.setMdtype(HConstants.A); tpactionlineparams.setMweight(mweight); List<Tpactionline> listDtype = tpactionlineBusiness.findTpactionlineByHeadguid(userInfo, tpactionlineparams); int typevaluecount = listDtype.size(); if (typevaluecount > 0) { throw new BusinessException("该派车单有实际派车且整车净重大于零不可删除!"); } // 通过headid查看全部派车单主表 Tpactionline tpactionline = new Tpactionline(); tpactionline.setMheadguid(IDList[i]); tpactionline.setMweight(mweight); List<Tpactionline> listline = tpactionlineBusiness.findTplineByHeadguid(userInfo, tpactionline); int count = listline.size(); for (int j = 0; j < count; j++) { tpactionlineBusiness.removeTpactionline(userInfo, listline.get(j).getMguid()); } removeTpactionhead(userInfo, IDList[i]); } } catch (Exception e) { throw new BuilderException(e.getMessage()); } }
/** * 修改派车单主表 * * @param Tpactionhead,Tpactionline * @return 0 */ @Override public void updateTpactionhead( IFWUserInfo userInfo, Tpactionhead tpactionhead, Tpactionline tpactionline) { if (tpactionhead != null && tpactionline != null) { String macttypeID = tpactionline.getMacttypeID(); Tpactionline dbtpactionline = tpactionlineBusiness.getTpactionlineByID(userInfo, tpactionline.getMguid()); String dbmacttypeId = dbtpactionline.getMacttypeID(); Tptrplanline tptrplanline = tptrplanlineBusiness.getTptrplanlineByID(userInfo, tpactionline.getMsguid()); double prplanqty = 0.00; if (tptrplanline != null) { prplanqty = tptrplanline.getMexecqty(); } if ((dbmacttypeId.equals(HConstants.PLAN) && macttypeID.equals(HConstants.PLANSA)) || (dbmacttypeId.equals(HConstants.PLAN) && macttypeID.equals(HConstants.OUTPLAN))) { // 运输计划修改为经营协议或者手动填写 Tptrplanline updateLine = new Tptrplanline(); updateLine.setMexecqty(tpactionline.getMplanqty()); updateLine.setMguid(tpactionline.getMtrplnbysguid()); updateLine.setMexecstate(HConstants.ZERO); tptrplanlineBusiness.updateTptrplaneStatus(userInfo, updateLine); } else if ((dbmacttypeId.equals(HConstants.OUTPLAN) && macttypeID.equals(HConstants.PLAN)) || (dbmacttypeId.equals(HConstants.PLANSA) && macttypeID.equals(HConstants.PLAN)) || (dbmacttypeId.equals(macttypeID))) { // 经营协议或者手动填写修改为运输计划 if (HConstants.PLAN.equals(macttypeID)) { Tptrplanline updateLine = new Tptrplanline(); updateLine.setMexecqty(tpactionline.getMplanqty()); updateLine.setMguid(tpactionline.getMsguid()); updateLine.setMexecstate(HConstants.ONE); tptrplanlineBusiness.updateTptrplaneStatus(userInfo, updateLine); } } tpactionhead.setMmodifydate(PublicMethod.now()); tpactionhead.setMactdate(PublicMethod.now()); tpactionhead.setMmodifyempID(userInfo.getUserID()); tpactionline.setMmodifydate(PublicMethod.now()); tpactionline.setMmodifyempID(userInfo.getUserID()); tpactionlineMapper.update(tpactionline); tpactionheadMapper.update(tpactionhead); } else if (tpactionhead != null && tpactionline == null) { tpactionhead.setMmodifydate(PublicMethod.now()); tpactionhead.setMactdate(PublicMethod.now()); tpactionhead.setMmodifyempID(userInfo.getUserID()); tpactionheadMapper.update(tpactionhead); } }