Date date = new Date(); DateFormat df2 = DateFormat.getDateTimeInstance();//可以精确到时分秒 Record xl =Db.use("szxy").findFirst("select * from t_dm_gy_xl where zf_bj='0' and KS_SJ<'"+df2.format(date)+"' and JS_SJ>'"+df2.format(date)+"'");
Record ry = (Record)getSession().getAttribute("CurUser"); Record list1=Db.use("szxy").findFirst("select * from t_pj_jxpjx where zf_bj='0' and JXPJX_DM='"+jxpjxDm[0]+"'"); for(int i=0;i Record r = Db.use("szxy").findFirst("select * from t_pj_gpjzb where zf_bj=0 and XL_DM='"+xl.getStr("XL_DM")+"' and JXPJX_DM='"+jxpjxDm[i]+"' and RY_DM='"+rydm+"' and LRR='"+ry.getStr("RY_DM")+"' and CPRYLB_DM='"+cprylbdm+"'and PJCS='"+pjcs+"'");
Record qzlist =Db.use("szxy").findFirst("select * from t_pj_xkjxpj where zf_bj='0' and JXPJX_DM='"+jxpjxDm[i]+"'");
Record fzlist =Db.use("szxy").findFirst("select * from t_pj_djxpj where zf_bj='0' and JXPJX_DM='"+list1.getStr("JXPJFJD_DM")+"' and PDDJ_DM='"+pddjdm[i]+"' "); Float qz = qzlist.getFloat("QZ"); Float fz = fzlist.getFloat("FZ"); df+=fz*qz;
if (r==null) {
getModel(PjGpjzb.class,"item").set("GPJZB_DM", UUIDUtil.getUUID()).set("XL_DM", xl.get("XL_DM")).set("PJCS", pjcs) .set("JXPJX_DM", jxpjxDm[i]).set("RY_DM", rydm).set("PDDJ_DM", pddjdm[i]).set("CPRYLB_DM", cprylbdm) .set("CJ_SJ", new Date()).set("ZF_BJ", "0").set("XG_SJ", new Date()) .set("LRR", ry != null ? ry.get("RY_DM") : "").save();;
}else {
String str = r.getStr("GPJZB_DM"); Db.use("szxy").update("update t_pj_gpjzb set PDDJ_DM='"+pddjdm[i]+"' where GPJZB_DM='"+str+"' and zf_bj=0 and XL_DM='"+xl.get("XL_DM")+"'"); }
} Record pjdf = Db.use("szxy").findFirst("SELECT * from t_pj_pjdf where JXPJX_DM='"+list1.getStr("JXPJFJD_DM")+"' and ZF_BJ='0' and XL_DM='"+xl.get("XL_DM")+"' and BPJRY_DM='"+rydm+"' and PJRY_DM='"+ry.getStr("RY_DM")+"' and CPRYLB_DM='"+cprylbdm+"'and PJCS='"+pjcs+"'"); if (pjdf==null) { if(text1==null){ new PjPjdf().set("JXPJX_DM", list1.getStr("JXPJFJD_DM")).set("BPJRY_DM", rydm).set("PJCS", pjcs) .set("DF", df).set("XL_DM", xl.get("XL_DM")).set("CPRYLB_DM", cprylbdm) .set("PJDF_DM", UUIDUtil.getUUID()).set("CJ_SJ", new Date()) .set("ZF_BJ", "0").set("XG_SJ", new Date()).set("PJRY_DM", ry.get("RY_DM")).save(); }else{ new PjPjdf().set("JXPJX_DM", list1.getStr("JXPJFJD_DM")).set("BPJRY_DM", rydm).set("PJCS", pjcs) .set("DF", df).set("XL_DM", xl.get("XL_DM")).set("CPRYLB_DM", cprylbdm) .set("JXBZ", text1).set("JXJY", text2) .set("PJDF_DM", UUIDUtil.getUUID()).set("CJ_SJ", new Date()) .set("ZF_BJ", "0").set("XG_SJ", new Date()).set("PJRY_DM", ry.get("RY_DM")).save(); }
}else { String pjdfdm = pjdf.getStr("PJDF_DM"); if(text1==null){ Db.use("szxy").update("update t_pj_pjdf set DF='"+df+"' where PJDF_DM='"+pjdfdm+"' and XL_DM='"+xl.get("XL_DM")+"'"); }else{ Db.use("szxy").update("update t_pj_pjdf set DF='"+df+"',JXBZ='"+text1+"',JXJY='"+text2+"' where PJDF_DM='"+pjdfdm+"' and XL_DM='"+xl.get("XL_DM")+"'");