master
喻忠伟 2 years ago
parent 59fd542f45
commit 1e83257581
  1. 1
      ant-design-vue-jeecg/package.json
  2. 2
      ant-design-vue-jeecg/src/views/device/modules/ZyDeviceForm.vue
  3. 86
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java
  4. 3
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java

@ -11,7 +11,6 @@
}, },
"dependencies": { "dependencies": {
"@antv/data-set": "^0.11.4", "@antv/data-set": "^0.11.4",
"@jeecg/antd-online-mini": "2.4.5-RC",
"@jiaminghi/data-view": "^2.10.0", "@jiaminghi/data-view": "^2.10.0",
"@tinymce/tinymce-vue": "2.1.0", "@tinymce/tinymce-vue": "2.1.0",
"@toast-ui/editor": "^2.1.2", "@toast-ui/editor": "^2.1.2",

@ -139,7 +139,7 @@
validatorRules: { validatorRules: {
name:[ name:[
{ required: true, message: '请输入设备名称!'}, { required: true, message: '请输入设备名称!'},
{min: 1, max: 50, message: '最多输入50字!', trigger: 'blur'}, {min: 1, max: 200, message: '最多输入200字!', trigger: 'blur'},
], ],
}, },
url: { url: {

@ -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 org.jeecg.common.util.XJobUtils;
import org.jeecg.modules.hangerlocation.entity.HangerLocation; import org.jeecg.modules.hangerlocation.entity.HangerLocation;
import org.jeecg.modules.hangerlocation.mapper.HangerLocationMapper; import org.jeecg.modules.hangerlocation.mapper.HangerLocationMapper;
import org.jeecg.modules.hangerlocation.service.IHangerLocationService; import org.jeecg.modules.hangerlocation.service.IHangerLocationService;
@ -16,6 +17,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import static org.jeecg.common.util.XJobUtils.dateToLong;
/** /**
* @Description: 衣架定位表 * @Description: 衣架定位表
* @Author: jeecg-boot * @Author: jeecg-boot
@ -56,7 +59,7 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
//服装进入制作工艺过程 //服装进入制作工艺过程
long timeMillis = System.currentTimeMillis(); long timeMillis = System.currentTimeMillis();
//将获取时间转为日期类型 //将获取时间转为日期类型
Date start_time=longToDate(timeMillis); Date start_time=XJobUtils.longToDate(timeMillis);
QueryWrapper<HangerMaker> qwhm=new QueryWrapper(); QueryWrapper<HangerMaker> qwhm=new QueryWrapper();
qwhm.eq("order_code",entry.getKey()); qwhm.eq("order_code",entry.getKey());
HangerMaker hm=hangerMakerMapper.selectOne(qwhm); HangerMaker hm=hangerMakerMapper.selectOne(qwhm);
@ -86,13 +89,13 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
/**到达时间*/ /**到达时间*/
model.setArrivalTime(start_time); model.setArrivalTime(start_time);
/**离开时间*/ /**离开时间*/
Date end_time=returnEXtime(start_time); Date end_time= XJobUtils.randomIntervaltime(start_time,3,5);
model.setLeaveTime(end_time); model.setLeaveTime(end_time);
/**时长*/ /**时长*/
model.setDuration(dateToLong(start_time,end_time)+""); model.setDuration(dateToLong(start_time,end_time)+"");
//执行下一步间隔时间 //执行下一步间隔时间
start_time=returnIntervaltime(end_time); start_time=XJobUtils.randomIntervaltime(end_time,1,3);
hangerLocationMapper.insert(model); hangerLocationMapper.insert(model);
} }
// System.out.println(entry.getKey()); // System.out.println(entry.getKey());
@ -101,81 +104,4 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
} }
} }
/**
* 获取制作时间
* @param start_Date
* @return
*/
private Date returnEXtime(Date start_Date)
{
//将时间转为long类型
long start=start_Date.getTime();
//获取5-20分钟对应毫秒
long intervalTime=randInt(300,1200)*1000;
//总共花费时长
long timeMillis =start+intervalTime;
//实例化日期对象
Calendar calendar = Calendar.getInstance();
//将毫秒值传入转Date类型
calendar.setTimeInMillis(timeMillis);
//Calendar --> date
Date time = calendar.getTime();
return time;
}
/**
* 获取间隔时间
* @param start_Date
* @return
*/
private Date returnIntervaltime(Date start_Date)
{
//将时间转为long类型
long start=start_Date.getTime();
//获取30-180秒对应毫秒
long intervalTime=randInt(30,180)*1000;
//总共花费时长
long timeMillis =start+intervalTime;
return longToDate(timeMillis);
}
/**
* 其实这是基于一个公式 如果要取一个范围在[min,max]之间的随机整数那么公式如下
* @param min
* @param max
* @return
*/
private int randInt(int min,int max)
{
Random rand = new Random();
// nextInt通常不包含顶部值,因此加上1使其包含
int randomNum = rand.nextInt((max - min) + 1) + min;
return randomNum;
}
//将long转为日期
private Date longToDate(long lo)
{
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//long转Date
Date date = null;
try {
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(sd.format(new Date(lo)));
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
//将日期转为long
private long dateToLong(Date s,Date e)
{
long sl=s.getTime();
long el=e.getTime();
long r=el-sl;
return (el-sl)/1000;
}
} }

@ -30,6 +30,9 @@ public class HangerMakerServiceImpl extends ServiceImpl<HangerMakerMapper, Hange
@Autowired @Autowired
private WorkOrderMapper workOrderMapper; private WorkOrderMapper workOrderMapper;
/** /**
* 自动衣架绑定工单 * 自动衣架绑定工单
* @param woList * @param woList

Loading…
Cancel
Save