zhc4dev
喻忠伟 2 years ago
parent 21b91a9984
commit f370138294
  1. 34
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java
  2. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java
  3. 30
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java
  4. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/IHangerMakerService.java
  5. 83
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java
  6. 6
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java
  7. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/mapper/xml/WorkOrderMapper.xml

@ -57,32 +57,34 @@ public class ZyGoodsServiceImpl extends ServiceImpl<ZyGoodsMapper, ZyGoods> impl
List<OrderGoodsJk> orderGoodsJkList = new ArrayList<>();
QueryWrapper<ZyGoods> wrapper = new QueryWrapper<>();
List<ZyGoods> goodsList = baseMapper.selectList(wrapper);
if(goodsList.size()>10){
//随机取商品数(1-5)个
int number = (int)(Math.random()*5)+1;
for(int i = 0 ; i < number ; i++){
//goodsList的随机下标数
int numberxb = (int)(Math.random()*goodsList.size());
//随机取商品数量(1-5)个
int numbersl = (int)(Math.random()*5)+1;
OrderGoodsJk orderGoodsJk = new OrderGoodsJk();
orderGoodsJk.setGoodsId(goodsList.get(numberxb).getId());
orderGoodsJk.setGoodsNum(numbersl);
orderGoodsJkList.add(orderGoodsJk);
}
}else{
//暂时默认商品数量为一个
// if(goodsList.size()>10){
// //随机取商品数(1-5)个
// int number = (int)(Math.random()*5)+1;
// for(int i = 0 ; i < number ; i++){
// //goodsList的随机下标数
// int numberxb = (int)(Math.random()*goodsList.size());
// //随机取商品数量(1-5)个
// int numbersl = (int)(Math.random()*5)+1;
// OrderGoodsJk orderGoodsJk = new OrderGoodsJk();
// orderGoodsJk.setGoodsId(goodsList.get(numberxb).getId());
// orderGoodsJk.setGoodsNum(numbersl);
// orderGoodsJkList.add(orderGoodsJk);
// }
// }else{
if(goodsList.size()>0){
//goodsList的随机下标数
int numberxb1 = (int)(Math.random()*goodsList.size());
//随机取商品数量(1-5)个
int numbersl = (int)(Math.random()*5)+1;
//int numbersl = (int)(Math.random()*5)+1;
int numbersl = 1;
OrderGoodsJk orderGoodsJk = new OrderGoodsJk();
orderGoodsJk.setGoodsId(goodsList.get(numberxb1).getId());
orderGoodsJk.setGoodsNum(numbersl);
orderGoodsJkList.add(orderGoodsJk);
}
}
// }
return orderGoodsJkList;
}

@ -293,6 +293,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl<ZyOrdersMapper, ZyOrders> i
zo = zyOrders;
zo.setId(null);
zo.setOrdersNum(getOrdersNum());
zo.setOrderId(listog.get(i).getId());
zo.setFreight(Double.parseDouble("0"));
zo.setIschild(1);
zo.setOrderId(zyOrders.getId());

@ -1,8 +1,11 @@
package org.jeecg.modules.hangerlocation.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.hangerlocation.entity.HangerLocation;
import org.jeecg.modules.hangerlocation.mapper.HangerLocationMapper;
import org.jeecg.modules.hangerlocation.service.IHangerLocationService;
import org.jeecg.modules.hangermaker.entity.HangerMaker;
import org.jeecg.modules.hangermaker.mapper.HangerMakerMapper;
import org.jeecg.modules.productplan.entity.ZyPlanProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -24,6 +27,11 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
@Autowired
private HangerLocationMapper hangerLocationMapper;
//衣架工单绑定
@Autowired
private HangerMakerMapper hangerMakerMapper;
@Override
public HangerLocation queryByNew() {
return hangerLocationMapper.queryByNew();
@ -49,28 +57,32 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
long timeMillis = System.currentTimeMillis();
//将获取时间转为日期类型
Date start_time=longToDate(timeMillis);
QueryWrapper<HangerMaker> qwhm=new QueryWrapper();
qwhm.eq("order_code",entry.getKey());
HangerMaker hm=hangerMakerMapper.selectOne(qwhm);
for(ZyPlanProcess process:entry.getValue())
{
HangerLocation model=new HangerLocation();
/**衣架编码*/
String HangerCode="00087896"+randInt(10,99);
model.setHangerCode(HangerCode);
//String HangerCode="00087896"+randInt(10,99);
model.setHangerCode(hm.getHangerCode());
/**工位ID*/
model.setStationId("");
model.setStationId(process.getStationId());
/**工位编码*/
model.setStationCode(randInt(2,32)+"");
model.setStationCode(process.getStationName());
/**设备ID*/
model.setEquipmentId("1459695008524345346");
model.setEquipmentId(process.getMachineIds());
/**设备名称*/
model.setEquipmentName("20211114");
model.setEquipmentName(process.getMachineNames());
/**工序ID*/
model.setProcedureId(process.getProcessId());
/**工序名称*/
model.setProcedureName(process.getProcessName());
/**工人ID*/
model.setWorkerId("20191923");
model.setWorkerId(process.getUserIds());
/**工人名称*/
model.setWorkerName("曾磊");
model.setWorkerName(process.getUserNames());
/**到达时间*/
model.setArrivalTime(start_time);
/**离开时间*/
@ -141,6 +153,8 @@ public class HangerLocationServiceImpl extends ServiceImpl<HangerLocationMapper,
return randomNum;
}
//将long转为日期
private Date longToDate(long lo)
{

@ -3,6 +3,8 @@ package org.jeecg.modules.hangermaker.service;
import org.jeecg.modules.hangermaker.entity.HangerMaker;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 衣架制单表
* @Author: jeecg-boot
@ -11,4 +13,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IHangerMakerService extends IService<HangerMaker> {
//自动衣架绑定工单
void doAutoHM(List<String> woList);
}

@ -1,12 +1,21 @@
package org.jeecg.modules.hangermaker.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.modules.hanger.entity.Hanger;
import org.jeecg.modules.hanger.mapper.HangerMapper;
import org.jeecg.modules.hangermaker.entity.HangerMaker;
import org.jeecg.modules.hangermaker.mapper.HangerMakerMapper;
import org.jeecg.modules.hangermaker.service.IHangerMakerService;
import org.jeecg.modules.workorder.entity.WorkOrder;
import org.jeecg.modules.workorder.mapper.WorkOrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Random;
/**
* @Description: 衣架制单表
* @Author: jeecg-boot
@ -16,4 +25,78 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class HangerMakerServiceImpl extends ServiceImpl<HangerMakerMapper, HangerMaker> implements IHangerMakerService {
@Autowired
private HangerMapper hangerMapper;
@Autowired
private WorkOrderMapper workOrderMapper;
/**
* 自动衣架绑定工单
* @param woList
*/
@Override
public void doAutoHM(List<String> woList) {
List<WorkOrder> workList=workOrderMapper.selectBatchIds(woList);
for(WorkOrder item:workList)
{
Hanger h=randomModel();
HangerMaker model=new HangerMaker();
/**
* 绑定方式
*/
model.setIsmaker(0);
/**
* 衣架ID
*/
model.setHangerId(h.getId());
/**
* 衣架编号
*/
model.setHangerCode(h.getHangerCode());
/**
* 工单ID
*/
model.setOrderId(item.getId());
/**
* 工单编号
*/
model.setOrderCode(item.getProductCode());
baseMapper.insert(model);
}
}
//随机获取衣架表
private Hanger randomModel()
{
QueryWrapper<Hanger> qw=new QueryWrapper<>();
List<Hanger> list=hangerMapper.selectList(qw);
int size=list.size();
if(size>0)
{
int r=0;
if(size>1)
{
r=randInt(0,(size-1));
}
return list.get(r);
}
return null;
}
private int randInt(int min,int max)
{
Random rand = new Random();
// nextInt通常不包含顶部值,因此加上1使其包含
int randomNum = rand.nextInt((max - min) + 1) + min;
return randomNum;
}
}

@ -18,6 +18,12 @@ import java.util.Map;
*/
public interface IZyProductPlanAutoService extends IService<ZyProductPlan> {
/**
*
* @param workOrderList
* @return 工单编号,生产计划工序
*/
List<Map<String, List<ZyPlanProcess>>> doAuto(List<String> workOrderList);
boolean filling4Auto(String planId);

@ -8,7 +8,7 @@
FROM work_order AS wo
LEFT JOIN zy_orders o ON o.id= wo.orders_id
LEFT JOIN order_goods og ON og.id= wo.order_goods_id
LEFT JOIN sys_user us ON us.username= o.user_id
LEFT JOIN sys_user us ON us.id= o.user_id
LEFT JOIN sys_dict_item dict ON dict.dict_id='1611565939851538433'
LEFT JOIN sys_depart dep ON dep.id=wo.enterprises_id
<where>

Loading…
Cancel
Save