parent
cafc1d4fd2
commit
d6ee9fd584
7 changed files with 214 additions and 40 deletions
@ -0,0 +1,31 @@ |
||||
package org.jeecg.modules.productplan.entity.vo; |
||||
|
||||
import lombok.Data; |
||||
import org.jeecg.modules.productplan.entity.ZyPlanProcess; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Data |
||||
public class PaiWeiTuVo { |
||||
|
||||
// 订单总件数
|
||||
private Integer goodsNum; |
||||
// 生产人数
|
||||
private Integer memberNum; |
||||
// 客户名称
|
||||
private String user; |
||||
// 制单号
|
||||
private String makerId; |
||||
// 款式号
|
||||
private String style; |
||||
|
||||
// 班组
|
||||
private String teamName; |
||||
|
||||
// 标准工时(分)
|
||||
private Integer duration; |
||||
|
||||
|
||||
private List<ZyPlanProcess> list; |
||||
} |
||||
|
@ -1,18 +1,110 @@ |
||||
package org.jeecg.modules.productplan.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.jeecg.common.exception.JeecgBootException; |
||||
import org.jeecg.modules.demo.ordergoods.entity.OrderGoods; |
||||
import org.jeecg.modules.demo.ordergoods.service.IOrderGoodsService; |
||||
import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
||||
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
||||
import org.jeecg.modules.productplan.entity.ZyPlanProcess; |
||||
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
||||
import org.jeecg.modules.productplan.entity.vo.PaiWeiTuVo; |
||||
import org.jeecg.modules.productplan.mapper.ZyProductPlanMapper; |
||||
import org.jeecg.modules.productplan.service.IZyPlanProcessService; |
||||
import org.jeecg.modules.productplan.service.IZyProductPlanService; |
||||
import org.jeecg.modules.system.service.ISysUserService; |
||||
import org.jeecg.modules.team.entity.Groupx; |
||||
import org.jeecg.modules.team.service.IGroupxService; |
||||
import org.jeecg.modules.workorder.entity.WorkOrder; |
||||
import org.jeecg.modules.workorder.service.IWorkOrderService; |
||||
import org.jeecg.modules.zyclothsstyle.entity.ZyClothsStyle; |
||||
import org.jeecg.modules.zyclothsstyle.service.IZyClothsStyleService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.util.ObjectUtils; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.concurrent.atomic.AtomicInteger; |
||||
|
||||
/** |
||||
* @Description: 生产计划 |
||||
* @Author: jeecg-boot |
||||
* @Date: 2022-12-12 |
||||
* @Date: 2022-12-12 |
||||
* @Version: V1.0 |
||||
*/ |
||||
@Service |
||||
public class ZyProductPlanServiceImpl extends ServiceImpl<ZyProductPlanMapper, ZyProductPlan> implements IZyProductPlanService { |
||||
|
||||
@Autowired |
||||
private IZyProductPlanService iZyProductPlanService; |
||||
|
||||
@Autowired |
||||
private IZyPlanProcessService iZyPlanProcessService; |
||||
|
||||
// 订单基本信息
|
||||
@Autowired |
||||
private IZyOrdersService iZyOrdersService; |
||||
|
||||
// 工单信息
|
||||
@Autowired |
||||
private IWorkOrderService iWorkOrderService; |
||||
|
||||
//商品订单信息
|
||||
@Autowired |
||||
private IOrderGoodsService iOrderGoodsService; |
||||
|
||||
@Autowired |
||||
private ISysUserService iSysUserService; |
||||
|
||||
@Autowired |
||||
private IZyClothsStyleService iZyClothsStyleService; |
||||
@Autowired |
||||
private IGroupxService iGroupxService; |
||||
|
||||
|
||||
@Override |
||||
public PaiWeiTuVo paiweitu(ZyProductPlan plan) { |
||||
ZyProductPlan productPlan = iZyProductPlanService.getById(plan.getId()); |
||||
if (ObjectUtils.isEmpty(productPlan)) throw new JeecgBootException(plan.getId() + "生产计划不存在"); |
||||
// 工单信息
|
||||
WorkOrder workOrder = iWorkOrderService.getOne(new LambdaQueryWrapper<WorkOrder>().eq(WorkOrder::getProductCode, productPlan.getProductCode())); |
||||
if (ObjectUtils.isEmpty(workOrder)) |
||||
throw new JeecgBootException(productPlan.getProductCode() + "工单信息不存在"); |
||||
|
||||
String ordersId = workOrder.getOrdersId(); |
||||
OrderGoods orderGoods = iOrderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrdersId, ordersId)); |
||||
if (ObjectUtils.isEmpty(orderGoods)) throw new JeecgBootException(ordersId + "订单商品信息不存在"); |
||||
|
||||
ZyOrders zyOrders = iZyOrdersService.getOne(new LambdaQueryWrapper<ZyOrders>().eq(ZyOrders::getId, ordersId)); |
||||
if (ObjectUtils.isEmpty(zyOrders)) throw new JeecgBootException(ordersId + "订单信息不存在"); |
||||
|
||||
PaiWeiTuVo vo = new PaiWeiTuVo(); |
||||
ZyClothsStyle zyClothsStyle = iZyClothsStyleService.getById(orderGoods.getStyleId()); |
||||
vo.setStyle(StringUtils.isNotBlank(zyClothsStyle.getStyleNames()) ? zyClothsStyle.getStyleNames() : ""); |
||||
vo.setGoodsNum(orderGoods.getGoodsNum()); |
||||
// SysUser sysUser = iSysUserService.getById(zyOrders.getUserId());
|
||||
// vo.setUser(StringUtils.isNotBlank(sysUser.getRealname()) ? sysUser.getRealname() : "");
|
||||
vo.setUser(zyOrders.getUserId()); |
||||
AtomicInteger memberNum = new AtomicInteger(0); |
||||
List<ZyPlanProcess> planProcessList = iZyPlanProcessService |
||||
.list(new LambdaQueryWrapper<ZyPlanProcess>() |
||||
.eq(ZyPlanProcess::getPlanId, plan.getId())); |
||||
if (!ObjectUtils.isEmpty(planProcessList)) { |
||||
planProcessList.forEach(e -> { |
||||
if (StringUtils.isNotBlank(e.getUserIds())) { |
||||
List<String> userList = Arrays.asList(e.getUserIds().split(",")); |
||||
memberNum.addAndGet(userList.size()); |
||||
} |
||||
}); |
||||
vo.setList(planProcessList); |
||||
} |
||||
vo.setMemberNum(memberNum.intValue()); |
||||
Groupx groupx = iGroupxService.getById(productPlan.getTeamId()); |
||||
vo.setTeamName(StringUtils.isNotBlank(groupx.getGroupName()) ? groupx.getGroupName() : ""); |
||||
vo.setDuration(productPlan.getDuration()); |
||||
return vo; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue