Browse Source

【越加红】【WMS对接】【历史出入库初始化】

wuyx 8 months ago
parent
commit
46bcdfb43b
1 changed files with 50 additions and 0 deletions
  1. 50 0
      src/test/java/com/uas/eis/UasEisApplicationTests.java

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

@@ -41,6 +41,56 @@ public class UasEisApplicationTests {
 	private ERPService erpService;
 	@Autowired
 	private VwmsConfig vwmsConfig;
+	@Test
+	public void init_sendIOOut(){
+		// 设置测试数据
+		String master = "YUEJH";
+		String emCode = "ADMIN";
+		SqlRowList toSendList = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_class,ds_table from "+master+".prodinout left join documentsetup on ds_name = pi_class " +
+				"where PI_INOUTNO ='SD25063480'"+
+//				" -- pi_status ='未过账' and PI_WMSORDERTYPE is not null and nvl(PI_SENDWMSFLAG,0) = 0 and ds_inorout in ('-IN','OUT') AND PI_CLASS = '拨出单'" +
+				" order by pi_id");
+		if(toSendList.hasNext()){
+			while (toSendList.next()){
+				String id = String.valueOf(toSendList.getObject("pi_id"));
+				String caller = toSendList.getGeneralString("ds_table");
+				// 调用待测方法
+				Map<String, Object> result = erpService.sendIO(master, id, emCode,caller);
+				System.out.println("result:"+result.toString());
+//				if (result.get("success") != null && "true".equals(result.get("success").toString())) {
+//					baseDao.execute("update "+master+".prodinout set "+(StringUtil.hasText(result.get("OrderId"))?"pi_wmsordercode='"+result.get("OrderId")+"',":"")+"pi_sendwmsstatus='同步成功' ,pi_sendwmserr=null,pi_sendwmsflag=-1 where pi_id = "+id);
+//				}else{
+//					String message = result.get("message") == null ? "同步失败" : result.get("message").toString().replaceAll("'", "''");
+//					baseDao.execute("update "+master+".prodinout set pi_sendwmsstatus='同步失败',pi_sendwmserr=('" + message + "') where pi_id = " + id);
+//				}
+			}
+		}
+	}
+
+	@Test
+	public void init_sendIOIn(){
+		// 设置测试数据
+		String master = "YUEJH";
+		String emCode = "ADMIN";
+		SqlRowList toSendList = baseDao.queryForRowSet("select pi_id,pi_inoutno,pi_class,ds_table from "+master+".prodinout left join documentsetup on ds_name = pi_class " +
+				"where pi_status ='未过账' and ds_inorout in ('IN','-OUT') and PI_WMSORDERTYPE is not null and nvl(PI_SENDWMSFLAG,0) = 0 order by pi_id");
+		if(toSendList.hasNext()){
+			while (toSendList.next()){
+				String id = String.valueOf(toSendList.getObject("pi_id"));
+				String caller = toSendList.getGeneralString("ds_table");
+				// 调用待测方法
+				Map<String, Object> result = erpService.sendIO(master, id, emCode,caller);
+				System.out.println("result:"+result.toString());
+				if (result.get("success") != null && "true".equals(result.get("success").toString())) {
+					baseDao.execute("update "+master+".prodinout set "+(StringUtil.hasText(result.get("OrderId"))?"pi_wmsordercode='"+result.get("OrderId")+"',":"")+"pi_sendwmsstatus='同步成功' ,pi_sendwmserr=null,pi_sendwmsflag=-1 where pi_id = "+id);
+				}else{
+					String message = result.get("message") == null ? "同步失败" : result.get("message").toString().replaceAll("'", "''");
+					baseDao.execute("update "+master+".prodinout set pi_sendwmsstatus='同步失败',pi_sendwmserr=('" + message + "') where pi_id = " + id);
+				}
+			}
+		}
+	}
+
 
 	@Test
 	public void testCancelIO(){