提交 ac5c34fd authored 作者: 许俊's avatar 许俊

微调

上级 c9c4201f
package org.jeecg.modules.iost.ims.kingdeeapi; package org.jeecg.modules.iost.ims.kingdeeapi;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import org.jeecg.modules.iost.ims.Dao.CategoryDao; import org.jeecg.modules.iost.ims.Dao.CategoryDao;
import org.jeecg.modules.iost.ims.Util.ImsLogUtil;
import org.jeecg.modules.iost.ims.Util.JsonUtil; import org.jeecg.modules.iost.ims.Util.JsonUtil;
import org.jeecg.modules.iost.ims.Util.KingdeeLogUtil; import org.jeecg.modules.iost.ims.Util.KingdeeLogUtil;
import org.jeecg.modules.iost.ims.Util.KingdeeResultParseUtil; import org.jeecg.modules.iost.ims.Util.KingdeeResultParseUtil;
...@@ -12,12 +11,13 @@ import org.jeecg.modules.iost.ims.entity.KingdeeResultObject.AddResultObject.Res ...@@ -12,12 +11,13 @@ import org.jeecg.modules.iost.ims.entity.KingdeeResultObject.AddResultObject.Res
import org.jeecg.modules.iost.ims.kingdeeapi.Interface.web_api; import org.jeecg.modules.iost.ims.kingdeeapi.Interface.web_api;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@Component @Component
public class ImsOtherOutstockPushApi implements web_api{ public class ImsOtherOutstockPushApi implements web_api {
@Autowired @Autowired
private CategoryDao categoryDao; private CategoryDao categoryDao;
...@@ -29,7 +29,6 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -29,7 +29,6 @@ public class ImsOtherOutstockPushApi implements web_api{
private String push_Rule; private String push_Rule;
private String Son_FEnrtyID; private String Son_FEnrtyID;
private String SeqName; private String SeqName;
private String wipOrdeName;
public ImsOtherOutstockPushApi() { public ImsOtherOutstockPushApi() {
sFormId = "STK_MisDelivery"; //子单据Formid sFormId = "STK_MisDelivery"; //子单据Formid
Father_sFormId = "STK_OutStockApply"; //父单据Formid Father_sFormId = "STK_OutStockApply"; //父单据Formid
...@@ -39,9 +38,7 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -39,9 +38,7 @@ public class ImsOtherOutstockPushApi implements web_api{
KingdeeLogName = "其他出库"; //金蝶云修改操作日志-name KingdeeLogName = "其他出库"; //金蝶云修改操作日志-name
push_Rule = "STK_OutStockApplyToSTK_MisDelivery"; //父单据下推子单据的规则 push_Rule = "STK_OutStockApplyToSTK_MisDelivery"; //父单据下推子单据的规则
SeqName="FSrcEntrySeq"; //子单据里面的源单行号(父单据行号); SeqName="FSrcEntrySeq"; //子单据里面的源单行号(父单据行号);
wipOrdeName="FEntity_Link_FSId"; //子单据里面的源单编号(父单据工单编号) 或者如果父单据没有工单编号条件改为源单行内码(源单分录内码)
} }
@Override @Override
public String add(Map<String, Object> maps) { public String add(Map<String, Object> maps) {
return null; return null;
...@@ -119,24 +116,36 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -119,24 +116,36 @@ public class ImsOtherOutstockPushApi implements web_api{
ModelMap.put("FEntity", list); ModelMap.put("FEntity", list);
return ModelMap; return ModelMap;
} }
@Override /*根据FID查询FEntity_FEntryId*/
public List<Map<String, String>> select(Map<String, String> map, String where) throws ParseException { public String select(String F,String seq, String FID) {
return null; if (ObjectUtils.isEmpty(FID)) {
FID = new String();
}
//源单分录内码
SeqName="FEntity_Link_FSId";
String FEntity_FEntryId = categoryDao.Son_FindFentryIdSpecial(F,SeqName,Son_FEnrtyID, Integer.valueOf(seq),FID,sFormId );
return FEntity_FEntryId;
} }
/*查询数据的子单据的FEntryID*/ /*查询数据的子单据的FEntryID*/
public String querySonFEntryID(String seq, String FID,String wipOrde) { public String querySonFEntryID(String F,String seq, String FID) {
if (ObjectUtils.isEmpty(FID)) { if (ObjectUtils.isEmpty(FID)) {
FID = new String(); FID = new String();
} }
String FEntity_FEntryId = categoryDao.select_Son_FentryId(SeqName,Son_FEnrtyID, Integer.valueOf(seq),FID,sFormId,KingdeeLogName+"子单据行内码查询",wipOrde,wipOrdeName); //源单分录内码
SeqName="FEntity_Link_FSId";
String FEntity_FEntryId = categoryDao.select_Son_FentryIdSpecial(F,SeqName,Son_FEnrtyID, Integer.valueOf(seq),FID,sFormId,KingdeeLogName+"子单据行内码查询");
return FEntity_FEntryId; return FEntity_FEntryId;
} }
@Override /*父单据下推到子单据*/
public String update( public Result push(List<Map<String, Object>> needPushLists,List<String> Father_FEntryIDs) {
Object object) { //目标单据为子单据Formid
return null; String TargetFormId = sFormId;
//下推父单据的Fromid-EntryID-单据转换规则(写死,客户端查询)-目标单据FormId-
String result = categoryDao.pushMore(KingdeeLogPushName, Father_sFormId, Father_FEntryIDs, push_Rule, TargetFormId);
Result pushResult = KingdeeResultParseUtil.parseAddResult(result);
return pushResult;
} }
/*查询needLists所有数据的父单据的FEntryID*/ /*查询needLists所有数据的父单据的FEntryID*/
public List<String> queryFatherFEntryIDs(List<Map<String, Object>> needLists,List<Map<String, Object>> SelectFatherFentryIdFailLists) public List<String> queryFatherFEntryIDs(List<Map<String, Object>> needLists,List<Map<String, Object>> SelectFatherFentryIdFailLists)
...@@ -170,6 +179,7 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -170,6 +179,7 @@ public class ImsOtherOutstockPushApi implements web_api{
else else
{ {
Father_FEntryIDs.add(FEntryID); Father_FEntryIDs.add(FEntryID);
maps.put(maps.get("AUDIT_ID").toString()+maps.get("AUDIT_SEQ").toString(),FEntryID);
} }
} else { } else {
...@@ -179,22 +189,75 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -179,22 +189,75 @@ public class ImsOtherOutstockPushApi implements web_api{
} }
return Father_FEntryIDs; return Father_FEntryIDs;
} }
@Override
public List<Map<String, String>> select(Map<String, String> map, String where) throws ParseException {
return null;
}
@Override
public String update(
Object object) {
return null;
}
/*父单据下推到子单据*/ /*父单据下推到子单据*/
public Result push(List<Map<String, Object>> needPushLists,List<String> Father_FEntryIDs) { public Map<String, String> push(Map<String, Object> maps) {
String FEntryID; //父单据FEntryID
ImsOtherOutstock ImsOtherOutstock = JSON.parseObject(JSON.toJSONString(maps), ImsOtherOutstock.class);//map转为实体类对象
//查询是否有FEntryID传入,没有就其他方法查询出
if (ObjectUtils.isEmpty(maps.get("SEQ_ENTRY_CODE"))) {
//根据父单据编码和行号(ERP工单行号)在数据库同步表查出父单据的FEntryID
FEntryID = categoryDao.Father_FindFentryId(Father_FEnrtyID, Integer.valueOf(ImsOtherOutstock.getMtrlSeq()), maps,Father_sFormId);
} else {
FEntryID = maps.get("SEQ_ENTRY_CODE").toString();
}
//目标单据为子单据Formid //目标单据为子单据Formid
String TargetFormId = sFormId; String TargetFormId = sFormId;
//下推父单据的Fromid-EntryID-单据转换规则(写死,客户端查询)-目标单据FormId- //下推父单据的Fromid-EntryID-单据转换规则(写死,客户端查询)-目标单据FormId-
String result = categoryDao.pushMore(KingdeeLogPushName, Father_sFormId, Father_FEntryIDs, push_Rule, TargetFormId); String pushResult = categoryDao.push(KingdeeLogPushName, Father_sFormId, FEntryID, push_Rule, TargetFormId);
Result pushResult = KingdeeResultParseUtil.parseAddResult(result); //解析信息,得到返回的本单据的单据编码FID和FBillNo
return pushResult; JSONObject jsonObject = JSON.parseObject(pushResult);
JSONObject result1 = (JSONObject) jsonObject.get("Result");
JSONObject responseStatus = (JSONObject) result1.get("ResponseStatus");
List<JSONObject> successEntitys = (List<JSONObject>) responseStatus.get("SuccessEntitys");
//如果为空说明下推失败没得到成功结果
if (ObjectUtils.isEmpty(successEntitys)) {
Map<String, String> map = new HashMap<>();
return map;
} else {
ImsOtherOutstock ImsOtherOutstock2 = JSON.parseObject(JSON.toJSONString(maps), ImsOtherOutstock.class);//map转为实体类对象
JSONObject SuccessEntitysList = successEntitys.get(0);
String FID = SuccessEntitysList.get("Id").toString();
String FBillNo = SuccessEntitysList.get("Number").toString();
Map<String, String> map = new HashMap<>();
map.put("FID", FID);
map.put("FBILL_NO", FBillNo);
map.put(ImsOtherOutstock.getMtrlSeq(),FEntryID);
return map;
}
} }
/*父单据下推到子单据*/ /*父单据下推到子单据*/
public List<Map<String, String>> pushMore(List<Map<String, Object>> lists) { public List<Map<String, String>> pushMore(List<Map<String, Object>> lists) {
List<String> FEntryIDs = new ArrayList<>(); //父单据FEntryID
for (Map<String, Object> maps : lists) {
ImsOtherOutstock ImsOtherOutstock = JSON.parseObject(JSON.toJSONString(maps), ImsOtherOutstock.class);//map转为实体类对象
//查询是否有FEntryID传入,没有就其他方法查询出
if (ObjectUtils.isEmpty(maps.get("SEQ_ENTRY_CODE"))) {
//根据父单据编码和行号(ERP工单行号)在数据库同步表查出父单据的FEntryID
String FEntryID = categoryDao.Father_FindFentryId(Father_FEnrtyID, Integer.valueOf(ImsOtherOutstock.getMtrlSeq()), maps, Father_sFormId);
FEntryIDs.add(FEntryID);
} else {
String FEntryID = maps.get("SEQ_ENTRY_CODE").toString();
FEntryIDs.add(FEntryID);
}
}
System.out.println("===============FEntryIDs============+"+FEntryIDs+"+=====================FEntryIDs================");
//目标单据为子单据Formid //目标单据为子单据Formid
String TargetFormId = sFormId; String TargetFormId = sFormId;
//下推父单据的Fromid-EntryID-单据转换规则(写死,客户端查询)-目标单据FormId- //下推父单据的Fromid-EntryID-单据转换规则(写死,客户端查询)-目标单据FormId-
String pushResult = categoryDao.pushMore(KingdeeLogPushName, Father_sFormId, null, push_Rule, TargetFormId); String pushResult = categoryDao.pushMore(KingdeeLogPushName, Father_sFormId, FEntryIDs, push_Rule, TargetFormId);
//解析信息,得到返回的本单据的单据编码FID和FBillNo //解析信息,得到返回的本单据的单据编码FID和FBillNo
JSONObject jsonObject = JSON.parseObject(pushResult); JSONObject jsonObject = JSON.parseObject(pushResult);
JSONObject result1 = (JSONObject) jsonObject.get("Result"); JSONObject result1 = (JSONObject) jsonObject.get("Result");
...@@ -214,15 +277,25 @@ public class ImsOtherOutstockPushApi implements web_api{ ...@@ -214,15 +277,25 @@ public class ImsOtherOutstockPushApi implements web_api{
list.add(map); list.add(map);
return list; return list;
} else { } else {
List<Map<String, String>> list = new ArrayList<>(); List<Map<String, String>> list=new ArrayList<>();
for (JSONObject successEntity : successEntitys) { for (JSONObject successEntity : successEntitys) {
String FID = successEntity.get("Id").toString(); String FID = successEntity.get("Id").toString();
String FBillNo = successEntity.get("Number").toString(); String FBillNo = successEntity.get("Number").toString();
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("FID", FID); map.put("FID", FID);
map.put("FBILL_NO", FBillNo); map.put("FBILL_NO", FBillNo);
int i=0;
for (String fEntryID : FEntryIDs) {
Map<String, Object> map1 = lists.get(i);
ImsOtherOutstock ImsOtherOutstock = JSON.parseObject(JSON.toJSONString(map1), ImsOtherOutstock.class);//map转为实体类对象
map.put(ImsOtherOutstock.getMtrlSeq(),FEntryIDs.get(i));
i++;
}
list.add(map); list.add(map);
} }
System.out.println("===============list============+"+list+"+=====================list================");
return list; return list;
} }
} }
......
...@@ -133,12 +133,11 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap ...@@ -133,12 +133,11 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap
} }
/*======================================================================================================*/ /*======================================================================================================*/
public String synchronizationPush(List<Map<String,Object>> needLists,String code) { public String synchronizationPush(List<Map<String,Object>> needLists,String code) {
this.imsLogName="其出库"; //ims日志-name this.imsLogName="其出库"; //ims日志-name
this.DocType="R100"; //调用者传入的标识 this.DocType="R100"; //调用者传入的标识
this.SEQ="MTRL_SEQ"; //父单据行号,一般默认是这个字符串(有些单据是AUDIT_SEQ) this.SEQ="MTRL_SEQ"; //父单据行号,一般默认是这个字符串(有些单据是AUDIT_SEQ)
this.wipOrde="AUDIT_ID"; //父亲单据工单编号或者行内码 this.wipOrde="AUDIT_ID"; //父亲单据工单编号或者行内码
List<ImsOtherOutstock> ImsOtherOutstocks=new ArrayList<>(); List<ImsOtherOutstock> ImsOtherOutstocks=new ArrayList<>();
//查询父单据失败的lists //查询父单据失败的lists
List<Map<String,Object>> SelectFatherFentryIdFailLists=new ArrayList(); List<Map<String,Object>> SelectFatherFentryIdFailLists=new ArrayList();
...@@ -194,11 +193,12 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap ...@@ -194,11 +193,12 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap
if(!CollectionUtils.isEmpty(pushResultLists)) { if(!CollectionUtils.isEmpty(pushResultLists)) {
throw new kingdeeException("操作失败!下推失败!", pushResultLists,code); throw new kingdeeException("操作失败!下推失败!", pushResultLists,code);
} }
//查询子单据行内码 //查询子单据行内码maps.get("AUDIT_ID").toString()+maps.get("AUDIT_SEQ").toString()
for (Map<String, Object> needmap : needLists) { for (Map<String, Object> needmap : needLists) {
String Son_FEntry_ID = imsOtherOutstockPushApi.querySonFEntryID(needmap.get(SEQ).toString(), result.getResponseStatus().getSuccessEntitys().get(0).getId(),needmap.get(wipOrde).toString()); String Son_FEntry_ID = imsOtherOutstockPushApi.querySonFEntryID(needmap.get(needmap.get("AUDIT_ID").toString()+needmap.get("AUDIT_SEQ").toString()).toString(),needmap.get(SEQ).toString(), result.getResponseStatus().getSuccessEntitys().get(0).getId());
needmap.put("FID", result.getResponseStatus().getSuccessEntitys().get(0).getId()); needmap.put("FID", result.getResponseStatus().getSuccessEntitys().get(0).getId());
needmap.put("FEntry_ID",Son_FEntry_ID); needmap.put("FEntry_ID",Son_FEntry_ID);
} }
//修改成功下推后needPushLists的数据 //修改成功下推后needPushLists的数据
AddResult=imsOtherOutstockPushApi.addTwo(needLists); AddResult=imsOtherOutstockPushApi.addTwo(needLists);
...@@ -218,7 +218,7 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap ...@@ -218,7 +218,7 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap
} }
//保存实体类 //保存实体类
this.saveBatch(ImsOtherOutstocks); this.saveBatch(ImsOtherOutstocks);
return ImsOtherOutstocks.get(0).getFbillNo(); return ImsOtherOutstocks.get(0).getFbillNo();
} }
public List<String> ResultSplitFourPush(org.jeecg.modules.iost.ims.entity.KingdeeResultObject.AddResultObject.Result AddResult) public List<String> ResultSplitFourPush(org.jeecg.modules.iost.ims.entity.KingdeeResultObject.AddResultObject.Result AddResult)
...@@ -260,7 +260,7 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap ...@@ -260,7 +260,7 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap
if(!ObjectUtils.isEmpty(queue_idRepeatResultMap.get("notExitFbillNo"))&&Boolean.valueOf(queue_idRepeatResultMap.get("notExitFbillNo").toString())==true) if(!ObjectUtils.isEmpty(queue_idRepeatResultMap.get("notExitFbillNo"))&&Boolean.valueOf(queue_idRepeatResultMap.get("notExitFbillNo").toString())==true)
{ {
String queue_id = queue_idRepeatResultMap.get("QUEUE_ID").toString(); String queue_id = queue_idRepeatResultMap.get("QUEUE_ID").toString();
result="单据编号"+queue_idRepeatResultMap.get(wipOrde)+"不存在,无法进行下推修改!"; result="发货通知单号"+queue_idRepeatResultMap.get(wipOrde)+"不存在,无法进行下推修改!";
rustList.add(result); rustList.add(result);
} }
else else
...@@ -296,5 +296,4 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap ...@@ -296,5 +296,4 @@ public class ImsOtherOutstockServiceImpl extends ServiceImpl<ImsOtherOutstockMap
} }
return rustList; return rustList;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论