| | |
| | | locRule.setCreateTime(now); |
| | | locRule.setUpdateBy(getUserId()); |
| | | locRule.setUpdateTime(now); |
| | | if (locRule.getMixed() == 1) { |
| | | //混载 |
| | | locRule.setMatnr("00000000"); |
| | | } |
| | | locRuleService.insert(locRule); |
| | | return R.ok(); |
| | | } |
| | |
| | | locRule.setUpdateBy(getUserId()); |
| | | locRule.setUpdateTime(new Date()); |
| | | locRuleService.updateById(locRule); |
| | | if (locRule.getMixed() == 0) { |
| | | locRuleService.updateKeepGoByMatnr(locRule.getMatnr(), locRule.getKeepGo()); |
| | | }else {//混载 |
| | | locRuleService.updateKeepGoByMixed(locRule.getKeepGo()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @Repository |
| | | public interface LocRuleMapper extends BaseMapper<LocRule> { |
| | | |
| | | LocRule selectByMatnr(String matnr); |
| | | List<LocRule> selectByMatnr(String matnr); |
| | | |
| | | LocRule selectByMixed(Integer mixed); |
| | | List<LocRule> selectByMixed(Integer mixed); |
| | | |
| | | int updateKeepGoByMatnr(String matnr, Integer keepGo); |
| | | |
| | | int updateKeepGoByMixed(Integer keepGo); |
| | | |
| | | } |
| | |
| | | |
| | | public interface LocRuleService extends IService<LocRule> { |
| | | |
| | | LocRule find(String matnr); |
| | | List<LocRule> find(String matnr); |
| | | |
| | | //找混载库位规则 |
| | | LocRule findMixed(); |
| | | List<LocRule> findMixed(); |
| | | |
| | | //将库位规则组转换为库位组 |
| | | List<LocMast> locRuleToLocNos(LocRule locRule); |
| | | |
| | | int updateKeepGoByMatnr(String matnr, Integer keepGo); |
| | | |
| | | int updateKeepGoByMixed(Integer keepGo); |
| | | |
| | | } |
| | |
| | | int row = Utils.getRow(locNo); |
| | | List<String> locNos = Utils.getGroupLoc(locNo); |
| | | if (CommonService.FIRST_GROUP_ROW_LIST.contains(row)) { |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row)) { |
| | | } else if (CommonService.SECOND_GROUP_ROW_LIST.contains(row) || CommonService.THIRD_GROUP_ROW_LIST.contains(row)) { |
| | | Collections.reverse(locNos); |
| | | } else { |
| | | throw new RuntimeException("库位解析异常"); |
| | |
| | | private LocMastService locMastService; |
| | | |
| | | @Override |
| | | public LocRule find(String matnr) { |
| | | public List<LocRule> find(String matnr) { |
| | | if (Cools.isEmpty(matnr)) { |
| | | return null; |
| | | } |
| | |
| | | |
| | | //找混载库位规则 |
| | | @Override |
| | | public LocRule findMixed() { |
| | | public List<LocRule> findMixed() { |
| | | return this.baseMapper.selectByMixed(1);//搜索混载库位规则 |
| | | } |
| | | |
| | | //将库位规则转换为库位组 |
| | | //将库位规则转换为库位组(能查出来的都是空库位) |
| | | @Override |
| | | public List<LocMast> locRuleToLocNos(LocRule locRule) { |
| | | ArrayList<String> locNos = new ArrayList<>(); |
| | | //将所有符合混载规则的库位号进行存储 |
| | | Integer rowBeg = locRule.getRowBeg(); |
| | | Integer rowEnd = locRule.getRowEnd(); |
| | | return locMastService.queryFreeLocMast2(null, locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | } |
| | | |
| | | Integer bayBeg = locRule.getBayBeg(); |
| | | Integer bayEnd = locRule.getBayEnd(); |
| | | @Override |
| | | public int updateKeepGoByMatnr(String matnr, Integer keepGo) { |
| | | return this.baseMapper.updateKeepGoByMatnr(matnr, keepGo); |
| | | } |
| | | |
| | | Integer levBeg = locRule.getLevBeg(); |
| | | Integer levEnd = locRule.getLevEnd(); |
| | | |
| | | for (int i = rowBeg; i <= rowEnd; i++) { |
| | | for (int j = bayBeg; j <= bayEnd; j++) { |
| | | for (int k = levBeg; k <= levEnd; k++) { |
| | | String locNo = Utils.getLocNo(i, j, k); |
| | | locNos.add(locNo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return locMastService.selectEmptyByLocNos(locNos); |
| | | @Override |
| | | public int updateKeepGoByMixed(Integer keepGo) { |
| | | return this.baseMapper.updateKeepGoByMixed(keepGo); |
| | | } |
| | | } |
| | |
| | | * 混载找库位 |
| | | */ |
| | | private LocMast getLocNoStep1(List<String> matNos, LocTypeDto locTypeDto) { |
| | | LocMast locMast = null; |
| | | |
| | | //判断当前货物是否为混载货物 |
| | | String firstMatNos = matNos.get(0); |
| | | boolean mixed = false;//默认不是混载货物 |
| | |
| | | } |
| | | |
| | | if (!mixed) { |
| | | return locMast;//不是混载货物,直接跳出当前任务 |
| | | return null;//不是混载货物,直接跳出当前任务 |
| | | } |
| | | |
| | | // 找混载库位规则 |
| | | LocRule locRule = locRuleService.findMixed(); |
| | | if (locRule == null) { |
| | | return locMast;//没有混载规则,跳出当前任务 |
| | | List<LocRule> locRules = locRuleService.findMixed(); |
| | | if (locRules == null || locRules.size() == 0) { |
| | | return null;//没有混载规则,跳出当前任务 |
| | | } |
| | | |
| | | //将库位规则组转换为库位组 |
| | | List<LocMast> locMasts = locRuleService.locRuleToLocNos(locRule); |
| | | if (locMasts == null || locMasts.size() == 0) { |
| | | if (locRule.getKeepGo() == 0) { |
| | | //找不到空库位,且禁止继续寻找其他非混载区域库位 |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("混载区域没有空库位"); |
| | | for (LocRule locRule : locRules) { |
| | | if (locRule == null) { |
| | | continue; |
| | | } |
| | | return locMast;//没有混载规则,跳出当前任务 |
| | | } |
| | | |
| | | for (LocMast one : locMasts) { |
| | | LocMast locMast0 = locMastService.findOutMost(one.getLocNo()); |
| | | if (null != locMast0) { |
| | | // 浅库位符合尺寸检测 |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | locMast = locMast0; |
| | | break; |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | |
| | | for (LocMast one : locMasts) { |
| | | LocMast locMast0 = locMastService.findOutMost(one.getLocNo()); |
| | | if (null != locMast0) { |
| | | // 浅库位符合尺寸检测 |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | return locMast0;//找到空余的混载库位 |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return locMast; |
| | | if (locRules.get(0).getKeepGo() == 0) { |
| | | //找不到空库位,且禁止继续寻找其他非混载区域库位 |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("混载区域没有空库位"); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | private LocMast getLocNoStep2(List<String> matNos, LocTypeDto locTypeDto) { |
| | | LocMast locMast = null; |
| | | // 库区锁定 |
| | | LocRule locRule = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0)); |
| | | if (!Cools.isEmpty(locRule)) { |
| | | List<LocRule> locRules = locRuleService.find(Cools.isEmpty(matNos) ? null : matNos.get(0)); |
| | | if (locRules == null || locRules.size() == 0) { |
| | | return null;//没有库位规则,跳出当前任务 |
| | | } |
| | | |
| | | for (LocRule locRule : locRules) { |
| | | if (locRule == null) { |
| | | continue; |
| | | } |
| | | |
| | | List<LocMast> locMasts = locMastService.queryFreeLocMast2(locTypeDto.getLocType1(), locRule.getRowBeg(), locRule.getRowEnd(), locRule.getBayBeg(), locRule.getBayEnd(), locRule.getLevBeg(), locRule.getLevEnd()); |
| | | for (LocMast one : locMasts) { |
| | | LocMast locMast0 = locMastService.findOutMost(one.getLocNo()); |
| | |
| | | if (VersionUtils.locMoveCheckLocType(locMast0, locTypeDto)) { |
| | | // 因库位移转、需预留空库位 |
| | | if (locMastService.checkEmptyCount(locMast0, 10)) { |
| | | locMast = locMast0; |
| | | break; |
| | | return locMast0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (locRules.get(0).getKeepGo() == 0) { |
| | | //找不到空库位,且禁止继续寻找其他非混载区域库位 |
| | | //找不到库位,抛出异常 |
| | | throw new CoolException("规则区域没有空库位"); |
| | | } |
| | | |
| | | return locMast; |
| | | } |
| | | |
| | |
| | | </select> |
| | | |
| | | <select id="selectByMixed" resultMap="BaseResultMap"> |
| | | select top 1 * from asr_loc_rule |
| | | select * from asr_loc_rule |
| | | where mixed = #{mixed} |
| | | and status = 1 |
| | | </select> |
| | | |
| | | <update id="updateKeepGoByMatnr"> |
| | | update asr_loc_rule set keep_go = #{keepGo} where matnr = #{matnr} |
| | | </update> |
| | | |
| | | <update id="updateKeepGoByMixed"> |
| | | update asr_loc_rule set keep_go = #{keepGo} where mixed = 1 |
| | | </update> |
| | | |
| | | </mapper> |
| | |
| | | {type: 'checkbox'} |
| | | // ,{field: 'id', align: 'center',title: 'ID'} |
| | | ,{field: 'matnr', align: 'center',title: '商品编号'} |
| | | ,{field: 'specs', align: 'center',title: '规格'} |
| | | ,{field: 'model', align: 'center',title: '型号'} |
| | | ,{field: 'cstmr', align: 'center',title: '客户'} |
| | | ,{field: 'specs', align: 'center',title: '规格', hide: true} |
| | | ,{field: 'model', align: 'center',title: '型号', hide: true} |
| | | ,{field: 'cstmr', align: 'center',title: '客户', hide: true} |
| | | ,{field: 'batch', align: 'center',title: '批号'} |
| | | ,{field: 'other', align: 'center',title: '其他', hide: true} |
| | | ,{field: 'rowBeg', align: 'center',title: '开始排'} |
| | |
| | | ,{field: 'bayEnd', align: 'center',title: '结束列'} |
| | | ,{field: 'levBeg', align: 'center',title: '开始层'} |
| | | ,{field: 'levEnd', align: 'center',title: '结束层'} |
| | | ,{field: 'limit', align: 'center',title: '上限'} |
| | | ,{field: 'limit', align: 'center',title: '上限', hide: true} |
| | | ,{field: 'status$', align: 'center',title: '状态', hide: true} |
| | | ,{field: 'createBy$', align: 'center',title: '添加人员', hide: true} |
| | | ,{field: 'createTime$', align: 'center',title: '添加时间', hide: true} |
| | |
| | | <input class="layui-input" name="matnr" placeholder="请输入商品编号"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">规格: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="specs" placeholder="请输入规格"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">型号: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="model" placeholder="请输入型号"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">客户: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="cstmr" placeholder="请输入客户"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">规格: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="specs" placeholder="请输入规格">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">型号: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="model" placeholder="请输入型号">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">客户: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="cstmr" placeholder="请输入客户">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">批号: </label> |
| | | <div class="layui-input-block"> |
| | |
| | | <!-- <input class="layui-input" name="other" placeholder="请输入其他">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">上限: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="limit" placeholder="请输入上限"> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="layui-form-item">--> |
| | | <!-- <label class="layui-form-label">上限: </label>--> |
| | | <!-- <div class="layui-input-block">--> |
| | | <!-- <input class="layui-input" name="limit" placeholder="请输入上限">--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">混载: </label> |
| | | <div class="layui-input-block"> |