@ -1,14 +1,19 @@
package com.op.mes.service.impl ;
import com.alibaba.fastjson2.JSON ;
import com.alibaba.fastjson2.JSONArray ;
import com.alibaba.fastjson2.JSONObject ;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder ;
import com.op.common.core.domain.R ;
import com.op.common.core.utils.DateUtils ;
import com.op.common.core.utils.bean.BeanUtils ;
import com.op.common.core.utils.http.HttpUtils ;
import com.op.common.core.utils.uuid.IdUtils ;
import com.op.mes.domain.BufferInfoParam ;
import com.op.mes.domain.MesReportWork ;
import com.op.mes.domain.MesShift ;
import com.op.mes.domain.ProOrderWorkorder ;
import com.op.mes.domain.buffer.JsonRootBean ;
import com.op.mes.domain.dto.LGInfoDto ;
import com.op.mes.mapper.MesMapper ;
import com.op.mes.mapper.MesReportWorkMapper ;
@ -403,21 +408,118 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
}
@Override
public Map getDryRoomData ( BoardDTO boardDTO ) {
public Map dryRoomDataHeader ( BoardDTO boardDTO ) {
DynamicDataSourceContextHolder . push ( "ds_" + boardDTO . getFactory ( ) ) ; // 这是数据源的key
//成型机清单
Map map = new HashMap ( ) ;
List < Map < String , String > > eqmapList = mesMapper . selectcxjList ( ) ;
/ * *
* 成 型 机
* /
long cxzc = eqmapList . stream ( )
. filter ( e - > e . get ( "status" ) . equals ( "1" ) & & e . get ( "equipment_type_code" ) . equals ( "equ_type_cxj" ) & & ! e . get ( "del_flag" ) . equals ( "1" ) )
. count ( ) ;
/ * *
* 烘 房
* /
long hfauto = eqmapList . stream ( )
. filter ( e - > e . get ( "status" ) . equals ( "1" ) & & e . get ( "equipment_type_code" ) . equals ( "equ_type_hf" ) & & ! e . get ( "del_flag" ) . equals ( "1" ) )
. count ( ) ;
/ * *
* 收 胚 机 台
* /
long spzc = eqmapList . stream ( )
. filter ( e - > e . get ( "status" ) . equals ( "1" ) & & e . get ( "equipment_type_code" ) . equals ( "equ_type_spj" ) & & ! e . get ( "del_flag" ) . equals ( "1" ) )
. count ( ) ;
BufferInfoParam bufferInfoParam = new BufferInfoParam ( ) ;
bufferInfoParam . setReqCode ( IdUtils . fastSimpleUUID ( ) ) ;
bufferInfoParam . setReqTime ( DateUtils . dateTimeNow ( ) ) ;
//成型缓存区
bufferInfoParam . setBufferType ( "10" ) ;
bufferInfoParam . setFactory ( boardDTO . getFactory ( ) ) ;
try {
String res = HttpUtils . sendPost ( "http://192.168.202.23:5001/api/ReceivingAndFeedingMaterials/bufferInfoSync" , JSON . toJSONString ( bufferInfoParam ) ) ;
JsonRootBean jsonRootBean = JSONObject . parseObject ( res , JsonRootBean . class ) ;
long count = jsonRootBean . getLocations ( ) . stream ( )
. filter ( obj - > ! obj . getRfid ( ) . isEmpty ( ) )
. count ( ) ;
map . put ( "hcnumber" , count ) ;
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
map . put ( "cxzc" , cxzc ) ;
map . put ( "hfauto" , hfauto ) ;
map . put ( "spzc" , spzc ) ;
map . put ( "result" , eqmapList ) ;
return map ;
}
public static void main ( String args [ ] ) {
DateTimeFormatter ymdhms = DateTimeFormatter . ofPattern ( "yyyy-MM-dd" ) ;
LocalDate today = LocalDate . now ( ) ;
LocalDate lastMonth3 = today . plus ( - 3 , ChronoUnit . MONTHS ) ;
System . out . println ( "7天之前的日期为:" + lastMonth3 . getYear ( ) ) ;
@Override
public Map dryRoomDataCarousel ( BoardDTO boardDTO ) {
DynamicDataSourceContextHolder . push ( "ds_" + boardDTO . getFactory ( ) ) ; // 这是数据源的key
Map map = new HashMap ( ) ;
//查询烘房信息
List < Map < String , String > > dryingRoomListInfo = mesMapper . selectdryingRoomListInfo ( ) ;
map . put ( "dryingroomList" , dryingRoomListInfo ) ;
return map ;
}
// public static void main(String[] args) {
// param param=new param();
// param.setReqCode(IdUtils.fastSimpleUUID());
// param.setReqTime(DateUtils.dateTimeNow());
// param.setBufferType("10");
// param.setFactory("999");
// try {
// String res= HttpUtils.sendPost("http://192.168.109.36:5001/api/ReceivingAndFeedingMaterials/bufferInfoSync", JSON.toJSONString(param));
// System.out.println(res);
// }catch (Exception e){
// System.out.println(e.getMessage());
// }
//
// }
// static class param{
// String reqCode;
// String reqTime;
// String factory;
// String bufferType;
//
// public String getReqCode() {
// return reqCode;
// }
//
// public void setReqCode(String reqCode) {
// this.reqCode = reqCode;
// }
//
// public String getReqTime() {
// return reqTime;
// }
//
// public void setReqTime(String reqTime) {
// this.reqTime = reqTime;
// }
//
// public String getFactory() {
// return factory;
// }
//
// public void setFactory(String factory) {
// this.factory = factory;
// }
//
// public String getBufferType() {
// return bufferType;
// }
//
// public void setBufferType(String bufferType) {
// this.bufferType = bufferType;
// }
// }
}