⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teststockmanagementdata.java

📁 一个使用java 写的进销存代码 使用了ejb 等技术 是学习j2ee的好
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    int result = stockManagementData.signStockLedgerAndSubForFinish(ledgerDate,
        fieldName, userName, orderId, onProcess, remark);
    this.assertEquals("", 1, result);
  }
  //测试创建商品分拆单的方法
  public void testCreateRearrangeOrder()throws Exception{
    /*String ledgerDate = "200405";
    String[] stockLedger = {
        "", "10", "", "jack", "仓库3", "", "", "", "仓库2", "2004-5-5", "2004-5-15",
        "2", "1件10000005商品被分拆为1件10000001商品和10000002商品"};
    String[][] stockSubLedgerIn = {{"", "", "10000001", "10", "2", "2004-12-5"},
        {"", "", "10000002", "17", "2", "2004-11-3"}};
    String[][] stockSubLedgerOut = {{"", "", "10000005", "27", "-2", "2004-12-5"}};
    int result = stockManagementData.createRearrangeOrder(ledgerDate,
        stockLedger, stockSubLedgerOut, stockSubLedgerIn);
    this.assertEquals("", 1, result);*/
  }
  //测试更新商品分拆单的方法
  public void testUpdateRearrangeOrder()throws Exception{
    String ledgerDate = "200405";
    String[] stockLedger = {
        "20040500069", "10", "20040500070", "jack", "仓库3", "", "", "", "仓库2",
        "2004-5-6", "2004-5-16", "2", "1件10000005商品被分拆为1件10000001商品和10000002商品"};
    String[][] stockSubLedgerIn = {{"267", "20040500069", "10000001", "10", "1", "2004-12-5"},
        {"268", "20040500069", "10000002", "17", "1", "2004-11-3"}};
    String[][] stockSubLedgerOut = {{"269", "20040500070", "10000005", "27", "-1", "2004-12-5"}};
    int result = stockManagementData.updateRearrangeOrder(ledgerDate,
        stockLedger, stockSubLedgerOut, stockSubLedgerIn);
    this.assertEquals("", 1, result);
  }
  //测试撤消商品分拆单的方法
  public void testCancelRearrangeOrder()throws Exception{
    String ledgerDate = "200405";
    String inOrderId = "20040500069";
    String outOrderId = "20040500070";
    String userName = "jack";
    int onProcess = 1;
    String remark = "1件10000005商品被分拆为1件10000001商品和10000002商品";
    int result = stockManagementData.cancelOrRestoreRearrangeOrder(ledgerDate,
        inOrderId, outOrderId, userName, onProcess, remark);
    this.assertEquals("", 1, result);
  }
  //测试恢复商品分拆单的方法
  public void testRestoreRearrangeOrder()throws Exception{
    String ledgerDate = "200405";
    String inOrderId = "20040500069";
    String outOrderId = "20040500070";
    String userName = "jack";
    int onProcess = 2;
    String remark = "1件10000005商品被分拆为1件10000001商品和10000002商品";
    int result = stockManagementData.cancelOrRestoreRearrangeOrder(ledgerDate,
        inOrderId, outOrderId, userName, onProcess, remark);
    this.assertEquals("", 1, result);
  }
  //测试创建商品组合单的方法
  public void testCreateCombineOrder()throws Exception{
    /*String ledgerDate = "200405";
    String[] stockLedger = {
        "", "12", "", "jack", "仓库3", "", "", "", "仓库2", "2004-5-5", "2004-5-15",
        "2", "1件10000001商品和10000002商品组合为1件10000005商品"};
    String[][] stockSubLedgerOut = {{"", "", "10000001", "10", "-2", "2004-12-5"},
        {"", "", "10000002", "17", "-2", "2004-11-3"}};
    String[][] stockSubLedgerIn = {{"", "", "10000005", "27", "2", "2004-12-5"}};
    int result = stockManagementData.createCombineOrder(ledgerDate,
        stockLedger, stockSubLedgerOut, stockSubLedgerIn);
    this.assertEquals("", 1, result);*/
  }
  //测试更新商品组合单的方法
  public void testUpdateCombineOrder()throws Exception{
    String ledgerDate = "200405";
    String[] stockLedger = {
        "20040500077", "12", "20040500078", "jack", "仓库3", "", "", "", "仓库2",
        "2004-5-6", "2004-5-16", "2", "1件10000001商品和10000002商品组合为1件10000005商品"};
    String[][] stockSubLedgerOut = {{"281", "20040500078", "10000001", "10", "-1", "2004-12-5"},
        {"282", "20040500078", "10000002", "17", "-1", "2004-11-3"}};
    String[][] stockSubLedgerIn = {{"280", "20040500077", "10000005", "27", "1", "2004-12-5"}};
    int result = stockManagementData.updateCombineOrder(ledgerDate,
        stockLedger, stockSubLedgerOut, stockSubLedgerIn);
    this.assertEquals("", 1, result);
  }
  //测试根据仓库名字取得盘点数据的方法
  public void testGetStocktakeQuantityByWarehouse()  throws Exception{
    String ledgerDate = "200405";
    String warehouse = "仓库1";
    int onProcess = 2;
    String[][] data = stockManagementData.getStocktakeQuantityByWarehouse(
        ledgerDate, warehouse, onProcess);
    this.assertEquals("", 4, data.length);
  }
  //测试根据仓库名字汇总显示商品数量和金额的方法
  public void testGetStockByWarehouse()  throws Exception{
    String ledgerDate = "200405";
    String warehouse = "仓库1";
    int onProcess = 2;
    String[][] data = stockManagementData.getStockByWarehouse(
        ledgerDate, warehouse, onProcess);
    this.assertEquals("", 27, data.length);
  }
  //测试根据商品条形码汇总显示商品在各个仓库的数量和金额的方法
  public void testGetStockByGoodsBarcode()  throws Exception{
    String ledgerDate = "200405";
    String goodsBarcode = "10000005";
    int onProcess = 2;
    String[][] data = stockManagementData.getStockByGoodsBarcode(
        ledgerDate, goodsBarcode, onProcess);
    this.assertEquals("", 8, data.length);
  }
  //测试查询过期商品的方法
  public void testGetStockByUsefulLife()  throws Exception{
    String ledgerDate = "200405";
    String usefulLife = "2004-6-1";
    int onProcess = 2;
    String[][] data = stockManagementData.getStockByUsefulLife(
        ledgerDate, usefulLife, onProcess);
    this.assertEquals("", 3, data.length);
  }
  //测试创建销售账套数据表和销售账套明细数据表记录的方法
  public void testCreateSaleLedgerAndSub() throws Exception{
    /*String ledgerDate = "200405";
    String[] saleLedger = {
        "", "0", "顾客", "jack", "", "", "", "2004-5-5", "2004-5-15",
        "0", ""};
    String[][] saleSubLedger = {{"", "", "10000001", "15.2", "8"},
        {"", "", "10000002", "18.5", "11"}};
    int result = stockManagementData.createSaleLedgerAndSub(ledgerDate, saleLedger, saleSubLedger);
    this.assertEquals("", 1, result);*/
  }
  //测试更新销售账套数据表和销售账套明细数据表记录的方法
  public void testUpdateSaleLedgerAndSub() throws Exception{
    String ledgerDate = "200405";
    String[] saleLedger = {
        "20040500001", "0", "顾客", "jack", "", "", "", "2004-5-6", "2004-5-6",
        "0", ""};
    String[][] saleSubLedger = {{"6", "20040500001", "10000001", "15.2", "3"},
        {"7", "20040500001", "10000002", "18.5", "5"}};
    int result = stockManagementData.updateSaleLedgerAndSub(ledgerDate, saleLedger, saleSubLedger);
    this.assertEquals("", 1, result);
  }
  //测试销售账套数据表电子签名和更新完成状态的方法
  public void testSignSaleLedgerAndSubForFinish() throws Exception{
    String ledgerDate = "200405";
    String fieldName = "counterUser";
    String userName = "jack";
    String orderId = "20040500001";
    int onProcess = 1;
    String remark = "销售单已撤消.";
    int result = stockManagementData.signSaleLedgerAndSub(ledgerDate,
        fieldName, userName, orderId, onProcess, remark);
    this.assertEquals("", 1, result);
  }
  //测试根据单据编号取得销售账套明细数据表的记录
  public void testGetSaleSubLedgerBySaleId() throws Exception{
    //根据单据编号取得记录
    String[][] detail = stockManagementData.getSaleSubLedgerBySaleId(
        "200404", "20040400001");
    this.assertEquals("", 1, detail.length);
  }
  //测试根据字符串字段取得销售账套数据表记录的方法
  public void testGetSaleLedgerByStringField() throws Exception{
    //根据单据编号取得记录
    String[][] detail = stockManagementData.getSaleLedgerByStringField(
        "200404", "saleId", "2004", 0);
    this.assertEquals("", 1, detail.length);
  }
  //测试根据填写日期取得销售账套数据表记录的方法
  public void testGetSaleLedgerByOrderDate() throws Exception{
    //创建日期类
    java.util.Calendar date = java.util.Calendar.getInstance();
    date.set(2004, 3, 10, 0, 0, 0);
    date.set(java.util.Calendar.MILLISECOND, 0);
    java.sql.Timestamp startDate = new java.sql.Timestamp(date.getTime().getTime());
    date.set(2004, 3, 10, 23, 59, 59);
    date.set(java.util.Calendar.MILLISECOND, 998);
    java.sql.Timestamp endDate = new java.sql.Timestamp(date.getTime().getTime());
    String[][] detail = stockManagementData.getSaleLedgerByOrderDate("200404", startDate, endDate, 1);
    this.assertEquals("", 1, detail.length);
  }
  //测试根据完成状态取得销售账套数据表的记录
  public void testGetSaleLedgerByOnProcess() throws Exception{
    //根据完成状态取得记录
    String[][] detail = stockManagementData.getSaleLedgerByOnProcess(
        "200404", 1, 0);
    this.assertEquals("", 1, detail.length);
  }
  //测试前台销售员进行销售账套数据表电子签名的方法
  public void testCounterUserSignSaleLedgerAndSub() throws Exception{
    String ledgerDate = "200405";
    String userName = "jack";
    String remark = "已签名";
    String warehouse = "柜台1";
    int result = stockManagementData.counterUserSignSaleLedgerAndSub(ledgerDate,
        userName, remark, warehouse);
    //由于在状态EJB中已完成jack用户的前台销售单签名,所以本测试方法的返回值是0
    this.assertEquals("", 0, result);
  }
  //测试根据商品的条形码取得销售价和折扣
  public void testGetGoodsPriceAndDiscount() throws Exception{
    String goodsBarcode = "10000001";
    double[] data = stockManagementData.getGoodsPriceAndDiscount(goodsBarcode);
    this.assertEquals("", 15, data[0], 2);
    this.assertEquals("", 0.35, data[1], 2);
  }
  //测试根据条形码、仓库取得商品的数量,然后检查卖出商品的数量是否足够
  public void testCheckGoodsSaleQuantity() throws Exception{
    String ledgerDate = "200405";
    String goodsBarcode = "10000001";
    int saleQuantity = 100;
    String warehouse = "柜台1";
    //库存数大于卖出数
    int result = stockManagementData.checkGoodsSaleQuantity(ledgerDate, goodsBarcode, saleQuantity, warehouse);
    this.assertEquals("", 1, result);
    saleQuantity = 200;
    //卖出数大于库存数
    result = stockManagementData.checkGoodsSaleQuantity(ledgerDate, goodsBarcode, saleQuantity, warehouse);
    this.assertEquals("", 0, result);
  }
  //测试信用销售员进行销售账套数据表电子签名的方法
  public void testCreditUserSignSaleLedgerAndSub() throws Exception{
    String ledgerDate = "200405";
    String userName = "jack";
    String remark = "已签名";
    String warehouse = "柜台1";
    String saleId = "20040500011";
    String customerName = "客户1";
    int result = stockManagementData.creditUserSignSaleLedgerAndSub(ledgerDate,
        userName, remark, warehouse, saleId, customerName);
    //由于在状态EJB中已完成20040500011销售单签名,所以本测试方法的返回值是0
    this.assertEquals("", 0, result);
  }
  //测试检查客户的方法
  public void testCheckCustomer() throws Exception{
    String customer = "客户";
    int result = stockManagementData.checkCustomer(customer);
    this.assertEquals("", 0, result);
    result = stockManagementData.checkCustomer("客户1");
    this.assertEquals("", 1, result);
  }
  //测试检查客户信用限度的方法
  public void testCheckCustomerCreditLimit() throws Exception{
    String customer = "客户1";
    double amount = 9000;
    int result = stockManagementData.checkCustomerCreditLimit(customer, amount);
    this.assertEquals("", 1, result);
    amount = 20000;
    result = stockManagementData.checkCustomerCreditLimit(customer, amount);
    this.assertEquals("", 0, result);
  }
  //测试现金管理员进行应收账款电子签名的方法
  public void testCashUserSignAccountReceivable() throws Exception{
    String ledgerDate = "200405";
    String userName = "jack";
    String[] currentAccountLedger = {"20040500012", "sa20040500011", "1", "466.5",
        "客户1", "jack", "", "2004-6-11 12:19:52", null, "0", "已签名."};
    int result = stockManagementData.cashUserSignAccountReceivable(ledgerDate,
        userName, currentAccountLedger);
    //状态EJB已对20040500012应收票据进行了签名,所以它的返回值应该是0
    this.assertEquals("", 0, result);
  }
  //测试根据关联标识、退货单的商品条形码取得库存账套的销售出库单明细账的数据
  public void testGetStockSaleOutBySaleOrderLink() throws Exception{
    String ledgerDate = "200405";
    String saleOrderLink = "sajack";
    String saleId = "20040500015";
    String[][] data = stockManagementData.getStockSaleOutBySaleOrderLink(
        ledgerDate, saleOrderLink, saleId);
    this.assertEquals("", 3, data.length);
  }
  //测试前台销售员进行销售退货单电子签名的方法
  public void testCountUserSignSaleReturn() throws Exception{
    String ledgerDate = "200405";
    String userName = "jack";
    String remark = "已签名";
    String warehouse = "柜台1";
    String saleId = "20040500015";
    //销售退货,库存数量增加
    String[][] stockSubLedger = {
        {"", "", "10000001", "15.2", "1", "2004-05-20"},
    };
    int result = stockManagementData.counterUserSignSaleReturn(ledgerDate,
        saleId, userName, remark, warehouse, stockSubLedger);
    //状态EJB已实现电子签名,所以返回值是0
    this.assertEquals("", 0, result);
  }
  //测试信用销售员进行销售退货单电子签名的方法
  public void testCreditUserSignSaleReturn() throws Exception{
    String ledgerDate = "200405";
    String userName = "jack";
    String remark = "已签名";
    String warehouse = "柜台1";
    String customerName = "客户1";
    String saleId = "20040500020";
    //销售退货,库存数量增加
    String[][] stockSubLedger = {
        {"", "", "10000001", "3.7", "10", "2004-11-5"},
    };
    int result = stockManagementData.creditUserSignSaleReturn(ledgerDate,
        saleId, userName, remark, warehouse, customerName,stockSubLedger, true);
    //状态EJB已实现电子签名,所以返回值是0
    this.assertEquals("", 0, result);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -