Commit 0019039d authored by 曲欣红's avatar 曲欣红

1

parent 01d1c9f4
...@@ -72,17 +72,15 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -72,17 +72,15 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
/***************item**************/ /***************item**************/
goods.put("GOODS_CODE", GOODS_CODE); goods.put("GOODS_CODE", GOODS_CODE);
goods.put("ROUGH_WEIGHT", element.elementText("BRGEW")); goods.put("ROUGH_WEIGHT", Double.valueOf(element.elementText("BRGEW")));
goods.put("NET_WEIGHT", element.elementText("NTGEW")); goods.put("NET_WEIGHT", Double.valueOf(element.elementText("NTGEW")));
goods.put("WETGHT_UNIT", element.elementText("GEWEI")); goods.put("WETGHT_UNIT", element.elementText("GEWEI"));
goods.put("CATEGORY_CODE", element.elementText("PLINE")); goods.put("CATEGORY_CODE", element.elementText("PLINE"));
goods.put("CREATION_DATE", datef.parse(element.elementText("ERSDA"))); goods.put("CREATION_DATE", datef.parse(element.elementText("ERSDA")));
goods.put("LAST_CHANGE_DATE", datef.parse(element.elementText("LAEDA"))); goods.put("LAST_CHANGE_DATE", datef.parse(element.elementText("LAEDA")));
goods.put("GOODS_NAME", element.elementText("NORMT")); goods.put("GOODS_NAME", element.elementText("NORMT"));
goods.put("VMSTA", element.elementText("VMSTA")); goods.put("VMSTA", element.elementText("VMSTA"));
goods.put("MSTAV", element.elementText("MSTAV"));
goods.put("STKTYP", element.elementText("STKTYP")); goods.put("STKTYP", element.elementText("STKTYP"));
goods.put("PRODUCTION_LINE_CODE", element.elementText("LIFNR"));
goods.put("SPEC", element.elementText("UMREZ")); goods.put("SPEC", element.elementText("UMREZ"));
/*******************新增字段,样例中没有******************/ /*******************新增字段,样例中没有******************/
...@@ -102,6 +100,21 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -102,6 +100,21 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("PUBLIC", element.elementText("PUBLIC")); goods.put("PUBLIC", element.elementText("PUBLIC"));
goods.put("INTERNET", element.elementText("INTERNET")); goods.put("INTERNET", element.elementText("INTERNET"));
/*******************新增字段,样例中没有******************/ /*******************新增字段,样例中没有******************/
/*********************缺*********************/
goods.put("CATEGORY_NAME", "");
goods.put("PRODUCTION_LINE_CODE", "");
goods.put("MSTAV", "");
goods.put("BARCODE", "");
goods.put("TAX_RATE", 0);
goods.put("PRODUCTION_LINE_NAME", "");
goods.put("GOODS_KEY", "");
goods.put("SEND_TIME", new Date());
goods.put("DIS_UPDATE_STATUS", "N");
/*********************缺*********************/
/*******************不知道填什么**********************/
goods.put("UPDATEDBY", "");
goods.put("CREATEDBY", "");
/*******************不知道填什么**********************/
/***************item**************/ /***************item**************/
String BATCH = (String) goods.get("BATCH"); String BATCH = (String) goods.get("BATCH");
...@@ -121,6 +134,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -121,6 +134,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("SEND_STATUS", "N"); goods.put("SEND_STATUS", "N");
goods.put("UPDATED", datetimef.format(new Date())); goods.put("UPDATED", datetimef.format(new Date()));
System.out.println(JSON.toJSONString(goods));
if(goods.get("ID")!=null) { if(goods.get("ID")!=null) {
updateGoods(goods); updateGoods(goods);
}else { }else {
...@@ -148,13 +163,17 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -148,13 +163,17 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
sql = sql.substring(0, sql.length()-2); sql = sql.substring(0, sql.length()-2);
sql = sql + " where ID = ?"; sql = sql + " where ID = ?";
args.add(goods.get("ID")); args.add(goods.get("ID"));
jdbcTemplate.update(sql, args); System.out.println("-------------------------------");
System.out.println(sql);
System.out.println(JSON.toJSONString(args));
System.out.println("-------------------------------");
jdbcTemplate.update(sql, args.toArray());
} }
private void insertGoods(Map<String, Object> goods) { private void insertGoods(Map<String, Object> goods) {
String countSql = "select count(1) from t_ven_goods"; String countSql = "select count(1) from t_ven_goods";
Integer count = jdbcTemplate.queryForObject(countSql, Integer.class); Integer count = jdbcTemplate.queryForObject(countSql, Integer.class);
String ID = System.currentTimeMillis() + prependZero(count, 5); String ID = System.currentTimeMillis() + prependZero(count+1, 5);
goods.put("ID", ID); goods.put("ID", ID);
goods.put("CREATED", datetimef.format(new Date())); goods.put("CREATED", datetimef.format(new Date()));
goods.put("CREATEDBY", ""); goods.put("CREATEDBY", "");
...@@ -172,7 +191,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -172,7 +191,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
fieldSql = fieldSql.substring(0, fieldSql.length()-2); fieldSql = fieldSql.substring(0, fieldSql.length()-2);
valuesSql = valuesSql.substring(0, valuesSql.length()-2); valuesSql = valuesSql.substring(0, valuesSql.length()-2);
insertSql = insertSql + fieldSql + ") values " + valuesSql + ")"; insertSql = insertSql + fieldSql + ") values " + valuesSql + ")";
jdbcTemplate.update(insertSql, values); System.out.println("-------------------------------");
System.out.println(insertSql);
System.out.println(JSON.toJSONString(values));
System.out.println("-------------------------------");
jdbcTemplate.update(insertSql, values.toArray());
} }
private String prependZero(int Num, int length) { private String prependZero(int Num, int length) {
...@@ -181,7 +204,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -181,7 +204,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
private String prependZero(String Num, int length) { private String prependZero(String Num, int length) {
String prepend = ""; String prepend = "";
for(int i=Num.length(); i<=length; i++) { for(int i=Num.length(); i<length; i++) {
prepend = prepend + "0"; prepend = prepend + "0";
} }
return prepend + Num; return prepend + Num;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment