Przeglądaj źródła

印厂入库单

huxy 2 lat temu
rodzic
commit
a5add6eedc

+ 29 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -1,8 +1,6 @@
 package org.jeecg.modules.splfi.controller;
 
-import java.io.File;
-import java.io.InputStream;
-import java.io.IOException;
+import java.io.*;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.*;
@@ -16,6 +14,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
 import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
@@ -1167,12 +1166,30 @@ public class SyPackingListFabricController implements Job {
 		 return result;
 	 }
 
+	 public static String getExceptionStr(Exception e) throws IOException {
+		 //读取异常栈信息
+		 ByteArrayOutputStream arrayOutputStream=new ByteArrayOutputStream();
+		 e.printStackTrace(new PrintStream(arrayOutputStream));
+		 //通过ByteArray转换输入输出流
+		 BufferedReader fr=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(arrayOutputStream.toByteArray())));
+		 String str;
+		 StringBuilder exceptionStr=new StringBuilder();
+		 while ((str=fr.readLine())!=null){
+			 exceptionStr.append(str);
+		 }
+		 //关闭流
+		 fr.close();
+		 return exceptionStr.toString();
+	 }
+
 	 @Override
 	 public void execute(JobExecutionContext context) throws JobExecutionException {
 
 		 QueryWrapper<SyPackingListFabric> queryWrapper=new QueryWrapper();
 		 queryWrapper.nested(i->i.ne("recording_Status","1").nested(s->s.eq("push_State","3").or()
-				 .like("recording_Error","超时").or().like("recording_Error","null"))) ;//推送中
+				 .like("recording_Error","超时").or().eq("recording_Error","null")
+				 .or().eq("recording_Error","nullnull")
+				 .or().eq("recording_Error","nullnullnull"))) ;//推送中
 		 //queryWrapper.or();
 		 //queryWrapper.like();//超时
 	 	 List<SyPackingListFabric> syPackingListFabrics=syPackingListFabricService.list(queryWrapper);//修改调整
@@ -1296,6 +1313,9 @@ public class SyPackingListFabricController implements Job {
 						 }catch (Exception e){
 							 e.printStackTrace();
 							 message+=e.getMessage();
+							 System.out.println("面辅料批量推送报错");
+							 String msg2=getExceptionStr(e);
+							 log.info("面辅料批量推送报错\t"+msg2);
 							 if(map.get("account").equals(account)){
 								 break;
 							 }
@@ -1650,11 +1670,12 @@ public class SyPackingListFabricController implements Job {
 	 	return Result.ok("更新了"+num+"条数据");
 	 }
 
-	 /*@AutoLog(value = "获取数据")
+	 @AutoLog(value = "获取数据")
 	 @ApiOperation(value="获取数据", notes="获取数据")
-	 @GetMapping(value = "/getMessage")*/
-	 public String getMessage( ) {
-		 return "更新了6条数据";
+	 @GetMapping(value = "/getMessage2")
+	 public List<String> getMessage(int max) {
+	 	List<String> codes=syPackingListTailoringService.getRedisSno(max);
+	 	return codes;
 	 }
 
  }

+ 6 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -1698,14 +1698,15 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			text(mapList7,"印厂采购入库单");
 		}
 		String isSucceed=null;
-		try{
+		//try{
 			if(mapList2!=null&&mapList2.size()>0&&main.getIsSucceed()!=null&&main.getIsSucceed().indexOf("-7-")>0){//印花
 				JSONArray resturn2 = InterfaceConnUtils.doPost(mapList2,"materialout_import");//材料出库单
 				isSucceed=result(main,resturn2,"材料出库单",((Map) mapList2.get(0)).get("CACCID").toString(),"2");//材料出库单
 				redisUtil.set("pushsno006", pushsno006);//材料出库单
 				isSucceed(main,isSucceed);
 				//this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn2.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
-			}else if(mapList2!=null&&mapList2.size()>0&&main.getIsSucceed()==null){
+			}
+			else if(mapList2!=null&&mapList2.size()>0&&main.getIsSucceed()==null){
 				JSONArray resturn7 = InterfaceConnUtils.doPost(mapList7,"purchasein_import");//采购入库单
 				isSucceed=result(main,resturn7,"印厂采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),"7");//采购入库单
 				redisUtil.set("pushsno001", pushsno007);//印厂采购入库单
@@ -1719,9 +1720,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				redisUtil.set("pushsno006", pushsno006);//材料出库单
 				//this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn2.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
 			}
-		}catch (Exception e){
-			e.printStackTrace();
-		}
+//		}catch (Exception e){
+//			e.printStackTrace();
+//		}
 		String recording=null;
 		if(main.getRecording()!=null){
 			String[] recordings=main.getRecording().split(",");

+ 23 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -1376,7 +1376,9 @@ public class SyPackingListTailoringController implements Job {
 	 public void execute(JobExecutionContext context) throws JobExecutionException {
 		 QueryWrapper <SyPackingListTailoring> queryWrapper=new QueryWrapper();
 		 queryWrapper.nested(i->i.ne("recording_Status","1").nested(s->s.eq("push_State","3").or()
-				 .like("recording_Error","超时").or().like("recording_Error","null"))) ;//推送中
+				 .like("recording_Error","超时").or().eq("recording_Error","null")
+				 .or().eq("recording_Error","nullnull")
+				 .or().eq("recording_Error","nullnullnull"))) ;//推送中
 		/* queryWrapper.eq("push_State","3");//推送中
 		 queryWrapper.or();
 		 queryWrapper.like("recording_Error","超时");//超时*/
@@ -1481,9 +1483,10 @@ public class SyPackingListTailoringController implements Job {
 							 }
 						 }catch (Exception e){
 							 e.printStackTrace();
-							 System.out.println("成衣批量推送报错");
 							 message+=e.getMessage();
-							 log.info("成衣批量推送报错\t"+message);
+							 String msg2=getExceptionStr(e);
+							 System.out.println("成衣批量推送报错");
+							 log.info("成衣批量推送报错\t"+msg2);
 						 }
 					 }
 				 }
@@ -1645,6 +1648,23 @@ public class SyPackingListTailoringController implements Job {
 		 return result;*/
 	 }
 
+	 public static String getExceptionStr(Exception e) throws IOException {
+		 //读取异常栈信息
+		 ByteArrayOutputStream arrayOutputStream=new ByteArrayOutputStream();
+		 e.printStackTrace(new PrintStream(arrayOutputStream));
+		 //通过ByteArray转换输入输出流
+		 BufferedReader fr=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(arrayOutputStream.toByteArray())));
+		 String str;
+		 StringBuilder exceptionStr=new StringBuilder();
+		 while ((str=fr.readLine())!=null){
+			 exceptionStr.append(str);
+		 }
+		 //关闭流
+		 fr.close();
+		 return exceptionStr.toString();
+	 }
+
+
 	 @AutoLog(value = "装箱单成衣推送u8")
 	 @ApiOperation(value="装箱单成衣推送u8", notes="装箱单成衣推送u8")
 	 @GetMapping(value = "/pushBatch")

+ 29 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/PushJob.java

@@ -13,6 +13,7 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.io.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -74,6 +75,8 @@ public class PushJob implements Job {
             if(codeMaps.get("error").toString().length()>2){
                 String names=codeMaps.get("error").toString();
                 order.setFailMesage(names.substring(1,names.length()-1));
+            }else{
+
             }
             syShippingOrderMapper.updateById(order);
             //codeMaps.put(order.getId(),message);
@@ -104,4 +107,30 @@ public class PushJob implements Job {
         }
         return codeMaps;//账套号-序号-生成的单号
     }
+
+//    public static void main(String[] args) throws IOException {
+//        try {
+//            String code="dz000001";
+//            int max=Integer.parseInt(code);
+//        }catch (Exception e){
+//            String exceptionStr = getExceptionStr(e);
+//            System.out.println("exceptionStr\t"+exceptionStr);
+//        }
+//    }
+//
+//    public static String getExceptionStr(Exception e) throws IOException {
+//        //读取异常栈信息
+//        ByteArrayOutputStream arrayOutputStream=new ByteArrayOutputStream();
+//        e.printStackTrace(new PrintStream(arrayOutputStream));
+//        //通过ByteArray转换输入输出流
+//        BufferedReader fr=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(arrayOutputStream.toByteArray())));
+//        String str;
+//        StringBuilder exceptionStr=new StringBuilder();
+//        while ((str=fr.readLine())!=null){
+//            exceptionStr.append(str);
+//        }
+//        //关闭流
+//        fr.close();
+//        return exceptionStr.toString();
+//    }
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/ISyPackingListTailoringService.java

@@ -141,4 +141,6 @@ public interface ISyPackingListTailoringService extends IService<SyPackingListTa
 
 	List<SyPackingListTailoring> queryByList(String id);
 
+	List<String> getRedisSno(int max);
+
 }

+ 33 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -2333,6 +2333,39 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		return syPackingListTailoringMapper.queryByList(id);
 	}
 
+	@Override
+	@DS("multi-three")
+	public List<String> getRedisSno(int max) {
+		List<String> codes=new ArrayList<>();
+		for (int i=0;i<max;i++){
+			String code=redisUtil.get("test001").toString();
+			code=org.jeecg.modules.system.util.oConvertUtils.addOne(code);
+			redisUtil.set("test001",code);
+			codes.add(code);
+
+			String code1=redisUtil.get("test002").toString();
+			code1=org.jeecg.modules.system.util.oConvertUtils.addOne(code1);
+			redisUtil.set("test003",code1);
+			codes.add(code1);
+
+			String code2=redisUtil.get("test003").toString();
+			code2=org.jeecg.modules.system.util.oConvertUtils.addOne(code2);
+			redisUtil.set("test003",code2);
+			codes.add(code2);
+
+			String code3=redisUtil.get("test004").toString();
+			code3=org.jeecg.modules.system.util.oConvertUtils.addOne(code3);
+			redisUtil.set("test004",code3);
+			codes.add(code3);
+
+			String code4=redisUtil.get("test005").toString();
+			code4=org.jeecg.modules.system.util.oConvertUtils.addOne(code4);
+			redisUtil.set("test005",code4);
+			codes.add(code4);
+		}
+		return codes;
+	}
+
 
 	@Autowired
 	private SyPackingListFabricMapper syPackingListFabricMapper;