|
|
@@ -95,6 +95,7 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
insertSQL.setValue("itemid", iteminfo.getStringValue("itemid"));
|
|
|
insertSQL.setValue("itemname", iteminfo.getStringValue("itemname"));
|
|
|
insertSQL.setValue("itemno", iteminfo.getStringValue("itemno"));
|
|
|
+ insertSQL.setValue("qty", iteminfo.getDoubleValue("qty"));
|
|
|
insertSQL.setValue("begindate", StringUtils.isBlank(iteminfo.getStringValue("begindate")) ?"null":iteminfo.getStringValue("begindate"));
|
|
|
insertSQL.setValue("enddate", StringUtils.isBlank(iteminfo.getStringValue("enddate")) ?"null":iteminfo.getStringValue("enddate"));
|
|
|
i++;
|
|
|
@@ -116,6 +117,7 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
updateSQL.setValue("itemid", iteminfo.getStringValue("itemid"));
|
|
|
updateSQL.setValue("itemname", iteminfo.getStringValue("itemname"));
|
|
|
updateSQL.setValue("itemno", iteminfo.getStringValue("itemno"));
|
|
|
+ updateSQL.setValue("qty", iteminfo.getDoubleValue("qty"));
|
|
|
updateSQL.setValue("begindate", StringUtils.isBlank(iteminfo.getStringValue("begindate")) ?"null":iteminfo.getStringValue("begindate"));
|
|
|
updateSQL.setValue("enddate", StringUtils.isBlank(iteminfo.getStringValue("enddate")) ?"null":iteminfo.getStringValue("enddate"));
|
|
|
sqlList.add(updateSQL.getSQL());
|
|
|
@@ -204,7 +206,7 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
DataFormat format = xssfFWorkbook.createDataFormat();
|
|
|
style.setDataFormat(format.getFormat("@"));
|
|
|
// 对单独某一列进行样式赋值,第一个参数为列数,第二个参数为样式
|
|
|
- for (int i = 0; i <= 20; i++) {
|
|
|
+ for (int i = 0; i <= 25; i++) {
|
|
|
sheet.setDefaultColumnStyle(i, style);
|
|
|
}
|
|
|
// 设置工作薄列宽
|
|
|
@@ -249,11 +251,15 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
ExcelFactory e;
|
|
|
try {
|
|
|
-
|
|
|
- // 华为云
|
|
|
- e = getExcelAttachment(content.getLong("attachmentid"));
|
|
|
- // 本地
|
|
|
- //e = getPostExcelFactory();
|
|
|
+ if (content.getLongValue("attachmentid") > 0) {
|
|
|
+ e = getExcelAttachment(content.getLongValue("attachmentid"));
|
|
|
+ // 本地
|
|
|
+ //e = getPostExcelFactory();
|
|
|
+ } else {
|
|
|
+ e = getPostExcel();
|
|
|
+ // 本地
|
|
|
+ //e = getPostExcelFactory();
|
|
|
+ }
|
|
|
|
|
|
ArrayList<String> keys = new ArrayList<>();
|
|
|
keys.add("bomname");
|
|
|
@@ -261,23 +267,28 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
keys.add("component");
|
|
|
keys.add("accessorie");
|
|
|
keys.add("itemno1");
|
|
|
+ keys.add("qty1");
|
|
|
keys.add("begindate1");
|
|
|
keys.add("enddate1");
|
|
|
keys.add("itemno2");
|
|
|
+ keys.add("qty2");
|
|
|
keys.add("begindate2");
|
|
|
keys.add("enddate2");
|
|
|
keys.add("itemno3");
|
|
|
+ keys.add("qty3");
|
|
|
keys.add("begindate3");
|
|
|
keys.add("enddate3");
|
|
|
keys.add("itemno4");
|
|
|
+ keys.add("qty4");
|
|
|
keys.add("begindate4");
|
|
|
keys.add("enddate4");
|
|
|
keys.add("itemno5");
|
|
|
+ keys.add("qty5");
|
|
|
keys.add("begindate5");
|
|
|
keys.add("enddate5");
|
|
|
|
|
|
|
|
|
- Rows rows = e.getSheetRows(0, keys, 3);
|
|
|
+ Rows rows = e.getSheetRows(0, keys, 2);
|
|
|
boolean iserr = false;
|
|
|
Rows rowserr = new Rows();
|
|
|
Rows rowssuc = new Rows();
|
|
|
@@ -291,6 +302,8 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
if(!StringUtils.isBlank(row.getString("itemno"+i))){
|
|
|
if (!itemRowsMap.containsKey(row.getString("itemno"+i))) {
|
|
|
msg = msg +row.getString("itemno"+i)+"商品不存在;";
|
|
|
+ }else if(!isNumeric(row.getString("qty"+i))){
|
|
|
+ msg = msg +row.getString("qty"+i)+"不为数字格式;";
|
|
|
} else {
|
|
|
row.put("itemid"+i, itemRowsMap.get(row.getString("itemno"+i)).get(0).getLong("itemid"));
|
|
|
row.put("itemname"+i, itemRowsMap.get(row.getString("itemno"+i)).get(0).getString("itemname"));
|
|
|
@@ -298,7 +311,7 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- if(msg.contains("商品不存在")){
|
|
|
+ if(msg.contains("商品不存在") || msg.contains("不为数字格式")){
|
|
|
iserr=true;
|
|
|
row.put("msg", msg);
|
|
|
rowserr.add(row);
|
|
|
@@ -315,18 +328,23 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
map.put("component","层级");
|
|
|
map.put("accessorie","层级");
|
|
|
map.put("itemno1","物料号1");
|
|
|
+ map.put("qty1","数量1");
|
|
|
map.put("begindate1","启用时间1");
|
|
|
map.put("enddate1","停用时间1");
|
|
|
map.put("itemno2","物料号2");
|
|
|
+ map.put("qty2","数量2");
|
|
|
map.put("begindate2","启用时间2");
|
|
|
map.put("enddate2","停用时间2");
|
|
|
map.put("itemno3","物料号3");
|
|
|
+ map.put("qty3","数量3");
|
|
|
map.put("begindate3","启用时间3");
|
|
|
map.put("enddate3","停用时间3");
|
|
|
map.put("itemno4","物料号4");
|
|
|
+ map.put("qty4","数量4");
|
|
|
map.put("begindate4","启用时间4");
|
|
|
map.put("enddate4","停用时间4");
|
|
|
map.put("itemno5","物料号5");
|
|
|
+ map.put("qty5","数量5");
|
|
|
map.put("begindate5","启用时间5");
|
|
|
map.put("enddate5","停用时间5");
|
|
|
map.put("msg", "错误信息");
|
|
|
@@ -337,18 +355,23 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
colNameList.add("component");
|
|
|
colNameList.add("accessorie");
|
|
|
colNameList.add("itemno1");
|
|
|
+ colNameList.add("qty1");
|
|
|
colNameList.add("begindate1");
|
|
|
colNameList.add("enddate1");
|
|
|
colNameList.add("itemno2");
|
|
|
+ colNameList.add("qty2");
|
|
|
colNameList.add("begindate2");
|
|
|
colNameList.add("enddate2");
|
|
|
colNameList.add("itemno3");
|
|
|
+ colNameList.add("qty3");
|
|
|
colNameList.add("begindate3");
|
|
|
colNameList.add("enddate3");
|
|
|
colNameList.add("itemno4");
|
|
|
+ colNameList.add("qty4");
|
|
|
colNameList.add("begindate4");
|
|
|
colNameList.add("enddate4");
|
|
|
colNameList.add("itemno5");
|
|
|
+ colNameList.add("qty5");
|
|
|
colNameList.add("begindate5");
|
|
|
colNameList.add("enddate5");
|
|
|
colNameList.add("msg");
|
|
|
@@ -357,22 +380,26 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
keytypemap.put("component",String.class);
|
|
|
keytypemap.put("accessorie",String.class);
|
|
|
keytypemap.put("itemno1",String.class);
|
|
|
+ keytypemap.put("qty1",String.class);
|
|
|
keytypemap.put("begindate1",String.class);
|
|
|
keytypemap.put("enddate1",String.class);
|
|
|
keytypemap.put("itemno2",String.class);
|
|
|
+ keytypemap.put("qty2",String.class);
|
|
|
keytypemap.put("begindate2",String.class);
|
|
|
keytypemap.put("enddate2",String.class);
|
|
|
keytypemap.put("itemno3",String.class);
|
|
|
+ keytypemap.put("qty3",String.class);
|
|
|
keytypemap.put("begindate3",String.class);
|
|
|
keytypemap.put("enddate3",String.class);
|
|
|
keytypemap.put("itemno4",String.class);
|
|
|
+ keytypemap.put("qty4",String.class);
|
|
|
keytypemap.put("begindate4",String.class);
|
|
|
keytypemap.put("enddate4",String.class);
|
|
|
keytypemap.put("itemno5",String.class);
|
|
|
+ keytypemap.put("qty5",String.class);
|
|
|
keytypemap.put("begindate5",String.class);
|
|
|
keytypemap.put("enddate5",String.class);
|
|
|
keytypemap.put("msg", String.class);
|
|
|
- keytypemap.put("msg", String.class);
|
|
|
rowserr.setFieldList(colNameList);
|
|
|
rowserr.setFieldTypeMap(keytypemap);
|
|
|
addSheet(excelFactory, "Sheet1", rowserr, map);
|
|
|
@@ -399,6 +426,7 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
insertSQL.setValue("component", row.getString("component"));
|
|
|
insertSQL.setValue("accessorie", row.getString("accessorie"));
|
|
|
insertSQL.setValue("itemid", row.getString("itemid"+i));
|
|
|
+ insertSQL.setValue("qty", row.getString("qty"+i));
|
|
|
insertSQL.setValue("itemname", row.getString("itemname"+i));
|
|
|
insertSQL.setValue("itemno", row.getString("itemno"+i));
|
|
|
insertSQL.setValue("begindate", StringUtils.isBlank(row.getString("begindate"+i)) ?"null":row.getString("begindate"+i));
|
|
|
@@ -464,11 +492,17 @@ public class aftersalesbom_pjs extends Controller {
|
|
|
} else {
|
|
|
datarow.createCell(i1).setCellValue(row.getString((String) keylist.get(i1)));
|
|
|
}
|
|
|
- if (i1 == 19) {
|
|
|
+ if (i1 == 24) {
|
|
|
datarow.getCell(i1).setCellStyle(xssfCellStyle1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return sheet;
|
|
|
}
|
|
|
+ public static boolean isNumeric(String strNum) {
|
|
|
+ if (strNum == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return strNum.matches("-?\\d+(\\.\\d+)?");
|
|
|
+ }
|
|
|
}
|