|
|
|
@ -19,6 +19,8 @@ import org.jeecg.modules.productplan.entity.ZyPlanProcess; |
|
|
|
|
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
|
|
|
|
import org.jeecg.modules.productplan.mapper.ZyPlanProcessMapper; |
|
|
|
|
import org.jeecg.modules.productplan.mapper.ZyProductPlanMapper; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDictItem; |
|
|
|
|
import org.jeecg.modules.system.service.ISysDictItemService; |
|
|
|
|
import org.jeecg.modules.workorder.entity.WorkOrder; |
|
|
|
|
import org.jeecg.modules.workorder.mapper.WorkOrderMapper; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -77,7 +79,13 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
@Autowired |
|
|
|
|
private HangRecordMapper hangRecordMapper; |
|
|
|
|
|
|
|
|
|
//数据字典
|
|
|
|
|
@Autowired |
|
|
|
|
private ISysDictItemService sysDictItemService;//
|
|
|
|
|
|
|
|
|
|
//定时间隔
|
|
|
|
|
private String dictItem_id3="1664449357463691266"; |
|
|
|
|
private String dictItem_id4="1664449522291449858"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -91,7 +99,10 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void recordAuto(List<String> woList) { |
|
|
|
|
|
|
|
|
|
SysDictItem dictItem1=sysDictItemService.getById(dictItem_id3); |
|
|
|
|
SysDictItem dictItem2=sysDictItemService.getById(dictItem_id4); |
|
|
|
|
int time_s=Integer.parseInt(dictItem1.getItemValue()); |
|
|
|
|
int time_e=Integer.parseInt(dictItem2.getItemValue()); |
|
|
|
|
//1、读取工单,得到生产计划
|
|
|
|
|
if(woList.size()<=0) |
|
|
|
|
{ |
|
|
|
@ -112,17 +123,16 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
QueryWrapper<Sensor> qws=new QueryWrapper<>(); |
|
|
|
|
List<Sensor> sensorList=sensorMapper.selectList(qws); |
|
|
|
|
|
|
|
|
|
//#region2.遍历list 吊挂(开始+结束)+传感器记录(每个)+生产记录(每个)
|
|
|
|
|
//#region2.遍历生产计划 吊挂(开始+结束)+传感器记录(每个)+生产记录(每个)
|
|
|
|
|
for(ZyProductPlan item :productPlanList) |
|
|
|
|
{ |
|
|
|
|
//3、每个生产计划对应工序,每一道工序对应工位
|
|
|
|
|
QueryWrapper<ZyPlanProcess> qwProcess=new QueryWrapper<>(); |
|
|
|
|
qwProcess.eq("plan_id",item.getId()); |
|
|
|
|
List<ZyPlanProcess> listProcess=zyPlanProcessMapper.selectList(qwProcess); |
|
|
|
|
|
|
|
|
|
//服装进入制作工艺过程
|
|
|
|
|
long timeMillis = System.currentTimeMillis(); |
|
|
|
|
//将获取时间转为日期类型
|
|
|
|
|
Date start_time=XJobUtils.longToDate(timeMillis); |
|
|
|
|
Date start_time=new Date(); |
|
|
|
|
|
|
|
|
|
//生产记录
|
|
|
|
|
List<ProductRecord> arrPR=new ArrayList<>(); |
|
|
|
@ -138,7 +148,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
//开始时间
|
|
|
|
|
Date str01= start_time; |
|
|
|
|
//结束时间
|
|
|
|
|
Date str02= XJobUtils.randomIntervaltime(str01,1,5); |
|
|
|
|
Date str02= XJobUtils.randomIntervaltime(str01,time_s,time_e); |
|
|
|
|
//生产时间
|
|
|
|
|
long time=XJobUtils.dateToLong(str01,str02); |
|
|
|
|
|
|
|
|
@ -161,6 +171,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
prmodel.setDuration(time+""); |
|
|
|
|
//状态
|
|
|
|
|
prmodel.setStatus("1"); |
|
|
|
|
productRecordMapper.insert(prmodel); |
|
|
|
|
arrPR.add(prmodel); |
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
@ -189,6 +200,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
srmodel.setProductIdenti(item.getProductCode()); |
|
|
|
|
//触发时间
|
|
|
|
|
srmodel.setTriggerTime(str01); |
|
|
|
|
sensorRecordMapper.insert(srmodel); |
|
|
|
|
arrSR.add(srmodel); |
|
|
|
|
} |
|
|
|
|
//查找出
|
|
|
|
@ -211,6 +223,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
srmodel.setProductIdenti(item.getProductCode()); |
|
|
|
|
//触发时间
|
|
|
|
|
srmodel.setTriggerTime(str01); |
|
|
|
|
sensorRecordMapper.insert(srmodel); |
|
|
|
|
arrSR.add(srmodel); |
|
|
|
|
} |
|
|
|
|
//#endregion
|
|
|
|
@ -231,26 +244,27 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
|
hrmodel.setDuration(time+""); |
|
|
|
|
//状态
|
|
|
|
|
hrmodel.setStatus("1"); |
|
|
|
|
hangRecordMapper.insert(hrmodel); |
|
|
|
|
arrHR.add(hrmodel); |
|
|
|
|
//#endregion
|
|
|
|
|
//间隔时间
|
|
|
|
|
start_time=XJobUtils.randomIntervaltime(str01,1,2); |
|
|
|
|
start_time=XJobUtils.randomIntervaltime(str01,time_s,time_e); |
|
|
|
|
} |
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region批量保存
|
|
|
|
|
for(ProductRecord arr:arrPR) |
|
|
|
|
{//生产记录
|
|
|
|
|
productRecordMapper.insert(arr); |
|
|
|
|
} |
|
|
|
|
for(SensorRecord arr:arrSR) |
|
|
|
|
{//传感器
|
|
|
|
|
sensorRecordMapper.insert(arr); |
|
|
|
|
} |
|
|
|
|
for(HangRecord arr:arrHR) |
|
|
|
|
{//吊挂
|
|
|
|
|
hangRecordMapper.insert(arr); |
|
|
|
|
} |
|
|
|
|
// for(ProductRecord arr:arrPR)
|
|
|
|
|
// {//生产记录
|
|
|
|
|
// productRecordMapper.insert(arr);
|
|
|
|
|
// }
|
|
|
|
|
// for(SensorRecord arr:arrSR)
|
|
|
|
|
// {//传感器
|
|
|
|
|
// sensorRecordMapper.insert(arr);
|
|
|
|
|
// }
|
|
|
|
|
// for(HangRecord arr:arrHR)
|
|
|
|
|
// {//吊挂
|
|
|
|
|
// hangRecordMapper.insert(arr);
|
|
|
|
|
// }
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|