| | |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.OrderDetl; |
| | | import com.zy.asrs.entity.result.StoPreTab; |
| | | import com.zy.asrs.service.LocDetlService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.OrderDetlService; |
| | | import com.zy.asrs.service.OrderService; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.model.LocDto; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/3/26 |
| | |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private LocDetlService locDetlService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | // @PostMapping("/out/pakout/preview/auth") |
| | | // public R pakoutPreview(@RequestBody List<Long> ids) { |
| | | // if (Cools.isEmpty(ids)) { |
| | | // return R.parse(BaseRes.PARAM); |
| | | // } |
| | | // List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | // Set<DetlDto> detlDtos = new HashSet<>(); |
| | | // for (OrderDetl orderDetl : orderDetls) { |
| | | // if (DetlDto.hasList(detlDtos, orderDetl)) { |
| | | // DetlDto detlDto = DetlDto.find(detlDtos, orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | // assert detlDto != null; |
| | | // detlDto.setAnfme(detlDto.getAnfme() + orderDetl.getAnfme()); |
| | | // } else { |
| | | // detlDtos.add(new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())); |
| | | // } |
| | | // } |
| | | // List<LocDto> locDtos = new ArrayList<>(); |
| | | // for (DetlDto detlDto : detlDtos) { |
| | | // double issued = Optional.ofNullable(detlDto.getAnfme()).orElse(0.0D) ; |
| | | // List<LocDetl> locDetls = locDetlService.queryStock(detlDto.getMatnr(), detlDto.getBatch(), null); |
| | | // for (LocDetl locDetl : locDetls) { |
| | | // if (issued > 0) { |
| | | // locDtos.add(new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(), issued>=locDetl.getAnfme()?locDetl.getAnfme():issued)); |
| | | // // 剩余待出数量递减 |
| | | // issued = issued - locDetl.getAnfme(); |
| | | // } else { |
| | | // break; |
| | | // } |
| | | // } |
| | | // } |
| | | // return R.ok().add(locDtos); |
| | | // } |
| | | |
| | | @PostMapping("/out/pakout/preview/auth") |
| | | public R pakoutPreview(@RequestBody List<Long> ids) { |
| | | if (Cools.isEmpty(ids)) { |
| | | return R.parse(BaseRes.PARAM); |
| | | } |
| | | // 合并同类项 |
| | | List<OrderDetl> orderDetls = orderDetlService.selectBatchIds(ids); |
| | | Set<DetlDto> detlDtos = new HashSet<>(); |
| | | List<LocDto> locDtos = new ArrayList<>(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | if (DetlDto.hasList(detlDtos, orderDetl)) { |
| | | DetlDto detlDto = DetlDto.find(detlDtos, orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | assert detlDto != null; |
| | | detlDto.setAnfme(detlDto.getAnfme() + orderDetl.getAnfme()); |
| | | } else { |
| | | detlDtos.add(new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getAnfme())); |
| | | // check stock |
| | | // Double stockAnfme = locDetlService.queryStockAnfme(orderDetl.getMatnr(), orderDetl.getBatch()); |
| | | double issued = Optional.ofNullable(orderDetl.getAnfme()).orElse(0.0D) ; |
| | | List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), null); |
| | | for (LocDetl locDetl : locDetls) { |
| | | if (issued > 0) { |
| | | locDtos.add(new LocDto(locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getMaktx(), locDetl.getBatch(), orderDetl.getOrderNo(), |
| | | issued>=locDetl.getAnfme()?locDetl.getAnfme():issued)); |
| | | // 剩余待出数量递减 |
| | | issued = issued - locDetl.getAnfme(); |
| | | } else { |
| | | break; |
| | | } |
| | | } |
| | | if (issued > 0) { |
| | | locDtos.add(new LocDto("缺货", orderDetl.getMatnr(), orderDetl.getMaktx(), orderDetl.getBatch(), orderDetl.getOrderNo(), issued)); |
| | | } |
| | | } |
| | | // |
| | | // List<LocDetl> locDetls = locDetlService.queryStock(orderDetl.getMatnr(), orderDetl.getBatch(), orderDetl.getOrderNo()); |
| | | |
| | | return R.ok().add(orderDetls); |
| | | |
| | | return R.ok().add(locDtos); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | | } |
| | |
| | | |
| | | // -------------------------------------------------- |
| | | |
| | | |
| | | List<LocDetl> queryStock(String matnr, String batch, String orderNo); |
| | | |
| | | Double queryStockAnfme(String matnr, String batch); |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | Boolean checkEmptyCount(LocMast locMast); |
| | | |
| | | /** |
| | | * 当前库存明细是否为整托 |
| | | */ |
| | | Boolean checkWhole(List<LocDetl> locDetls); |
| | | |
| | | } |
| | |
| | | public List<LocDetl> queryStock(String matnr, String batch, String orderNo) { |
| | | return this.baseMapper.queryStock(matnr, batch, orderNo); |
| | | } |
| | | |
| | | @Override |
| | | public Double queryStockAnfme(String matnr, String batch) { |
| | | return this.baseMapper.queryStockAnfme(matnr, batch); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.LocMastService; |
| | |
| | | return this.baseMapper.selectEmptyLocCount(locMast.getLocType1(), locMast.getCrnNo()) > 1; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkWhole(List<LocDetl> locDetls) { |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.common.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by vincent on 2022/3/28 |
| | | */ |
| | | @Data |
| | | public class LocDto { |
| | | |
| | | private String locNo; |
| | | |
| | | private String matnr; |
| | | |
| | | private String maktx; |
| | | |
| | | private String batch; |
| | | |
| | | private String orderNo; |
| | | |
| | | private Double anfme; |
| | | |
| | | public LocDto() { |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String batch, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.anfme = anfme; |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String batch, String orderNo, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | } |
| | | |
| | | public LocDto(String locNo, String matnr, String maktx, String batch, String orderNo, Double anfme) { |
| | | this.locNo = locNo; |
| | | this.matnr = matnr; |
| | | this.maktx = maktx; |
| | | this.batch = batch; |
| | | this.orderNo = orderNo; |
| | | this.anfme = anfme; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return this.matnr + "(" + this.maktx + ")"; |
| | | } |
| | | |
| | | } |
| | |
| | | where 1=1 |
| | | and b.loc_sts = 'F' |
| | | and a.matnr = #{matnr} |
| | | <if test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </if> |
| | | <choose> |
| | | <when test="batch != null and batch != ''"> |
| | | and a.batch = #{batch} |
| | | </when> |
| | | <otherwise> |
| | | and (a.batch IS NULL OR a.batch = '') |
| | | </otherwise> |
| | | </choose> |
| | | <if test="orderNo != null and orderNo != ''"> |
| | | and a.orderNo = #{orderNo} |
| | | </if> |
| | |
| | | desc |
| | | </select> |
| | | |
| | | <select id="queryStockAnfme" resultType="java.lang.Double"> |
| | | select sum(anfme) as count from man_loc_detl |
| | | where 1=1 |
| | | and matnr = #{matnr} |
| | | <if test="batch != null and batch != ''"> |
| | | and batch = #{batch} |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | ,title: false |
| | | ,closeBtn: false |
| | | ,offset: '100px' |
| | | // ,area: ['1000px', '700px'] |
| | | ,area: '1000px' |
| | | ,shade: 0.5 |
| | | ,shadeClose: true |
| | |
| | | cellMinWidth: 100, |
| | | height: 432, |
| | | cols: [[ |
| | | {field: 'title', title: '商品', merge: true, align: 'center'}, |
| | | {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90}, |
| | | {field: 'type', title: '仓库', merge: true, align: 'center', templet: '#typeTpl', width: 90}, |
| | | {field: 'locNo', title: '货位', align: 'center'}, |
| | | {field: 'prior$', title: '推荐货位', align: 'center', width: 100}, |
| | | {field: 'reduce', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | {field: 'orderNo', title: '单据编号', merge: true, align: 'center'}, |
| | | {field: 'title', title: '商品', merge: true, align: 'center', width: 300}, |
| | | // {field: 'anfme', title: '总数量', merge: ['title'], align: 'center', style: 'font-weight: bold', width: 90}, |
| | | {field: 'locNo', title: '货位', align: 'center', width: 90}, |
| | | {field: 'batch', title: '批号', align: 'center'}, |
| | | {field: 'anfme', title: '数量', align: 'center', width: 90, style: 'font-weight: bold'}, |
| | | // {field: 'remQty', title: '余量', align: 'center', width: 80}, |
| | | {field: 'total', title: '总量', align: 'center', width: 90}, |
| | | // {field: 'total', title: '总量', align: 'center', width: 90}, |
| | | ]], |
| | | done: function () { |
| | | $('.layui-table-body.layui-table-main').css("overflow", "auto") |