|
|
@ -1,6 +1,7 @@ |
|
|
|
package org.jeecg.modules.hangerlocation.service.impl; |
|
|
|
package org.jeecg.modules.hangerlocation.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import org.jeecg.common.util.XJobUtils; |
|
|
|
import org.jeecg.common.util.XJobUtils; |
|
|
|
import org.jeecg.modules.demo.productrecord.entity.ProductRecord; |
|
|
|
import org.jeecg.modules.demo.productrecord.entity.ProductRecord; |
|
|
|
import org.jeecg.modules.demo.productrecord.mapper.ProductRecordMapper; |
|
|
|
import org.jeecg.modules.demo.productrecord.mapper.ProductRecordMapper; |
|
|
@ -8,6 +9,7 @@ import org.jeecg.modules.demo.sensor.entity.Sensor; |
|
|
|
import org.jeecg.modules.demo.sensor.mapper.SensorMapper; |
|
|
|
import org.jeecg.modules.demo.sensor.mapper.SensorMapper; |
|
|
|
import org.jeecg.modules.demo.sensorrecord.entity.SensorRecord; |
|
|
|
import org.jeecg.modules.demo.sensorrecord.entity.SensorRecord; |
|
|
|
import org.jeecg.modules.demo.sensorrecord.mapper.SensorRecordMapper; |
|
|
|
import org.jeecg.modules.demo.sensorrecord.mapper.SensorRecordMapper; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
import org.jeecg.modules.hanger.entity.HangRecord; |
|
|
|
import org.jeecg.modules.hanger.entity.HangRecord; |
|
|
|
import org.jeecg.modules.hanger.mapper.HangRecordMapper; |
|
|
|
import org.jeecg.modules.hanger.mapper.HangRecordMapper; |
|
|
|
import org.jeecg.modules.hangerlocation.entity.HangerLocation; |
|
|
|
import org.jeecg.modules.hangerlocation.entity.HangerLocation; |
|
|
@ -45,7 +47,9 @@ import static org.jeecg.common.util.XJobUtils.dateToLong; |
|
|
|
public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, HangerLocation> implements IHangerLocationService { |
|
|
|
public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, HangerLocation> implements IHangerLocationService { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private HangerLocationMapper hangerLocationMapper; |
|
|
|
private HangerLocationMapper hangerLocationMapper; |
|
|
|
|
|
|
|
//订单
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IZyOrdersService zyOrdersService; |
|
|
|
//工单
|
|
|
|
//工单
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private WorkOrderMapper workOrderMapper; |
|
|
|
private WorkOrderMapper workOrderMapper; |
|
|
@ -103,6 +107,9 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
SysDictItem dictItem2=sysDictItemService.getById(dictItem_id4); |
|
|
|
SysDictItem dictItem2=sysDictItemService.getById(dictItem_id4); |
|
|
|
int time_s=Integer.parseInt(dictItem1.getItemValue()); |
|
|
|
int time_s=Integer.parseInt(dictItem1.getItemValue()); |
|
|
|
int time_e=Integer.parseInt(dictItem2.getItemValue()); |
|
|
|
int time_e=Integer.parseInt(dictItem2.getItemValue()); |
|
|
|
|
|
|
|
//查找有所传感器
|
|
|
|
|
|
|
|
QueryWrapper<Sensor> qws=new QueryWrapper<>(); |
|
|
|
|
|
|
|
List<Sensor> sensorList=sensorMapper.selectList(qws); |
|
|
|
//1、读取工单,得到生产计划
|
|
|
|
//1、读取工单,得到生产计划
|
|
|
|
if(woList.size()<=0) |
|
|
|
if(woList.size()<=0) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -110,22 +117,22 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
//得到所有工单
|
|
|
|
//得到所有工单
|
|
|
|
List<WorkOrder> workList=workOrderMapper.selectBatchIds(woList); |
|
|
|
List<WorkOrder> workList=workOrderMapper.selectBatchIds(woList); |
|
|
|
//
|
|
|
|
|
|
|
|
List<String> workCodeList=new ArrayList<>(); |
|
|
|
|
|
|
|
for(WorkOrder wk:workList) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
workCodeList.add(wk.getProductCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QueryWrapper<ZyProductPlan> qwProduct=new QueryWrapper<>(); |
|
|
|
|
|
|
|
qwProduct.in("product_code",workCodeList); |
|
|
|
|
|
|
|
List<ZyProductPlan> productPlanList=zyProductPlanMapper.selectList(qwProduct); |
|
|
|
|
|
|
|
//查找有所传感器
|
|
|
|
|
|
|
|
QueryWrapper<Sensor> qws=new QueryWrapper<>(); |
|
|
|
|
|
|
|
List<Sensor> sensorList=sensorMapper.selectList(qws); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region2.遍历生产计划 吊挂(开始+结束)+传感器记录(每个)+生产记录(每个)
|
|
|
|
//#region2.遍历生产计划 吊挂(开始+结束)+传感器记录(每个)+生产记录(每个)
|
|
|
|
for(ZyProductPlan item :productPlanList) |
|
|
|
for(WorkOrder wo:workList) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
//根据工单得到生产计划
|
|
|
|
|
|
|
|
QueryWrapper<ZyProductPlan> qwProduct=new QueryWrapper<>(); |
|
|
|
|
|
|
|
qwProduct.eq("product_code",wo.getProductCode()); |
|
|
|
|
|
|
|
ZyProductPlan item=zyProductPlanMapper.selectOne(qwProduct); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生产计划成产中
|
|
|
|
|
|
|
|
item.setStatus(2); |
|
|
|
|
|
|
|
zyProductPlanMapper.updateById(item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//订单生产中
|
|
|
|
|
|
|
|
item.setStatus(2); |
|
|
|
|
|
|
|
workOrderMapper.updateById(wo); |
|
|
|
|
|
|
|
|
|
|
|
//3、每个生产计划对应工序,每一道工序对应工位
|
|
|
|
//3、每个生产计划对应工序,每一道工序对应工位
|
|
|
|
QueryWrapper<ZyPlanProcess> qwProcess=new QueryWrapper<>(); |
|
|
|
QueryWrapper<ZyPlanProcess> qwProcess=new QueryWrapper<>(); |
|
|
|
qwProcess.eq("plan_id",item.getId()); |
|
|
|
qwProcess.eq("plan_id",item.getId()); |
|
|
@ -144,6 +151,8 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
//#region每一道工序
|
|
|
|
//#region每一道工序
|
|
|
|
for(ZyPlanProcess process:listProcess) |
|
|
|
for(ZyPlanProcess process:listProcess) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
process.setStatus(2); |
|
|
|
|
|
|
|
zyPlanProcessMapper.updateById(process); |
|
|
|
//传感器记录(每个)+生产记录(每个)
|
|
|
|
//传感器记录(每个)+生产记录(每个)
|
|
|
|
//开始时间
|
|
|
|
//开始时间
|
|
|
|
Date str01= start_time; |
|
|
|
Date str01= start_time; |
|
|
@ -153,7 +162,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
long time=XJobUtils.dateToLong(str01,str02); |
|
|
|
long time=XJobUtils.dateToLong(str01,str02); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region生产记录
|
|
|
|
//#region生产记录
|
|
|
|
ProductRecord prmodel=new ProductRecord(); |
|
|
|
ProductRecord prmodel=new ProductRecord(); |
|
|
|
//工位
|
|
|
|
//工位
|
|
|
|
prmodel.setStationId(process.getStationId()); |
|
|
|
prmodel.setStationId(process.getStationId()); |
|
|
@ -173,9 +182,9 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
prmodel.setStatus("1"); |
|
|
|
prmodel.setStatus("1"); |
|
|
|
productRecordMapper.insert(prmodel); |
|
|
|
productRecordMapper.insert(prmodel); |
|
|
|
arrPR.add(prmodel); |
|
|
|
arrPR.add(prmodel); |
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region 传感器记录
|
|
|
|
//#region 传感器记录
|
|
|
|
//查找工位对应的传感器
|
|
|
|
//查找工位对应的传感器
|
|
|
|
List<Sensor> senlist = sensorList.stream() |
|
|
|
List<Sensor> senlist = sensorList.stream() |
|
|
|
.filter(Sensor -> Sensor.getStationId().equals(process.getStationId())) |
|
|
|
.filter(Sensor -> Sensor.getStationId().equals(process.getStationId())) |
|
|
@ -231,9 +240,9 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
} |
|
|
|
} |
|
|
|
process.setStatus(3); |
|
|
|
process.setStatus(3); |
|
|
|
zyPlanProcessMapper.updateById(process); |
|
|
|
zyPlanProcessMapper.updateById(process); |
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region吊挂运行记录
|
|
|
|
//#region吊挂运行记录
|
|
|
|
HangRecord hrmodel=new HangRecord(); |
|
|
|
HangRecord hrmodel=new HangRecord(); |
|
|
|
//吊挂编号
|
|
|
|
//吊挂编号
|
|
|
|
hrmodel.setHangCode("DG1000"); |
|
|
|
hrmodel.setHangCode("DG1000"); |
|
|
@ -251,10 +260,15 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
hrmodel.setStatus("1"); |
|
|
|
hrmodel.setStatus("1"); |
|
|
|
hangRecordMapper.insert(hrmodel); |
|
|
|
hangRecordMapper.insert(hrmodel); |
|
|
|
arrHR.add(hrmodel); |
|
|
|
arrHR.add(hrmodel); |
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
//间隔时间
|
|
|
|
//间隔时间
|
|
|
|
start_time=XJobUtils.randomIntervaltime(str01,time_s,time_e); |
|
|
|
start_time=XJobUtils.randomIntervaltime(str01,time_s,time_e); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工序完成
|
|
|
|
|
|
|
|
process.setStatus(3); |
|
|
|
|
|
|
|
zyPlanProcessMapper.updateById(process); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region批量保存
|
|
|
|
//#region批量保存
|
|
|
@ -271,12 +285,40 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper, |
|
|
|
// hangRecordMapper.insert(arr);
|
|
|
|
// hangRecordMapper.insert(arr);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//#region修改工单、订单状态
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生产计划已完成
|
|
|
|
|
|
|
|
item.setStatus(3); |
|
|
|
|
|
|
|
zyProductPlanMapper.updateById(item); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//订单已完成
|
|
|
|
|
|
|
|
item.setStatus(3); |
|
|
|
|
|
|
|
workOrderMapper.updateById(wo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
} |
|
|
|
} |
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region修改工单状态
|
|
|
|
//#region修改工单状态
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param id 衣架id |
|
|
|
|
|
|
|
* @param code 传感器id |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void records(String id, String code) { |
|
|
|
|
|
|
|
//根据衣架查找工单
|
|
|
|
|
|
|
|
//根据传感器查找工位
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|