@Override
  protected void editing() {
    NHzInfo hzInfo = StorageModule.getInstance().getHzInfo();

    NSpInfo zhspInfo = businessDialog.getHeadPane().getData(); // 组合商品

    NSpjgpzInfo rowObject = xTable.getRowObject(editingRow);

    NSpInfo spInfo = (NSpInfo) KasaSwingTools.getComponentValue(editorComponent);
    if (null == spInfo) {
      rowObject.REFERENCE_NSp_yl = null; // 原料商品 not null
      rowObject.REFERENCE_NSp_yl_desc = null;
      rowObject.SPDH = null; // 商品代号 null
      rowObject.SPGG = null; // 商品规格 null
      rowObject.GJTM = null; // 国际条码 null
      rowObject.YS = null; // 颜色 null
      rowObject.KS = null; // 款式 null
      rowObject.REFERENCE_NSpdw_D = null;
      rowObject.REFERENCE_NSpdw_D_desc = null;
      rowObject.REFERENCE_NSpdw_X = null;
      rowObject.REFERENCE_NSpdw_X_desc = null;
      rowObject.DXZHL = null;
      rowObject.SPCBJ = null; // 商品成本价 null
      rowObject.SPLSJ = null; // 商品零售价 null
    } else {
      if (isExist(spInfo)) {
        KasaSwingTools.resetComponent(editorComponent);

        StorageModule.showMessageDialog(businessDialog, "商品重复!");
      } else {
        rowObject.REFERENCE_NJt = hzInfo.REFERENCE_NJt; // 集团 not null
        rowObject.REFERENCE_NJt_desc = hzInfo.REFERENCE_NJt_desc; // 集团 not null
        rowObject.REFERENCE_NSp = zhspInfo.ID; // 组合商品 not null
        rowObject.REFERENCE_NSp_desc = zhspInfo.SPMC;
        rowObject.REFERENCE_NSp_yl = spInfo.ID; // 原料商品 not null
        rowObject.REFERENCE_NSp_yl_desc = spInfo.SPMC;
        rowObject.SPDH = spInfo.SPDH; // 商品代号 null
        rowObject.SPGG = spInfo.SPGG; // 商品规格 null
        rowObject.GJTM = spInfo.GJTM; // 国际条码 null
        rowObject.YS = spInfo.YS; // 颜色 null
        rowObject.KS = spInfo.KS; // 款式 null
        rowObject.REFERENCE_NSpdw_D = spInfo.REFERENCE_NSpdw_D;
        rowObject.REFERENCE_NSpdw_D_desc = spInfo.REFERENCE_NSpdw_D_desc;
        rowObject.REFERENCE_NSpdw_X = spInfo.REFERENCE_NSpdw_X;
        rowObject.REFERENCE_NSpdw_X_desc = spInfo.REFERENCE_NSpdw_X_desc;
        rowObject.DXZHL = spInfo.DXZHL;
        rowObject.SPCBJ = spInfo.SPCBJ; // 商品成本价 null
        rowObject.SPLSJ = spInfo.SPLSJ; // 商品零售价 null
      }
    }

    xTable.refreshRow(editingRow);
  }
  @Override
  protected void editing() {
    Object value = KasaSwingTools.getComponentValue(editorComponent);
    if (null != value) {
      int sl = (Integer) value;
      if (sl > 0) {
        NYsdlistInfo ysdlistInfo = xTable.getRowObject(editingRow);

        Double dwtj = ysdlistInfo.DWTJ;
        if (null != dwtj && dwtj > 0) {
          ysdlistInfo.setValue("ZTJ", NumberTools.multiplyScale(10, dwtj, sl));
        }

        Double dwzl = ysdlistInfo.DWZL;
        if (null != dwzl && dwzl > 0) {
          ysdlistInfo.setValue("ZZL", NumberTools.multiplyScale(10, dwzl, sl));
        }

        Double dwje = ysdlistInfo.DWJE;
        if (null != dwje && dwje > 0) {
          ysdlistInfo.setValue("ZJE", NumberTools.multiplyScale(10, dwje, sl));
        }
        xTable.refreshRow(editingRow);
      }
    }
  }
  @Override
  protected void editing() {
    NPsdthomsInfo rowObject = xTable.getRowObject(editingRow);

    NSpInfo spInfo = (NSpInfo) KasaSwingTools.getComponentValue(editorComponent);
    if (null == spInfo) {
      DdSpFastSelectDlg.updateRowObject(rowObject, null);
    } else {
      if (isExist(spInfo)) {
        KasaSwingTools.resetComponent(editorComponent);

        StorageModule.showMessageDialog(businessDialog, "商品重复!");
      } else {
        DdSpFastSelectDlg.updateRowObject(rowObject, spInfo);
      }
    }

    xTable.refreshRow(editingRow);
  }
Пример #4
0
  @Override
  public boolean verify() {
    if (super.verify()) {
      KasaEnum yjfw = (KasaEnum) yjfw_comboBox.getSelectedItem();
      if (NZxyjbzEnum.ENUM_YJFW.JG.key == yjfw.key) {
        if (null == zzjgfwSelect.getObject()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "当预警范围为机构时,请选择机构!");
          return false;
        }
      }
      if (NZxyjbzEnum.ENUM_YJFW.SZ.key == yjfw.key) {
        if (null == szfwSelect.getObject()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "当预警范围为所站时,请选择所站!");
          return false;
        }
      } else if (NZxyjbzEnum.ENUM_YJFW.KQ.key == yjfw.key) {
        if (null == kqfwSelect.getObject()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "当预警范围为库区时,请选择库区!");
          return false;
        }
      } else if (NZxyjbzEnum.ENUM_YJFW.CW.key == yjfw.key) {
        if (null == cwfwSelect.getObject()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "当预警范围为储位时,请选择储位!");
          return false;
        }
      }

      if (null == zzjgfwSelect.getObject()) {
        StorageModule.showMessageDialog(ZxyjbzPane.this, "请设置组织机构");
        return false;
      }

      Integer zxts = (Integer) KasaSwingTools.getComponentValue(ZXTS);
      if (null == zxts || zxts.intValue() <= 0) {
        StorageModule.showMessageDialog(ZxyjbzPane.this, "请输入滞销天数,且必须大于0!");
        return false;
      }

      KasaEnum ke = (KasaEnum) yjfs_comboBox.getSelectedItem();
      if (NZxyjbzEnum.ENUM_YJFS.JT.key == ke.key) {

        Integer zxsl = (Integer) KasaSwingTools.getComponentValue(ZXSL);
        if (null == zxsl || zxsl.intValue() <= 0) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "请输入滞销数量,且必须大于0!");
          return false;
        }
      } else if (NZxyjbzEnum.ENUM_YJFS.DT.key == ke.key) {
        Double zxbl = (Double) KasaSwingTools.getComponentValue(ZXBL);

        if (null == zxbl || zxbl.doubleValue() <= 0 || 1 <= zxbl.doubleValue()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "请输入滞销比例,且必须在0~1之间!");
          return false;
        }

        Integer zxtjts = (Integer) KasaSwingTools.getComponentValue(ZXTJTS);
        if (null == zxtjts || zxtjts.intValue() < zxts.intValue()) {
          StorageModule.showMessageDialog(ZxyjbzPane.this, "请输入统计滞销天数,且不能小于等于滞销天数!");
          return false;
        }
      } else {
        StorageModule.showMessageDialog(ZxyjbzPane.this, "预警方式选择异常!");
        return false;
      }

      return true;
    }
    return false;
  }
  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);
    }
  }