1、物料分类乳液条件修改
2、增加泰山入库计算单行的金额 3、汇总计算增加乳液、钛白粉、重钙的单位处理;泰山石膏增加DHJE
This commit is contained in:
parent
4f39842877
commit
39fceb2797
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -266,10 +266,18 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC, XQGC";
|
||||
String currentMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
String currentMonthSql = "";
|
||||
if ("泰山石膏".equals(bkgs)) {
|
||||
currentMonthSql = "SELECT WLMC, SLGC, SUM(DHJE) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
"FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
"GROUP BY WLMC, SLGC";
|
||||
}else {
|
||||
currentMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
"FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
"GROUP BY WLMC, SLGC";
|
||||
}
|
||||
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, yearMonth + "%");
|
||||
|
||||
// 上月数据
|
||||
@ -279,11 +287,11 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC, XQGC";
|
||||
String lastMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
"FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
"GROUP BY WLMC, SLGC";
|
||||
lastMonthData = DBSql.getMaps(lastMonthSql, bkgs, yearLastMonth + "%");
|
||||
// String lastMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// "FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// "GROUP BY WLMC, SLGC";
|
||||
lastMonthData = DBSql.getMaps(currentMonthSql, bkgs, yearLastMonth + "%");
|
||||
}
|
||||
|
||||
// 去年同期数据
|
||||
@ -293,11 +301,11 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC, XQGC";
|
||||
String lastYearMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
" FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
" GROUP BY WLMC, SLGC";
|
||||
lastYearMonthData = DBSql.getMaps(lastYearMonthSql, bkgs, lastYearMonth + "%");
|
||||
// String lastYearMonthSql = "SELECT WLMC, SLGC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// " FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// " GROUP BY WLMC, SLGC";
|
||||
lastYearMonthData = DBSql.getMaps(currentMonthSql, bkgs, lastYearMonth + "%");
|
||||
}
|
||||
|
||||
// 3. 创建物料名称和基地组合键映射的数据Map
|
||||
@ -375,12 +383,6 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
for (RowMap row : currentMonthData) {
|
||||
bases.add(row.getString("SLGC"));
|
||||
}
|
||||
// for (RowMap row : lastMonthData) {
|
||||
// bases.add(row.getString("SLGC"));
|
||||
// }
|
||||
// for (RowMap row : lastYearMonthData) {
|
||||
// bases.add(row.getString("SLGC"));
|
||||
// }
|
||||
|
||||
// 5. 批量插入
|
||||
List<BO> bos = new ArrayList<>();
|
||||
@ -390,53 +392,56 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
RowMap currentMonthRow = currentMonthMap.get(key);
|
||||
if (currentMonthRow == null || currentMonthRow.getDouble("totalAmount") == 0.0) continue;
|
||||
|
||||
double avgPrice = 0.00;
|
||||
BO summaryBO = new BO();
|
||||
summaryBO.set("BKGS", bkgs);
|
||||
summaryBO.set("JD", base);
|
||||
// List<BO> bnbmCgPzwlfl = SDK.getBOAPI().query("BO_EU_BNBM_CG_PZWLFL").
|
||||
// addQuery("BKMC = ", bkgs).addQuery("WLMC LIKE '%" + wlmc + "%'", null).list();
|
||||
// if (bnbmCgPzwlfl!=null){
|
||||
// String wlfl = bnbmCgPzwlfl.stream().map(o -> o.getString("WLFL")).collect(Collectors.joining("|"));
|
||||
// summaryBO.set("WLMC", wlfl);
|
||||
// }else {
|
||||
if(("龙牌".equals(bkgs) || "梦牌".equals(bkgs) || "泰山石膏".equals(bkgs))
|
||||
&& (wlmc.contains("脱硫石膏") || wlmc.contains("护面纸"))){
|
||||
summaryBO.set("WLMC", "脱硫石膏");
|
||||
} else if ("泰山石膏".equals(bkgs) && wlmc.contains("镀锌带钢")) {
|
||||
summaryBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("龙牌".equals(bkgs) || "梦牌".equals(bkgs))
|
||||
&& (wlmc.equals("轻钢镀锌带钢") || wlmc.equals("镀锌带钢"))) {
|
||||
summaryBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("泰山石膏".equals(bkgs) || "龙牌".equals(bkgs) || "梦牌".equals(bkgs)) && wlmc.contains("乳液")) {
|
||||
continue;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("CGZE", currentMonthRow.getDouble("totalAmount")/1000);
|
||||
avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
(currentMonthRow.getDouble("totalAmount")/1000) / currentMonthRow.getDouble("totalQuantity") : 0;
|
||||
}else {
|
||||
summaryBO.set("WLMC", wlmc);
|
||||
summaryBO.set("CGZE", currentMonthRow.getDouble("totalAmount"));
|
||||
avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
currentMonthRow.getDouble("totalAmount") / currentMonthRow.getDouble("totalQuantity") : 0;
|
||||
}
|
||||
// }
|
||||
summaryBO.set("YEARMONTH", yearMonth);
|
||||
summaryBO.set("CGZE", currentMonthRow.getDouble("totalAmount"));
|
||||
summaryBO.set("CGZL", currentMonthRow.getDouble("totalQuantity"));
|
||||
double avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
currentMonthRow.getDouble("totalAmount") / currentMonthRow.getDouble("totalQuantity") : 0;
|
||||
|
||||
summaryBO.set("PJDJ", avgPrice);
|
||||
|
||||
// 添加上月数据
|
||||
RowMap lastMonthRow = lastMonthMap.get(key);
|
||||
if (lastMonthRow != null) {
|
||||
double lastMonthAvgPrice = 0.00;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("SQCGZE", lastMonthRow.getDouble("totalAmount")/1000);
|
||||
lastMonthAvgPrice = lastMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
(lastMonthRow.getDouble("totalAmount")/1000) / lastMonthRow.getDouble("totalQuantity") : 0;
|
||||
}else {
|
||||
summaryBO.set("SQCGZE", lastMonthRow.getDouble("totalAmount"));
|
||||
summaryBO.set("SQCGZL", lastMonthRow.getDouble("totalQuantity"));
|
||||
double lastMonthAvgPrice = lastMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
lastMonthAvgPrice = lastMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
lastMonthRow.getDouble("totalAmount") / lastMonthRow.getDouble("totalQuantity") : 0;
|
||||
}
|
||||
summaryBO.set("SQCGZL", lastMonthRow.getDouble("totalQuantity"));
|
||||
summaryBO.set("SQPJDJ", lastMonthAvgPrice);
|
||||
}
|
||||
|
||||
// 添加去年同期数据
|
||||
RowMap lastYearMonthRow = lastYearMonthMap.get(key);
|
||||
if (lastYearMonthRow != null) {
|
||||
summaryBO.set("TQCGZE", lastYearMonthRow.getDouble("totalAmount"));
|
||||
double lastYearMonthAvgPrice = 0.00;
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("TQCGZE", lastYearMonthRow.getDouble("totalAmount")/1000);
|
||||
lastYearMonthAvgPrice = lastYearMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
(lastYearMonthRow.getDouble("totalAmount")/1000) / lastYearMonthRow.getDouble("totalQuantity") : 0;
|
||||
}else {
|
||||
summaryBO.set("TQCGZL", lastYearMonthRow.getDouble("totalQuantity"));
|
||||
double lastYearMonthAvgPrice = lastYearMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
lastYearMonthAvgPrice = lastYearMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
lastYearMonthRow.getDouble("totalAmount") / lastYearMonthRow.getDouble("totalQuantity") : 0;
|
||||
}
|
||||
|
||||
summaryBO.set("TQPJDJ", lastYearMonthAvgPrice);
|
||||
}
|
||||
|
||||
@ -487,10 +492,18 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC";
|
||||
String currentMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
String currentMonthSql = "";
|
||||
if ("泰山石膏".equals(bkgs)) {
|
||||
currentMonthSql = "SELECT WLMC, SUM(DHJE) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
" FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
" GROUP BY WLMC";
|
||||
}else {
|
||||
currentMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
" FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
" GROUP BY WLMC";
|
||||
}
|
||||
List<RowMap> currentMonthData = DBSql.getMaps(currentMonthSql, bkgs, yearMonth + "%");
|
||||
|
||||
// 上月数据
|
||||
@ -500,11 +513,19 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC";
|
||||
String lastMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
" FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
" GROUP BY WLMC";
|
||||
lastMonthData = DBSql.getMaps(lastMonthSql, bkgs, yearLastMonth + "%");
|
||||
// String lastMonthSql = "";
|
||||
// if ("泰山石膏".equals(bkgs)) {
|
||||
// lastMonthSql = "SELECT WLMC, SUM(DHJE) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// " FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// " GROUP BY WLMC";
|
||||
// }else {
|
||||
// lastMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// " FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// " GROUP BY WLMC";
|
||||
// }
|
||||
lastMonthData = DBSql.getMaps(currentMonthSql, bkgs, yearLastMonth + "%");
|
||||
}
|
||||
|
||||
// 去年同期数据
|
||||
@ -514,11 +535,19 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ LIKE ? " +
|
||||
// "GROUP BY WLMC";
|
||||
String lastYearMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
" FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
" GROUP BY WLMC";
|
||||
lastYearMonthData = DBSql.getMaps(lastYearMonthSql, bkgs, lastYearMonth + "%");
|
||||
// String lastYearMonthSql = "";
|
||||
// if ("泰山石膏".equals(bkgs)) {
|
||||
// lastYearMonthSql = "SELECT WLMC, SUM(DHJE) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// " FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// " GROUP BY WLMC";
|
||||
// }else {
|
||||
// lastYearMonthSql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
// " FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
// " WHERE BKGS = ? AND DJRQ LIKE ? " +
|
||||
// " GROUP BY WLMC";
|
||||
// }
|
||||
lastYearMonthData = DBSql.getMaps(currentMonthSql, bkgs, lastYearMonth + "%");
|
||||
}
|
||||
|
||||
// 3. 创建物料名称映射的数据Map
|
||||
@ -584,26 +613,41 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
String wlmc = currentMonthRow.getString("WLMC");
|
||||
if (currentMonthRow == null || currentMonthRow.getDouble("totalAmount") == 0.0) continue;
|
||||
|
||||
double avgPrice = 0.00;
|
||||
BO summaryBO = new BO();
|
||||
summaryBO.set("YEARMONTH", yearMonth);
|
||||
summaryBO.set("WLMC", wlmc);
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("CGZE", currentMonthRow.getDouble("totalAmount")/1000);
|
||||
avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
(currentMonthRow.getDouble("totalAmount")/1000) / currentMonthRow.getDouble("totalQuantity") : 0;
|
||||
}else {
|
||||
summaryBO.set("CGZE", currentMonthRow.getDouble("totalAmount"));
|
||||
summaryBO.set("CGZL", currentMonthRow.getDouble("totalQuantity"));
|
||||
double avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
avgPrice = currentMonthRow.getDouble("totalQuantity") != 0 ?
|
||||
currentMonthRow.getDouble("totalAmount") / currentMonthRow.getDouble("totalQuantity") : 0;
|
||||
}
|
||||
summaryBO.set("CGZL", currentMonthRow.getDouble("totalQuantity"));
|
||||
summaryBO.set("PJDJ", avgPrice);
|
||||
|
||||
// 添加上月数据
|
||||
RowMap lastMonthRow = lastMonthMap.get(wlmc);
|
||||
if (lastMonthRow != null) {
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("SQCGZE", lastMonthRow.getDouble("totalAmount")/1000);
|
||||
}else {
|
||||
summaryBO.set("SQCGZE", lastMonthRow.getDouble("totalAmount"));
|
||||
}
|
||||
summaryBO.set("SQCGZL", lastMonthRow.getDouble("totalQuantity"));
|
||||
}
|
||||
|
||||
// 添加去年同期数据
|
||||
RowMap lastYearMonthRow = lastYearMonthMap.get(wlmc);
|
||||
if (lastYearMonthRow != null) {
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("TQCGZE", lastYearMonthRow.getDouble("totalAmount")/1000);
|
||||
}else {
|
||||
summaryBO.set("TQCGZE", lastYearMonthRow.getDouble("totalAmount"));
|
||||
}
|
||||
summaryBO.set("TQCGZL", lastYearMonthRow.getDouble("totalQuantity"));
|
||||
}
|
||||
|
||||
@ -657,10 +701,18 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
// "FROM " + PROCUREMENT_PURCHASE_ORDER_SUMMARY +
|
||||
// " WHERE BKGS = ? AND CGRQ = ? " +
|
||||
// "GROUP BY WLMC";
|
||||
String querySql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
String querySql = "";
|
||||
if ("泰山石膏".equals(bkgs)) {
|
||||
querySql = "SELECT WLMC, SUM(DHJE) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
"FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ = ? " +
|
||||
"GROUP BY WLMC";
|
||||
}else {
|
||||
querySql = "SELECT WLMC, SUM(JSHJHYF) AS totalAmount, SUM(RKSL) AS totalQuantity " +
|
||||
"FROM " + BO_EU_DWD_ORDER_RKD_HZ +
|
||||
" WHERE BKGS = ? AND DJRQ = ? " +
|
||||
"GROUP BY WLMC";
|
||||
}
|
||||
List<RowMap> dailyData = DBSql.getMaps(querySql, bkgs, dateStr);
|
||||
|
||||
// 3. 创建物料数据映射
|
||||
@ -687,32 +739,20 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
RowMap row = dailyMap.get(wlmc);
|
||||
if (row == null || row.getDouble("totalAmount") == 0.0) continue;
|
||||
|
||||
double avgPrice = 0.00;
|
||||
BO summaryBO = new BO();
|
||||
summaryBO.set("RQ", dateStr);
|
||||
// List<BO> bnbmCgPzwlfl = SDK.getBOAPI().query("BO_EU_BNBM_CG_PZWLFL").
|
||||
// addQuery("BKMC = ", bkgs).addQuery("WLMC LIKE '%" + wlmc + "%'", null).list();
|
||||
// if (bnbmCgPzwlfl!=null){
|
||||
// String wlfl = bnbmCgPzwlfl.stream().map(o -> o.getString("WLFL")).collect(Collectors.joining("|"));
|
||||
// summaryBO.set("WLMC", wlfl);
|
||||
// }else {
|
||||
if(("龙牌".equals(bkgs) || "梦牌".equals(bkgs) || "泰山石膏".equals(bkgs))
|
||||
&& (wlmc.contains("脱硫石膏") || wlmc.contains("护面纸"))){
|
||||
summaryBO.set("WLMC", "脱硫石膏");
|
||||
} else if ("泰山石膏".equals(bkgs) && wlmc.contains("镀锌带钢")) {
|
||||
summaryBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("龙牌".equals(bkgs) || "梦牌".equals(bkgs))
|
||||
&& (wlmc.equals("轻钢镀锌带钢") || wlmc.equals("镀锌带钢"))) {
|
||||
summaryBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("泰山石膏".equals(bkgs) || "龙牌".equals(bkgs) || "梦牌".equals(bkgs)) && wlmc.contains("乳液")) {
|
||||
continue;
|
||||
}else {
|
||||
summaryBO.set("WLMC", wlmc);
|
||||
}
|
||||
// }
|
||||
if (wlmc.equals("乳液") || wlmc.equals("钛白粉") || wlmc.equals("重钙")){
|
||||
summaryBO.set("CGZE", row.getDouble("totalAmount")/1000);
|
||||
avgPrice = row.getDouble("totalQuantity") != 0 ?
|
||||
(row.getDouble("totalAmount")/1000) / row.getDouble("totalQuantity") : 0;
|
||||
}else {
|
||||
summaryBO.set("CGZE", row.getDouble("totalAmount"));
|
||||
summaryBO.set("CGZL", row.getDouble("totalQuantity"));
|
||||
double avgPrice = row.getDouble("totalQuantity") != 0 ?
|
||||
avgPrice = row.getDouble("totalQuantity") != 0 ?
|
||||
row.getDouble("totalAmount") / row.getDouble("totalQuantity") : 0;
|
||||
}
|
||||
summaryBO.set("CGZL", row.getDouble("totalQuantity"));
|
||||
summaryBO.set("PJDJ", avgPrice);
|
||||
summaryBO.set("BKGS", bkgs);
|
||||
bos.add(summaryBO);
|
||||
@ -781,7 +821,7 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
LOGGER.debug("正在处理第{}页入库数据,偏移量:{}", page + 1, offset);
|
||||
|
||||
String querySql = "SELECT DJRQ, DJH, WLMC, WLBM, GGXH, SLGC, SUM(RKSL) AS RKSL, " +
|
||||
" JLDW, HSDJHYF, SUM(JEHYF) AS JEHYF, GYSNAME, CGDDH " +
|
||||
" JLDW, HSDJHYF, SUM(JEHYF) AS JEHYF, GYSNAME, CGDDH, DHJE " +
|
||||
" FROM "+BO_EU_DWD_ORDER_RKD_HZ+" WHERE BKGS = ? AND DATE(DJRQ) = ? " +
|
||||
" GROUP BY DJRQ,DJH,WLMC "+
|
||||
" ORDER BY DJH LIMIT ? OFFSET ?";
|
||||
@ -797,26 +837,18 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
detailBO.set("RKDH", row.getString("DJH")); // 入库单号
|
||||
detailBO.set("WLBM", row.getString("WLBM")); // 物料编码
|
||||
String wlmc = row.getString("WLMC");
|
||||
if(("龙牌".equals(bkgs) || "梦牌".equals(bkgs) || "泰山石膏".equals(bkgs))
|
||||
&& (wlmc.contains("脱硫石膏") || wlmc.contains("护面纸"))){
|
||||
detailBO.set("WLMC", "脱硫石膏");
|
||||
} else if ("泰山石膏".equals(bkgs) && wlmc.contains("镀锌带钢")) {
|
||||
detailBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("龙牌".equals(bkgs) || "梦牌".equals(bkgs))
|
||||
&& (wlmc.equals("轻钢镀锌带钢") || wlmc.equals("镀锌带钢"))) {
|
||||
detailBO.set("WLMC", "镀锌带钢");
|
||||
} else if (("泰山石膏".equals(bkgs) || "龙牌".equals(bkgs) || "梦牌".equals(bkgs)) && wlmc.contains("乳液")) {
|
||||
continue;
|
||||
}else {
|
||||
detailBO.set("WLMC", wlmc);
|
||||
}
|
||||
// detailBO.set("WLMC", ); // 物料名称
|
||||
detailBO.set("WLMC", wlmc); // 物料名称
|
||||
detailBO.set("GGXH", row.getString("GGXH")); // 规格型号
|
||||
detailBO.set("GC", row.getString("SLGC")); // 收料工厂
|
||||
detailBO.set("RKSL", row.getDouble("RKSL")); // 入库数量
|
||||
detailBO.set("DW", row.getString("JLDW")); // 单位
|
||||
if ("泰山石膏".equals(bkgs)) {
|
||||
detailBO.set("RKDJ", row.getDouble("DHJE")); // 入库单价(含税单价含运费)
|
||||
detailBO.set("RKJE", row.getDouble("DHJE")); // 入库金额(金额含运费)
|
||||
}else {
|
||||
detailBO.set("RKDJ", row.getDouble("HSDJHYF")); // 入库单价(含税单价含运费)
|
||||
detailBO.set("RKJE", row.getDouble("JEHYF")); // 入库金额(金额含运费)
|
||||
}
|
||||
detailBO.set("GYS", row.getString("GYSNAME")); // 供应商
|
||||
detailBO.set("DDBH", row.getString("CGDDH")); // 订单编号
|
||||
detailBO.set("KCS", 0.00); // 库存数(默认为0,需后续计算)
|
||||
@ -824,7 +856,6 @@ public class PurchaseDataSummaryServiceImpl implements DataSummaryService {
|
||||
detailBO.set("YEARMONTH", yearMonth); // 年月
|
||||
bos.add(detailBO);
|
||||
}
|
||||
|
||||
// 批量插入当前页数据
|
||||
if (!bos.isEmpty()) {
|
||||
SDK.getBOAPI().createDataBO(BO_EU_CG_NYRKMX, bos, UserContext.fromUID("admin"));
|
||||
|
||||
@ -670,6 +670,20 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
PurchaseUtil purchaseUtil = new PurchaseUtil();
|
||||
// 查询嘉宝莉为盖的平均单价
|
||||
Double gaiAverage = 0.00;
|
||||
int gaiSum = 0;
|
||||
RowMap map1 = DBSql.getMap("SELECT SUM(RKSL) AS gaiSum, SUM(DJHYF) AS gaiPrice FROM BO_EU_DWD_PUR_PURCHASE_ORDER" +
|
||||
" WHERE WLMC LIKE '%盖%' AND DJHYF < 5");
|
||||
if (map1!=null){
|
||||
gaiSum = map1.getInt("gaiSum");
|
||||
Double gaiPrice = map1.getDouble("gaiPrice");
|
||||
if (gaiSum==0.0){
|
||||
gaiAverage = 0.0;
|
||||
}else {
|
||||
gaiAverage = gaiPrice / gaiSum;
|
||||
}
|
||||
}
|
||||
try {
|
||||
do {
|
||||
if (startDated == null || endDated == null) {
|
||||
@ -717,16 +731,35 @@ public class PurchaseDataSyncServiceImpl implements DataSyncService {
|
||||
}
|
||||
// 如果是采购_入库单汇总 刷新物料名称
|
||||
if (hzb.equals("BO_EU_DWD_ORDER_RKD_HZ")){
|
||||
String wlmc = bo.getString("WLMC");
|
||||
String bkgs = bo.getString("BKGS");
|
||||
String wlmc = bo.getString("WLMC");
|
||||
String wlbm = bo.getString("WLBM");
|
||||
String jldw = bo.getString("JLDW");
|
||||
String wlfl = bo.getString("WLFL");
|
||||
Double djhyf = Double.parseDouble(bo.getString("DJHYF"));
|
||||
String newWlmc = purchaseUtil.materialClassificationFiltering(bkgs, wlmc, wlbm, jldw, djhyf, wlfl);
|
||||
bo.set("WLMC",newWlmc);
|
||||
LOGGER.info("采购_入库单汇总,刷新物料名称------物料名称:{},板块公司:{},物料编码:{},入库单位:{},单价:{},物料分类:{}",wlmc,bkgs,wlbm,jldw,djhyf,wlfl);
|
||||
if (bkgs.equals("北新嘉宝莉")) {
|
||||
if (wlmc.contains("盖") && djhyf < 5.0){
|
||||
continue;
|
||||
} else if (wlmc.contains("桶身") && gaiSum > 0) {
|
||||
Double djhyf1 = bo.get("DJHYF", Double.class);
|
||||
bo.set("DJHYF", djhyf1 + gaiAverage);
|
||||
gaiSum--;
|
||||
}
|
||||
}
|
||||
bo.set("WLMC",newWlmc);
|
||||
bo.set("OLDWLMC",wlmc);
|
||||
// LOGGER.info("采购_入库单汇总,刷新物料名称------物料名称:{},板块公司:{},物料编码:{},入库单位:{},单价:{},物料分类:{}",wlmc,bkgs,wlbm,jldw,djhyf,wlfl);
|
||||
|
||||
if ("泰山石膏".equals(bkgs)){
|
||||
// 泰山石膏处理入库单金额 入库数量*含税单价
|
||||
Double rksl = bo.get("RKSL", Double.class);// 入库数量
|
||||
Double hsdjhyf = bo.get("HSDJHYF", Double.class);// 含税单价(含运费)
|
||||
BigDecimal multiply = BigDecimal.valueOf(rksl).multiply(BigDecimal.valueOf(hsdjhyf));
|
||||
bo.set("DHJE",multiply.doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
bos.add(bo);
|
||||
}
|
||||
|
||||
|
||||
@ -29,45 +29,48 @@ public class PurchaseUtil {
|
||||
}
|
||||
// 煤炭
|
||||
else if (("龙牌".equals(bkgs) || "梦牌".equals(bkgs)
|
||||
&& ("煤炭".contains(wlmc) || "籽煤".contains(wlmc) || "褐煤".contains(wlmc)))) {
|
||||
&& (wlmc.contains("煤炭") || wlmc.contains("煤炭") || wlmc.contains("煤炭")))) {
|
||||
newWlmc = "煤炭";
|
||||
} else if ("泰山石膏".equals(bkgs) && ("原煤".contains(wlmc) || "contains".equals(wlmc) || "contains".equals(wlmc))) {
|
||||
} else if ("泰山石膏".equals(bkgs) && (wlmc.contains("原煤") || wlmc.contains("水洗精煤") || wlmc.contains("褐煤"))) {
|
||||
newWlmc = "煤炭";
|
||||
}
|
||||
// 护面纸
|
||||
else if (("龙牌".equals(bkgs) || "泰山石膏".equals(bkgs))
|
||||
&& "护面纸".contains(wlmc)) {
|
||||
&& wlmc.contains("护面纸")) {
|
||||
newWlmc = "护面纸";
|
||||
}
|
||||
// 乳液
|
||||
else if (("北新防水".equals(bkgs) || "北新涂料".equals(bkgs) || "北新嘉宝莉".equals(bkgs)
|
||||
&& "乳液".contains(wlmc))){
|
||||
else if ("北新嘉宝莉".equals(bkgs) && wlbm.contains("11M")){
|
||||
newWlmc = "乳液";
|
||||
} else if ("北新防水".equals(bkgs) && wlbm.contains("5070201")) {
|
||||
newWlmc = "乳液";
|
||||
} else if ("北新涂料".equals(bkgs) && wlbm.contains("10114137")) {
|
||||
newWlmc = "乳液";
|
||||
}
|
||||
// 钛白粉
|
||||
else if (("北新防水".equals(bkgs) || "北新涂料".equals(bkgs) || "北新嘉宝莉".equals(bkgs)
|
||||
&& "钛白粉".contains(wlmc))){
|
||||
else if (("北新防水".equals(bkgs) || "北新涂料".equals(bkgs) || "北新嘉宝莉".equals(bkgs))
|
||||
&& wlmc.contains("钛白粉")){
|
||||
newWlmc = "钛白粉";
|
||||
}
|
||||
// 重钙
|
||||
else if (("北新防水".equals(bkgs) || "北新涂料".equals(bkgs) || "北新嘉宝莉".equals(bkgs)
|
||||
&& "重钙".contains(wlmc))){
|
||||
else if (("北新防水".equals(bkgs) || "北新涂料".equals(bkgs) || "北新嘉宝莉".equals(bkgs))
|
||||
&& wlmc.contains("重钙")){
|
||||
newWlmc = "重钙";
|
||||
}
|
||||
// 包装袋
|
||||
else if ("龙牌".equals(bkgs) && ("编织袋".equals(wlmc) || "阀口袋".equals(wlmc) || "两纸一膜".equals(wlmc)
|
||||
|| "三纸一膜".contains(wlmc) || "包装袋".contains(wlmc) || "包装".contains(wlmc))) {
|
||||
else if ("龙牌".equals(bkgs) && (wlmc.equals("编织袋") || wlmc.equals("阀口袋") || wlmc.equals("两纸一膜")
|
||||
|| wlmc.contains("三纸一膜") || wlmc.contains("包装袋") || wlmc.contains("包装"))) {
|
||||
newWlmc = "包装袋";
|
||||
} else if ("泰山石膏".equals(bkgs) && ("编织袋".contains(wlmc) || "纸袋".contains(wlmc))) {
|
||||
} else if ("泰山石膏".equals(bkgs) && (wlmc.contains("编织袋") || wlmc.contains("纸袋"))) {
|
||||
newWlmc = "包装袋";
|
||||
} else if ("梦牌".equals(bkgs) && "包装袋".contains(wlmc)) {
|
||||
} else if ("梦牌".equals(bkgs) && wlmc.contains("包装袋")) {
|
||||
newWlmc = "包装袋";
|
||||
} else if ("北新防水".equals(bkgs) && ("包装袋".contains(wlmc) || "阀口袋".contains(wlmc) || "口袋".contains(wlmc))) {
|
||||
} else if ("北新防水".equals(bkgs) && (wlmc.contains("包装袋") || wlmc.contains("阀口袋") || wlmc.contains("口袋"))) {
|
||||
newWlmc = "包装袋";
|
||||
} else if ("北新涂料".equals(bkgs) && "包装袋".contains(wlmc)) {
|
||||
} else if ("北新涂料".equals(bkgs) && wlmc.contains("包装袋")) {
|
||||
newWlmc = "包装袋";
|
||||
} else if ("北新嘉宝莉".equals(bkgs) && ("阀口袋".contains(wlmc) || "腻子粉袋".contains(wlmc) || "阀口纸袋".contains(wlmc)
|
||||
|| "纸袋".equals(wlmc) || "编织袋".equals(wlmc))) {
|
||||
} else if ("北新嘉宝莉".equals(bkgs) && (wlmc.contains("阀口袋") || wlmc.contains("腻子粉袋") || wlmc.contains("阀口纸袋")
|
||||
|| wlmc.equals("纸袋") || wlmc.equals("编织袋"))) {
|
||||
newWlmc = "包装袋";
|
||||
}
|
||||
// 包装桶
|
||||
|
||||
Loading…
Reference in New Issue
Block a user