diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java index 6d7b396d..19645a16 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zygoods/service/impl/ZyGoodsServiceImpl.java @@ -57,32 +57,34 @@ public class ZyGoodsServiceImpl extends ServiceImpl impl List orderGoodsJkList = new ArrayList<>(); QueryWrapper wrapper = new QueryWrapper<>(); List 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; } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java index 3a89a9f6..da05bb5e 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/service/impl/ZyOrdersServiceImpl.java @@ -293,6 +293,7 @@ public class ZyOrdersServiceImpl extends ServiceImpl 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()); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java index a7c05072..fbcccaf0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangerlocation/service/impl/HangerLocationServiceImpl.java @@ -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 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 { + //自动衣架绑定工单 + void doAutoHM(List woList); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java index b68d339f..86671a0b 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/hangermaker/service/impl/HangerMakerServiceImpl.java @@ -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 implements IHangerMakerService { + @Autowired + private HangerMapper hangerMapper; + + @Autowired + private WorkOrderMapper workOrderMapper; + /** + * 自动衣架绑定工单 + * @param woList + */ + @Override + public void doAutoHM(List woList) { + + List 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 qw=new QueryWrapper<>(); + List 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; + } } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java index ccf7f440..2b2c43b3 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/productplan/service/IZyProductPlanAutoService.java @@ -18,6 +18,12 @@ import java.util.Map; */ public interface IZyProductPlanAutoService extends IService { + /** + * + * @param workOrderList + * @return 工单编号,生产计划工序 + */ + List>> doAuto(List workOrderList); boolean filling4Auto(String planId); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/mapper/xml/WorkOrderMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/mapper/xml/WorkOrderMapper.xml index f3b65aad..1733201f 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/mapper/xml/WorkOrderMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/workorder/mapper/xml/WorkOrderMapper.xml @@ -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