Commit fcda275c by liuyang

2024/03/06 附件备份

parent 96deb3b4
...@@ -5,14 +5,12 @@ import com.baosight.hpjx.common.DdynamicEnum; ...@@ -5,14 +5,12 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.kc.tools.HPKCTools; import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.*; import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
...@@ -483,6 +481,8 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -483,6 +481,8 @@ public class ServiceHPSC002 extends ServiceBase {
HPSCTools.HpSc004.deleteByMat(fSc002.getId()); HPSCTools.HpSc004.deleteByMat(fSc002.getId());
// 同步删除生产订单 // 同步删除生产订单
HPSCTools.HpSc005.deleteByMat(fSc002.getId()); HPSCTools.HpSc005.deleteByMat(fSc002.getId());
// 删除附件文件
delectDoc(fSc002.getId());
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -759,4 +759,21 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -759,4 +759,21 @@ public class ServiceHPSC002 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 删除附件文件
* @param id 文件ID
*/
@OperationLogAnnotation(operModul = "物料清单",operType = "删除",operDesc = "删除附件文件")
public void delectDoc(Long id){
Map<String,Object> map = new HashMap<>();
map.put("docId","(select DOC_ID from HPJX.T_HPSC002A\n" +
" where MAT_ID in( select distinct ID from HPJX.T_HPSC002 where ID = '"+id+"' or PARENT_ID = '"+id+"')");
List<HPDS002> list = this.dao.query("HPDS002.queryByDocId",map);
for (HPDS002 hpds002: list) {
FileUtils.deleteFile(hpds002.getRealPath());
}
this.dao.delete(HPDS002.DELETE_BATCH,map);
}
} }
package com.baosight.hpjx.hp.sc.service; package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC002A; import com.baosight.hpjx.hp.sc.domain.HPSC002A;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -119,6 +113,9 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -119,6 +113,9 @@ public class ServiceHPSC002A extends ServiceEPBase {
HPSC002A fSc002A = new HPSC002A(); HPSC002A fSc002A = new HPSC002A();
fSc002A.fromMap(resultRows.get(i)); fSc002A.fromMap(resultRows.get(i));
DaoUtils.update(HPSC002A.DELETE, fSc002A); DaoUtils.update(HPSC002A.DELETE, fSc002A);
if (!fSc002A.getDocId().isEmpty()) {
this.delectDoc(fSc002A.getDocId());
}
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -128,4 +125,17 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -128,4 +125,17 @@ public class ServiceHPSC002A extends ServiceEPBase {
} }
return inInfo; return inInfo;
} }
/**
* 删除文件
* @param docId 文件ID
*/
@OperationLogAnnotation(operModul = "附件清单",operType = "删除",operDesc = "删除附件文件")
public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>();
map.put("docId",docId);
List<Map> list = this.dao.query(HPDS002.QUERY,map);
FileUtils.deleteFile(list.get(0).get(HPDS002.FIELD_REAL_PATH).toString());
this.dao.delete(HPDS002.DELETE,map);
}
} }
...@@ -11,6 +11,7 @@ $(function () { ...@@ -11,6 +11,7 @@ $(function () {
$("#fileDocId").val(docId); $("#fileDocId").val(docId);
NotificationUtil("附件上传成功"); NotificationUtil("附件上传成功");
console.log($("#fileDocId").val()) console.log($("#fileDocId").val())
saveTemp(e);
try { try {
parent.JSColorbox.setValueCallback(docId); parent.JSColorbox.setValueCallback(docId);
} catch (e){ } catch (e){
...@@ -18,4 +19,35 @@ $(function () { ...@@ -18,4 +19,35 @@ $(function () {
}, },
} }
}; };
function saveTemp(e) {
let docId = e.response.docId;
let docName = e.response.docName;
let docSize = e.response.docSize;
let docTag = e.response.docTag;
let docUrl = e.response.docUrl;
let result = new EiInfo();
result.set("result-0-docId",docId);
result.set("result-0-docName",docName);
result.set("result-0-docSize",docSize);
result.set("result-0-docTag",docTag);
result.set("result-0-realPath",docUrl);
EiCommunicator.send("HPDS002", "insert", result, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment