1.修改增加付款申请单识别发票后保存发票登记同时把发票带到发票登记中
This commit is contained in:
parent
bbc9b1397b
commit
8a8326653f
|
@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.grapecity.documents.excel.B;
|
import com.grapecity.documents.excel.B;
|
||||||
import com.grapecity.documents.excel.D;
|
import com.grapecity.documents.excel.D;
|
||||||
import com.huawei.shade.org.apache.http.protocol.RequestContent;
|
import com.huawei.shade.org.apache.http.protocol.RequestContent;
|
||||||
|
import com.kingdee.bos.webapi.entity.KDException;
|
||||||
import com.tongtech.jms.ra.util.Str;
|
import com.tongtech.jms.ra.util.Str;
|
||||||
import kd.bos.bill.BillShowParameter;
|
import kd.bos.bill.BillShowParameter;
|
||||||
import kd.bos.bill.OperationStatus;
|
import kd.bos.bill.OperationStatus;
|
||||||
|
@ -266,7 +267,7 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
|
||||||
JSONArray dataList = ocr_jsonObject.getJSONArray("data");//data数据类型为集合表示
|
JSONArray dataList = ocr_jsonObject.getJSONArray("data");//data数据类型为集合表示
|
||||||
JSONObject data = dataList.getJSONObject(0);//data数据
|
JSONObject data = dataList.getJSONObject(0);//data数据
|
||||||
String invoiceType = data.getString("type"); //票据类型
|
String invoiceType = data.getString("type"); //票据类型
|
||||||
JSONObject details = data.getJSONObject("details");//票据数据内容
|
JSONObject details = data.getJSONObject("details");//票据数据内容
|
||||||
String description = data.getString("description");//发票名称
|
String description = data.getString("description");//发票名称
|
||||||
String qeug_invoicecode = "";//发票代码初始定义
|
String qeug_invoicecode = "";//发票代码初始定义
|
||||||
String qeug_invoiceno = "";//发票号码
|
String qeug_invoiceno = "";//发票号码
|
||||||
|
@ -478,6 +479,8 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
|
||||||
OperationResult operationResult1 = OperationServiceHelper.executeOperate("save", "recon_invoicebill", new DynamicObject[]{recon_invoicebill}, operateOption1);
|
OperationResult operationResult1 = OperationServiceHelper.executeOperate("save", "recon_invoicebill", new DynamicObject[]{recon_invoicebill}, operateOption1);
|
||||||
if (!operationResult1.isSuccess()){
|
if (!operationResult1.isSuccess()){
|
||||||
logger.error(operationResult1.getMessage());
|
logger.error(operationResult1.getMessage());
|
||||||
|
}else{
|
||||||
|
saveAttachmentToInvoicebill( attachment, operationResult1.getSuccessPkIds().get(0).toString());
|
||||||
}
|
}
|
||||||
//提交
|
//提交
|
||||||
OperateOption operateOption2 = OperateOption.create();
|
OperateOption operateOption2 = OperateOption.create();
|
||||||
|
@ -504,6 +507,8 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
|
||||||
this.getView().showSuccessNotification("发票识别成功");
|
this.getView().showSuccessNotification("发票识别成功");
|
||||||
refreshInvoiceEntry();
|
refreshInvoiceEntry();
|
||||||
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity()});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}else {//
|
}else {//
|
||||||
//验真保存失败--提示失败信息
|
//验真保存失败--提示失败信息
|
||||||
|
@ -597,6 +602,45 @@ public class ReconPayreqFormPlugin extends AbstractFormPlugin implements BeforeF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**将付款申请发票附件保存至对应发票登记*
|
||||||
|
* pkid:发票登记ID
|
||||||
|
*
|
||||||
|
* **/
|
||||||
|
private void saveAttachmentToInvoicebill(Map<String, Object> attachment,String pkid) {
|
||||||
|
Object attPKId = attachment.get("attPkId");
|
||||||
|
AttachmentDto attachmentDto = AttachmentServiceHelper.getAttachmentInfoByAttPk(attPKId);
|
||||||
|
String resourcePath = attachmentDto.getResourcePath();
|
||||||
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
FileServiceFactory.getAttachmentFileService().download(resourcePath,out,null);
|
||||||
|
byte[] bytes = out.toByteArray();
|
||||||
|
String type = attachment.get("type").toString();//附件类型
|
||||||
|
String fileName = attachment.get("name").toString();//附件名称
|
||||||
|
InputStream input = new ByteArrayInputStream(bytes);
|
||||||
|
String uploadPath = "dbjt/" + fileName;
|
||||||
|
StringBuffer uid = new StringBuffer();
|
||||||
|
uid.append("rc-upload-").append(new Date().getTime()).append("-");
|
||||||
|
int index = (int) (1 + Math.random() * 10);
|
||||||
|
String uid1 = uid.toString() + index++;
|
||||||
|
/****上传****/
|
||||||
|
FileService fs = FileServiceFactory.getAttachmentFileService();
|
||||||
|
// 构造FileItem
|
||||||
|
FileItem fi = new FileItem(fileName, uploadPath, input);
|
||||||
|
String path = fs.upload(fi);
|
||||||
|
/****绑定****/
|
||||||
|
Map uploadFileMap = new HashMap();
|
||||||
|
uploadFileMap.put("uid", uid1);
|
||||||
|
uploadFileMap.put("entityNum", "recon_invoicebill");
|
||||||
|
uploadFileMap.put("billPkId", pkid);
|
||||||
|
uploadFileMap.put("lastModified", new Date().getTime());
|
||||||
|
uploadFileMap.put("name", fileName);
|
||||||
|
uploadFileMap.put("url", path);
|
||||||
|
uploadFileMap.put("size", bytes.length);
|
||||||
|
uploadFileMap.put("status", "success");
|
||||||
|
List<Map<String, Object>> attachments = new ArrayList<>( );
|
||||||
|
attachments.add(uploadFileMap);
|
||||||
|
AttachmentServiceHelper.upload("recon_invoicebill", pkid, "attachmentpanel", attachments);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateAmt(){
|
private void updateAmt(){
|
||||||
DynamicObject dataEntity = this.getModel().getDataEntity();
|
DynamicObject dataEntity = this.getModel().getDataEntity();
|
||||||
DynamicObjectCollection invoiceentry = dataEntity.getDynamicObjectCollection("invoiceentry");
|
DynamicObjectCollection invoiceentry = dataEntity.getDynamicObjectCollection("invoiceentry");
|
||||||
|
|
Loading…
Reference in New Issue