| | |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.param.StockOutParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.service.impl.WorkServiceImpl; |
| | | import com.zy.asrs.utils.OutboundAllocationUtil; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.model.TaskDto; |
| | | import com.zy.common.web.BaseController; |
| | |
| | | } |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | |
| | | Set<String> exist = new HashSet<>(); |
| | | |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | locDto.setStaNos(staNos); |
| | | locDtos.add(locDto); |
| | | exist.add(locDetl.getLocNo()); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | locDto.setLack(Boolean.TRUE); |
| | | locDtos.add(locDto); |
| | | } |
| | | LocDto locDto = new LocDto(orderDetl.getManu(), orderDetl.getMatnr(), orderDetl.getMaktx(),orderDetl.getModel(),orderDetl.getSpecs(), |
| | | orderDetl.getBatch(),orderDetl.getBrand(),orderDetl.getBarcode(), orderDetl.getOrderNo(),orderDetl.getAnfme()); |
| | | locDtos.add(locDto); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | // Set<String> exist = new HashSet<>(); |
| | | |
| | | // for (OrderDetl orderDetl : orderDetls) { |
| | | // double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | // if (issued <= 0.0D) { continue; } |
| | | // List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist); |
| | | // for (LocDetl locDetl : locDetls) { |
| | | // if (issued > 0) { |
| | | // LocDto locDto = new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | // issued >= locDetl.getAnfme() ? locDetl.getAnfme() : issued); |
| | | // List<Integer> staNos = staDescService.queryOutStaNosByLocNo(locDetl.getLocNo(), issued >= locDetl.getAnfme() ? 101 : 103); |
| | | // locDto.setStaNos(staNos); |
| | | // locDtos.add(locDto); |
| | | // exist.add(locDetl.getLocNo()); |
| | | // // 剩余待出数量递减 |
| | | // issued = issued - locDetl.getAnfme(); |
| | | // } else { |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (issued > 0) { |
| | | // LocDto locDto = new LocDto(null, orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued); |
| | | // locDto.setLack(Boolean.TRUE); |
| | | // locDtos.add(locDto); |
| | | // } |
| | | // } |
| | | return R.ok().add(locDtos); |
| | | } |
| | | |
| | | @PostMapping("/out/pakout/auth") |
| | | @ManagerAuth(memo = "订单出库") |
| | | public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException { |
| | | if (Cools.isEmpty(locDtos)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | boolean lack = true; |
| | | for (LocDto locDto : locDtos) { |
| | | if (!locDto.isLack()) { |
| | | lack = false; |
| | | break; |
| | | } |
| | | } |
| | | if (lack) { |
| | | return R.error("库存不足"); |
| | | } |
| | | StockOutParam param = new StockOutParam(); |
| | | ArrayList<StockOutParam.LocDetl> locDetls = new ArrayList<>(); |
| | | for (LocDto locDto:locDtos){ |
| | | StockOutParam.LocDetl locDetl = new StockOutParam.LocDetl(); |
| | | locDetl.setBrand(locDto.getBrand()); |
| | | locDetl.setLocNo(locDto.getLocNo()); |
| | | locDetl.setAnfme(locDto.getAnfme()); |
| | | locDetl.setMatnr(locDto.getMatnr()); |
| | | locDetl.setBatch(locDto.getBatch()); |
| | | locDetl.setModel(locDto.getModel()); |
| | | locDetl.setSpecs(locDto.getSpecs()); |
| | | locDetl.setZpallet(locDto.getZpallet()); |
| | | |
| | | Thread.sleep(1000L); |
| | | param.setOrderNo(locDto.getOrderNo()); |
| | | |
| | | List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | for (LocDto locDto : locDtos) { |
| | | if (locDto.isLack()) { continue; } |
| | | TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | if (TaskDto.has(taskDtos, taskDto)) { |
| | | TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | assert dto != null; |
| | | dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | } else { |
| | | taskDtos.add(taskDto); |
| | | } |
| | | locDetls.add(locDetl); |
| | | } |
| | | // ----------------------------------------------------------------------------------------------- |
| | | for (TaskDto taskDto : taskDtos) { |
| | | BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | workService.stockOut(staNo, taskDto, getUserId()); |
| | | param.setLocDetls(locDetls); |
| | | |
| | | List<StockOutParam> stockOutParams = OutboundAllocationUtil.OutboundClassification(param); |
| | | for (StockOutParam stockOutParam : stockOutParams){ |
| | | workService.startupFullTakeStore(stockOutParam, getUserId()); |
| | | } |
| | | // if (Cools.isEmpty(locDtos)) { |
| | | // return R.parse(BaseRes.PARAM); |
| | | // } |
| | | // boolean lack = true; |
| | | // for (LocDto locDto : locDtos) { |
| | | // if (!locDto.isLack()) { |
| | | // lack = false; |
| | | // break; |
| | | // } |
| | | // } |
| | | // if (lack) { |
| | | // return R.error("库存不足"); |
| | | // } |
| | | // |
| | | // Thread.sleep(1000L); |
| | | // |
| | | // List<TaskDto> taskDtos = new ArrayList<>(); |
| | | // // 根据 (库位 & 出库站) 分组; 理想状态:一组为一次出库任务 |
| | | // for (LocDto locDto : locDtos) { |
| | | // if (locDto.isLack()) { continue; } |
| | | // TaskDto taskDto = new TaskDto(locDto.getLocNo(), locDto.getStaNo(), locDto); |
| | | // if (TaskDto.has(taskDtos, taskDto)) { |
| | | // TaskDto dto = TaskDto.find(taskDtos, taskDto); |
| | | // assert dto != null; |
| | | // dto.getLocDtos().addAll(taskDto.getLocDtos()); |
| | | // } else { |
| | | // taskDtos.add(taskDto); |
| | | // } |
| | | // } |
| | | // // ----------------------------------------------------------------------------------------------- |
| | | // for (TaskDto taskDto : taskDtos) { |
| | | // BasDevp staNo = basDevpService.checkSiteStatus(taskDto.getStaNo()); |
| | | // workService.stockOut(staNo, taskDto, getUserId()); |
| | | // } |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | null, // 发货时间 |
| | | null, // 物流名称 |
| | | null, // 物流单号 |
| | | 2L, // 订单状态 |
| | | // 2L, // 订单状态 |
| | | 1L, // 订单状态 |
| | | 1, // 状态 |
| | | userId, // 添加人员 |
| | | now, // 添加时间 |
| | |
| | | orderDetl.setModel(locDetl.getModel());//批次 |
| | | orderDetl.setSpecs(locDetl.getSpecs());//规格 |
| | | orderDetl.setBrand(locDetl.getBrand());//木箱类型 |
| | | orderDetl.setWorkQty(locDetl.getAnfme()); |
| | | orderDetl.setBarcode(locDetl.getZpallet());//木箱类型 |
| | | // orderDetl.setWorkQty(locDetl.getAnfme()); |
| | | orderDetl.setWorkQty(0.0); |
| | | orderDetl.setOrderId(order.getId()); |
| | | orderDetl.setOrderNo(order.getOrderNo()); |
| | | orderDetl.setCreateBy(userId); |
| | |
| | | } |
| | | } |
| | | |
| | | List<StockOutParam> stockOutParams = OutboundAllocationUtil.OutboundClassification(param); |
| | | for (StockOutParam stockOutParam : stockOutParams){ |
| | | startupFullTakeStore(stockOutParam,userId); |
| | | } |
| | | // List<StockOutParam> stockOutParams = OutboundAllocationUtil.OutboundClassification(param); |
| | | // for (StockOutParam stockOutParam : stockOutParams){ |
| | | // startupFullTakeStore(stockOutParam,userId); |
| | | // } |
| | | |
| | | } else { |
| | | throw new CoolException("订单号重复,订单"+param.getOrderNo()+"已存在!!!"); |
| | |
| | | private String matnr; |
| | | |
| | | private String maktx; |
| | | private String model; |
| | | //规格 |
| | | private String specs; |
| | | |
| | | private String batch; |
| | | |
| | | //木箱类型 |
| | | private String brand; |
| | | |
| | | //托盘码 |
| | | private String zpallet; |
| | | |
| | | private String orderNo; |
| | | |
| | | private Double anfme; |
| | | private Double count; |
| | | |
| | | private boolean lack = false; |
| | | |
| | |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.anfme = anfme; |
| | | this.count = anfme; |
| | | |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String batch, String orderNo, Double anfme) { |
| | |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | this.count = anfme; |
| | | |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme) { |
| | |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | this.count = anfme; |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String maktx,String model,String specs, String batch,String brand,String zpallet, String orderNo, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | | this.maktx = maktx; |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | this.count = anfme; |
| | | this.model = model; |
| | | this.specs = specs; |
| | | this.brand = brand; |
| | | this.zpallet = zpallet; |
| | | } |
| | | |
| | | public String getTitle() { |
| | |
| | | } |
| | | } |
| | | |
| | | public void setAnfme(Double anfme){ |
| | | this.anfme=anfme; |
| | | this.count=anfme; |
| | | } |
| | | |
| | | } |
| | |
| | | ,title: false |
| | | ,closeBtn: false |
| | | ,offset: '50px' |
| | | ,area: ['1200px', '700px'] |
| | | ,area: ['1500px', '700px'] |
| | | ,shade: 0.5 |
| | | ,shadeClose: false |
| | | ,btn: ['立即出库', '稍后处理'] |
| | |
| | | {field: 'orderNo', title: '单据编号', merge: true, align: 'center'}, |
| | | {field: 'title', title: '商品', merge: true, align: 'center', width: 350}, |
| | | {field: 'batch', title: '箱号', align: 'center'}, |
| | | {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'model', title: '批次', align: 'center'}, |
| | | {field: 'specs', title: '规格', align: 'center'}, |
| | | {field: 'brand', title: '木箱类型', align: 'center'}, |
| | | {field: 'zpallet', title: '托盘码', align: 'center'}, |
| | | {field: 'anfme', title: '木箱中铜箔数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'count', title: '木箱中铜箔数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'}, |
| | | {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, |
| | | {type: 'checkbox', merge: ['locNo']}, |
| | | // {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'}, |
| | | // {type: 'checkbox', merge: ['locNo']}, |
| | | ]], |
| | | done: function (res) { |
| | | tableMerge.render(this); |
| | |
| | | { |
| | | "code": 0 |
| | | ,"msg": "" |
| | | ,"count": "100" |
| | | ,"data": [{ |
| | | "id": "1001" |
| | | ,"poster": "赵" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "为什么花儿这么么红" |
| | | ,"posttime": 20160805 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1002" |
| | | ,"poster": "钱" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "喜欢胡歌,赞赞赞" |
| | | ,"posttime": 20161205 |
| | | ,"top": true |
| | | },{ |
| | | "id": "1003" |
| | | ,"poster": "孙" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "明天就要考试了,好紧张,求保佑" |
| | | ,"posttime": 20170405 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1004" |
| | | ,"poster": "李" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "希望明天是个好天气" |
| | | ,"posttime": 20171005 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1005" |
| | | ,"poster": "周" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "女追男隔层纱,是不是真的" |
| | | ,"posttime": 20180205 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1006" |
| | | ,"poster": "吴" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "竟然有人跳楼,年轻人想不开啊!" |
| | | ,"posttime": 20180512 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1007" |
| | | ,"poster": "郑" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "大家一定不能学那个年轻人,珍爱生命啊" |
| | | ,"posttime": 20180512 |
| | | ,"top": false |
| | | },{ |
| | | "id": "1008" |
| | | ,"poster": "王" |
| | | ,"avatar": "https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg" |
| | | ,"content": "想知道南昌哪里有好吃的西安肉夹馍" |
| | | ,"posttime": 20180514 |
| | | ,"top": false |
| | | }] |
| | | } |
| | | {"code":0,"msg":"","count":"100","data":[{"id":"1001","poster":"赵","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"为什么花儿这么么红","posttime":20160805,"top":false},{"id":"1002","poster":"钱","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"喜欢胡歌,赞赞赞","posttime":20161205,"top":true},{"id":"1003","poster":"孙","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"明天就要考试了,好紧张,求保佑","posttime":20170405,"top":false},{"id":"1004","poster":"李","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"希望明天是个好天气","posttime":20171005,"top":false},{"id":"1005","poster":"周","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"女追男隔层纱,是不是真的","posttime":20180205,"top":false},{"id":"1006","poster":"吴","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"竟然有人跳楼,年轻人想不开啊!","posttime":20180512,"top":false},{"id":"1007","poster":"郑","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"大家一定不能学那个年轻人,珍爱生命啊","posttime":20180512,"top":false},{"id":"1008","poster":"王","avatar":"https://wx4.sinaimg.cn/mw1024/5db11ff4gy1fmx4keaw9pj20dw08caa4.jpg","content":"想知道南昌哪里有好吃的西安肉夹馍","posttime":20180514,"top":false}]} |