?? teststockmanagementdata.java
字號:
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 + -