|
楼主 |
发表于 2017-6-2 16:31:46
|
显示全部楼层
public static void newInBillProcessAfterFinish() throws Exception {
String fid=com.justep.system.process.ProcessUtils.getProcessData1();
System.out.println(fid);
Mkt_inbill_parent inbillParent = Mkt_inbill_parentService.getInstance().fetch(fid);
BigDecimal inBillAmount=inbillParent.getINBILLAMOUNT();
if(inBillAmount.compareTo(new BigDecimal(0))>0){
inbillParent.setINBILLSTATUS("开正票完成");
inbillParent.setINBILLPERSON(null);
}else {
inbillParent.setINBILLSTATUS("开负票完成");
inbillParent.setINBILLPERSON(null);
}
Mkt_inbill_parentService.getInstance().update(inbillParent);
//插入进度单表
//------------------------------------------------------------
List<Mkt_inbill> bill= Mkt_inbillService.getInstance().query(Cnd.where("inBillParentID", "=", fid));
String isZhengQi=inbillParent.getKSLB();
Iterator<Mkt_inbill> billitIs50 = bill.iterator();
String processStatus="审批完成";
while(billitIs50.hasNext()){
Mkt_inbill tempbill=billitIs50.next();
if((tempbill.getPrjAllInbillAmount().add(tempbill.getINBILLAMOUNT())).compareTo(new BigDecimal(5000000))>=0&&"政企".equals(isZhengQi)){
processStatus="暂存";
}
}
Fin_schedule_parent temp=new Fin_schedule_parent();
String tempfid=temp.UUID();
System.out.println(tempfid);
temp.setFid(tempfid);
temp.setVersion(0);
temp.setFcreatdtime(new java.sql.Date(System.currentTimeMillis()));
temp.setFupdatetime(new java.sql.Date(System.currentTimeMillis()));
temp.setFcreatepersonname(inbillParent.getFCREATEPERSONNAME());
temp.setFcreatepersonid(inbillParent.getFCREATEPERSONID());
temp.setFcreatepersoncode(inbillParent.getFCREATEPERSONCODE());
temp.setFcreatepersonfid(inbillParent.getFCREATEPERSONFID());
String scheduleCreater=inbillParent.getFCREATEPERSONFID();//进度单发起人
temp.setFcreatedeptname(inbillParent.getFCREATEDEPTNAME());
temp.setFcreatedeptid(inbillParent.getFCREATEDEPTID());
temp.setFcreatedeptcode(inbillParent.getFCREATEDEPTCODE());
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyMM");
String date = sDateFormat.format(new java.util.Date());
String bm = BizUtils.createNextSequenceString("KPJD"+date,"0000");
temp.setScheduleno(bm);
temp.setCustomerunit(inbillParent.getMNAME());
temp.setCustomertype(inbillParent.getMTYPE());
temp.setCustomerprovince(inbillParent.getMPROVINCE());
temp.setCustomercity(inbillParent.getMCITY());
temp.setScheduleamount(inbillParent.getPROCESSAMOUNT());
temp.setJudgingcondition("0");
try {
FinScheduleParentService.getInstance().insert(temp);
} catch (Exception e) {
log.error("插入进度单主表失败:" + e.getMessage());
}
Iterator<Mkt_inbill> billit = bill.iterator();
while(billit.hasNext()){
Mkt_inbill tempbill=billit.next();
Fin_schedule_detail tempSchedule=new Fin_schedule_detail();
tempSchedule.setFid(tempSchedule.UUID());
tempSchedule.setVersion(0);
tempSchedule.setFcreatepersonname(inbillParent.getFCREATEPERSONNAME());
tempSchedule.setFcreatepersonid(inbillParent.getFCREATEPERSONID());
tempSchedule.setFcreatepersoncode(inbillParent.getFCREATEPERSONCODE());
tempSchedule.setFcreatepersonfid(inbillParent.getFCREATEPERSONFID());
tempSchedule.setFcreatedeptname(inbillParent.getFCREATEDEPTNAME());
tempSchedule.setFcreatedeptid(inbillParent.getFCREATEDEPTID());
tempSchedule.setFcreatedeptcode(inbillParent.getFCREATEDEPTCODE());
tempSchedule.setFcreatdtime(new java.sql.Date(System.currentTimeMillis()));
tempSchedule.setFupdatetime(new java.sql.Date(System.currentTimeMillis()));
tempSchedule.setPrjno(tempbill.getPRJNO());
tempSchedule.setPrjname(tempbill.getPRJNAME());
tempSchedule.setSubprjno(tempbill.getSUBPRJNO());
tempSchedule.setSubprjname(tempbill.getSUBPRJNAME());
tempSchedule.setSubprjincome(tempbill.getSUBPRJESTIMATEAMOUNT());
tempSchedule.setSubprjsettlementamount(tempbill.getSUBPRJSETTLEMENTAMOUNT());
tempSchedule.setSubprjinagree(tempbill.getSUBPRJINAGREEAMOUNT());
BigDecimal allProcessAmount=tempbill.getPLUSPROCESSAMOUNT().add(tempbill.getTHISPROCESSAMOUNT());
tempSchedule.setSubsumschedamount(allProcessAmount);//单项累计进度额
tempSchedule.setSubsumschedtemp(allProcessAmount);//单项累计进度额暂时
tempSchedule.setNowschedamount(tempbill.getTHISPROCESSAMOUNT());//单项本次进度额
tempSchedule.setIs_confirm("否");
tempSchedule.setIs_print("否");
tempSchedule.setCurrentstate(processStatus);
tempSchedule.setParentid(tempfid);
FinScheduleDetailService.getInstance().insert(tempSchedule);
}
if("暂存".equals(processStatus)){
ProcessUtils.startProcess("/ERP/FIN/fininCome/process/schedule/scheduleProcess", "进度单发起", tempfid, scheduleCreater);
}
//------------------------------------------------------------
// //发送emoss
try {
//参数:类型 、业务主键 、业务表、类型名称、数据源
CallForEmoss.callServiceAndSaveInfoByDataModel("MKT_INBILL", fid, null, "开票发起", "/ERP/MKT/inbill/data");
} catch (Exception e) {
log.error("调用发报文方法出错:" + e.getMessage());
}
} |
|