fix(ims): 高压IMS-采购入库同步优化调整
This commit is contained in:
		
							parent
							
								
									ae84d49fb7
								
							
						
					
					
						commit
						fb9e58e6ee
					
				|  | @ -47,7 +47,7 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|     @Override | ||||
|     public PreAlertObject executeTask(BgWorkingContext bgWorkingContext) throws BusinessException { | ||||
|         // 查询高压ims中间表需要同步的数据 | ||||
|         String sql = "SELECT * FROM BIPInputMainTab a WHERE a.status != '2'"; | ||||
|         String sql = "SELECT * FROM BIPInputMainTab a WHERE a.status = 'C'"; | ||||
|         List<Map<String, Object>> remain = (List<Map<String, Object>>) getImsDao().executeQuery(sql, new MapListProcessor()); | ||||
|         if (remain == null || remain.isEmpty()) { | ||||
|             return null; | ||||
|  | @ -57,6 +57,8 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|             List<Map<String, Object>> paramList = new ArrayList<>(); | ||||
|             for (Map<String, Object> map : remain) { | ||||
|                 String cgeneralhid = (String) map.get("cgeneralhid"); | ||||
|                 // 状态标识 IMS:C-创建;U-修改 BIP:2-BIP单据接收完成 | ||||
|                 String status = map.get("status") + ""; | ||||
|                 String bodySql = " SELECT *" + " from BIPInputDetailTab a " + " where a.cgeneralhid ='" + cgeneralhid + "'"; | ||||
|                 List<Map<String, Object>> bodyList = (List<Map<String, Object>>) getImsDao().executeQuery(bodySql, new MapListProcessor()); | ||||
|                 if (bodyList == null || bodyList.isEmpty()) { | ||||
|  | @ -70,8 +72,8 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|                 headJson.put("ctrantypeid", "45-Cxx-CI02"); | ||||
|                 headJson.put("vtrantypecode", "45-Cxx-CI02"); | ||||
|                 headJson.put("vbillcode", map.get("vbillcode"));// 单据号 | ||||
|                 headJson.put("dbilldate", map.get("dbilldate"));// 单据日期 | ||||
|                 headJson.put("cvendorid", map.get("cvendorid"));// 供应商 | ||||
|                 headJson.put("cvendorid", map.get("cvendorvid"));// 供应商 | ||||
|                 headJson.put("cvendorvid", map.get("cvendorvid"));// 供应商 | ||||
|                 headJson.put("cwarehouseid", map.get("cwarehouseid"));// 仓库编码 | ||||
|                 headJson.put("cfanaceorgvid", map.get("cfanaceorgvid"));// 结算财务组织 | ||||
|                 headJson.put("ccostdomainid", map.get("ccostdomainid"));// 结算成本域 | ||||
|  | @ -81,12 +83,13 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|                 headJson.put("cpurorgoid", map.get("cpurorgoid"));// 采购组织 | ||||
|                 // 购销类型 2=国内采购; | ||||
|                 headJson.put("fbuysellflag", 2); | ||||
|                 headJson.put("cpayfinorgoid", "C003");// 应付财务组织最新版本 | ||||
|                 headJson.put("cpayfinorgvid", "C003");// 应付财务组织最新版本 | ||||
|                 headJson.put("cpayfinorgoid", "C003");// 应付财务组织 | ||||
|                 headJson.put("creator", "BIP"); | ||||
|                 headJson.put("billmaker", "BIP"); | ||||
|                 if (map.get("dmakedate") != null && map.get("dmakedate") instanceof Timestamp dmakedate1) { | ||||
|                     String dmakedateStr = DATE_FORMATTER.format(dmakedate1); | ||||
|                     headJson.put("dmakedate", dmakedateStr); | ||||
|                     String dmakedateStr = DATETIME_FORMATTER.format(dmakedate1); | ||||
|                     headJson.put("dmakedate", dmakedateStr); // 单据日期 | ||||
|                 } | ||||
|                 if (map.get("creationtime") != null && map.get("creationtime") instanceof Timestamp creationtime1) { | ||||
|                     String creationtimeStr = DATETIME_FORMATTER.format(creationtime1); | ||||
|  | @ -96,8 +99,8 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|                 for (Map<String, Object> body : bodyList) { | ||||
|                     JSONObject bodyJson = new JSONObject(); | ||||
|                     bodyJson.put("cmaterialvid", body.get("cmaterialvid"));// 物料编码 | ||||
|                     bodyJson.put("castunitid", body.get("castunitid"));// 单位 | ||||
|                     bodyJson.put("cunitid", body.get("cunitid"));// 主单位 | ||||
|                     // bodyJson.put("castunitid", body.get("castunitid"));// 单位 | ||||
|                     // bodyJson.put("cunitid", body.get("cunitid"));// 主单位 | ||||
|                     bodyJson.put("nshouldnum", body.get("nshouldnum"));// 应收主数量 | ||||
|                     bodyJson.put("nshouldassistnum", body.get("nshouldassistnum"));// 应收数量 | ||||
|                     bodyJson.put("nnum", body.get("nnum"));// 实收主数量 | ||||
|  | @ -122,6 +125,12 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|             } | ||||
|             IAPIPurchaseInMaitain purchaseInMaitain = NCLocator.getInstance().lookup(IAPIPurchaseInMaitain.class); | ||||
|             PurchaseInVO[] resultvos = purchaseInMaitain.save(paramList); | ||||
|             if (!imsIdSet.isEmpty()) { | ||||
|                 // 修改状态为 完成 | ||||
|                 String inSql = SqlUtils.getInStr("cgeneralhid", imsIdSet.toArray(new String[0]), Boolean.TRUE); | ||||
|                 String updateSql = "update BIPInputMainTab set status = '2',err_msg = null where " + inSql; | ||||
|                 ImsDaoUtil.executeUpdate(updateSql, imsIdSet.toString()); | ||||
|             } | ||||
|         } catch (Exception e) { | ||||
|             Logger.error("ErpIaI2billFromGyImsPlugin Error: ", e); | ||||
|             NCCForUAPLogger.debug("ErpIaI2billFromGyImsPlugin Error: " + e.getMessage()); | ||||
|  | @ -132,12 +141,6 @@ public class ErpIaI2billFromGyImsPlugin implements IBackgroundWorkPlugin { | |||
|             int rows = ImsDaoUtil.executeUpdate(updateSql, imsIdSet.toString()); | ||||
|             NCCForUAPLogger.debug("ErpIaI2billFromGyImsPlugin-rows = " + rows); | ||||
|         } | ||||
|         if (!imsIdSet.isEmpty()) { | ||||
|             // 修改状态为 完成 | ||||
|             String inSql = SqlUtils.getInStr("cgeneralhid", imsIdSet.toArray(new String[0]), Boolean.TRUE); | ||||
|             String updateSql = "update BIPInputMainTab set status = '2',err_msg = null where " + inSql; | ||||
|             ImsDaoUtil.executeUpdate(updateSql, imsIdSet.toString()); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue