| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.ManLocDetl; |
| | | import com.zy.asrs.entity.Mat; |
| | | import com.zy.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.ManLocDetlService; |
| | | import com.zy.asrs.service.MatService; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | param.remove("modi_time"); |
| | | } |
| | | } |
| | | Page<LocDetl> stockOut = locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class)); |
| | | if (stockOut.getRecords().size()==0){ |
| | | stockOut = locDetlService.getStockOut(toPage(1, limit, param, LocDetl.class)); |
| | | param.remove("curr"); |
| | | param.remove("limit"); |
| | | EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByLocNo(getUserId(),wrapper); |
| | | Page<LocDetl> locDetlPage = locDetlService.selectPage(new Page<>(curr, limit), wrapper); |
| | | if (locDetlPage.getRecords().size()==0){ |
| | | locDetlPage = locDetlService.selectPage(new Page<>(1, limit), wrapper); |
| | | } |
| | | return R.ok(stockOut); |
| | | return R.ok(locDetlPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/stock/out/crn/list/auth") |
| | |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(LocDetl.class, param.keySet(), wrapper, condition); |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByLocNo(getUserId(),wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | // if (!row.equals("")){ |
| | | // wrapper.and() |
| | |
| | | import com.zy.asrs.service.BasWhsService; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.entity.Parameter; |
| | | import com.zy.common.model.Shelves; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | |
| | | excludeTrash(param); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByCrn(getUserId(),wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(locMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.StaDesc; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.entity.param.EmptyPlateOutParam; |
| | |
| | | import com.zy.asrs.service.StaDescService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 工作流接口控制器 |
| | |
| | | @RequestMapping("/available/empty/take/site") |
| | | @ManagerAuth() |
| | | public R availableEmptyTakeSite(){ |
| | | return R.ok().add(basDevpService.getAvailableEmptyOutSite()); |
| | | EntityWrapper<StaDesc> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("type_no",110); |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByCrn(getUserId(),wrapper); |
| | | List<StaDesc> staDescs = staDescService.selectList(wrapper); |
| | | List<Integer> collect = staDescs.stream().map(StaDesc::getStnNo).distinct().collect(Collectors.toList()); |
| | | return R.ok().add(collect); |
| | | // return R.ok().add(basDevpService.getAvailableEmptyOutSite()); |
| | | } |
| | | |
| | | @RequestMapping("/full/store/put/start") |
| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkDetl; |
| | | import com.zy.asrs.service.WrkDetlService; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | } else { |
| | | wrapper.orderBy("appe_time", false); |
| | | } |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByBarcode(getUserId(),wrapper); |
| | | return R.ok(wrkDetlService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkDetlLog; |
| | | import com.zy.asrs.service.WrkDetlLogService; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | public class WrkDetlLogController extends BaseController { |
| | |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | try { |
| | | Integer wrkNo = null; |
| | | String orderNo = null; |
| | | String matnr = null; |
| | | String specs = null; |
| | | String zpallet = null; |
| | | String batch = null; |
| | | Double anfme = null; |
| | | Date modiTimeStart = null, modiTimeEnd = null; |
| | | for (Map.Entry<String, Object> entry : param.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (Cools.isEmpty(val)) { |
| | | continue; |
| | | } |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | modiTimeStart = DateUtils.convert(dates[0]); |
| | | modiTimeEnd = DateUtils.convert(dates[1]); |
| | | } else if (entry.getKey().equals("wrk_no")) { |
| | | wrkNo = Integer.parseInt(val); |
| | | } else if (entry.getKey().equals("order_no")) { |
| | | orderNo = val; |
| | | } else if (entry.getKey().equals("specs")) { |
| | | specs = val; |
| | | } else if (entry.getKey().equals("zpallet")) { |
| | | zpallet = val; |
| | | } else if (entry.getKey().equals("batch")) { |
| | | batch = val; |
| | | } else if (entry.getKey().equals("anfme")) { |
| | | anfme = Double.parseDouble(val); |
| | | }else if (entry.getKey().equals("matnr")) { |
| | | matnr = val; |
| | | } |
| | | excludeTrash(param); |
| | | EntityWrapper<WrkDetlLog> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | allLike(WrkDetlLog.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } else { |
| | | wrapper.orderBy("appe_time", false); |
| | | } |
| | | List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectWrkDetlLogs(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd, curr, limit); |
| | | Page<WrkDetlLog> page1 = new Page<WrkDetlLog>(curr, limit).setRecords(wrkDetlLogs); |
| | | page1.setTotal(wrkDetlLogService.selectWrkDetlLogsTotal(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd)); |
| | | return R.ok(page1); |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByBarcode(getUserId(),wrapper); |
| | | return R.ok(wrkDetlLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | // Integer wrkNo = null; |
| | | // String orderNo = null; |
| | | // String matnr = null; |
| | | // String specs = null; |
| | | // String zpallet = null; |
| | | // String batch = null; |
| | | // Double anfme = null; |
| | | // Date modiTimeStart = null, modiTimeEnd = null; |
| | | // for (Map.Entry<String, Object> entry : param.entrySet()) { |
| | | // String val = String.valueOf(entry.getValue()); |
| | | // if (Cools.isEmpty(val)) { |
| | | // continue; |
| | | // } |
| | | // if (val.contains(RANGE_TIME_LINK)) { |
| | | // String[] dates = val.split(RANGE_TIME_LINK); |
| | | // modiTimeStart = DateUtils.convert(dates[0]); |
| | | // modiTimeEnd = DateUtils.convert(dates[1]); |
| | | // } else if (entry.getKey().equals("wrk_no")) { |
| | | // wrkNo = Integer.parseInt(val); |
| | | // } else if (entry.getKey().equals("order_no")) { |
| | | // orderNo = val; |
| | | // } else if (entry.getKey().equals("specs")) { |
| | | // specs = val; |
| | | // } else if (entry.getKey().equals("zpallet")) { |
| | | // zpallet = val; |
| | | // } else if (entry.getKey().equals("batch")) { |
| | | // batch = val; |
| | | // } else if (entry.getKey().equals("anfme")) { |
| | | // anfme = Double.parseDouble(val); |
| | | // }else if (entry.getKey().equals("matnr")) { |
| | | // matnr = val; |
| | | // } |
| | | // } |
| | | // List<WrkDetlLog> wrkDetlLogs = wrkDetlLogService.selectWrkDetlLogs(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd, curr, limit); |
| | | // Page<WrkDetlLog> page1 = new Page<WrkDetlLog>(curr, limit).setRecords(wrkDetlLogs); |
| | | // page1.setTotal(wrkDetlLogService.selectWrkDetlLogsTotal(wrkNo, orderNo,matnr,specs,zpallet,batch,anfme, modiTimeStart, modiTimeEnd)); |
| | | // return R.ok(page1); |
| | | } catch (Exception e) { |
| | | return R.error("异常" + e); |
| | | } |
| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | }else { |
| | | wrapper.orderBy("io_time", false); |
| | | } |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByCrn(getUserId(),wrapper); |
| | | return R.ok(wrkMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkMastLog; |
| | | import com.zy.asrs.service.WrkMastLogService; |
| | | import com.zy.common.utils.RoleUtils; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | }else { |
| | | wrapper.orderBy("modi_time", false); |
| | | } |
| | | // 不同继承角色显示不同库信息 |
| | | RoleUtils.addRoleWrapperByCrn(getUserId(),wrapper); |
| | | return R.ok(wrkMastLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
New file |
| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @author pang.jiabao |
| | | * @description 根据角色区分不同库显示不同库存 |
| | | * @createDate 2024/11/3 14:11 |
| | | */ |
| | | @Component |
| | | public class RoleUtils { |
| | | |
| | | /** |
| | | * 以角色继承角色显示出指定库信息按堆垛机限制 |
| | | */ |
| | | public static <T> void addRoleWrapperByCrn(Long userId, EntityWrapper<T> wrapper) { |
| | | // super账号 |
| | | if (userId == 9527) { |
| | | return; |
| | | } |
| | | |
| | | UserService userService = SpringUtils.getBean(UserService.class); |
| | | User user = userService.selectById(userId); |
| | | String roleName = user.getRoleName(); |
| | | |
| | | // 管理员角色 |
| | | if (Cools.isEmpty(roleName)) { |
| | | wrapper.eq("1", 0); |
| | | } else if (roleName.equals("管理员")) { |
| | | return; |
| | | } |
| | | |
| | | // 其他角色看继承角色 |
| | | String roleLeaderCode = user.getRoleLeaderCode(); |
| | | if (Cools.isEmpty(roleLeaderCode)) { |
| | | wrapper.eq("1", 0); |
| | | } else if (roleLeaderCode.equals("stacker_hangar")) { // 堆垛机库 |
| | | wrapper.le("crn_no", 4); // 限制1~4号堆垛机 |
| | | } else if (roleLeaderCode.equals("four_directional_library")) { // 四向库 |
| | | wrapper.eq("crn_no", 7); // 限制7号堆垛机 |
| | | } else if (roleLeaderCode.equals("ctu_library")) { // ctu库 |
| | | wrapper.in("crn_no", 8, 9); //限制8,9号堆垛机 |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 以角色继承角色显示出指定库信息按库位限制 |
| | | */ |
| | | public static <T> void addRoleWrapperByLocNo(Long userId, EntityWrapper<T> wrapper) { |
| | | // super账号 |
| | | if (userId == 9527) { |
| | | return; |
| | | } |
| | | |
| | | UserService userService = SpringUtils.getBean(UserService.class); |
| | | User user = userService.selectById(userId); |
| | | String roleName = user.getRoleName(); |
| | | |
| | | // 管理员角色 |
| | | if (Cools.isEmpty(roleName)) { |
| | | wrapper.eq("1", 0); |
| | | return; |
| | | } else if (roleName.equals("管理员")) { |
| | | return; |
| | | } |
| | | |
| | | // 其他角色看继承角色 |
| | | String roleLeaderCode = user.getRoleLeaderCode(); |
| | | if (Cools.isEmpty(roleLeaderCode)) { |
| | | wrapper.eq("1", 0); |
| | | } else if (roleLeaderCode.equals("stacker_hangar")) { // 堆垛机库 |
| | | wrapper.addFilter("LEFT(loc_no,2)<=16"); // 限制1~16排 |
| | | } else if (roleLeaderCode.equals("four_directional_library")) { // 四向库 |
| | | wrapper.addFilter("LEFT(loc_no,2)>=17 and LEFT(loc_no,2)<=37"); // 限制17~37排 |
| | | } else if (roleLeaderCode.equals("ctu_library")) { // ctu库 |
| | | wrapper.addFilter("LEFT(loc_no,2)>=38"); //限制38~53排 |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 以角色继承角色显示出指定库信息按托盘码限制 |
| | | */ |
| | | public static <T> void addRoleWrapperByBarcode(Long userId, EntityWrapper<T> wrapper) { |
| | | // super账号 |
| | | if (userId == 9527) { |
| | | return; |
| | | } |
| | | |
| | | UserService userService = SpringUtils.getBean(UserService.class); |
| | | User user = userService.selectById(userId); |
| | | String roleName = user.getRoleName(); |
| | | |
| | | // 管理员角色 |
| | | if (Cools.isEmpty(roleName)) { |
| | | wrapper.eq("1", 0); |
| | | return; |
| | | } else if (roleName.equals("管理员")) { |
| | | return; |
| | | } |
| | | |
| | | // 其他角色看继承角色 |
| | | String roleLeaderCode = user.getRoleLeaderCode(); |
| | | if (Cools.isEmpty(roleLeaderCode)) { |
| | | wrapper.eq("1", 0); |
| | | } else if (roleLeaderCode.equals("stacker_hangar")) { // 堆垛机库 |
| | | // TODO 堆垛机开头未确认 |
| | | // wrapper.addFilter("LEFT(zpallet,3) =''"); // 限制 |
| | | } else if (roleLeaderCode.equals("four_directional_library")) { // 四向库 |
| | | wrapper.addFilter("LEFT(zpallet,3) ='SXK'"); // 限制SXK |
| | | } else if (roleLeaderCode.equals("ctu_library")) { // ctu库 |
| | | wrapper.addFilter("LEFT(zpallet,3) ='CTU'"); //限制CTU |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getLeaderCode(){ |
| | | RoleService service = SpringUtils.getBean(RoleService.class); |
| | | Role role = service.selectById(this.leader); |
| | | if (!Cools.isEmpty(role)){ |
| | | return String.valueOf(role.getCode()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setLeader(Long leader) { |
| | | this.leader = leader; |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | public String getRoleLeaderCode(){ |
| | | RoleService service = SpringUtils.getBean(RoleService.class); |
| | | Role role = service.selectById(this.roleId); |
| | | if (!Cools.isEmpty(role)){ |
| | | return role.getLeaderCode(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setRoleId(Long roleId) { |
| | | this.roleId = roleId; |