|
|
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.core.JsonParser;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.node.TextNode;
|
|
|
+import com.uas.eis.beans.x5domain.X5Response;
|
|
|
import com.uas.eis.core.support.TokenProperties;
|
|
|
import com.uas.eis.dao.BaseDao;
|
|
|
import com.uas.eis.dao.SqlRowList;
|
|
|
@@ -407,6 +408,69 @@ public class ERPServiceImpl implements ERPService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> createASN(String id) {
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ UUID uuid = UUID.randomUUID();
|
|
|
+ ASNMain asnMain = new ASNMain();
|
|
|
+ asnMain.setSYSTEMID("SRM");
|
|
|
+ asnMain.setGUID(uuid.toString().replaceAll("-", "").toUpperCase());
|
|
|
+ SqlRowList rs = baseDao.queryForRowSet("select * from asnXM where asn_id=" + id);
|
|
|
+ // 获取当前日期
|
|
|
+ Date currentDate = new Date();
|
|
|
+ // 创建SimpleDateFormat对象,指定格式
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ SimpleDateFormat hhmmss = new SimpleDateFormat("yyyyMMddHHMMSS");
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ if (rs.next()){
|
|
|
+ String asn_code = rs.getGeneralString("asn_code");
|
|
|
+ asnMain.setDELIVERY_NOTICE(rs.getGeneralString("delivery_notice"));
|
|
|
+ asnMain.setSUPPLIER_CODE(rs.getGeneralString("supplier_code"));
|
|
|
+ asnMain.setSUPPLIER_NAME(rs.getGeneralString("supplier_name"));
|
|
|
+ asnMain.setASN_STATUS(rs.getGeneralString("asn_status"));
|
|
|
+ asnMain.setSHIP_WAREHOUSE_ID(rs.getGeneralString("ship_warehouse_id"));
|
|
|
+ asnMain.setETD_DATE(rs.getGeneralString("etd_date"));
|
|
|
+ asnMain.setETD_TIME(rs.getGeneralString("etd_time"));
|
|
|
+ asnMain.setSHIP_DATE(rs.getGeneralString("ship_date"));
|
|
|
+ asnMain.setSHIP_TIME(rs.getGeneralString("ship_time"));
|
|
|
+ asnMain.setETA_DATE(rs.getGeneralString("eta_date"));
|
|
|
+ asnMain.setETA_TIME(rs.getGeneralString("eta_time"));
|
|
|
+ asnMain.setNUM_OF_CARTON(rs.getGeneralString("num_of_carton"));
|
|
|
+ asnMain.setSHIP_TO_CODE(rs.getGeneralString("ship_to_code"));
|
|
|
+ asnMain.setSHIP_TO_NAME(rs.getGeneralString("ship_to_name"));
|
|
|
+ asnMain.setSHIPTO_WAREHOUSE_ID(rs.getGeneralString("shipto_warehouse_id"));
|
|
|
+ asnMain.setDESTINATION_CODE(rs.getGeneralString("destination_code"));
|
|
|
+ asnMain.setDESTINATION_NAME(rs.getGeneralString("destination_name"));
|
|
|
+ asnMain.setDESTINATION_WAREHOUSE_ID(rs.getGeneralString("destination_warehouse_id"));
|
|
|
+ asnMain.setPURCHASE_ORG(rs.getGeneralString("purchase_org"));
|
|
|
+ asnMain.setSTOCK_ORG_TO(rs.getGeneralString("stock_org_to"));
|
|
|
+ asnMain.setIF_BYDELIINSTR(rs.getGeneralString("if_bydeliinstr"));
|
|
|
+ List<ASNItem> IT_ASN_ITEM = new ArrayList<>();
|
|
|
+ SqlRowList rs_asnDetail = baseDao.queryForRowSet("select * from asnDetailXM where asnd_asnid=" + id);
|
|
|
+ if (rs_asnDetail.next()){
|
|
|
+ ASNItem asnItem = new ASNItem();
|
|
|
+ asnItem.setDELIVERY_NOTICE_ITEM(rs_asnDetail.getGeneralString("delivery_notice_item"));
|
|
|
+ asnItem.setDELI_INSTRU_NUM(rs_asnDetail.getGeneralString("deli_instru_num"));
|
|
|
+ asnItem.setDELI_INSTRU_ITEM(rs_asnDetail.getGeneralString("deli_instru_item"));
|
|
|
+ asnItem.setPURORD_NUM(rs_asnDetail.getGeneralString("purord_num"));
|
|
|
+ asnItem.setPURORD_ITEM_NUM(rs_asnDetail.getGeneralString("purord_item_num"));
|
|
|
+ asnItem.setMATERIAL_NUM(rs_asnDetail.getGeneralString("material_num"));
|
|
|
+ asnItem.setSHIP_QTY(rs_asnDetail.getGeneralString("ship_qty"));
|
|
|
+ asnItem.setQTY_UNIT(rs_asnDetail.getGeneralString("qty_unit"));
|
|
|
+ asnItem.setAPP_MODELS(rs_asnDetail.getGeneralString("app_models"));
|
|
|
+ IT_ASN_ITEM.add(asnItem);
|
|
|
+ }
|
|
|
+ asnMain.setIT_ASN_ITEM(IT_ASN_ITEM);
|
|
|
+ //asnMain.setSUPPLIER_CODE("108207");
|
|
|
+ data.put("data", asnMain);
|
|
|
+ EDIX5JsonHttpClient edix5JsonHttpClient = new EDIX5JsonHttpClient(xmediConfiguration.getX5appid(), xmediConfiguration.getX5appkey(), xmediConfiguration.getX5createAsnUrl());
|
|
|
+ X5Response<Object> createAsn = edix5JsonHttpClient.post(data, xmediConfiguration, baseDao, "CreateAsn");
|
|
|
+ result.put("header", createAsn.getHeader());
|
|
|
+ result.put("body", createAsn.getBody());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
public static String unescapeJsonWithJackson(String jsonString) {
|
|
|
try {
|
|
|
ObjectMapper mapper = new ObjectMapper();
|