|
@@ -1,22 +1,5 @@
|
|
|
package com.behosoft.lis.wms.orders.service;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-
|
|
|
-import org.apache.commons.beanutils.BeanUtilsBean;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.apache.commons.logging.Log;
|
|
|
-import org.apache.commons.logging.LogFactory;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
import com.behosoft.edi.common.EdiConst;
|
|
|
import com.behosoft.edi.dtomodel.common.FetchMailNoRequestDto;
|
|
|
import com.behosoft.edi.dtomodel.common.FetchMailNoResponseDto;
|
|
@@ -37,27 +20,8 @@ import com.behosoft.lis.data.packagingMaterial.service.PackagingMaterialService;
|
|
|
import com.behosoft.lis.data.warehouse.service.WarehouseService;
|
|
|
import com.behosoft.lis.edi.bigcustomer.service.BigCustomerService;
|
|
|
import com.behosoft.lis.edi.ws.callediws.GetMailNoService;
|
|
|
-import com.behosoft.lis.model.bo.AbnormalDeliveryDocument;
|
|
|
-import com.behosoft.lis.model.bo.BigCustomer;
|
|
|
-import com.behosoft.lis.model.bo.DeliverDocument;
|
|
|
-import com.behosoft.lis.model.bo.DeliveryOutbound;
|
|
|
-import com.behosoft.lis.model.bo.DeliveryOutboundDetail;
|
|
|
-import com.behosoft.lis.model.bo.Orders;
|
|
|
-import com.behosoft.lis.model.bo.OrdersDetail;
|
|
|
-import com.behosoft.lis.model.bo.OrdersWave;
|
|
|
-import com.behosoft.lis.model.bo.OwnGoodManage;
|
|
|
-import com.behosoft.lis.model.bo.PickList;
|
|
|
-import com.behosoft.lis.model.bo.PickListDetail;
|
|
|
-import com.behosoft.lis.model.bo.PicklistBox;
|
|
|
-import com.behosoft.lis.model.bo.ProvinceCityCompare;
|
|
|
-import com.behosoft.lis.model.bo.ReturnOutbound;
|
|
|
-import com.behosoft.lis.model.bo.ReturnOutboundDetail;
|
|
|
-import com.behosoft.lis.model.vo.CustomerVO;
|
|
|
-import com.behosoft.lis.model.vo.ItemVO;
|
|
|
-import com.behosoft.lis.model.vo.PackagingMaterialVO;
|
|
|
-import com.behosoft.lis.model.vo.TransceiverVO;
|
|
|
-import com.behosoft.lis.model.vo.VenderVO;
|
|
|
-import com.behosoft.lis.model.vo.WarehouseVO;
|
|
|
+import com.behosoft.lis.model.bo.*;
|
|
|
+import com.behosoft.lis.model.vo.*;
|
|
|
import com.behosoft.lis.oms.deliveryoutbound.service.DeliveryOutboundService;
|
|
|
import com.behosoft.lis.oms.deliveryoutbounddetail.service.DeliveryOutboundDetailService;
|
|
|
import com.behosoft.lis.oms.returnoutbounddetail.service.ReturnOutboundDetailService;
|
|
@@ -68,16 +32,28 @@ import com.behosoft.lis.sys.user.service.UserWarehouseService;
|
|
|
import com.behosoft.lis.util.IdGenerator;
|
|
|
import com.behosoft.lis.util.ListUtils;
|
|
|
import com.behosoft.lis.wms.abnormaldeliverydocument.service.AbnormalDeliveryDocumentService;
|
|
|
-import com.behosoft.lis.wms.deliverDocument.service.ProvinceCityUtil;
|
|
|
import com.behosoft.lis.wms.orderswave.service.OrdersWaveService;
|
|
|
import com.behosoft.lis.wms.pickList.service.PickListService;
|
|
|
import com.behosoft.lis.wms.pickListDetail.service.PickListDetailService;
|
|
|
import com.behosoft.lis.wms.replenishmentDetail.service.ReplenishmentDetailService;
|
|
|
import com.behosoft.util.DataUtils;
|
|
|
import com.behosoft.util.DateUtils;
|
|
|
+import com.behosoft.util.HttpUtils;
|
|
|
import com.wondersgroup.framework.util.CollectionUtils;
|
|
|
import com.wondersgroup.saas.access.dao.impl.ExtendedJdbcDao;
|
|
|
import com.wondersgroup.saas.access.mapper.QueryContext;
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
+import org.apache.commons.beanutils.BeanUtilsBean;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.commons.logging.Log;
|
|
|
+import org.apache.commons.logging.LogFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service
|
|
|
public class OrdersService extends ManagementService {
|
|
@@ -1890,7 +1866,7 @@ public class OrdersService extends ManagementService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public JSONArray doPrintFiveBill(List<String> ids,boolean isReming){
|
|
|
+ public JSONArray doPrintFiveBill(List<String> ids,boolean isReming) {
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
QueryContext<Orders> qc = QueryContext.createQueryContext(Orders.class);
|
|
|
ExtendedJdbcDao<Orders> dao = this.daoFactory.getJdbcDao(qc);
|
|
@@ -1901,6 +1877,12 @@ public class OrdersService extends ManagementService {
|
|
|
|
|
|
if( list!=null && list.size()>0 ){
|
|
|
for(Orders orders : list ){
|
|
|
+// 获取destCode
|
|
|
+// if(StringUtil.isEmpty(orders.getDestCode())) {
|
|
|
+// String descCode = getDestCodeByWmsOrders(orders);
|
|
|
+// orders.setDestCode(descCode);
|
|
|
+// this.updateOrders(orders);
|
|
|
+// }
|
|
|
if (null != orders.getCarrierId() && isReming == true && StringUtils.isBlank(orders.getCarrierTrackingNumber())){
|
|
|
Map map = this.getcarrierTrackNumber(orders);
|
|
|
|
|
@@ -1908,12 +1890,12 @@ public class OrdersService extends ManagementService {
|
|
|
orders.setOriginCode((String)map.get("originCode"));
|
|
|
orders.setDestCode((String)map.get("destCode"));
|
|
|
}
|
|
|
- else{
|
|
|
- //WarehouseVO warehousevo = this.warehouseService.getEntity(orders.getWarehouseId());
|
|
|
-
|
|
|
- //orders.setOriginCode(ProvinceCityUtil.getInstance().getCityCode(warehousevo.getProvince(), warehousevo.getCity()));
|
|
|
- orders.setDestCode(ProvinceCityUtil.getInstance().getCityCode(orders.getReceiverProvince(), orders.getReceiverCity()));
|
|
|
- }
|
|
|
+// else{
|
|
|
+// //WarehouseVO warehousevo = this.warehouseService.getEntity(orders.getWarehouseId());
|
|
|
+//
|
|
|
+// //orders.setOriginCode(ProvinceCityUtil.getInstance().getCityCode(warehousevo.getProvince(), warehousevo.getCity()));
|
|
|
+// orders.setDestCode(ProvinceCityUtil.getInstance().getCityCode(orders.getReceiverProvince(), orders.getReceiverCity()));
|
|
|
+// }
|
|
|
}
|
|
|
for(Orders orders : list ){
|
|
|
|
|
@@ -1993,6 +1975,7 @@ public class OrdersService extends ManagementService {
|
|
|
|
|
|
jsonObject.put("EXPRESS_NO", DataUtils.asString(trackingNumber,"") );
|
|
|
jsonObject.put("ORIGINATIONG_CODE", DataUtils.asString(orders.getOriginCode(),"") );
|
|
|
+
|
|
|
jsonObject.put("DESTINATION_CODE", DataUtils.asString(orders.getDestCode(),"") );
|
|
|
jsonObject.put("ITEM_DESCRIPTION", DataUtils.asString(orders.getOrderMemo(),"") );
|
|
|
jsonObject.put("ITEM_COUNT", DataUtils.asString(orders.getDetailCount(),"") );
|
|
@@ -2597,14 +2580,12 @@ public class OrdersService extends ManagementService {
|
|
|
else{
|
|
|
map.put("originCode", "");
|
|
|
}
|
|
|
-
|
|
|
- if (null != destCode && !"".equals(destCode)){
|
|
|
- map.put("destCode", destCode);
|
|
|
- }
|
|
|
- else{
|
|
|
- map.put("destCode", "");
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ //获取新的分拣码
|
|
|
+ orders.setCarrierTrackingNumber(mailNo);
|
|
|
+ destCode = getDestCodeByWmsOrders(orders);
|
|
|
+ map.put("destCode", destCode);
|
|
|
+
|
|
|
String sql ="UPDATE wms_orders SET CARRIER_TRACKING_NUMBER=?,ORIGIN_CODE=?,DEST_CODE=? WHERE ORDER_ID=?";
|
|
|
this.daoFactory.getJdbcDao().update(sql, mailNo, originCode, destCode, orders.getOrderId());
|
|
|
|
|
@@ -2845,4 +2826,78 @@ public class OrdersService extends ManagementService {
|
|
|
|
|
|
return findRecordsByConditions(sql, param, Orders.class);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过发货单获取三段码(分拣码新加接口)
|
|
|
+ * @param orders
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String getDestCodeByWmsOrders(Orders orders) {
|
|
|
+ StringBuffer destCode = new StringBuffer();
|
|
|
+ try {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ JSONArray jsonArray = new JSONArray();
|
|
|
+ JSONObject jsonDetail = new JSONObject();
|
|
|
+ jsonDetail.put("id", "1");
|
|
|
+ // 面单号
|
|
|
+ jsonDetail.put("mailNum", orders.getCarrierTrackingNumber());
|
|
|
+ // 产品代码 0100000000:文件;0200000000:信函;0300000000:物品;默认物品
|
|
|
+ jsonDetail.put("prodCode", "0300000000");
|
|
|
+ // 寄件人邮编
|
|
|
+ jsonDetail.put("clctOrgCode", "210023");
|
|
|
+ // 收件人邮编
|
|
|
+ String receiverZipcode = orders.getReceiverZipcode();
|
|
|
+ if (com.behosoft.util.StringUtils.isEmpty(receiverZipcode)) {
|
|
|
+ receiverZipcode = this.globalPostCodeSettingService.getPostCodeForPlace(orders.getReceiverProvince(),
|
|
|
+ orders.getReceiverCity(), null, null);
|
|
|
+ }
|
|
|
+ jsonDetail.put("arriPostCode", receiverZipcode);
|
|
|
+ //运输方式 0:陆运;1:航空;2:陆转航;3:航转陆;4:其他;默认是0
|
|
|
+ jsonDetail.put("transMode", "0");
|
|
|
+ // 收寄行政区划代码 与寄件人邮编必填一项
|
|
|
+ jsonDetail.put("clctArea", "210023");
|
|
|
+ // 寄达行政区划代码
|
|
|
+ jsonDetail.put("arriArea", receiverZipcode);
|
|
|
+ // 是否集散邮件 1:是;0:否;默认否
|
|
|
+ jsonDetail.put("isNanji", "0");
|
|
|
+ jsonDetail.put("recerAddress", orders.getReceiverStreet() == null? "*" : orders.getReceiverStreet());
|
|
|
+ jsonDetail.put("recerOrg", orders.getReceiverName() == null? "*" : orders.getReceiverName());
|
|
|
+ jsonDetail.put("recerProvName", orders.getReceiverProvince() == null? "*" : orders.getReceiverProvince());
|
|
|
+ jsonDetail.put("recerCityName", orders.getReceiverCity() == null? "*" : orders.getReceiverCity());
|
|
|
+ jsonDetail.put("recerCountryName", orders.getReceiverDistrict() == null? "*" : orders.getReceiverDistrict());
|
|
|
+ jsonDetail.put("requestTime", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
|
+ // 邮件种类 邮件号码前两位 【11】标准快递 【51】经济快递 【96】快递包裹 默认标准快递
|
|
|
+ jsonDetail.put("mailClass", "11");
|
|
|
+ jsonDetail.put("mome2", "");
|
|
|
+ jsonDetail.put("mome3", "");
|
|
|
+ jsonArray.add(jsonDetail);
|
|
|
+ json.put("dataList", jsonArray);
|
|
|
+ logger.info("获取三段码请求报文:" + json.toString());
|
|
|
+
|
|
|
+// String result = HttpUtils.post(
|
|
|
+// "http://ebi.ems.com.cn/ext-web/a/chinapost/thermalforward?method=getEMSSortCode",
|
|
|
+// "application/json",
|
|
|
+// json.toString().getBytes());
|
|
|
+ HashMap<String, Object> objectObjectHashMap = new HashMap<String, Object>();
|
|
|
+ objectObjectHashMap.put("url","http://ebi.ems.com.cn/ext-web/a/chinapost/thermalforward?method=getEMSSortCode");
|
|
|
+ objectObjectHashMap.put("requestData",json.toString());
|
|
|
+ Map<String, String> stringStringMap = HttpUtils.httpPost(objectObjectHashMap);
|
|
|
+ logger.info("获取三段码返回报文:" + stringStringMap.toString());
|
|
|
+ JSONObject jsonResult = JSONObject.fromObject(stringStringMap);
|
|
|
+ String response = (String) jsonResult.get("response");
|
|
|
+ JSONObject jsonResponse = JSONObject.fromObject(response);
|
|
|
+ JSONObject jsonObj1 = jsonResponse.getJSONArray("dataList").getJSONObject(0);
|
|
|
+ String provSendOrg = jsonObj1.getString("provSendOrg");
|
|
|
+ String provInSendOrg = jsonObj1.getString("provInSendOrg");
|
|
|
+ String dlvOrg = jsonObj1.getString("dlvOrg");
|
|
|
+ destCode.append(provSendOrg);
|
|
|
+ destCode.append("-");
|
|
|
+ destCode.append(provInSendOrg);
|
|
|
+ destCode.append("-");
|
|
|
+ destCode.append(dlvOrg);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("获取三段码报错:"+e);
|
|
|
+ }
|
|
|
+ return destCode.toString();
|
|
|
+ }
|
|
|
}
|