Procházet zdrojové kódy

【华信科】【富勒WMS对接】【出库单创建】【出库单确认 追加分组字段】

wuyx před 11 měsíci
rodič
revize
f039748023

+ 3 - 0
src/main/java/com/uas/eis/entity/vwms/entity/OrderLineOut.java

@@ -4,4 +4,7 @@ import lombok.Data;
 
 @Data
 public class OrderLineOut extends OrderLine {
+    private String customField1;
+    private String customField2;
+    private String customField3;
 }

+ 3 - 0
src/main/java/com/uas/eis/entity/vwms/entity/Prodiodetail.java

@@ -14,4 +14,7 @@ public class Prodiodetail {
     private String pdWhname;
     private String pdInBatch;
     private String pdBrandName;
+    private String pdCustprodcode;
+    private String pdCustprodcode1;
+    private String pdPocode;
 }

+ 22 - 3
src/main/java/com/uas/eis/service/Impl/ERPServiceImpl.java

@@ -971,6 +971,17 @@ public class ERPServiceImpl implements ERPService {
                     " where pd_piid = "+prodInOut.getPiId()+" and pb_sendwms = -1 " +
                     " group by pd_piid,pd_prodcode,pr_detail,pr_brand,pd_whcode,wh_description,pd_description" +
                     " order by MIN(pd_pdno) ";
+            if("out".equals(prodInOut.getPiWmsInType())){
+                detSql = "select pd_piid pdPiid,min(pd_id) pdId,min(pd_pdno) pdPdno,pd_prodcode pdProdcode,pr_detail pdProdname,pr_brand pdBrandName" +
+                        ",sum(nvl(pd_inqty,0)+nvl(pd_outqty,0)) pdQty" +
+                        ",pd_whcode pdWhcode,wh_description pdWhname,pd_description pdInBatch" +
+                        ",pd_custprodcode pdCustprodcode,pd_custprodcode1_user pdCustprodcode1, pd_pocode pdPocode" +
+                        " from "+master+".prodiodetail LEFT JOIN "+master+".product on pr_code = pd_prodcode left join  "+master+".productbrand on pb_name = pr_brand " +
+                        " left join "+master+".warehouse on wh_Code = pd_whcode " +
+                        " where pd_piid = "+prodInOut.getPiId()+" and pb_sendwms = -1 " +
+                        " group by pd_piid,pd_prodcode,pr_detail,pr_brand,pd_whcode,wh_description,pd_description,pd_custprodcode,pd_custprodcode1_user,pd_pocode" +
+                        " order by MIN(pd_pdno) ";
+            }
             List<Prodiodetail> details = baseDao.getJdbcTemplate().query(detSql,
                     new BeanPropertyRowMapper<Prodiodetail>(Prodiodetail.class));
             prodInOut.setDetails(details);
@@ -983,8 +994,13 @@ public class ERPServiceImpl implements ERPService {
                         " from "+master+".prodinout where pi_id = "+prodInOut.getPiId());
                 //写入 prodiowms_Lines 账套
                 baseDao.execute("delete from "+master+".prodiowms_lines where pl_piid = "+prodInOut.getPiId());
-                baseDao.execute("INSERT INTO "+master+".prodiowms_Lines(ITIME,PL_PIID,LINENO, ITEMCODE, PLANQTY,virtualWarehouse, USERDEFINED1,userDefined3,USERDEFINED4)" +
-                        "select sysdate,pdPiid,pdPdno,pdProdcode,pdQty,pdWhname,pdInBatch,pdBrandName,'"+master+"' from ("+detSql+") ");
+                if("out".equals(prodInOut.getPiWmsInType())){
+                    baseDao.execute("INSERT INTO "+master+".prodiowms_Lines(ITIME,PL_PIID,LINENO, ITEMCODE, PLANQTY,virtualWarehouse, USERDEFINED1,userDefined3,USERDEFINED4,customField1,customField2,customField3)" +
+                            "select sysdate,pdPiid,pdPdno,pdProdcode,pdQty,pdWhname,pdInBatch,pdBrandName,'"+master+"',pdCustprodcode,pdCustprodcode1,pdPocode from ("+detSql+") ");
+                }else {
+                    baseDao.execute("INSERT INTO "+master+".prodiowms_Lines(ITIME,PL_PIID,LINENO, ITEMCODE, PLANQTY,virtualWarehouse, USERDEFINED1,userDefined3,USERDEFINED4)" +
+                            "select sysdate,pdPiid,pdPdno,pdProdcode,pdQty,pdWhname,pdInBatch,pdBrandName,'"+master+"' from ("+detSql+") ");
+                }
             }
         }
         return prodInOut;
@@ -998,7 +1014,10 @@ public class ERPServiceImpl implements ERPService {
                 orderLine = new OrderLineIn(); // 创建入库订单行对象
                 ((OrderLineIn) orderLine).setStockinDate(prodInOut.getPiDate()); // 设置入库日期
             } else {
-                orderLine = new OrderLine(); // 创建普通订单行对象
+                orderLine = new OrderLineOut(); // 创建普通订单行对象
+                ((OrderLineOut) orderLine).setCustomField1(detail.getPdCustprodcode());
+                ((OrderLineOut) orderLine).setCustomField2(detail.getPdCustprodcode1());
+                ((OrderLineOut) orderLine).setCustomField3(detail.getPdPocode());
             }
             // 设置通用属性
             orderLine.setLineNo(String.valueOf(detail.getPdPdno()));// 行号

+ 58 - 0
src/test/java/com/uas/eis/UasEisApplicationTests.java

@@ -8,7 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.util.*;
+import java.util.zip.DeflaterOutputStream;
+import java.util.zip.InflaterOutputStream;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = {UasEisApplication.class})
@@ -86,4 +92,56 @@ public class UasEisApplicationTests {
 		Map<String, Object> result = erpService.sendIO(master, id, emCode,caller);
 		System.out.println("result:"+result.toString());
 	}
+
+	@Test
+	public void testYS() throws UnsupportedEncodingException {
+		try (Scanner scanner = new Scanner(new File("D:\\testimg.txt"))) {
+			while (scanner.hasNextLine()) {
+				String a =scanner.nextLine();
+				System.out.println(a.length());
+			byte[] compressed = null;
+			try {
+				compressed = compress(a.getBytes("UTF-8"));
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+			System.out.println("压缩后长度: " + compressed.length);
+			String compressedStr= Base64.getEncoder().encodeToString(compressed);
+			System.out.println("压缩后内容长度: " + compressedStr.length());
+//			System.out.println("压缩后内容: " + compressedStr);
+			//解压
+			byte[] decompressed = compressedStr.getBytes("UTF-8");
+			try {
+				decompressed = decompress(compressed);
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+//				System.out.println("解压后长度: " + decompressed.length);
+//				String decompressedStr= Base64.getEncoder().encodeToString(decompressed);
+//				System.out.println("解压后内容长度: " + decompressedStr.length());
+//				System.out.println("解压后内容: " + decompressedStr);
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+
+	private static byte[] compress(byte[] data) throws Exception {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		try (DeflaterOutputStream deflater = new DeflaterOutputStream(out)) {
+			deflater.write(data);
+		}
+		return out.toByteArray();
+	}
+
+
+
+	private static byte[] decompress(byte[] data) throws Exception {
+		ByteArrayOutputStream out = new ByteArrayOutputStream();
+		try (InflaterOutputStream inflater = new InflaterOutputStream(out)) {
+			inflater.write(data);
+		}
+		return out.toByteArray();
+	}
 }