wip:同步图片
This commit is contained in:
parent
f99635f3ef
commit
6af629d16f
@ -1,14 +1,17 @@
|
|||||||
package com.yem.em.task;
|
package com.yem.em.task;
|
||||||
|
|
||||||
import com.yem.em.utils.AtlasUtils;
|
import com.yem.em.utils.AtlasUtils;
|
||||||
|
import com.yem.wm.utils.AttachmentUtil;
|
||||||
import com.yem.wm.utils.YEM;
|
import com.yem.wm.utils.YEM;
|
||||||
import kd.bos.context.RequestContext;
|
import kd.bos.context.RequestContext;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.exception.KDException;
|
import kd.bos.exception.KDException;
|
||||||
import kd.bos.schedule.executor.AbstractTask;
|
import kd.bos.schedule.executor.AbstractTask;
|
||||||
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -131,7 +134,7 @@ public class GenerateReplaceRelationshipTaskEdit extends AbstractTask {
|
|||||||
successMap.put(entryObject.getLong("id"), bomChange);
|
successMap.put(entryObject.getLong("id"), bomChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<Long> list = new ArrayList<>();
|
||||||
for (Map.Entry<Long, DynamicObject> mapEntry : successMap.entrySet()) {
|
for (Map.Entry<Long, DynamicObject> mapEntry : successMap.entrySet()) {
|
||||||
Long bomChangeEntryId = mapEntry.getKey();
|
Long bomChangeEntryId = mapEntry.getKey();
|
||||||
// DynamicObject bomChangeObj = mapEntry.getValue();
|
// DynamicObject bomChangeObj = mapEntry.getValue();
|
||||||
@ -148,12 +151,20 @@ public class GenerateReplaceRelationshipTaskEdit extends AbstractTask {
|
|||||||
long id = d.getLong("id");
|
long id = d.getLong("id");
|
||||||
if (bomChangeEntryId == id) {
|
if (bomChangeEntryId == id) {
|
||||||
d.set("yem_isgenfnish", "B");
|
d.set("yem_isgenfnish", "B");
|
||||||
// d.set("yem_invoktime", completetime);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DynamicObject d : collection) {
|
||||||
|
long entryId = d.getLong("id");
|
||||||
|
String isgenfnish = d.getString("yem_isgenfnish");
|
||||||
|
if ("B".equals(isgenfnish)) {
|
||||||
|
list.add(entryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveServiceHelper.save(new DynamicObject[]{plmObj});
|
SaveServiceHelper.save(new DynamicObject[]{plmObj});
|
||||||
|
// syncImage(plmObj, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -212,4 +223,72 @@ public class GenerateReplaceRelationshipTaskEdit extends AbstractTask {
|
|||||||
}
|
}
|
||||||
return bomchange;
|
return bomchange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步图片 总成图册明细
|
||||||
|
* @param plmObj
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
private void syncImage(DynamicObject plmObj, List<Long> list) {
|
||||||
|
plmObj = BusinessDataServiceHelper.loadSingle(plmObj.getPkValue(), plmObj.getDynamicObjectType().getName());
|
||||||
|
DynamicObjectCollection detail = plmObj.getDynamicObjectCollection("yem_change_detail");
|
||||||
|
DynamicObjectCollection pictureentry = plmObj.getDynamicObjectCollection("yem_pictureentry");
|
||||||
|
for (Long entryId : list) {
|
||||||
|
for (DynamicObject d : detail) {
|
||||||
|
long id = d.getLong("id");
|
||||||
|
if (id == entryId) {
|
||||||
|
String exchangetype = d.getString("yem_exchangetype");
|
||||||
|
String imageName;
|
||||||
|
if ("D".equals(exchangetype)) {
|
||||||
|
imageName = d.getString("yem_parent_now");
|
||||||
|
} else {
|
||||||
|
imageName = d.getString("yem_textfield");
|
||||||
|
}
|
||||||
|
List<DynamicObject> imageInfo = getImageInfo(pictureentry, imageName);
|
||||||
|
|
||||||
|
for (DynamicObject image : imageInfo) {
|
||||||
|
String picturename = image.getString("yem_picturename");
|
||||||
|
int idx = picturename.lastIndexOf(".");
|
||||||
|
String partno = picturename.substring(0, idx);
|
||||||
|
String pictureid = image.getString("yem_pictureid");
|
||||||
|
String pictureaddress = image.getString("yem_pictureaddress");
|
||||||
|
Date breakpointtime = getBreakPointTime(detail, partno);
|
||||||
|
|
||||||
|
DynamicObject attachment = AttachmentServiceHelper.getAttCreatorByUID(pictureid);
|
||||||
|
String url = attachment.getString("ffileid");
|
||||||
|
// AttachmentUtil.uploadAttachmentPanel("yem_em_assatlasdet", )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DynamicObject> getImageInfo(DynamicObjectCollection pictureentry, String imageName) {
|
||||||
|
List<DynamicObject> list = new ArrayList<>();
|
||||||
|
for (DynamicObject d : pictureentry) {
|
||||||
|
String picturename = d.getString("yem_picturename");
|
||||||
|
if (StringUtils.containsIgnoreCase(picturename, imageName)) {
|
||||||
|
list.add(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Date getBreakPointTime(DynamicObjectCollection detail, String partno) {
|
||||||
|
for (DynamicObject d : detail) {
|
||||||
|
String exchangetype = d.getString("yem_exchangetype");
|
||||||
|
String detailPartNo;
|
||||||
|
if ("D".equals(exchangetype)) {
|
||||||
|
detailPartNo = d.getString("yem_parent_now");
|
||||||
|
} else {
|
||||||
|
detailPartNo = d.getString("yem_textfield");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partno.equals(detailPartNo)) {
|
||||||
|
return d.getDate("yem_invoktime");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user