2023-06-08-01-bug

master
喻忠伟 1 year ago
parent 5010af7261
commit 6884f17f83
  1. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hanger/entity/Hanger.java
  2. 16
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/controller/HangerLocationController.java
  3. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/IHangerLocationService.java
  4. 86
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java
  5. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/IHangerMakerService.java
  6. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java

@ -58,4 +58,9 @@ public class Hanger implements Serializable {
@Excel(name = "衣架编号", width = 15)
@ApiModelProperty(value = "衣架编号")
private java.lang.String hangerCode;
/**衣架状态*/
@Excel(name = "衣架状态", width = 15)
@ApiModelProperty(value = "衣架状态")
private java.lang.String status;
}

@ -225,4 +225,20 @@ public class HangerLocationController extends JeecgController<HangerLocation, IH
return super.importExcel(request, response, HangerLocation.class);
}
/**
* 传感器记录
*
* @param id 衣架id
* @param code 传感器id
* @return
*/
@AutoLog(value = "传感器记录")
@ApiOperation(value="传感器记录", notes="传感器记录")
@PutMapping(value = "/records")
public Result<?> records(@RequestParam(name="code",required=true) String code,@RequestParam(name="id",required=true) String id) {
hangerLocationService.records(id, code);
return Result.ok("编辑成功!");
}
}

@ -18,4 +18,6 @@ public interface IHangerLocationService extends IService<HangerLocation> {
//自动化生产传感器记录
void recordAuto(List<String> woList);
//记录传感器信息
void records(String id, String code);
}

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

@ -14,5 +14,5 @@ import java.util.List;
public interface IHangerMakerService extends IService<HangerMaker> {
//自动衣架绑定工单
void doAutoHM(List<String> woList);
Boolean doAutoHM(List<String> woList);
}

@ -38,12 +38,14 @@ public class HangerMakerServiceImpl extends ServiceImpl<HangerMakerMapper, Hange
* @param woList
*/
@Override
public void doAutoHM(List<String> woList) {
public Boolean doAutoHM(List<String> woList) {
Boolean flag=false;
if(woList.size()<=0)
{
return;
return flag;
}
QueryWrapper<WorkOrder> qw=new QueryWrapper<>();
qw.in("id",woList);
List<WorkOrder> workList=workOrderMapper.selectList(qw);
@ -73,9 +75,10 @@ public class HangerMakerServiceImpl extends ServiceImpl<HangerMakerMapper, Hange
model.setOrderCode(item.getProductCode());
baseMapper.insert(model);
flag=true;
}
return flag;
}

Loading…
Cancel
Save