| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.wms.asrs.mapper.WaitPakinRuleMapper; |
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinRuleService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.wms.asrs.service.WaitPakinService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("waitPakinRuleService") |
| | | public class WaitPakinRuleServiceImpl extends ServiceImpl<WaitPakinRuleMapper, WaitPakinRule> implements WaitPakinRuleService { |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | |
| | | @Override |
| | | public boolean rule(WaitPakin waitPakin) { |
| | | List<WaitPakinRule> list = this.list(new LambdaQueryWrapper<WaitPakinRule>().eq(WaitPakinRule::getStatus, 1).orderByDesc(WaitPakinRule::getId)); |
| | | if (list.isEmpty()) { |
| | | return true;//无规则,直接放行 |
| | | } |
| | | |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode())); |
| | | if(waitPakins.isEmpty()) { |
| | | return true;//无托盘,放行 |
| | | } |
| | | |
| | | WaitPakinRule waitPakinRule = list.get(0); |
| | | //判断是否混载 |
| | | if (waitPakinRule.getPalletMixed() == 1) { |
| | | //混载 |
| | | //判断是否允许多订单 |
| | | if (waitPakinRule.getPalletOrder() == 0) { |
| | | //单订单 |
| | | for (WaitPakin pakin : waitPakins) { |
| | | if (!pakin.getOrderId().equals(waitPakin.getOrderId())) { |
| | | throw new CoolException("托盘不允许多订单"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | //单放 |
| | | //判断组托通知档是否已经存在托盘 |
| | | if(!waitPakins.isEmpty()) { |
| | | throw new CoolException("托盘已组托"); |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | package com.zy.asrs.wms.asrs.service.impl;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | | import com.zy.asrs.wms.asrs.entity.WaitPakin;
|
| | | import com.zy.asrs.wms.asrs.mapper.WaitPakinRuleMapper;
|
| | | import com.zy.asrs.wms.asrs.entity.WaitPakinRule;
|
| | | import com.zy.asrs.wms.asrs.service.WaitPakinRuleService;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.zy.asrs.wms.asrs.service.WaitPakinService;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | @Service("waitPakinRuleService")
|
| | | public class WaitPakinRuleServiceImpl extends ServiceImpl<WaitPakinRuleMapper, WaitPakinRule> implements WaitPakinRuleService {
|
| | |
|
| | | @Autowired
|
| | | private WaitPakinService waitPakinService;
|
| | |
|
| | | @Override
|
| | | public boolean rule(WaitPakin waitPakin) {
|
| | | List<WaitPakinRule> list = this.list(new LambdaQueryWrapper<WaitPakinRule>().eq(WaitPakinRule::getStatus, 1).orderByDesc(WaitPakinRule::getId));
|
| | | if (list.isEmpty()) {
|
| | | return true;//无规则,直接放行
|
| | | }
|
| | |
|
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().eq(WaitPakin::getBarcode, waitPakin.getBarcode()));
|
| | | if(waitPakins.isEmpty()) {
|
| | | return true;//无托盘,放行
|
| | | }
|
| | |
|
| | | WaitPakinRule waitPakinRule = list.get(0);
|
| | | //判断是否混载
|
| | | if (waitPakinRule.getPalletMixed() == 1) {
|
| | | //混载
|
| | | //判断是否允许多订单
|
| | | if (waitPakinRule.getPalletOrder() == 0) {
|
| | | //单订单
|
| | | for (WaitPakin pakin : waitPakins) {
|
| | | if (!pakin.getOrderId().equals(waitPakin.getOrderId())) {
|
| | | throw new CoolException("托盘不允许多订单");
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }else {
|
| | | //单放
|
| | | //判断组托通知档是否已经存在托盘
|
| | | if(!waitPakins.isEmpty()) {
|
| | | throw new CoolException("托盘已组托");
|
| | | }
|
| | | }
|
| | |
|
| | | return false;
|
| | | }
|
| | | }
|