コード例 #1
0
  private void doCXHXAction() {
    int result = StorageModule.showConfirmDialog(this, "确定撤销核销这些数据吗?");
    if (0 == result) {
      List<NPczbInfo> list = this.getSelectedRowList();
      if (null != list) {
        String YYCLCZ = null; // 车主
        for (NPczbInfo one : list) {
          if (null == YYCLCZ) {
            YYCLCZ = one.REFERENCE_NYyclcz;
          } else if (!one.REFERENCE_NYyclcz.equals(YYCLCZ)) {
            StorageModule.showMessageDialog(this, "同一车队才能进行撤销核销操作!转运车辆:" + one.CPHM + "所属“车主”不相同");
            return;
          }

          if (NPczbEnum.ENUM_JSZT.HX.key != one.ENUM_JSZT) {
            StorageModule.showMessageDialog(
                this, "只有“核销”状态下才能进行撤销核销操作!转运车辆:" + one.CPHM + "的记录状态不是“核销”状态");
            return;
          }
        }

        PczbHXRequest request = new PczbHXRequest();
        request.szInfo = StorageModule.getInstance().getSzInfo();
        request.list = new ZTOArrayList<NPczbInfo>(list, NPczbInfo.class);

        PczbHXResponse response = new PczbHXResponse();

        int iRresult =
            CommonTools.sendSynCommand(StorageCmdCode.CX_PCZB_ZYFY_HX, request, response);
        if (0 == iRresult) {
          List<NPczbInfo> responseList = response.list;
          if (null == responseList || list.size() != responseList.size()) {
            StorageModule.showMessageDialog(this, "系统错误:返回的数据和请求的数据数量上不对应!");
          } else {
            int[] selected = this.getSelectedRows();
            int index = 0;
            for (int rowIndex : selected) {
              this.setRow(rowIndex, responseList.get(index++));
            }

            StorageModule.showMessageDialog(this, "撤销核销完成!");
          }
        }
      }
    }
  }
コード例 #2
0
  private void doHXAction() {
    int result = StorageModule.showConfirmDialog(this, "确定核销这些数据吗?");
    if (0 == result) {
      final List<NPczbInfo> list = this.getSelectedRowList();

      UIProperties[] properties =
          PropertiesTools.getTableProperties2(
              Constants.PROPERTY_FILE_BASE_PATH + "fms/ksdz/xyfy/xyzyfy/NPczbStat.properties");
      final PropertiesPane statPane =
          new PropertiesPane(TableNameConstants.PCZB, properties, Constants.MODIFY_TYPE);
      statPane.setBorder(KasaSwingTools.getTitleBorder("费用统计"));

      String YYCLCZ = null; // 车主
      double YSCB = 0; // 运输成本 null
      double JHFY = 0; // 接货费用 null
      double YSFY = 0; // 运输费用 null
      double BZYF = 0; // 标准运费 null
      double TSFY = 0; // 特殊费用 null
      double SHFY = 0; // 送货费用 null
      double LZF = 0; // 力资费 null
      double QTFY = 0; // 其他费用 null
      double ZYFY = 0; // 转运费用 null
      double NXYF = 0; // 逆向运费 null
      for (NPczbInfo one : list) {
        if (null == YYCLCZ) {
          YYCLCZ = one.REFERENCE_NYyclcz;
        } else if (!one.REFERENCE_NYyclcz.equals(YYCLCZ)) {
          StorageModule.showMessageDialog(this, "同一车队才能进行核销操作!转运车辆:" + one.CPHM + "所属“车主”不相同");
          return;
        }

        if (null != one.YSCB) {
          YSCB = NumberTools.add(YSCB, one.YSCB);
        }

        if (null != one.JHFY) {
          JHFY = NumberTools.add(JHFY, one.JHFY);
        }

        if (null != one.YSFY) {
          YSFY = NumberTools.add(YSFY, one.YSFY);
        }

        if (null != one.BZYF) {
          BZYF = NumberTools.add(BZYF, one.BZYF);
        }

        if (null != one.TSFY) {
          TSFY = NumberTools.add(TSFY, one.TSFY);
        }

        if (null != one.SHFY) {
          SHFY = NumberTools.add(SHFY, one.SHFY);
        }

        if (null != one.LZF) {
          LZF = NumberTools.add(LZF, one.LZF);
        }

        if (null != one.QTFY) {
          QTFY = NumberTools.add(QTFY, one.QTFY);
        }

        if (null != one.ZYFY) {
          ZYFY = NumberTools.add(ZYFY, one.ZYFY);
        }

        if (null != one.NXYF) {
          NXYF = NumberTools.add(NXYF, one.NXYF);
        }

        if (null != one.ENUM_JSZT) {
          StorageModule.showMessageDialog(
              this, "“结算状态”为空才能进行核销操作!转运车辆:" + one.CPHM + "的记录的“结算状态”不为空");
          return;
        }
      }
      NPczbInfo statInfo = new NPczbInfo();
      statInfo.YSCB = YSCB; // 运输成本 null
      statInfo.JHFY = JHFY; // 接货费用 null
      statInfo.YSFY = YSFY; // 运输费用 null
      statInfo.BZYF = BZYF; // 标准运费 null
      statInfo.TSFY = TSFY; // 特殊费用 null
      statInfo.SHFY = SHFY; // 送货费用 null
      statInfo.LZF = LZF; // 力资费 null
      statInfo.QTFY = QTFY; // 其他费用 null
      statInfo.ZYFY = ZYFY; // 转运费用 null
      statInfo.NXYF = NXYF; // 逆向运费 null
      statPane.setData(statInfo);

      KasaCommonXTable<NPczbInfo> ysdTable =
          new KasaCommonXTable<NPczbInfo>(
              mainPane.getTableName(), XyzyfyTablePane.this.properties, Constants.QUERY_TYPE);
      ysdTable.setData(list);
      JScrollPane scrollPane = new JScrollPane(ysdTable);
      ysdTable.showRowIndex(true);
      scrollPane.setBorder(KasaSwingTools.getTitleBorder("转运车辆列表"));

      Ok_Cancel_Dialog dialog =
          new Ok_Cancel_Dialog(StorageModule.getMainFrame(), "转运车辆核销对话框") {
            private static final long serialVersionUID = 1L;

            public void doOkEvent() {
              if (null == statPane.getComponentValue("ENUM_WLFS")) {
                StorageModule.showMessageDialog(this, "“往来方式”必选");
                return;
              }

              PczbHXRequest request = new PczbHXRequest();
              request.szInfo = StorageModule.getInstance().getSzInfo();
              request.ENUM_WLFS = ((KasaEnum) statPane.getComponentValue("ENUM_WLFS")).key;
              request.list = new ZTOArrayList<NPczbInfo>(list, NPczbInfo.class);

              PczbHXResponse response = new PczbHXResponse();

              int iRresult =
                  CommonTools.sendSynCommand(StorageCmdCode.PCZB_ZYFY_HX, request, response);
              if (0 == iRresult) {
                List<NPczbInfo> responseList = response.list;
                if (null == responseList || list.size() != responseList.size()) {
                  StorageModule.showMessageDialog(this, "系统错误:返回的数据和请求的数据数量上不对应!");
                } else {
                  int[] selected = XyzyfyTablePane.this.getSelectedRows();
                  int index = 0;
                  for (int rowIndex : selected) {
                    XyzyfyTablePane.this.setRow(rowIndex, responseList.get(index++));
                  }

                  StorageModule.showMessageDialog(this, "核销完成!");
                  this.dispose();
                }
              }
            }
          };
      dialog.getContentPane().add(statPane, java.awt.BorderLayout.NORTH);
      dialog.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);
      dialog.setResizable(true);
      dialog.setSize(800, 500);
      dialog.setLocationRelativeTo(StorageModule.getMainFrame());
      dialog.setVisible(true);
    }
  }