fs-danaus
2021-08-28 50b1a1a73719e1e0f1881f225af8c9a1759bcbd6
完善wms代码
6个文件已修改
96 ■■■■■ 已修改文件
src/com/yc/open/wms/controller/WMSController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/wms/entity/Constant.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/wms/schedule/Sales120380Thread.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/wms/service/WMSServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/WebSocketMessage/action/WebSocketMessageServer.java 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/sdk/WebSocketMessage/api/messagelistener/WebSocketMessageListener.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/yc/open/wms/controller/WMSController.java
@@ -252,7 +252,7 @@
            if(salesData!=null) {
                String data =BaseThread.createXmlData(salesData);
                log.info(data);
                String url = Constant.PUSH_URL +  baseController.getSignByWms(data, "deliveryorder.create",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID);
                String url = Constant.PUSH_URL +  baseController.getSignByWms(data, "SyncSalesOrderInfoJinWu",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID);
                final String msg = baseController.doPostByParameterNotNameByXml(url, data);
                log.info("msg:"+msg);
                if(StringUtils.isNotBlank(msg)){
@@ -576,13 +576,7 @@
                    throw new ApplicationException("接收返回结果数据为空");
                }
            }
        } catch (Exception e) {
            //写错误日志
            e.printStackTrace();
            this.sendErrorLog(formid, docCode, e);
            //String errorMsg = (e.getCause() != null ? (e.getCause().getMessage()).trim() : e.getMessage());
           // this.print(response, errorMsg);
        } finally {
        }  finally {
            SpObserver.setDBtoInstance();
        }
    }
src/com/yc/open/wms/entity/Constant.java
@@ -8,16 +8,17 @@
    public static String CANEL_TOTAL_LIST =",120301,120386,120385,120384,120383,120382,120381,120380,140223,140240,140204,130301,140315,140130,140104,140107,140206,";
    public static String PUSH_SALES_LIST =",120301,120386,120385,120384,120383,120382,120381,140223,140240,140204,";
    public static String PUSH_130301_LIST =",130301,140315,140130,140104,";
    /**
     * 推送的网址
     */
    //---测试
    //public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPITest/router";
    //public static String APP_KEY="4d1d598839c2a574cdf2ae0f9afb313e";
    //public static String CUSTOMERID="RongyaTest";
    public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPITest/router";
    public static String APP_KEY="4d1d598839c2a574cdf2ae0f9afb313e";
    public static String CUSTOMERID="RongyaTest";
    //---正式
    public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPI/router";
    public static String APP_KEY="6b26f899d1c4c8be50df3ec929adab3d";
//    public static String PUSH_URL="http://106.15.237.140/iWMSOpenAPI/router";
//    public static String APP_KEY="6b26f899d1c4c8be50df3ec929adab3d";
//    public static String CUSTOMERID="Rongya";
    public static String SECRET="7AY1NPQrmvLm108Kq1TXfOFHCvcluQYt";
    public static String CUSTOMERID="Rongya";
}
src/com/yc/open/wms/schedule/Sales120380Thread.java
@@ -39,7 +39,7 @@
            if (salesData != null) {
                String data = createXmlData(salesData);
                log.info(data);
                String url = Constant.PUSH_URL +  baseController.getSignByWms(data, "deliveryorder.create",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID);
                String url = Constant.PUSH_URL +  baseController.getSignByWms(data, "SyncSalesOrderInfoJinWu",Constant.APP_KEY,Constant.SECRET,Constant.CUSTOMERID);
                final String msg = baseController.doPostByParameterNotNameByXml(url, data);
                log.info("msg:"+msg);
                if (StringUtils.isNotBlank(msg)) {
src/com/yc/open/wms/service/WMSServiceImpl.java
@@ -68,9 +68,11 @@
                "   b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " +
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t110503 d on  d.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  c.postdocstatus = a.DocStatus \n" +
                " and  d.MatType <>'虚拟' \n" +
                " and  a.docCode=@docCode \n" +
                " and a.ShippingMethod not in('门店已提','电商平台已发','维修订单已发') \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
@@ -255,10 +257,12 @@
                "   b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " +
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t110503 e on  e.matCode= b.matCode\n" +
                " join t110203 d on  a.cltcode= d.CltCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  c.postdocstatus = a.DocStatus \n" +
                " and  e.MatType <>'虚拟' \n" +
                " and  a.docCode=@docCode \n" +
                " and a.ShippingMethod not in('门店已提','电商平台已发','维修订单已发') \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
@@ -433,9 +437,11 @@
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t140304H d on d.doccode=a.refCode \n" +
                " join t110503 e on  e.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  c.postdocstatus = a.DocStatus \n" +
                " and  e.MatType <>'虚拟' \n" +
                " and  a.docCode=@docCode \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
                " open mycurDeli \n" +
@@ -584,8 +590,10 @@
                "   b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " +
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t110503 d on  d.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" ;
                "  isnull(a.PushStatus,0)=0  \n"+
                  " and  d.MatType <>'虚拟' \n";
        if(pushEntity.getFormId()==140240) {
           hsql+= " and  c.postdocstatus = a.DocStatus \n";
        }else {
@@ -742,8 +750,10 @@
                "   b.rowid ,b.MatCode ,b.cv1 ,b.cv2 ," +
                "   b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " +
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join t110503 d on  d.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  d.MatType <>'虚拟' \n" +
                " and  a.DocStatus=60 \n"+
                " and  a.docCode=@docCode \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
@@ -888,9 +898,11 @@
                "   b.digit ,b.stCode ,b.stName ,b.itemMemo, b.DocItem " +
                " from " + orderEntity.getHDtable() + " a join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t110503 d on  d.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  c.postdocstatus = a.DocStatus \n" +
                " and  d.MatType <>'虚拟' \n" +
                " and  a.docCode=@docCode \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
                " open mycurDeli \n" +
@@ -1036,8 +1048,10 @@
                " from " + orderEntity.getHDtable() + " a \n" +
                " join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join t110203 d on  d.cltCode= a.cltCode\n" +
                " join t110503 e on  e.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and  e.MatType <>'虚拟' \n" +
                " and  a.DocStatus=60 \n" +
                " and  a.docCode=@docCode \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
@@ -1189,8 +1203,10 @@
                " from " + orderEntity.getHDtable() + " a \n" +
                " join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join gform c on  a.formid= c.formid\n" +
                " join t110503 d on  d.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n";
                "  isnull(a.PushStatus,0)=0  \n"+
                "  and  d.MatType <>'虚拟' \n" ;
        if ("140315".equalsIgnoreCase(orderEntity.getType())) {
            hsql += " and  c.postdocstatus = a.DocStatus \n";
@@ -1337,9 +1353,11 @@
                " join " + orderEntity.getDDtable() + " b on a.DocCode  = b.DocCode\n" +
                " join t140304H c on a.refcode  = c.DocCode\n" +
                " join gform d on  a.formid= d.formid\n" +
                " join t110503 e on  e.matCode= b.matCode\n" +
                " where \n" +
                "  isnull(a.PushStatus,0)=0  \n" +
                " and   a.DocStatus=d.postdocstatus \n" +
                " and  e.MatType <>'虚拟' \n" +
                " and  a.docCode=@docCode \n" +
                " order by a.doccode asc,b.DocItem asc \n" +
                " open mycurDeli \n" +
@@ -1748,7 +1766,7 @@
        try {
            docCodeList ="'"+ docCodeList.replaceAll(";",",").replaceAll(",","','")+"'";
            return this.jdbcTemplate.query("set nocount  on \n" +
                    " select MatCode as itemCode,MatName as itemName,MatCode as goodsCode,Barcode as barCode,MatGroup as categoryId,MatGroupName as categoryName,brand as brandName,special as size,BaseUOM as stockUnit,volume,BaseUomWeight as grossWeight,EnterDate as createTime,ModifyDate as updateTime,a.docCode from t110503 a where a.DocCode in ("+ docCodeList +")", new BeanPropertyRowMapper<>(MatCodeEntity.class));
                    " select MatCode as itemCode,MatName as itemName,MatCode as goodsCode,Barcode as barCode,MatGroup as categoryId,MatGroupName as categoryName,brand as brandName,special as size,BaseUOM as stockUnit,volume,BaseUomWeight as grossWeight,EnterDate as createTime,ModifyDate as updateTime,a.docCode from t110503 a where a.MatType<>'虚拟' and a.DocCode in ("+ docCodeList +")", new BeanPropertyRowMapper<>(MatCodeEntity.class));
        } catch (EmptyResultDataAccessException e) {
            return null;
        }
src/com/yc/sdk/WebSocketMessage/action/WebSocketMessageServer.java
@@ -59,7 +59,7 @@
        session.getUserProperties().put("org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT", 30000L);//30秒
        session.getUserProperties().put("org.apache.tomcat.websocket.textBufferSize", 10240);//10K
        try {
            WsMessageUserEntity wsMessageUserEntity = getOnlineUser(dbId, userFromType, userCode);
            WsMessageUserEntity wsMessageUserEntity = getOnlineUser(dbId, userFromType, userCode,sessionId);
            WsUserEntity wsUserEntity = WsUserEntity.builder().dbId(dbId).userCode(userCode).userFromType(userFromType).sessionId(sessionId).build();
            //log.error("onOpen>>>"+dbId+":usercode:"+userCode);
            //log.error("onlineUserList.size>>>"+onlineUserList.size());
@@ -129,22 +129,45 @@
     * @param wsMessageUserEntity
     */
    public void addOnlineUser(Integer dbId, String userCode,String userFromType, WsMessageUserEntity wsMessageUserEntity) {
        onlineUserList.put(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType +":" + userCode, wsMessageUserEntity);
        onlineUserList.put(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType +":" + userCode+":"+wsMessageUserEntity.getSessionId(), wsMessageUserEntity);
    }
    /**
     * 获取在线用户
     *
     * @param dbId
     * @param userFromType   用户来源分类:1.ERP 网页端用户,2.ERP APP端用户,3.联盟商城版小程序(旧版),4.活动版小程序(新版)
     * @param userFromType   用户来源分类:1.ERP 网页端用户,2.ERP APP端用户,3.联盟商城版小程序(旧版),4.活动版小程序(新版),5.农行支付结果 回调
     * @param userCode
     * @return
     */
    public static WsMessageUserEntity getOnlineUser(Integer dbId, String userFromType,String userCode) {
        return onlineUserList.get(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":" + userCode);
    public static List<WsMessageUserEntity> getOnlineUser(Integer dbId, String userFromType,String userCode) {
        List<WsMessageUserEntity> wsMessageUserList = new ArrayList<WsMessageUserEntity>();
        for(Map.Entry<String, WsMessageUserEntity> entry:onlineUserList.entrySet()){
            if (entry.getKey().startsWith(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":"+userCode)) {
                wsMessageUserList.add(entry.getValue()) ;
            }
        }
        return wsMessageUserList;
    }
    /**
     * 具体一个会话用户
     * @param dbId
     * @param userFromType
     * @param userCode
     * @param sessionId
     * @return
     */
    public static WsMessageUserEntity getOnlineUser(Integer dbId, String userFromType,String userCode,String sessionId) {
        return onlineUserList.get(RedisSocket.CHANEL_WS_MESSAGES + ":" + dbId + ":" + userFromType + ":" + userCode+":"+sessionId);
    }
    /**
     * 群发只能用户类型
     * @param dbId
     * @param userFromType
     * @return
     */
    public static List<WsMessageUserEntity> getOnlineUser(Integer dbId, String userFromType) {
        List<WsMessageUserEntity> wsMessageUserList = new ArrayList<WsMessageUserEntity>();
        for(Map.Entry<String, WsMessageUserEntity> entry:onlineUserList.entrySet()){  
src/com/yc/sdk/WebSocketMessage/api/messagelistener/WebSocketMessageListener.java
@@ -57,21 +57,15 @@
                        handlerMessage(msg, wsMessageUserEntity);
                    }
                }
            }else if(msg.getMsgType().equals(MessageType.ABC_PAY_CALLBACK)){
                List<WsMessageUserEntity> wsMessageUserEntityList = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType());
            }else{
                List<WsMessageUserEntity> wsMessageUserEntityList = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType(),msg.getUserCode());
                //只有是存在于当前的用户信息才需要处理,否则不需要处理
                if (wsMessageUserEntityList != null && wsMessageUserEntityList.size() != 0) {
                    for (WsMessageUserEntity wsMessageUserEntity : wsMessageUserEntityList) {
                        handlerMessage(msg, wsMessageUserEntity);
                    }
                }
            }else {
                //只发一个具体用户
                WsMessageUserEntity wsMessageUserEntity = WebSocketMessageServer.getOnlineUser(msg.getDbId(), msg.getUserFromType(),msg.getUserCode());
                handlerMessage(msg, wsMessageUserEntity);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }