/**
  * 修改派车单主表
  *
  * @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);
   }
 }
 /**
  * 添加派车单主表
  *
  * @param Tpactionhead
  * @return 0
  */
 @Override
 public void saveTpactionhead(
     IFWUserInfo userInfo,
     Tpactionhead tpactionhead,
     Tpactionline tpactionline,
     SerialnumInfo serialnumInfo) {
   if (tpactionhead != null) {
     if (serialnumInfo != null) {
       serialnumBusiness.updateSerialnum(userInfo, serialnumInfo);
     }
     tpactionhead.setMcreatedate(PublicMethod.now());
     tpactionhead.setMactdate(PublicMethod.now());
     tpactionhead.setMcreateempID(userInfo.getUserID());
     tpactionhead.setMmodifydate(PublicMethod.now());
     tpactionhead.setMmodifyempID(userInfo.getUserID());
     tpactionhead.setMdtype(HConstants.P);
     tpactionheadMapper.insert(tpactionhead);
   }
   if (tpactionline != null) {
     String macttypeID = tpactionline.getMacttypeID();
     Tptrplanline trplanline =
         tptrplanlineBusiness.getTptrplanlineByID(userInfo, tpactionline.getMsguid());
     double prplanqty = 0.00;
     if (trplanline != null) {
       prplanqty = trplanline.getMexecqty();
     }
     if (HConstants.PLAN.equals(macttypeID)) {
       Tptrplanline updateLine = new Tptrplanline();
       updateLine.setMexecqty(tpactionline.getMplanqty() + prplanqty);
       updateLine.setMguid(tpactionline.getMsguid());
       updateLine.setMexecstate(HConstants.ONE);
       tptrplanlineBusiness.updateTptrplaneStatus(userInfo, updateLine);
     }
     tpactionline.setMdtype(HConstants.P);
     tpactionline.setMcreatedate(PublicMethod.now());
     tpactionline.setMcreateempID(userInfo.getUserID());
     tpactionline.setMmodifydate(PublicMethod.now());
     tpactionline.setMmodifyempID(userInfo.getUserID());
     tpactionlineMapper.insert(tpactionline);
   }
 }