自动化立体仓库 - WMS系统
pang.jiabao
2024-12-02 57936e11434f6614f818a0a0a495918dc1af6dd6
单据出库完成
19个文件已修改
569 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MobileController.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OutController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/WaitPakinController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/CombParam.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/MobileService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 187 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/NodeServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/SaasUtils.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/system/entity/SaasLog.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/LocDetlMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ManLocDetlMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/OrderDetlMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/manLocDetl/manLocDetl.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/saasLog/saasLog.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -22,6 +22,7 @@
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
 * 移动端接口控制器
@@ -56,6 +57,129 @@
    @Autowired
    private WrkDetlLogService wrkDetlLogService;
    @PostMapping("/pda/OutOrder")
    @ManagerAuth(memo = "获得出库单")
    @Transactional
    public R OutOrder(@RequestParam String orderNo) {
        List<Order> orders=new ArrayList<Order>();
        List<Order> OrderList=new ArrayList<Order>();
        if(Cools.isEmpty(orderNo)){
            orders= orderService.selectList(new EntityWrapper<Order>()
                    .in("settle",1,2)
            );
        }else{
            orders= orderService.selectList(new EntityWrapper<Order>()
                            .like("order_no",orderNo)
                            .in("settle",1,2)
            );
        }
        if(Cools.isEmpty(orders)){
            return R.parse("无数据");
        }
        for (Order o:orders
        ) {
            DocType docType=docTypeService.selectOne(new EntityWrapper<DocType>()
                    .eq("doc_id",o.getDocType()));
            if(docType.getPakout()==1){
                OrderList.add(o);
            }
        }
        return R.ok(OrderList);
    }
    @PostMapping("/pda/OutLocNo")
    @ManagerAuth(memo = "获得平库出库的对应库位号")
    @Transactional
    public R OutLocNo(@RequestParam Long orderId) {
        List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>()
                .eq("order_id", orderId)
        );
        if (Cools.isEmpty(orderDetls)) {
            return R.error("订单明细不存在");
        }
        List<String> list = new ArrayList<>();
        for (OrderDetl o : orderDetls
        ) {
            if (o.getAnfme() <= o.getWorkQty()) {
                continue;
            } else {
                //查看库位明细中有的物料
                List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>()
                        .eq("matnr", o.getMatnr()).eq("batch",o.getBatch())
                );
                if (Cools.isEmpty(locDetls)) {
                    continue;
                } else {
                    for (ManLocDetl l : locDetls
                    ) {
                        String s = l.getLocNo().substring(0, 2);
                        if (Integer.parseInt(s) > 8) {
                            list.add(l.getLocNo());
                        }
                    }
                }
            }
        }
        List<String> myList = list.stream().distinct().collect(Collectors.toList());
        return R.ok(myList);
    }
    @PostMapping("/pda/OrderDetlContrastLocDetl")
    @ManagerAuth(memo = "获得订单明细对应的库存明细")
    @Transactional
    public R OrderDetlContrastLocDetl(@RequestParam Long orderId, @RequestParam String locNo) {
        List<ManLocDetl> locDetlList = new ArrayList<ManLocDetl>();
        List<OrderDetl> orderDetls = orderDetlService.selectList(new EntityWrapper<OrderDetl>()
                .eq("order_id", orderId)
        );
        if (Cools.isEmpty(orderDetls)) {
            return R.error("订单明细不存在");
        }
        List<ManLocDetl> locDetls = manLocDetlMapper.selectList(new EntityWrapper<ManLocDetl>()
                .eq("loc_no", locNo));
        if (Cools.isEmpty(locDetls)) {
            return R.error("库位为空");
        }
        for (OrderDetl o : orderDetls
        ) {
            if(o.getAnfme().equals(o.getQty())){
                continue;
            }
            for (ManLocDetl l : locDetls
            ) {
                if (o.getMatnr().equals(l.getMatnr()) && o.getBatch().equals(l.getBatch())) {
                    if (o.getAnfme() - o.getWorkQty() >= l.getAnfme()) {
                    } else {
                        l.setAnfme(o.getAnfme() - o.getWorkQty());
                    }
                    locDetlList.add(l);
                    break;
                }
            }
        }
        return R.ok(locDetlList);
    }
    /**
     * 平庫下架
     */
    @RequestMapping("/pda/WarehouseOut")
    @ManagerAuth
    public R WarehouseOut(@RequestBody CombParam combParam) {
        return mobileService.WarehouseOut(combParam, getUserId());
    }
    /**
     * 平庫上架
     */
    @RequestMapping("/pda/WarehouseIn")
    @ManagerAuth
    public R WarehouseIn(@RequestParam String locNo, @RequestParam String barcode) {
        return mobileService.WarehouseIn(locNo, barcode, getUserId());
    }
    // 商品上架
    @RequestMapping("/mat/onSale/auth")
src/main/java/com/zy/asrs/controller/OutController.java
@@ -7,6 +7,7 @@
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.mapper.LocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.common.model.LocDto;
import com.zy.common.model.TaskDto;
@@ -17,6 +18,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@@ -41,6 +43,9 @@
    private WorkService workService;
    @Autowired
    private BasDevpService basDevpService;
    @Resource
    private LocDetlMapper locDetlMapper;
    @PostMapping("/out/pakout/orderDetlIds/auth")
@@ -79,6 +84,22 @@
                    break;
                }
            }
            List<LocDetl> locDetls2 = locDetlMapper.queryStockByManLoc(orderDetl.getMatnr(), orderDetl.getBatch(), null, exist);
            for (LocDetl locDetl : locDetls2) {
                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);
                    locDto.setLocNo("平库" + locDetl.getLocNo());
                    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);
@@ -94,6 +115,10 @@
        if (Cools.isEmpty(locDtos)) {
            return R.parse(BaseRes.PARAM);
        }
        locDtos = locDtos.stream().filter(locDto -> locDto.getLocNo() != null && !locDto.getLocNo().startsWith("平库")).collect(Collectors.toList());
        if (Cools.isEmpty(locDtos)) {
            return R.parse("平库库存/库存不足");
        }
        boolean lack = true;
        for (LocDto locDto : locDtos) {
            if (!locDto.isLack()) {
src/main/java/com/zy/asrs/controller/WaitPakinController.java
@@ -11,7 +11,6 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.entity.WrkDetl;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.OrderDetlService;
import com.zy.asrs.service.WaitPakinService;
@@ -36,6 +35,16 @@
    @Autowired
    private WrkMastService wrkMastService;
    @RequestMapping(value = "/waitPakin/forBarcode/auth")
    @ManagerAuth
    public R forBarcode(@RequestParam("barcode") String barcode) {
        List<WaitPakin> list = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
        if (Cools.isEmpty(list)){
            return R.error("未找到组托信息");
        }
        return R.ok(list);
    }
    @RequestMapping(value = "/waitPakin/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -1,6 +1,5 @@
package com.zy.asrs.entity.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@@ -20,10 +19,30 @@
    // 库位编号
    private String locno;
    // 货主
    private String owner;
    //组托物料
    private List<CombMat> combMats;
    /*
    满板
     */
    private String fullPlt;
    @Data
    public static class CombMat {
        private String orderNo;
        //料想码
        private String containerCode;
        //销售订单号
        private String csocode;
        //销售订单行号
        private String isoseq;
        // 物料编号
        private String matnr;
@@ -40,6 +59,8 @@
        // 规格
        private String specs;
        private String zpallet;
    }
}
src/main/java/com/zy/asrs/mapper/LocDetlMapper.java
@@ -58,6 +58,11 @@
    List<LocDetl> queryStock(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos);
    /**
     * 在平库里面查询库存
     */
    List<LocDetl> queryStockByManLoc(@Param("matnr")String matnr, @Param("batch")String batch, @Param("orderNo")String orderNo, @Param("locNos") Set<String> locNos);
    Double queryStockAnfme(String matnr, String batch);
    List<StockVo> queryStockTotal();
src/main/java/com/zy/asrs/mapper/OrderDetlMapper.java
@@ -32,6 +32,7 @@
    int addToLogTable(OrderDetl orderDetl);
    int increaseQtyByOrderNo(@Param("orderNo")String orderNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("qty")Double qty);
    int increaseWorkQtyByOrderNo(@Param("orderNo") String orderNo, @Param("matnr") String matnr, @Param("batch") String batch, @Param("qty") Double qty);
    int increaseWorkQty(@Param("orderId")Long orderId, @Param("matnr")String matnr, @Param("batch")String batch, @Param("workQty")Double workQty);
}
src/main/java/com/zy/asrs/service/MobileService.java
@@ -1,6 +1,7 @@
package com.zy.asrs.service;
import com.alibaba.fastjson.JSONObject;
import com.core.common.R;
import com.zy.asrs.entity.BasDevp;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.OrderDetl;
@@ -38,4 +39,14 @@
    void stockOut(OrderDetl orderDetl, BasDevp staNo, LocDetl locDetl,
                  Double curOutQty, Integer ioType, Long userId, Date now);
    /**
     * 平库下架
     */
    R WarehouseOut(CombParam combParam, Long userId);
    /**
     * 平库上架
     */
    R WarehouseIn(String locNo, String barcode, Long userId);
}
src/main/java/com/zy/asrs/service/impl/ManLocDetlServiceImpl.java
@@ -172,7 +172,7 @@
            manLocDetl.setUnit(mat.getUnit());
            manLocDetl.setBarcode(mat.getBarcode());
            manLocDetl.setPrice(mat.getPrice());
            SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),userId);
            SaasUtils.insertLog(3,manLocDetl.getLocNo(), manLocDetl.getMatnr(),manLocDetl.getAnfme(),userId,manLocDetl.getBatch());
            this.baseMapper.insert(manLocDetl);
        }
    }
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -12,6 +12,7 @@
import com.zy.asrs.entity.param.OffSaleParam;
import com.zy.asrs.entity.param.OpenOrderPakinParam;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.mapper.OrderDetlMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.SaasUtils;
@@ -26,6 +27,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@@ -43,6 +46,10 @@
    private MatService matService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Resource
    private WaitPakinLogService waitPakinLogService;
    @Autowired
    private OrderService orderService;
    @Autowired
@@ -78,6 +85,182 @@
    @Autowired
    private ManLocDetlMapper manLocDetlMapper;
    @Resource
    private OrderDetlMapper orderDetlMapper;
    @Override
    @Transactional
    public R WarehouseOut(CombParam combParam, Long userId) {
        //查询库存数据
        for (CombParam.CombMat combMat : combParam.getCombMats()) {
            ManLocDetl locDetl = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>()
                            .eq("loc_no", combParam.getLocno())
                            .eq("zpallet", combMat.getZpallet())
                            .eq("matnr", combMat.getMatnr())
//                    .eq(LocDetl::getBatch, combMat.getBatch())
            );
            if (Cools.isEmpty(locDetl)) {
                return R.error("未查询到库存数据");
            }
            if (combMat.getAnfme() > locDetl.getAnfme()) {
                return R.error("下架数量错误,超出库存数量");
            }
            if (!Cools.isEmpty(combParam.getOrderNo())) {
                Order order = orderService.selectByNo(combParam.getOrderNo());
                if (Cools.isEmpty(order)) {
                    continue;
                }
                if (order.getSettle() == 1) {
                    orderService.updateSettle(order.getId(), 2L, userId);
                }
                OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch());
                if (Cools.isEmpty(orderDetl)) {
                    continue;
                }
                if (orderDetl.getAnfme() < orderDetl.getWorkQty() + combMat.getAnfme()) {
                    combMat.setAnfme(orderDetl.getAnfme() - orderDetl.getWorkQty());
                }
                // 修改订单明细作业数量
                if (orderDetlMapper.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme()) <= 0) {
                    throw new CoolException("修改单据明细工作数量失败");
                }
                // 修改订单明细完成数量
                if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) {
                    throw new CoolException("修改单据明细完成数量失败");
                }
                // 修改订单状态 作业中 ===>> 已完成
                orderService.checkComplete(combParam.getOrderNo());
            }
            try {
                double i = 0.0;
                double j = locDetl.getAnfme();
                //处理库存信息
                if (combMat.getAnfme().equals(locDetl.getAnfme())) {
                    //库存相等删除数据
                    manLocDetlMapper.deleteLocNo0(combParam.getLocno(), combMat.getMatnr());
                    int count = manLocDetlMapper.selectCount(new EntityWrapper<ManLocDetl>().eq("loc_no", combParam.getLocno()));
                    if (count == 0) {
                        Node node = nodeService.selectByUuid(combParam.getLocno());
                        node.setUpdateTime(new Date());
                        node.setUpdateBy(userId);
                        node.setBarcode("");
                        nodeService.updateById(node);
                    }
                } else {
                    BigDecimal subtract = BigDecimal.valueOf(locDetl.getAnfme()).subtract(BigDecimal.valueOf(combMat.getAnfme()));
                    i = subtract.byteValue();
                    locDetl.setAnfme(subtract.doubleValue());
                    // 更新库存
                    manLocDetlMapper.updateAnfme(subtract.doubleValue(), combParam.getLocno(), combMat.getMatnr(), combMat.getBatch());
                }
                // 记录日志
                SaasUtils.insertLog(1, combParam.getLocno(), combMat.getMatnr(), combMat.getAnfme(), userId,combMat.getBatch());
            } catch (Exception e) {
                throw new CoolException("更新库存数据出错" + e.getMessage());
            }
        }
        return R.ok();
    }
    @Override
    @Transactional
    public R WarehouseIn(String locNo, String barcode, Long userId) {
        //查询组托数据
        List<WaitPakin> list = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", barcode));
        if (Cools.isEmpty(list)) {
            return R.error("未找到组托信息");
        }
        Date now = new Date();
        //插入库存数据
        for (WaitPakin waitPakin : list) {
            Mat mat = matService.selectOne(new EntityWrapper<Mat>()
                    .eq("matnr", waitPakin.getMatnr()));
            ManLocDetl locDetl1 = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr", waitPakin.getMatnr()).
                    eq("batch", waitPakin.getBatch()));
            Node node = nodeService.selectByUuid(locNo);
            if (Cools.isEmpty(node)) {
                throw new CoolException(locNo + ":库位不存在");
            }
            if (!Cools.isEmpty(locDetl1)) {
                locDetl1.setAnfme(waitPakin.getAnfme() + waitPakin.getAnfme());
                locDetl1.setUpdateBy(userId);
                locDetl1.setModiTime(now);
                manLocDetlService.update(locDetl1, new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr", waitPakin.getMatnr()).
                        eq("batch", waitPakin.getBatch()));
            } else {
                ManLocDetl manLocDetl = new ManLocDetl();
                manLocDetl.setLocNo(locNo);
//            manLocDetl.setBarcode(barcode);
                manLocDetl.setZpallet(barcode);
                manLocDetl.setNodeId(node.getId());
                manLocDetl.setMaktx(mat.getMaktx());
                manLocDetl.setMatnr(mat.getMatnr());
                manLocDetl.setSpecs(mat.getSpecs());
                manLocDetl.setBatch(Cools.isEmpty(waitPakin.getBatch()) ? "" : waitPakin.getBatch());
                manLocDetl.setAnfme(waitPakin.getAnfme());
                manLocDetl.setCreateBy(userId);
                manLocDetl.setCreateTime(now);
                manLocDetl.setUpdateBy(userId);
                manLocDetl.setModiTime(now);
                if (!manLocDetlService.insert(manLocDetl)) {
                    throw new CoolException("商品上架失败!");
                }
                // 更新库位条码
                node.setBarcode(barcode);
                node.setUpdateBy(userId);
                node.setUpdateTime(now);
                nodeService.updateById(node);
            }
            // 记录日志
            SaasUtils.insertLog(0, locNo, waitPakin.getMatnr(), waitPakin.getAnfme(), userId,waitPakin.getBatch());
            //是否属于订单数据
//            if (!Cools.isEmpty(waitPakin.getOrderNo())){
//                Order order = orderService.selectByNo(waitPakin.getOrderNo(), hostId);
//                if (Cools.isEmpty(order)){
//                    continue;
//                }
//                OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(),hostId);
//                if (Cools.isEmpty(orderDetl)){
//                    continue;
//                }
//                // 修改订单明细完成数量
//                if (!orderDetlService.increase(order.getId(), hostId, waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getAnfme())) {
//                    throw new CoolException("修改单据明细数量失败");
//                }
//                // 修改订单状态 作业中 ===>> 已完成
//                orderService.checkComplete(waitPakin.getOrderNo(), hostId);
//
//            }
            // 更新入库工作档
            waitPakin.setLocNo(locNo);
            waitPakin.setIoStatus("Y");
            waitPakin.setModiUser(userId);
            waitPakin.setModiTime(now);
            waitPakinService.update(waitPakin,new EntityWrapper<WaitPakin>().eq("zpallet", barcode).eq("matnr",waitPakin.getMatnr())
                    .eq("batch",waitPakin.getBatch()));
            // 保存入库通知档历史档
            if (!waitPakinLogService.save(barcode)) {
                throw new CoolException("保存组托数据失败");
            }
            // 删除入库通知档
            if (!waitPakinService.delete(new EntityWrapper<WaitPakin>().eq("zpallet", barcode))) {
                throw new CoolException("删除组托数据失败");
            }
        }
        return R.ok("上架成功");
    }
    @Override
    @Transactional
@@ -252,7 +435,7 @@
            node.setUpdateBy(userId);
            node.setUpdateTime(now);
            nodeService.updateById(node);
            SaasUtils.insertLog(0,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId);
            SaasUtils.insertLog(0,manLocDetl.getLocNo(), manLocDetl.getMatnr(),combMat.getAnfme(),userId,manLocDetl.getBatch());
        }
    }
@@ -268,7 +451,7 @@
        if (anfme < 0) {
            throw new CoolException("商品库存不足!");
        } else if (anfme == 0){
            SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId);
            SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),offSaleParam.getAnfme(),userId,manLocDetl.getBatch());
            manLocDetlMapper.deleteLocNo0(offSaleParam.getLocNo(), offSaleParam.getMatnr());
            // 清空库位条码
            Node node = nodeService.selectByUuid(offSaleParam.getLocNo());
src/main/java/com/zy/asrs/service/impl/NodeServiceImpl.java
@@ -112,7 +112,7 @@
                manLocDetl.setCreateTime(now);
                manLocDetl.setModiTime(now);
                manLocDetl.setCreateBy(userId);
                SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme(),userId);
                SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme(),userId, manLocDetl.getBatch());
                manLocDetlService.insert(manLocDetl);
            }else {
                check.setAnfme(dto.getCount() + check.getAnfme());
@@ -146,7 +146,7 @@
                if (manLocDetl.getAnfme() - param.getCount() < 0) {
                    return R.error("物料:"+ param.getMatnr() + " 在库位中数量不足");
                } else if (manLocDetl.getAnfme() - param.getCount() == 0) {
                    SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId);
                    SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId,manLocDetl.getBatch());
                    manLocDetlService.delete(new EntityWrapper<ManLocDetl>()
                            .eq("loc_no",node.getUuid())
                            .eq("matnr",param.getMatnr()));
@@ -161,7 +161,7 @@
                    manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>()
                            .eq("loc_no",node.getUuid())
                            .eq("matnr",param.getMatnr()));
                    SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId);
                    SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount(),userId,manLocDetl.getBatch());
                }
            }
        }
@@ -189,7 +189,7 @@
                source.setLocNo(targetNode.getUuid());
                source.setNodeId(targetNode.getId());
                SaasUtils.insertLog(2,source.getLocNo(), source.getMatnr(), source.getAnfme(),userId);
                SaasUtils.insertLog(2,source.getLocNo(), source.getMatnr(), source.getAnfme(),userId,source.getBatch());
                manLocDetlService.insert(source);
            }else {
                check.setAnfme(check.getAnfme() + source.getAnfme());
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java
@@ -71,30 +71,6 @@
            }
        }
        if (complete) {
            // 出库订单重新整理明细
            DocType docType = docTypeService.selectById(order.getDocType());
            if (null != docType && docType.getPakout() == 1) {
                if (!orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id", order.getId()))) {
                    throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                }
                List<WrkDetl> wrkDetls = wrkDetlService.selectAndLogByOrderNo(orderNo);
                for (WrkDetl wrkDetl : wrkDetls) {
                    OrderDetl orderDetl = new OrderDetl();
                    orderDetl.sync(wrkDetl);
                    orderDetl.setQty(orderDetl.getAnfme());
                    orderDetl.setOrderId(order.getId());
                    orderDetl.setOrderNo(orderNo);
                    orderDetl.setStatus(1);
                    orderDetl.setCreateTime(order.getCreateTime());
                    orderDetl.setCreateBy(order.getCreateBy());
                    orderDetl.setUpdateTime(order.getUpdateTime());
                    orderDetl.setUpdateBy(order.getUpdateBy());
                    if (!orderDetlService.insert(orderDetl)) {
                        throw new CoolException("重整出库订单【orderNo = " + order.getOrderNo() + "】明细失败");
                    }
                }
            }
            if (!this.updateSettle(order.getId(), 4L, null)) {
                throw new CoolException("修改订单【orderNo = " + order.getOrderNo() + "】状态为已完成失败");
            }
src/main/java/com/zy/asrs/utils/SaasUtils.java
@@ -7,7 +7,7 @@
import java.util.Date;
public class SaasUtils {
    public static void insertLog(Integer type, String locNo, String matnr,Double anfme, Long userId){
    public static void insertLog(Integer type, String locNo, String matnr,Double anfme, Long userId,String batch){
        SaasLogService bean = SpringUtils.getBean(SaasLogService.class);
        SaasLog saasLog = new SaasLog();
        saasLog.setType(type);
@@ -16,6 +16,7 @@
        saasLog.setIoTime(new Date());
        saasLog.setAnfme(anfme);
        saasLog.setCreateBy(userId);
        saasLog.setBatch(batch);
        bean.insert(saasLog);
    }
}
src/main/java/com/zy/system/entity/SaasLog.java
@@ -1,16 +1,17 @@
package com.zy.system.entity;
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.core.common.Cools;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotations.TableName;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@TableName("sys_saas_log")
@@ -38,6 +39,9 @@
    @ApiModelProperty(value= "")
    private String matnr;
    @ApiModelProperty(value= "批次")
    private String batch;
    @ApiModelProperty(value= "")
    @TableField("io_time")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
src/main/resources/mapper/LocDetlMapper.xml
@@ -401,5 +401,79 @@
        and lm.row1 in (31,32)
        order by row1
    </select>
    <select id="queryStockByManLoc" resultMap="BaseResultMap">
        select a.*
        from man_loc_detl a
        where 1=1
        and a.matnr = #{matnr}
        <if test="batch != null and batch != ''">
            and a.batch = #{batch}
        </if>
        <if test="orderNo != null and orderNo != ''">
            and a.doc_num = #{orderNo}
        </if>
        <if test="locNos != null and locNos.size > 0">
            and a.loc_no not in
            <foreach item="item" collection="locNos" index="index"  separator="," open="(" close=")">
                #{item}
            </foreach>
        </if>
        order by
        DATEPART(yyyy,a.modi_time),DATEPART(mm,a.modi_time),DATEPART(dd,a.modi_time), a.anfme
        desc,
        NEWID(),
        case
        when (left(a.loc_no, 2) = '01') then 0
        when (left(a.loc_no, 2) = '02') then 1
        when (left(a.loc_no, 2) = '03') then 1
        when (left(a.loc_no, 2) = '04') then 0
        when (left(a.loc_no, 2) = '05') then 0
        when (left(a.loc_no, 2) = '06') then 1
        when (left(a.loc_no, 2) = '07') then 1
        when (left(a.loc_no, 2) = '08') then 0
        when (left(a.loc_no, 2) = '09') then 0
        when (left(a.loc_no, 2) = '10') then 1
        when (left(a.loc_no, 2) = '11') then 1
        when (left(a.loc_no, 2) = '12') then 0
        when (left(a.loc_no, 2) = '13') then 0
        when (left(a.loc_no, 2) = '14') then 1
        when (left(a.loc_no, 2) = '15') then 1
        when (left(a.loc_no, 2) = '16') then 0
        when (left(a.loc_no, 2) = '17') then 0
        when (left(a.loc_no, 2) = '18') then 1
        when (left(a.loc_no, 2) = '19') then 1
        when (left(a.loc_no, 2) = '20') then 0
        when (left(a.loc_no, 2) = '21') then 0
        when (left(a.loc_no, 2) = '22') then 1
        when (left(a.loc_no, 2) = '23') then 1
        when (left(a.loc_no, 2) = '24') then 0
        when (left(a.loc_no, 2) = '25') then 0
        when (left(a.loc_no, 2) = '26') then 1
        when (left(a.loc_no, 2) = '27') then 1
        when (left(a.loc_no, 2) = '28') then 0
        when (left(a.loc_no, 2) = '29') then 0
        when (left(a.loc_no, 2) = '30') then 1
        when (left(a.loc_no, 2) = '31') then 1
        when (left(a.loc_no, 2) = '32') then 0
        when (left(a.loc_no, 2) = '33') then 0
        when (left(a.loc_no, 2) = '34') then 1
        when (left(a.loc_no, 2) = '35') then 1
        when (left(a.loc_no, 2) = '36') then 0
        when (left(a.loc_no, 2) = '37') then 0
        when (left(a.loc_no, 2) = '38') then 1
        when (left(a.loc_no, 2) = '39') then 1
        when (left(a.loc_no, 2) = '40') then 0
        when (left(a.loc_no, 2) = '41') then 0
        when (left(a.loc_no, 2) = '42') then 1
        when (left(a.loc_no, 2) = '43') then 1
        when (left(a.loc_no, 2) = '44') then 0
        when (left(a.loc_no, 2) = '45') then 0
        when (left(a.loc_no, 2) = '46') then 1
        when (left(a.loc_no, 2) = '47') then 1
        when (left(a.loc_no, 2) = '48') then 0
        else 0
        end
        desc
    </select>
</mapper>
src/main/resources/mapper/ManLocDetlMapper.xml
@@ -343,5 +343,17 @@
        update man_loc_detl set anfme = #{anfme}
        where node_id = #{nodeId} ;
    </update>
    <update id="updateAnfme">
        update man_loc_detl set anfme = #{anfme}
        where loc_no = #{locNo} and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
</mapper>
src/main/resources/mapper/OrderDetlMapper.xml
@@ -199,5 +199,20 @@
            </otherwise>
        </choose>
    </update>
    <update id="increaseWorkQtyByOrderNo">
        update man_order_detl
        set work_qty = work_qty + #{qty}
        where 1=1
        and order_no = #{orderNo}
        and matnr = #{matnr}
        <choose>
            <when test="batch != null and batch != ''">
                and batch = #{batch}
            </when>
            <otherwise>
                and (batch IS NULL OR batch = '')
            </otherwise>
        </choose>
    </update>
</mapper>
src/main/webapp/static/js/common.js
@@ -222,18 +222,18 @@
]
var detlCols = [
    {field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true}
    {field: 'zpallet', align: 'center',title: '托盘条码', hide: false}
    ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
    ,{field: 'batch', align: 'center',title: '货品特征', sort:true}
    ,{field: 'matnr', align: 'center',title: '商品编号(品号)', sort:true}
    ,{field: 'maktx', align: 'center',title: '商品名称(品名)', sort:true}
    ,{field: 'batch', align: 'center',title: '批次', sort:true}
    ,{field: 'anfme', align: 'center',title: '数量', hide: false}
    ,{field: 'zpallet', align: 'center',title: '托盘条码', hide: false}
    ,{field: 'specs', align: 'center',title: '规格', hide: false}
    ,{field: 'model', align: 'center',title: '代码', hide: true}
    ,{field: 'color', align: 'center',title: '颜色', hide: true}
    ,{field: 'brand', align: 'center',title: '品牌', hide: true}
    ,{field: 'unit', align: 'center',title: '单位', hide: false}
    ,{field: 'locNo', align: 'center',title: '库位', hide: false}
    ,{field: 'price', align: 'center',title: '单价', hide: true}
    ,{field: 'sku', align: 'center',title: 'sku', hide: true}
    ,{field: 'units', align: 'center',title: '单位量', hide: true}
src/main/webapp/static/js/manLocDetl/manLocDetl.js
@@ -2,12 +2,12 @@
function getCol() {
    var cols = [
        {field: 'locNo', align: 'center',title: '库位号'},
        {field: 'zpallet', align: 'center',title: '托盘条码'},
        {field: 'matnr', align: 'center',title: '商品编号', sort:true}
        ,{field: 'maktx', align: 'center',title: '商品名称', sort:true}
        ,{field: 'anfme', align: 'center',title: '数量'}
        ,{field: 'orderNo', align: 'center',title: '单据编号', hide: false}
        ,{field: 'batch', align: 'center',title: '批号', width: 300, sort:true}
        //,{field: 'zpallet', align: 'center',title: '托盘条码'}
        ,{field: 'orderNo', align: 'center',title: '单据编号', hide: true}
        ,{field: 'batch', align: 'center',title: '批号', sort:true}
        ,{field: 'specs', align: 'center',title: '规格'}
        ,{field: 'model', align: 'center',title: '代码', hide: true}
        ,{field: 'color', align: 'center',title: '颜色', hide: true}
src/main/webapp/static/js/saasLog/saasLog.js
@@ -23,14 +23,14 @@
        cols: [[
            {type: 'checkbox'}
            ,{field: 'id', align: 'center',title: 'id', hide:true}
            ,{field: 'locNo', align: 'center',title: '库位'}
            ,{field: 'type$', align: 'center',title: '操作类型'}
            ,{field: 'matnr', align: 'center',title: '物料号'}
            ,{field: 'locNo', align: 'center',title: '库位'}
            ,{field: 'matnr', align: 'center',title: '物料'}
            ,{field: 'batch', align: 'center',title: '批次'}
            ,{field: 'anfme', align: 'center',title: '数量'}
            ,{field: 'createBy', align: 'center',title: '操作账号'}
            ,{field: 'ioTime$', align: 'center',title: '操作时间'}
            ,{field: 'createBy', align: 'center',title: '', hide:true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
            // ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
        ]],
        request: {
            pageName: 'curr',