Commit 748f5c9c authored by zhoumaotao's avatar zhoumaotao

gpfkjg表替换gpfk

parent 6a4b51ac
......@@ -54,7 +54,7 @@ public class KmesBoardController extends BaseController {
/**
* 时段产量
* 时段产量(每一天)
*/
@RequestMapping(value = "querySdcl", method = RequestMethod.POST)
@ResponseBody
......@@ -64,7 +64,7 @@ public class KmesBoardController extends BaseController {
}
/**
*近一周排产数据
*近一周日排产数据(每一天)
*/
@RequestMapping(value = "queryWeekPcsl", method = RequestMethod.POST)
@ResponseBody
......
......@@ -3,6 +3,7 @@ package com.gavel.kwell.dao;
import com.gavel.common.base.dao.BaseDao;
import com.gavel.gygl.vo.BzgxVO;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.persistent.Gpfkjg;
import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkcxVO;
import com.gavel.persistence.sql.RecordSet;
......@@ -19,11 +20,11 @@ public interface GpfkcxDao extends BaseDao {
public List<BzgxVO> listBzgxName();
public List<Gpfk> queryByBetween(Date start, Date end);
public List<Gpfkjg> queryByBetween(Date start, Date end);
public List<Gpfk> queryGpfk(Date date,String[] gxbzs);
public List<Gpfkjg> queryGpfk(Date date,String[] gxbzs);
public Gpfk queryWeekGpfk(Date date,String woid);
public Gpfkjg queryWeekGpfk(Date date,String woid);
public Gpfk queryMonthGpfk(Date date);
public Gpfkjg queryMonthGpfk(Date date);
}
......@@ -7,6 +7,7 @@ import com.gavel.common.utils.StringUtils;
import com.gavel.gygl.vo.BzgxVO;
import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.persistent.Gpfkjg;
import com.gavel.kwell.vo.GpfkCondition;
import com.gavel.kwell.vo.GpfkcxVO;
import com.gavel.persistence.sql.RecordSet;
......@@ -115,47 +116,47 @@ public class GpfkcxDaoImpl extends BaseDaoImpl implements GpfkcxDao {
}
@Override
public List<Gpfk> queryByBetween(Date start, Date end) {
public List<Gpfkjg> queryByBetween(Date start, Date end) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKGX, ");
sqlMap.append(" GPFK_FKSJ,GPFK_FKR,GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,");
sqlMap.append(" GPFK_HGBZ,GPFK_FKSL,GPFK_HGSL,GPFK_BHGSL,GPFK_GFSL, ");
sqlMap.append(" GPFK_LFSL,WOGYLX_GXBZ ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append("where (GPFK_FKSJ >= :pStart and GPFK_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");//[a,b)
sqlMap.append("select GPFKJG_ID, GPFKJG_WOSNID, GPFKJG_FKLX, GPFKJG_FKGX, ");
sqlMap.append(" GPFKJG_FKSJ,GPFKJG_FKR,GPFKJG_FKRID, GPFKJG_FKBX, GPFKJG_FKJSSJ,");
sqlMap.append(" GPFKJG_HGBZ,GPFKJG_FKSL,GPFKJG_HGSL,GPFKJG_BHGSL,GPFKJG_GFSL, ");
sqlMap.append(" GPFKJG_LFSL,WOGYLX_GXBZ ");
sqlMap.append("from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_FKGX ");
sqlMap.append("where (GPFKJG_FKSJ >= :pStart and GPFKJG_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");//[a,b)
sqlMap.setParamValue("pStart", start);
sqlMap.setParamValue("pEnd", end);
sqlMap.setParamValue("pDGxbz", GxlxGxbzEnum.ONLY.getId());
sqlMap.setParamValue("pMGxbz", GxlxGxbzEnum.LAST.getId());
return sqlMap.query(Gpfk.class);
return sqlMap.query(Gpfkjg.class);
}
@Override
public List<Gpfk> queryGpfk(Date date,String[] gxbzs) {
public List<Gpfkjg> queryGpfk(Date date,String[] gxbzs) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select GPFK_ID, GPFK_WOSNID, GPFK_FKLX, GPFK_FKGX, ");
sqlMap.append(" GPFK_FKSJ,GPFK_FKR,GPFK_FKRID, GPFK_FKBX, GPFK_FKJSSJ,");
sqlMap.append(" GPFK_HGBZ,GPFK_FKSL,GPFK_HGSL,GPFK_BHGSL,GPFK_GFSL, ");
sqlMap.append(" GPFK_LFSL,WOGYLX_GXBZ ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append("select GPFKJG_ID, GPFKJG_WOSNID, GPFKJG_FKLX, GPFKJG_FKGX, ");
sqlMap.append(" GPFKJG_FKSJ,GPFKJG_FKR,GPFKJG_FKRID, GPFKJG_FKBX, GPFKJG_FKJSSJ,");
sqlMap.append(" GPFKJG_HGBZ,GPFKJG_FKSL,GPFKJG_HGSL,GPFKJG_BHGSL,GPFKJG_GFSL, ");
sqlMap.append(" GPFKJG_LFSL,WOGYLX_GXBZ ");
sqlMap.append("from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where ( GPFK_FKSJ >= :pKsrq and GPFK_FKSJ < :pJsrq ) ");
sqlMap.append("where ( GPFKJG_FKSJ >= :pKsrq and GPFKJG_FKSJ < :pJsrq ) ");
sqlMap.append(" and ").append("WOGYLX_BZGXID", gxbzs);
sqlMap.setParamValue("pKsrq", DateUtils.beginOfDay(date));
sqlMap.setParamValue("pJsrq", DateUtils.endOfDay(date));
return sqlMap.query(Gpfk.class);
return sqlMap.query(Gpfkjg.class);
}
@Override
public Gpfk queryWeekGpfk(Date date,String woid) {
public Gpfkjg queryWeekGpfk(Date date,String woid) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(GPFK_FKSL) as GPFK_FKSL ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append("select sum(GPFKJG_FKSL) as GPFK_FKSL ");
sqlMap.append("from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where (GPFK_FKSJ >= :pStart and GPFK_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");
sqlMap.append("where (GPFKJG_FKSJ >= :pStart and GPFKJG_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");
sqlMap.setParamValue("pStart", DateUtils.beginOfDay(DateUtils.getCurrentWeekDateBegin(date)));
sqlMap.setParamValue("pEnd", DateUtils.endOfDay(DateUtils.getCurrentWeekDateEnd(date)));
sqlMap.setParamValue("pDGxbz", GxlxGxbzEnum.ONLY.getId());
......@@ -164,22 +165,22 @@ public class GpfkcxDaoImpl extends BaseDaoImpl implements GpfkcxDao {
sqlMap.append(" and WOGYLX_WOID = :pWoid ");
sqlMap.setParamValue("pWoid", woid);
}
return sqlMap.queryEntity(Gpfk.class);
return sqlMap.queryEntity(Gpfkjg.class);
}
@Override
public Gpfk queryMonthGpfk(Date date) {
public Gpfkjg queryMonthGpfk(Date date) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(GPFK_FKSL) as GPFK_FKSL ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_FKGX ");
sqlMap.append("select sum(GPFKJG_FKSL) as GPFKJG_FKSL ");
sqlMap.append("from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_FKGX ");
sqlMap.append(" left join BZGX on BZGX_ID = WOGYLX_BZGXID ");
sqlMap.append("where (GPFK_FKSJ >= :pStart and GPFK_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");
sqlMap.append("where (GPFKJG_FKSJ >= :pStart and GPFKJG_FKSJ < :pEnd) and (WOGYLX_GXBZ = :pDGxbz or WOGYLX_GXBZ = :pMGxbz) ");
sqlMap.setParamValue("pStart", DateUtils.beginOfMonth(date));
sqlMap.setParamValue("pEnd", DateUtils.endOfMonth(date));
sqlMap.setParamValue("pDGxbz", GxlxGxbzEnum.ONLY.getId());
sqlMap.setParamValue("pMGxbz", GxlxGxbzEnum.LAST.getId());
return sqlMap.queryEntity(Gpfk.class);
return sqlMap.queryEntity(Gpfkjg.class);
}
}
......@@ -21,9 +21,10 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
@Override
public Pcjhmx queryWeekPcsl(Date date) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(PCJHMX_JHSL) as PCJHMX_JHSL,sum(PCJHMX_WGSL) as PCJHMX_WGSL ");
sqlMap.append("select sum(PCJHMX_JHSL) as PCJHMX_JHSL ");
sqlMap.append("from PCJHMX ");
sqlMap.append("where 1=1 and ( :ksrq <= PCJHMX_JHRQ and PCJHMX_JHRQ <= :jsrq ) ");
sqlMap.append(" left join PCJH on PCJH_ID = PCJHMX_MID ");
sqlMap.append("where 1=1 and ( :ksrq <= PCJH_JHRQ and PCJH_JHRQ <= :jsrq ) ");
sqlMap.setParamValue("ksrq", DateUtils.beginOfDay(date));
sqlMap.setParamValue("jsrq", DateUtils.endOfDay(date));
return sqlMap.queryEntity(Pcjhmx.class);
......@@ -32,7 +33,7 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
@Override
public PcslVO queryTodayPcsl(Date date) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(PCJHMX_JHSL) as JHSL,0 as WGSL ");
sqlMap.append("select sum(PCJHMX_JHSL) as JHSL ");
sqlMap.append("from PCJHMX ");
sqlMap.append("where 1=1 and ( :pKsrq <= PCJHMX_JHRQ and U_PCJHMX_JSRQ <= :pJsrq ) ");
sqlMap.append(" or ( PCJHMX_JHRQ < :pKsrq and U_PCJHMX_JSRQ > :pKsrq ) ");
......@@ -45,7 +46,7 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
@Override
public PcslVO queryMonthPcsl(Date date) {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select sum(PCJHMX_JHSL) as JHSL,0 as WGSL ");
sqlMap.append("select sum(PCJHMX_JHSL) as JHSL ");
sqlMap.append("from PCJHMX ");
sqlMap.append("where 1=1 and ( :pKsrq <= PCJHMX_JHRQ and U_PCJHMX_JSRQ <= :pJsrq ) ");
sqlMap.append(" or ( PCJHMX_JHRQ < :pKsrq and U_PCJHMX_JSRQ > :pKsrq ) ");
......@@ -77,13 +78,13 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
public UWoVO queryWorkingWO() {
SqlMap sqlMap = new SqlMap();
sqlMap.append("select WO_DJID,WO_GCID,WO_YWRQ,WO_WLID,WO_XQSL,WO_WGSL,WLXX_CODE,WLXX_NAME,WLXX_GG ");
sqlMap.append("from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_WOGYLX ");
sqlMap.append("from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_WOGYLX ");
sqlMap.append(" left join WO on WO_ID = WOGYLX_WOID ");
sqlMap.append(" left join WLXX on WLXX_ID = WO_WLID ");
sqlMap.append("where 1=1 and GPFK_CJSJ = (select max(GPFK_CJSJ) ");
sqlMap.append(" from GPFK ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFK_WOGYLX ");
sqlMap.append("where 1=1 and GPFKJG_CJSJ = (select max(GPFKJG_CJSJ) ");
sqlMap.append(" from GPFKJG ");
sqlMap.append(" left join WOGYLX on WOGYLX_ID = GPFKJG_WOGYLX ");
sqlMap.append(" where WOGYLX_GXBZ = :pGxbz ");
sqlMap.setParamValue("pGxbz", GxlxGxbzEnum.FIRST.getId());
sqlMap.append(" ) ");
......@@ -94,10 +95,10 @@ public class KmesBoardDaoImpl extends BaseDaoImpl implements KmesBoardDao {
public int queryZtsl(String[] fkids) {
SqlMap sqlMap = new SqlMap();
sqlMap.append(" select sum(a.sl) from ");
sqlMap.append(" (select count(1) as sl,bzgx_id as bzgx from gpfk ");
sqlMap.append(" left join wogylx on wogylx_id = gpfk_fkgx ");
sqlMap.append(" left join bzgx on bzgx_id = WOGYLX_BZGXID ");
sqlMap.append(" group by bzgx_id) a ");
sqlMap.append(" (select count(1) as sl,bzgx_id as bzgx from gpfkjg ");
sqlMap.append(" left join wogylx on wogylx_id = gpfkjg_fkgx ");
sqlMap.append(" left join bzgx on bzgx_id = wogylx_bzgxid ");
sqlMap.append(" group by bzgx_id ) a ");
sqlMap.append(" where 1=1 ");
if(fkids!=null&&fkids.length>0) {
sqlMap.append(" and ( ");
......
......@@ -9,6 +9,7 @@ import com.gavel.common.utils.StringUtils;
import com.gavel.kwell.dao.GpfkcxDao;
import com.gavel.kwell.dao.KmesBoardDao;
import com.gavel.kwell.persistent.Gpfk;
import com.gavel.kwell.persistent.Gpfkjg;
import com.gavel.kwell.service.KmesBoardService;
import com.gavel.kwell.utils.DateCalculateUtil;
import com.gavel.kwell.utils.KwellParamEnum;
......@@ -63,12 +64,22 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
for(int i=0;i<dateList.size()-1;i++){
List<Double> doubleList = sdclVO.getTimeperiodMount();
List<String> xseriesList = sdclVO.getXseriesList();
Date dateStart = dateList.get(i);
Date dateEnd = dateList.get(i+1);
List<Gpfk> gpfks = queryByBetween(dateStart,dateEnd);
Date dateStart =null;
if(i== 0){
dateStart = DateUtils.beginOfDay( dateList.get(0));//8:30置为0点
}else {
dateStart = dateList.get(i);
}
Date dateEnd=null;
if(i == dateList.size()-2){
dateEnd = DateUtils.endOfDay( dateList.get(i+1));//21:30置为23.59点
}else {
dateEnd = dateList.get(i+1);
}
List<Gpfkjg> gpfks = queryByBetween(dateStart,dateEnd);
double sl = 0.0;
if(gpfks != null && gpfks.size()>0){
sl = gpfks.stream().mapToDouble(Gpfk::getFksl).sum();
sl = gpfks.stream().mapToDouble(Gpfkjg::getFksl).sum();//每一天
}
total= NumberUtils.plus(total,sl);
doubleList.add(sl);
......@@ -78,7 +89,7 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
return sdclVO;
}
private List<Gpfk> queryByBetween(Date start,Date end){
private List<Gpfkjg> queryByBetween(Date start,Date end){
return gpfkcxDao.queryByBetween(start,end);
}
......@@ -91,9 +102,18 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
for(Date date : dateList){
PcslVO pcslVO = new PcslVO();
Pcjhmx pcjhmx = kmesBoardDao.queryWeekPcsl(date);
pcslVO.setPcrq(date);
List<Gpfkjg> gpfks = queryByBetween(date,date);
double wgsl =0.0;
if(gpfks != null && gpfks.size()>0){
wgsl = gpfks.stream().mapToDouble(Gpfkjg::getFksl).sum();//每一天
}
if(pcjhmx != null){
pcslVO.setJhsl(pcjhmx.getJhsl()==null?0.0:pcjhmx.getJhsl());
pcslVO.setWgsl(pcjhmx.getWgsl()==null?0.0:pcjhmx.getWgsl());
}else {
pcslVO.setJhsl(0.0);
}
pcslVO.setPcrq(date);
pcslVO.setWgsl(wgsl);
pcslVOList.add(pcslVO);
}
return pcslVOList;
......@@ -102,28 +122,32 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
@Override
public PcslVO queryTodayPcsl() {
PcslVO pcslVO = kmesBoardDao.queryTodayPcsl(new Date());
if(pcslVO != null){
Gpfk gpfk = gpfkcxDao.queryWeekGpfk(new Date(),"");
pcslVO.setWgsl(gpfk.getFgsl()==null?0.0:gpfk.getFgsl());
}else {
pcslVO =new PcslVO();
if(pcslVO == null){
pcslVO = new PcslVO();
pcslVO.setJhsl(0.0);
pcslVO.setWgsl(0.0);
}
Gpfkjg gpfkjg = gpfkcxDao.queryWeekGpfk(new Date(),"");
double wgsl =0.0;
if(gpfkjg != null){
wgsl = gpfkjg.getFksl()==null?0.0:gpfkjg.getFksl();
}
pcslVO.setWgsl(wgsl);
return pcslVO;
}
@Override
public PcslVO queryMonthPcsl() {
PcslVO pcslVO = kmesBoardDao.queryMonthPcsl(new Date());
if(pcslVO != null){
Gpfk gpfk = gpfkcxDao.queryMonthGpfk(new Date());
pcslVO.setWgsl(gpfk.getFgsl()==null?0.0:gpfk.getFgsl());
}else {
pcslVO =new PcslVO();
if(pcslVO == null){
pcslVO = new PcslVO();
pcslVO.setJhsl(0.0);
pcslVO.setWgsl(0.0);
}
Gpfkjg gpfkjg = gpfkcxDao.queryMonthGpfk(new Date());
double wgsl =0.0;
if(gpfkjg != null){
pcslVO.setWgsl(gpfkjg.getFksl()==null?0.0:gpfkjg.getFksl());
}
pcslVO.setWgsl(wgsl);
return pcslVO;
}
......@@ -132,8 +156,8 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
public List<UWoVO> queryWo() {
List<UWoVO> uWoVOList = kmesBoardDao.queryWo(new Date());
for(UWoVO uWoVO : uWoVOList ){
Gpfk gpfk = gpfkcxDao.queryWeekGpfk(new Date(),uWoVO.getId());
uWoVO.setWgsl(gpfk.getFgsl()==null?0.0:gpfk.getFgsl());
Gpfkjg gpfk = gpfkcxDao.queryWeekGpfk(new Date(),uWoVO.getId());
uWoVO.setWgsl(gpfk.getFksl()==null?0.0:gpfk.getFksl());
}
return uWoVOList;
}
......@@ -155,12 +179,12 @@ public class KmesBoardServiceImpl extends BaseEditServiceImpl implements KmesBoa
String[] gxbzs = gxbz.split(",");
for(Date date : dateList){
GpfkHgVO gpfkHgVO = new GpfkHgVO();
List<Gpfk> gpfks = gpfkcxDao.queryGpfk(date,gxbzs);
Integer fksl =0;
List<Gpfkjg> gpfks = gpfkcxDao.queryGpfk(date,gxbzs);
Double fksl =0.0;
Double hgsl =0.0;
if(CollectionUtils.isNotEmpty(gpfks)){
fksl= gpfks.size();
hgsl = gpfks.stream().mapToDouble(Gpfk::getHgsl).sum();
fksl = gpfks.stream().mapToDouble(Gpfkjg::getFksl).sum();
hgsl = gpfks.stream().mapToDouble(Gpfkjg::getHgsl).sum();
gpfkHgVO.setFksl(fksl);
gpfkHgVO.setHgsl(hgsl);
}else {
......
......@@ -9,7 +9,7 @@ public class GpfkHgVO extends BaseEntity {
private Date fkrq;
private Integer fksl;//反馈数量
private Double fksl;//反馈数量
private Double hgsl;//合格数量
......@@ -21,11 +21,11 @@ public class GpfkHgVO extends BaseEntity {
this.fkrq = fkrq;
}
public Integer getFksl() {
public Double getFksl() {
return fksl;
}
public void setFksl(Integer fksl) {
public void setFksl(Double fksl) {
this.fksl = fksl;
}
......
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