2023-06-3-01-bug

master
喻忠伟 1 year ago
parent 894776036e
commit 689344098a
  1. 6
      jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/XJobUtils.java
  2. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/entity/ZyOrders.java
  3. 185
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/entity/ZyOrdersJk.java
  4. 3
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java
  5. 52
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java
  6. 14
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/impl/ZyPlanProcessServiceImpl.java
  7. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/service/impl/WorkOrderServiceImpl.java

@ -30,7 +30,7 @@ public class XJobUtils{
//将时间转为long类型 //将时间转为long类型
long start=start_Date.getTime(); long start=start_Date.getTime();
//获取30-180秒对应毫秒 //获取30-180秒对应毫秒
long intervalTime=randInt(s*60,e*60)*1000; long intervalTime=randInt(s,e)*1000;
//总共花费时长 //总共花费时长
long timeMillis =start+intervalTime; long timeMillis =start+intervalTime;
@ -77,10 +77,10 @@ public class XJobUtils{
return (el-sl)/1000; return (el-sl)/1000;
} }
//随机暂停s-e分钟() //随机暂停s-e()
public static void sleepTime(int s ,int e) throws InterruptedException { public static void sleepTime(int s ,int e) throws InterruptedException {
Thread.sleep(randInt(60*1000*s,60*1000*e)); Thread.sleep(randInt(1000*s,1000*e));
} }

@ -203,4 +203,9 @@ public class ZyOrders implements Serializable {
@Dict(dicCode = "delivery_status") @Dict(dicCode = "delivery_status")
@ApiModelProperty(value = "交付状态") @ApiModelProperty(value = "交付状态")
private java.lang.Integer deliveryStatus; private java.lang.Integer deliveryStatus;
/**是否虚拟订单*/
@Dict(dicCode = "isvirtual")
@ApiModelProperty(value = "是否虚拟订单")
private java.lang.String isvirtual;
} }

@ -1,90 +1,95 @@
package org.jeecg.modules.demo.zyorders.entity; package org.jeecg.modules.demo.zyorders.entity;
import java.io.Serializable; import java.io.Serializable;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.util.Date; import java.util.Date;
import java.math.BigDecimal; import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
/** /**
* @Description: 订单基本信息 * @Description: 订单基本信息
* @Author: jeecg-boot * @Author: jeecg-boot
* @Date: 2022-12-26 * @Date: 2022-12-26
* @Version: V1.0 * @Version: V1.0
*/ */
@Data @Data
public class ZyOrdersJk implements Serializable { public class ZyOrdersJk implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/**运费*/ /**运费*/
@Excel(name = "运费", width = 15) @Excel(name = "运费", width = 15)
@ApiModelProperty(value = "运费") @ApiModelProperty(value = "运费")
private java.lang.Double freight; private java.lang.Double freight;
/**交货期*/ /**交货期*/
@Excel(name = "交货期", width = 15) @Excel(name = "交货期", width = 15)
@ApiModelProperty(value = "交货期") @ApiModelProperty(value = "交货期")
private java.lang.Integer deliveryTime; private java.lang.Integer deliveryTime;
/**订单类型*/ /**订单类型*/
@Excel(name = "订单类型", width = 15, dicCode = "orders_type") @Excel(name = "订单类型", width = 15, dicCode = "orders_type")
@Dict(dicCode = "orders_type") @Dict(dicCode = "orders_type")
@ApiModelProperty(value = "订单类型") @ApiModelProperty(value = "订单类型")
private java.lang.Integer ordersType; private java.lang.Integer ordersType;
/**顾客id*/ /**顾客id*/
@Excel(name = "顾客id", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Excel(name = "顾客id", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@ApiModelProperty(value = "顾客id") @ApiModelProperty(value = "顾客id")
private java.lang.String userId; private java.lang.String userId;
/**商品条目数量*/ /**商品条目数量*/
@Excel(name = "商品条目数量", width = 15) @Excel(name = "商品条目数量", width = 15)
@ApiModelProperty(value = "商品条目数量") @ApiModelProperty(value = "商品条目数量")
private java.lang.Integer goodsQuantity; private java.lang.Integer goodsQuantity;
/**顾客地址id*/ /**顾客地址id*/
@Excel(name = "顾客地址id", width = 15) @Excel(name = "顾客地址id", width = 15)
@ApiModelProperty(value = "顾客地址id") @ApiModelProperty(value = "顾客地址id")
private java.lang.String addressId; private java.lang.String addressId;
/**收货人*/ /**收货人*/
@Excel(name = "收货人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Excel(name = "收货人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@ApiModelProperty(value = "收货人") @ApiModelProperty(value = "收货人")
private java.lang.String receiver; private java.lang.String receiver;
/**顾客发票id*/ /**顾客发票id*/
@Excel(name = "顾客发票id", width = 15) @Excel(name = "顾客发票id", width = 15)
@ApiModelProperty(value = "顾客发票id") @ApiModelProperty(value = "顾客发票id")
private java.lang.String invoiceId; private java.lang.String invoiceId;
/**销售门店*/ /**销售门店*/
@Excel(name = "销售门店", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") @Excel(name = "销售门店", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "销售门店") @ApiModelProperty(value = "销售门店")
private java.lang.String salesEnterpriseId; private java.lang.String salesEnterpriseId;
/**销售员*/ /**销售员*/
@Excel(name = "销售员", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Excel(name = "销售员", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username")
@Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username")
@ApiModelProperty(value = "销售员") @ApiModelProperty(value = "销售员")
private java.lang.String salespersonId; private java.lang.String salespersonId;
/**物流企业*/ /**物流企业*/
@Excel(name = "物流企业", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") @Excel(name = "物流企业", width = 15, dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id") @Dict(dictTable = "sys_depart", dicText = "depart_name", dicCode = "id")
@ApiModelProperty(value = "物流企业") @ApiModelProperty(value = "物流企业")
private java.lang.String logisticsEnterprisesId; private java.lang.String logisticsEnterprisesId;
/**交付状态*/ /**交付状态*/
@Excel(name = "交付状态", width = 15, dicCode = "delivery_status") @Excel(name = "交付状态", width = 15, dicCode = "delivery_status")
@Dict(dicCode = "delivery_status") @Dict(dicCode = "delivery_status")
@ApiModelProperty(value = "交付状态") @ApiModelProperty(value = "交付状态")
private java.lang.Integer deliveryStatus; private java.lang.Integer deliveryStatus;
/**顾客量体id*/ /**是否虚拟订单*/
@Excel (name = "顾客量体id", width = 15, dictTable = "customer_measure", dicText = "username", dicCode = "id") @Dict(dicCode = "isvirtual")
@ApiModelProperty (value = "顾客量体id") @ApiModelProperty(value = "是否虚拟订单")
private java.lang.String measureId; private java.lang.String isvirtual;
}
/**顾客量体id*/
@Excel (name = "顾客量体id", width = 15, dictTable = "customer_measure", dicText = "username", dicCode = "id")
@ApiModelProperty (value = "顾客量体id")
private java.lang.String measureId;
}

@ -192,6 +192,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i
zyOrders.setOrdersType(zyOrdersJk.getOrdersType()); zyOrders.setOrdersType(zyOrdersJk.getOrdersType());
zyOrders.setUserId(zyOrdersJk.getUserId()); zyOrders.setUserId(zyOrdersJk.getUserId());
zyOrders.setGoodsQuantity(zyOrdersJk.getGoodsQuantity()); zyOrders.setGoodsQuantity(zyOrdersJk.getGoodsQuantity());
zyOrders.setIsvirtual(zyOrdersJk.getIsvirtual());
//顾客地址 //顾客地址
if (zyOrdersJk.getAddressId() != null && zyOrdersJk.getAddressId() != "") { if (zyOrdersJk.getAddressId() != null && zyOrdersJk.getAddressId() != "") {
CustomerReceivingAddress customerReceivingAddress = customerReceivingAddressMapper.selectById(zyOrdersJk.getAddressId()); CustomerReceivingAddress customerReceivingAddress = customerReceivingAddressMapper.selectById(zyOrdersJk.getAddressId());
@ -315,6 +316,8 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i
zo.setPromotionPrice(listog.get(i).getPromotionPrice()); zo.setPromotionPrice(listog.get(i).getPromotionPrice());
zo.setActualPayment(listog.get(i).getPayTotalPrice()); zo.setActualPayment(listog.get(i).getPayTotalPrice());
zo.setGoodsQuantity(1); zo.setGoodsQuantity(1);
zo.setDeliveryStatus(2);
zo.setIsvirtual("1");
baseMapper.insert(zo); baseMapper.insert(zo);
ids.add(zo.getId()); ids.add(zo.getId());
OrderGoods og = new OrderGoods(); OrderGoods og = new OrderGoods();

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

@ -378,11 +378,15 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z
ZyPlanProcess en = new ZyPlanProcess(); ZyPlanProcess en = new ZyPlanProcess();
en.setProcessId(o.getProcessId()); en.setProcessId(o.getProcessId());
ZyProcess zyProcess = iZyProcessService.getById(o.getProcessId()); ZyProcess zyProcess = iZyProcessService.getById(o.getProcessId());
en.setProcessName(StringUtils.isNotBlank(zyProcess.getProcessName()) ? zyProcess.getProcessName() : ""); if(zyProcess!=null)
en.setPlanId(zyPlanProcess.getPlanId()); {
en.setTotalMachine(!ObjectUtils.isEmpty(zyProcess.getTotalMachine()) ? zyProcess.getTotalMachine() : 0); en.setProcessName(StringUtils.isNotBlank(zyProcess.getProcessName()) ? zyProcess.getProcessName() : "");
en.setTotalMaunal(!ObjectUtils.isEmpty(zyProcess.getTotalMaunal()) ? zyProcess.getTotalMaunal() : 0); en.setPlanId(zyPlanProcess.getPlanId());
saveList.add(en); en.setTotalMachine(!ObjectUtils.isEmpty(zyProcess.getTotalMachine()) ? zyProcess.getTotalMachine() : 0);
en.setTotalMaunal(!ObjectUtils.isEmpty(zyProcess.getTotalMaunal()) ? zyProcess.getTotalMaunal() : 0);
saveList.add(en);
}
}); });
this.saveBatch(saveList); this.saveBatch(saveList);
} }

@ -69,6 +69,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -209,6 +210,7 @@ public class WorkOrderServiceImpl extends ServiceImpl<WorkOrderMapper, WorkOrder
* @return * @return
*/ */
@Override @Override
@Transactional (readOnly = false, rollbackFor = Exception.class)
public Result<?> paidan(ZyOrders zyOrders,String depId) { public Result<?> paidan(ZyOrders zyOrders,String depId) {
//订单ID //订单ID
String orderId=zyOrders.getId(); String orderId=zyOrders.getId();

Loading…
Cancel
Save