自动化立体仓库 - WMS系统
zyx
2024-01-14 25314b5ee613c48e7db31138d7fcb8abc4c536be
# 功能完善
29个文件已修改
7个文件已添加
1611 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/DocTypeController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/LocOwnerController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/NodeController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OrderController.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OrderDetlController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OutController.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/PlaController.java 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/PlaQtyController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/Pla.java 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/PlaLog.java 245 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/PlaQty.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/GlobleParameter.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/OrderDomainParam.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/mapper/PlaLogMapper.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/MobileService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/OrderDetlService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/PlaLogService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderDetlServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/PlaLogServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/OrderLogScheduler.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/utils/PlaExcelListener.java 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/entity/PlaExcel.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/web/BaseController.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/cool.js 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/order.js 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/order/out.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/pla/plaDetl.js 222 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/pla/waitingPakin.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/order/order.html 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/order/out.html 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pla/plaDetl.html 137 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pla/returned.html 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pla/sellout.html 175 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/DocTypeController.java
@@ -112,6 +112,7 @@
            Map<String, Object> map = new HashMap<>();
            map.put("id", docType.getDocId());
            map.put("value", docType.getDocName());
            map.put("type","docType");
            result.add(map);
        }
        return R.ok(result);
src/main/java/com/zy/asrs/controller/LocOwnerController.java
@@ -123,6 +123,7 @@
            map.put("value", locOwner.getOwner());
            map.put("phone", locOwner.getPhone());
            map.put("addr", locOwner.getAddr());
            map.put("type", "locOwner");
            result.add(map);
        }
        return R.ok(result);
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -17,6 +17,7 @@
import com.zy.asrs.service.*;
import com.zy.common.model.WrkDto;
import com.zy.common.web.BaseController;
import com.zy.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -427,7 +428,14 @@
        if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){
            return R.error("有参数为空,无法入库");
        }
        mobileService.plaPakin(locNo,batch,packageNo);
        //测试
        if(true){
            User user = new User();
            user.setUsername("test");
            mobileService.plaPakin(locNo,batch,packageNo,user);
            return R.ok();
        }
        mobileService.plaPakin(locNo,batch,packageNo,getUser());
        return R.ok();
    }
@@ -468,4 +476,11 @@
        mobileService.plaPakout(locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme);
        return R.ok();
    }
    public static void main(String[] args) {
        String aa = "aabb";
        String[] ccs = aa.split("cc");
        System.out.println(ccs[0]);
    }
}
src/main/java/com/zy/asrs/controller/NodeController.java
@@ -13,9 +13,8 @@
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.Node;
import com.zy.asrs.entity.param.InitPakoutParam;
import com.zy.asrs.entity.param.LocMastInitParam;
import com.zy.asrs.entity.param.NodeInitPatam;
import com.zy.asrs.entity.param.PakinParam;
import com.zy.asrs.entity.result.KeyValueVo;
@@ -24,7 +23,6 @@
import com.zy.common.entity.NodeExcel;
import com.zy.common.entity.NodeExcelListener;
import com.zy.common.entity.Parameter;
import com.zy.common.model.Shelves;
import com.zy.common.utils.ListUtils;
import com.zy.common.utils.NodeUtils;
import com.zy.common.utils.TreeUtils;
@@ -38,8 +36,6 @@
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
import static jdk.nashorn.api.scripting.ScriptUtils.convert;
@RestController
public class NodeController extends BaseController {
@@ -392,8 +388,11 @@
                        locNo = param.getName()+"-" +String.format("%02d", r) + String.format("%02d", b) + String.format("%02d", l);
                    }
                    //客户要求格式位A-01-01-01
                    StringBuilder sb = new StringBuilder(locNo);
                    sb.insert(sb.length()-4,"-");
                    sb.insert(sb.length()-2,"-");
                    locNo = sb.toString();
                    if (locNo == null){
                        continue;
src/main/java/com/zy/asrs/controller/OrderController.java
@@ -133,13 +133,13 @@
                DateUtils.convert(now),    // 单据日期
                param.getDocType(),    // 单据类型
                null,    // 项目编号
                null,    //
                param.getItemName(),    //
                null,    // 调拨项目编号
                null,    // 初始票据号
                null,    // 票据号
                null,    // 客户编号
                null,    // 客户
                null,    // 联系方式
                param.getNumber(),    // 票据号
                param.getCstmr(),    // 客户编号
                param.getCstmrName(),    // 客户
                param.getTel(),    // 联系方式
                null,    // 操作人员
                null,    // 合计金额
                null,    // 优惠率
@@ -209,9 +209,14 @@
        Date now = new Date();
        Long userId = getUserId();
        // 修改主档
        if (!param.getDocType().equals(order.getDocType())) {
        if (!param.getDocType().equals(order.getDocType()) || param.getCstmrName() != order.getCstmrName() || !Cools.eq(param.getItemName(),order.getItemName())) {
            order.setDocType(param.getDocType());
            order.setUpdateBy(userId);
            order.setCstmr(param.getCstmr());
            order.setCstmrName(param.getCstmrName());
            order.setTel(param.getTel());
            order.setNumber(param.getNumber());
            order.setItemName(param.getItemName());
            order.setUpdateTime(now);
            if (!orderService.updateById(order)) {
                throw new CoolException("修改订单类型失败");
@@ -227,8 +232,7 @@
        List<DetlDto> list = new ArrayList<>();
        for (OrderDetl orderDetl : param.getOrderDetlList()) {
            DetlDto dto = new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch());
            //if (DetlDto.has(list, dto)) {
            if(false){
            if (DetlDto.has(list, dto)) {
                OrderDetl item = orderDetlService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch());
                item.setAnfme(item.getAnfme() + orderDetl.getAnfme());
                if (!orderDetlService.updateById(item)) {
@@ -343,13 +347,18 @@
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<Order> wrapper = new EntityWrapper<>();
        wrapper.like("id", condition);
        wrapper.like("order_no", condition);
        Page<Order> page = orderService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (Order order : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", order.getId());
            map.put("value", order.getOrderNo());
            map.put("customer",order.getCstmrName());
            map.put("phone",order.getTel());
            map.put("addr",order.getNumber());
            map.put("allocate",order.getItemName());
            map.put("type","order");
            result.add(map);
        }
        return R.ok(result);
@@ -393,7 +402,7 @@
        List<OrderDetlVo> orderDetlVos=new ArrayList<>();
        OrderDetlVo orderDetlVo=new OrderDetlVo();
        for (OrderDetl o:
             list) {
                list) {
            orderDetlVo.setOrderNo(o.getOrderNo());
            orderDetlVo.setMatnr(o.getMatnr());
            orderDetlVo.setMaktx(o.getMaktx());
src/main/java/com/zy/asrs/controller/OrderDetlController.java
@@ -173,14 +173,25 @@
    @RequestMapping(value = "/orderDetlQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        if(condition.split(",").length < 2){
            return R.ok();
        }
        String maktxCondition = condition.split(",")[0];
        Long orderId = Long.parseLong(condition.split(",")[1]);
        EntityWrapper<OrderDetl> wrapper = new EntityWrapper<>();
        wrapper.like("id", condition);
        wrapper.eq("order_id",orderId);
        wrapper.like("maktx", maktxCondition);
        Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (OrderDetl orderDetl : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
            map.put("id", orderDetl.getId());
            map.put("value", orderDetl.getId());
            map.put("value", orderDetl.getMaktx());
            map.put("weight",orderDetl.getAnfme() - orderDetl.getWorkQty());
            map.put("type","orderDetl");
            result.add(map);
        }
        return R.ok(result);
src/main/java/com/zy/asrs/controller/OutController.java
@@ -11,15 +11,13 @@
import com.zy.common.model.TaskDto;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -47,10 +45,6 @@
    private ManPakOutService manPakOutService;
    @Autowired
    private ManLocDetlService manLocDetlService;
    @Autowired
    private PlaService plaService;
    @Autowired
    private PlaQtyService plaQtyService;
    @PostMapping("/out/pakout/orderDetlIds/auth")
@@ -74,15 +68,6 @@
            }
        }
        List<PlaQty> plaQties = new ArrayList<>();
        for (OrderDetl orderDetl : orderDetls) {
            plaService.queryStock(orderDetl,plaQties);
        }
        return R.ok(plaQties);
/*
        Set<String> exist = new HashSet<>();
        for (OrderDetl orderDetl : orderDetls) {
@@ -123,13 +108,12 @@
                locDtos.add(locDto);
            }
        }
        return R.ok().add(locDtos); */
        return R.ok().add(locDtos);
    }
    @PostMapping("/out/pakout/auth")
    @ManagerAuth(memo = "订单出库")
    public synchronized R pakout(@RequestBody List<LocDto> locDtos) throws InterruptedException {
        int[][] is=new int[locDtos.size()][2];
        for (int i=0;i<locDtos.size();i++){
            LocDto locDto=locDtos.get(locDtos.size()-1-i);
@@ -184,31 +168,8 @@
    @PostMapping("/out/pakout2/auth")
    @ManagerAuth(memo = "生成拣货单")
    @Transactional
    public synchronized R pakout2(@RequestBody List<PlaQty> plaQties) throws InterruptedException {
        for (PlaQty plaQty : plaQties){
            if(Cools.isEmpty(plaQty.getLocNo())){
                continue;
            }
            //插入一条pla的拣货信息
            plaQtyService.insert(plaQty);
            addPakOUT(plaQty);
            Pla pla = plaService.selectByBatchAndPackageNo(plaQty.getBatch(), plaQty.getPackageNo());
            //pla明细中修改锁定出库的重量
            pla.setQtyAnfme(pla.getQtyAnfme() + plaQty.getQtyAnfme());
            plaService.updateById(pla);
            OrderDetl orderDetl = orderDetlService.selectById(plaQty.getOrderDetlId());
            orderDetl.setWorkQty(orderDetl.getWorkQty() + plaQty.getQtyAnfme());
            orderDetlService.updateById(orderDetl);
            orderService.updateSettle(plaQty.getOrderId(),2L,null);
        }
        return R.ok();
    /*  int[][] is = new int[locDtos.size()][2];
    public synchronized R pakout2(@RequestBody List<LocDto> locDtos) throws InterruptedException {
        int[][] is = new int[locDtos.size()][2];
        List<String> matnrs=new ArrayList<>();
        for (int i = 0; i < locDtos.size(); i++) {
            LocDto locDto = locDtos.get(locDtos.size() - 1 - i);
@@ -300,25 +261,6 @@
                addPakOUT(locDto,uuid).equals(R.ok());
            }
        }
        return R.ok(); */
    }
    private R addPakOUT(PlaQty plaQty){
        ManPakOut manPakOut=new ManPakOut();
        manPakOut.setWrkNo(plaQty.getOrderNo()+"-"+System.currentTimeMillis());
        manPakOut.setWrkSts((long)1);
        manPakOut.setAnfme(plaQty.getQtyAnfme());
        manPakOut.setLocNo(plaQty.getLocNo());
        manPakOut.setBatch(plaQty.getBatch());
        manPakOut.setBarcode(plaQty.getPackageNo());
        manPakOut.setUuid(String.valueOf(System.currentTimeMillis()));
        manPakOut.setCreateTime(new Date());
        manPakOut.setUpdateTime(new Date());
        manPakOut.setCount(0.0);
        manPakOut.setDocNum(plaQty.getOrderNo());
        manPakOut.setNodeId(plaQty.getOrderDetlId());
        manPakOut.setStatus(0);
        manPakOutService.insert(manPakOut);
        return R.ok();
    }
src/main/java/com/zy/asrs/controller/PlaController.java
@@ -1,26 +1,30 @@
package com.zy.asrs.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.ManPakOut;
import com.zy.asrs.entity.Pla;
import com.zy.asrs.entity.PlaQty;
import com.zy.asrs.service.ManPakOutService;
import com.zy.asrs.service.PlaQtyService;
import com.zy.asrs.service.PlaService;
import com.zy.asrs.entity.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.PlaExcelListener;
import com.zy.asrs.utils.SaasUtils;
import com.zy.common.entity.PlaExcel;
import com.zy.common.web.BaseController;
import lombok.Synchronized;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -34,6 +38,12 @@
    private PlaQtyService plaQtyService;
    @Autowired
    private ManPakOutService manPakOutService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private PlaLogService plaLogService;
    @RequestMapping(value = "/pla/list/auth")
    @ManagerAuth
@@ -44,6 +54,7 @@
        excludeTrash(param);
        EntityWrapper<Pla> wrapper = new EntityWrapper<>();
        convert(param, wrapper);
        wrapper.orderBy("pakin_time",false);
        allLike(Pla.class, param.keySet(), wrapper, condition);
        return R.ok(plaService.selectPage(new Page<>(curr, limit), wrapper));
    }
@@ -63,6 +74,11 @@
    public R update(@RequestBody List<Pla> plas) {
        System.out.println(plas.toString());
        plas.forEach(pla -> {
            Pla plaSave = plaService.selectById(pla.getId());
            PlaLog plaLog = new PlaLog();
            BeanUtils.copyProperties(plaSave,plaLog);
            plaLog.setId(null);
            plaLogService.insert(plaLog);
            plaService.updateById(pla);
        });
        return R.ok();
@@ -76,29 +92,52 @@
    @RequestMapping(value = "/pla/sellout/auth")
    @ManagerAuth
    @Transactional
    @Synchronized
    public R sellout(@RequestBody List<Pla> plas) {
        plas.forEach(pla -> {
        String orderNo = plas.get(0).getOrderNo();
        String maktx = plas.get(0).getBrand();
        Double allOrderWeight = 0.0;
        Order order = orderService.selectByNo(orderNo);
        OrderDetl orderDetl = orderDetlService.selectByOrderNoAndMaktx(orderNo, maktx);
        for (Pla pla : plas){
            allOrderWeight += pla.getOrderWeight();
            if(pla.getWeightAnfme() - pla.getQtyAnfme() - pla.getOrderWeight() < 0){
                throw new CoolException("该库存剩余重量不足,请调整出库重量");
                throw new CoolException("批号:" + pla.getBatch() +",包号:" + pla.getPackageNo() +" 剩余可出库重量不足,请调整出库重量");
            }
            pla.setQtyAnfme(pla.getQtyAnfme() + pla.getOrderWeight());
            pla.setHandlerBy(getUser().getUsername());
            pla.setStatus("待出库");
            pla.setPakoutTime(pla.getPakoutTime().split("\\(")[0]);
            //生成此次作业信息
            PlaQty plaQty = new PlaQty();
            BeanUtils.copyProperties(pla,plaQty);
            plaQty.setCreateTime(new Date());
            plaQty.setId(null);
            plaQty.setTransfer(order.getDocType$());
            plaQty.setOrderDetlId(orderDetl.getId());
            plaService.updateById(pla);
            plaQtyService.insert(plaQty);
            //生成拣货单
            addPakOUT(plaQty);
        });
        };
        //修改单据信息
        if(orderDetl.getAnfme()-orderDetl.getWorkQty()-allOrderWeight < 0){
            throw new CoolException("该订单出库数量大于订单待出数量,请重新选择出库数量");
        }
        if(order.getStatus() < 2){
            orderService.updateSettle(order.getId(),2L,getUserId());
        }
        orderDetl.setWorkQty(orderDetl.getWorkQty() + allOrderWeight);
        orderDetlService.updateById(orderDetl);
        return R.ok();
    }
@@ -125,6 +164,36 @@
        return R.ok();
    }
    /**
     * excel导入模板下载
     */
    @RequestMapping(value = "/pla/excel/import/mould")
    public void plaExcelImportMould(HttpServletResponse response) throws IOException {
        List<PlaExcel> excels = new ArrayList<>();
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding("utf-8");
        String fileName = URLEncoder.encode("聚乳酸Excel导入模板", "UTF-8");
        response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
        EasyExcel.write(response.getOutputStream(), PlaExcel.class)
                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .sheet("sheet1")
                .doWrite(excels);
    }
    // excel导入
    @PostMapping(value = "/pla/excel/import/auth")
    @ManagerAuth(memo = "pla档案数据导入")
    @Transactional
    public R matExcelImport(MultipartFile file) throws IOException {
        PlaExcelListener listener = new PlaExcelListener(getUserId());
        try {
            EasyExcel.read(file.getInputStream(), PlaExcel.class, listener).sheet().doRead();
        }catch (Exception e){
            throw new CoolException("导入的数据格式错误,原因:" + e.getMessage());
        }
        return R.ok("成功同步"+listener.getTotal()+"条pla物料数据");
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
@@ -132,6 +201,10 @@
                String[] dates = val.split(RANGE_TIME_LINK);
                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
            }else if (entry.getKey().contains("Min")){
                wrapper.ge(entry.getKey().substring(0,entry.getKey().length()-3),val);
            }else if (entry.getKey().contains("Max")){
                wrapper.le(entry.getKey().substring(0,entry.getKey().length()-3),val);
            } else {
                wrapper.like(entry.getKey(), val);
            }
@@ -143,6 +216,7 @@
        manPakOut.setWrkNo(plaQty.getOrderNo()+"-"+System.currentTimeMillis());
        manPakOut.setWrkSts((long)1);
        manPakOut.setAnfme(plaQty.getOrderWeight());
        manPakOut.setMaktx(plaQty.getBrand());
        manPakOut.setLocNo(plaQty.getLocNo());
        manPakOut.setBatch(plaQty.getBatch());
        manPakOut.setBarcode(plaQty.getPackageNo());
@@ -152,6 +226,7 @@
        manPakOut.setCount(0.0);
        manPakOut.setDocNum(plaQty.getOrderNo());
        manPakOut.setStatus(0);
        manPakOut.setDocId(plaQty.getOrderDetlId());
        manPakOut.setNodeId(plaQty.getId());
        //manPakOut.setNodeId(plaQty.getOrderDetlId());
        manPakOutService.insert(manPakOut);
src/main/java/com/zy/asrs/controller/PlaQtyController.java
@@ -57,6 +57,9 @@
            if (Cools.isEmpty(manPakOut.getStatus()) || manPakOut.getStatus() != 1) {
                return false;
            }
            if(plaQty.getReturned() > 0){
                return false;
            }
            return true;
        }).collect(Collectors.toList());
@@ -86,6 +89,7 @@
            map.put("id", plaQty.getId());
            map.put("value", orderNo);
            map.put("customer", plaQty.getCustomer());
            map.put("type","returned");
            result.add(map);
        }
        return R.ok(result);
src/main/java/com/zy/asrs/entity/Pla.java
@@ -1,13 +1,16 @@
package com.zy.asrs.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotations.TableField;
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 org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@@ -19,111 +22,175 @@
    //入库时间
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @TableField("pakin_time")
    private String pakinTime;
    private Date pakinTime;
    //批号
    @TableField("batch")
    private String batch;
    //主体
    @ExcelProperty(value = "主体")
    @TableField("owner")
    private String owner;
    //包装号
    @TableField("package_no")
    private String packageNo;
    //主体
    @ExcelProperty(value = "物资类别")
    @TableField("type")
    private String type;
    //牌号
    @TableField("brand")
    private String brand;
    //重量
    @TableField("weight")
    private Double weight;
    //生产订单编号
    @ExcelProperty(value = "生产订单编号")
    @TableField("pro_order_no")
    private String proOrderNo;
    //车间
    @ExcelProperty(value = "生产车间")
    @TableField("workshop")
    private String workshop;
    //生产线
    @ExcelProperty(value = "生产线")
    @TableField("line")
    private String line;
    //生产线
    @ExcelProperty(value = "存货编码")
    @TableField("matnr")
    private String matnr;
    //牌号
    @ExcelProperty(value = "牌号")
    @TableField("brand")
    private String brand;
    //批号
    @TableField("batch")
    @ExcelProperty(value = "批号")
    private String batch;
    //包装号
    @TableField("package_no")
    @ExcelProperty(value = "包装号")
    private String packageNo;
    //包装号
    @ExcelProperty(value = "生产日期")
    @TableField("pro_date")
    private String proDate;
    //重量
    @TableField("weight")
    @ExcelProperty(value = "重量")
    private Double weight;
    @ApiModelProperty(value= "单位")
    @ExcelProperty(value = "单位")
    @TableField("unit")
    private String unit;
    //包装类型
    @TableField("package_type")
    @ExcelProperty(value = "包装类型")
    private String packageType;
    //托盘类型
    @TableField("zpallet_type")
    @ExcelProperty(value = "托盘类型")
    private String zpalletType;
    //缠膜
    @TableField("film_wrap")
    @ExcelProperty(value = "缠膜")
    private String filmWrap;
    //熔指
    @TableField("finger_melting")
    @ExcelProperty(value = "熔指")
    private Double fingerMelting;
    //水分
    @TableField("water")
    @ExcelProperty(value = "水分")
    private Double water;
    //熔点
    @TableField("fusing_point")
    @ExcelProperty(value = "熔点")
    private Double fusingPoint;
    //挥发份1
    @TableField("vadf1")
    @ExcelProperty(value = "挥发份1")
    private Double vadf1;
    //挥发份2
    @TableField("vadf2")
    @ExcelProperty(value = "挥发份2")
    private Double vadf2;
    //黄度
    @TableField("yellowness")
    @ExcelProperty(value = "黄度")
    private Double yellowness;
    //不透明度
    @TableField("opacity")
    @ExcelProperty(value = "不透明度")
    private Double opacity;
    //水分
    @TableField("water")
    private Double water;
    //L值
    @TableField("l")
    @ExcelProperty(value = "l值")
    private Double l;
    //a值
    @TableField("a")
    @ExcelProperty(value = "a值")
    private Double a;
    //b值
    @TableField("b")
    @ExcelProperty(value = "b值")
    private Double b;
    //填充
    @TableField("fill_in")
    @ExcelProperty(value = "填充")
    private Double fillIn;
    //质量状态
    @TableField("mass_state")
    @ExcelProperty(value = "质量状体")
    private String massState;
    //质量问题
    @TableField("problem")
    @ExcelProperty(value = "备注")
    private String problem;
    //仓库
    @TableField("stash")
    private String stash;
    //应用方向
    @ExcelProperty(value = "应用方向")
    @TableField("direction")
    private String direction;
    //库位
    @TableField("loc_no")
    private String locNo;
    //存放位置
    @ExcelProperty(value = "存放位置")
    @TableField("position")
    private String position;
    //剩余重量
    @TableField("weight_anfme")
    @ExcelProperty(value = "入库量")
    private Double weightAnfme = 0.0;
    //待出库数量
    @TableField("qty_anfme")
    private Double qtyAnfme = 0.0;
    //仓库
    @TableField("stash")
    //@ExcelProperty(value = "仓库")
    private String stash;
    //库位
    @TableField("loc_no")
    //@ExcelProperty(value = "库位")
    private String locNo;
    //状态
    @TableField("status")
@@ -168,4 +235,11 @@
    @TableField("memo")
    private String memo;
    public String getPakinTime$() {
        if (Cools.isEmpty(this.pakinTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.pakinTime);
    }
}
src/main/java/com/zy/asrs/entity/PlaLog.java
New file
@@ -0,0 +1,245 @@
package com.zy.asrs.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotations.TableField;
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 org.springframework.format.annotation.DateTimeFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
@Data
@TableName("asr_pla_detl_log")
public class PlaLog {
    @ApiModelProperty(value= "ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    //入库时间
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date pakinTime;
    //主体
    @ExcelProperty(value = "主体")
    @TableField("owner")
    private String owner;
    //主体
    @ExcelProperty(value = "物资类别")
    @TableField("type")
    private String type;
    //生产订单编号
    @ExcelProperty(value = "生产订单编号")
    @TableField("pro_order_no")
    private String proOrderNo;
    //车间
    @ExcelProperty(value = "生产车间")
    @TableField("workshop")
    private String workshop;
    //生产线
    @ExcelProperty(value = "生产线")
    @TableField("line")
    private String line;
    //生产线
    @ExcelProperty(value = "存货编码")
    @TableField("matnr")
    private String matnr;
    //牌号
    @ExcelProperty(value = "牌号")
    @TableField("brand")
    private String brand;
    //批号
    @TableField("batch")
    @ExcelProperty(value = "批号")
    private String batch;
    //包装号
    @TableField("package_no")
    @ExcelProperty(value = "包装号")
    private String packageNo;
    //包装号
    @ExcelProperty(value = "生产日期")
    @TableField("pro_date")
    private String proDate;
    //重量
    @TableField("weight")
    @ExcelProperty(value = "重量")
    private Double weight;
    @ApiModelProperty(value= "单位")
    @ExcelProperty(value = "单位")
    @TableField("unit")
    private String unit;
    //包装类型
    @TableField("package_type")
    @ExcelProperty(value = "包装类型")
    private String packageType;
    //托盘类型
    @TableField("zpallet_type")
    @ExcelProperty(value = "托盘类型")
    private String zpalletType;
    //缠膜
    @TableField("film_wrap")
    @ExcelProperty(value = "缠膜")
    private String filmWrap;
    //熔指
    @TableField("finger_melting")
    @ExcelProperty(value = "熔指")
    private Double fingerMelting;
    //水分
    @TableField("water")
    @ExcelProperty(value = "水分")
    private Double water;
    //熔点
    @TableField("fusing_point")
    @ExcelProperty(value = "熔点")
    private Double fusingPoint;
    //挥发份1
    @TableField("vadf1")
    @ExcelProperty(value = "挥发份1")
    private Double vadf1;
    //挥发份2
    @TableField("vadf2")
    @ExcelProperty(value = "挥发份2")
    private Double vadf2;
    //黄度
    @TableField("yellowness")
    @ExcelProperty(value = "黄度")
    private Double yellowness;
    //不透明度
    @TableField("opacity")
    @ExcelProperty(value = "不透明度")
    private Double opacity;
    //L值
    @TableField("l")
    @ExcelProperty(value = "l值")
    private Double l;
    //a值
    @TableField("a")
    @ExcelProperty(value = "a值")
    private Double a;
    //b值
    @TableField("b")
    @ExcelProperty(value = "b值")
    private Double b;
    //填充
    @TableField("fill_in")
    @ExcelProperty(value = "填充")
    private Double fillIn;
    //质量状态
    @TableField("mass_state")
    @ExcelProperty(value = "质量状体")
    private String massState;
    //质量问题
    @TableField("problem")
    @ExcelProperty(value = "备注")
    private String problem;
    //应用方向
    @ExcelProperty(value = "应用方向")
    @TableField("direction")
    private String direction;
    //存放位置
    @ExcelProperty(value = "存放位置")
    @TableField("position")
    private String position;
    //剩余重量
    @TableField("weight_anfme")
    @ExcelProperty(value = "入库量")
    private Double weightAnfme = 0.0;
    //待出库数量
    @TableField("qty_anfme")
    private Double qtyAnfme = 0.0;
    //仓库
    @TableField("stash")
    //@ExcelProperty(value = "仓库")
    private String stash;
    //库位
    @TableField("loc_no")
    //@ExcelProperty(value = "库位")
    private String locNo;
    //状态
    @TableField("status")
    private String status;
    //步骤
    @TableField("step")
    private int step;
    @TableField("create_time")
    private Date createTime;
    @TableField("modify_time")
    private Date modifyTime;
    @TableField("create_user")
    private String createUser;
    @TableField("modify_user")
    private String modifyUser;
    @TableField("order_no")
    private String orderNo;
    @TableField("pakout_time")
    private String pakoutTime;
    @TableField("order_weight")
    private Double orderWeight;
    @TableField("handler_by")
    private String handlerBy;
    @TableField("transfer")
    private String transfer;
    @TableField("customer")
    private String customer;
    @TableField("allocate")
    private String allocate;
    @TableField("memo")
    private String memo;
    public String getPakinTime$() {
        if (Cools.isEmpty(this.pakinTime)){
            return "";
        }
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.pakinTime);
    }
}
src/main/java/com/zy/asrs/entity/PlaQty.java
@@ -22,6 +22,9 @@
    //包装号
    private String packageNo;
    //牌号
    private String brand;
    //单据明细id
    private Long orderDetlId;
@@ -61,7 +64,8 @@
    @TableField("memo")
    private String memo;
    private int returned;
    //退回重量
    private Double returned;
    public PlaQty(String batch, String packageNo, Long orderDetlId, Long orderId, String orderNo, Double qtyAnfme, String locNo, Date createTime) {
        this.batch = batch;
src/main/java/com/zy/asrs/entity/param/GlobleParameter.java
New file
@@ -0,0 +1,9 @@
package com.zy.asrs.entity.param;
public class GlobleParameter {
    public static final String PLA_STATUS_0 = "待入库";
    public static final String PLA_STATUS_1 = "已入库";
    public static final String PLA_STATUS_2 = "待出库";
    public static final String PLA_STATUS_3 = "部分出库";
    public static final String PLA_STATUS_4 = "全部出库";
}
src/main/java/com/zy/asrs/entity/param/OrderDomainParam.java
@@ -17,6 +17,19 @@
    private String orderNo;
    private Long cstmr;
    private String cstmrName;
    //客户电话
    private String tel;
    //该字段作为单据的客户地址显示
    private String number;
    //调拨到
    private String itemName;
    private List<OrderDetl> orderDetlList;
src/main/java/com/zy/asrs/mapper/PlaLogMapper.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.zy.asrs.entity.PlaLog;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
@Mapper
@Repository
public interface PlaLogMapper extends BaseMapper<PlaLog> {
}
src/main/java/com/zy/asrs/service/MobileService.java
@@ -54,7 +54,7 @@
    R manDetlOriginOut(JSONObject json, User user);
    void plaPakin(String locNo, String batch, String packageNo);
    void plaPakin(String locNo, String batch, String packageNo, User user);
    void plaPakout(String locNo, String batch, String packageNo, String orderNo, String orderDetlId, String wrkNo,Double anfme);
}
src/main/java/com/zy/asrs/service/OrderDetlService.java
@@ -41,4 +41,6 @@
    Boolean checkAllDetlFinish(String orderNo);
    Integer sameOrderComb(String orderNo, String matnr, String batch);
    OrderDetl selectByOrderNoAndMaktx(String orderNo, String maktx);
}
src/main/java/com/zy/asrs/service/PlaLogService.java
New file
@@ -0,0 +1,9 @@
package com.zy.asrs.service;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.PlaLog;
public interface PlaLogService extends IService<PlaLog> {
}
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -10,13 +10,11 @@
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.CombParam;
import com.zy.asrs.entity.param.MobileAdjustNewParam;
import com.zy.asrs.entity.param.MobileAdjustParam;
import com.zy.asrs.entity.param.OffSaleParam;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.SaasUtils;
import com.zy.asrs.utils.Utils;
import com.zy.common.model.DetlDto;
import com.zy.common.service.CommonService;
import com.zy.common.utils.Synchro;
@@ -1207,18 +1205,29 @@
    }
    @Override
    public void plaPakin(String locNo, String batch, String packageNo) {
    public void plaPakin(String locNo, String batch, String packageNo,User user) {
        Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo);
        if(!pla.getLocNo().equals(locNo)){
            throw new CoolException("该物料入库的库位错误");
        if(Cools.isEmpty(pla)){
            throw new CoolException("系统未检测到该包物料信息,请重新录入");
        }
        if("已入库".equals(pla.getStatus())){
        if(Cools.eq(GlobleParameter.PLA_STATUS_1,pla.getStatus())){
            throw new CoolException("该物料已入库");
        }
        pla.setStatus("已入库");
        pla.setStatus(GlobleParameter.PLA_STATUS_1);
        pla.setModifyTime(new Date());
        pla.setPakinTime(new Date());
        Node node = nodeService.selectByUuid(locNo);
        if(Cools.isEmpty(node)){
            throw new CoolException("库位信息不正确");
        }
        pla.setStash(node.getParentName());
        pla.setLocNo(node.getUuid());
        plaService.updateById(pla);
        SaasUtils.insertLog(0,locNo,batch+","+packageNo,pla.getWeightAnfme(),null);
        SaasUtils.insertLog(0,locNo,batch+","+packageNo,pla.getWeightAnfme(),user.getUsername());
    }
    @Override
@@ -1243,6 +1252,10 @@
            manPakOutService.updateById(manPakOut);
        }
        //更新plaQty信息
        plaQty.setPakoutTime(Utils.getDateStr(new Date()));
        plaQtyService.updateById(plaQty);
        //更新pla明细
        pla.setWeightAnfme(pla.getWeightAnfme() - anfme);
        pla.setQtyAnfme(pla.getQtyAnfme() - anfme);
@@ -1254,5 +1267,14 @@
        plaService.updateById(pla);
        SaasUtils.insertLog(1,locNo,batch+","+packageNo,anfme,null);
        //更新订单明细
        Order order = orderService.selectByNo(orderNo);
        OrderDetl orderDetl = orderDetlService.selectById(plaQty.getOrderDetlId());
        orderDetl.setQty(orderDetl.getQty() + anfme);
        orderDetlService.updateById(orderDetl);
        orderService.checkComplete(orderNo);
    }
}
src/main/java/com/zy/asrs/service/impl/OrderDetlServiceImpl.java
@@ -110,4 +110,9 @@
        Integer sum = this.baseMapper.sameOrderComb(orderNo, matnr, batch);
        return  sum != null ? sum : 0;
    }
    @Override
    public OrderDetl selectByOrderNoAndMaktx(String orderNo, String maktx) {
        return this.selectOne(new EntityWrapper<OrderDetl>().eq("order_no",orderNo).eq("maktx",maktx));
    }
}
src/main/java/com/zy/asrs/service/impl/PlaLogServiceImpl.java
New file
@@ -0,0 +1,12 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.asrs.entity.PlaLog;
import com.zy.asrs.mapper.PlaLogMapper;
import com.zy.asrs.service.PlaLogService;
import org.springframework.stereotype.Service;
@Service("plaLogService")
public class PlaLogServiceImpl extends ServiceImpl<PlaLogMapper, PlaLog> implements PlaLogService {
}
src/main/java/com/zy/asrs/service/impl/PlaServiceImpl.java
@@ -7,9 +7,11 @@
import com.zy.asrs.entity.OrderDetl;
import com.zy.asrs.entity.Pla;
import com.zy.asrs.entity.PlaQty;
import com.zy.asrs.entity.param.GlobleParameter;
import com.zy.asrs.mapper.PlaMapper;
import com.zy.asrs.service.PlaQtyService;
import com.zy.asrs.service.PlaService;
import com.zy.asrs.utils.SaasUtils;
import com.zy.asrs.utils.Utils;
import com.zy.system.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,7 +42,7 @@
        if(!Cools.isEmpty(orderDetl.getBrand())){
            wrapper.eq("package_no",orderDetl.getBrand());
        }
        wrapper.eq("status","已入库");
        wrapper.eq("status", GlobleParameter.PLA_STATUS_1);
        wrapper.ge("finger_melting", orderDetl.getFingerMeltingMin()).le("finger_melting", orderDetl.getFingerMeltingMax());
        wrapper.ge("fusing_point", orderDetl.getFusingPointMin()).le("fusing_point", orderDetl.getFusingPointMax());
        wrapper.ge("yellowness", orderDetl.getYellownessMin()).le("yellowness", orderDetl.getYellownessMax());
@@ -91,7 +93,11 @@
    public void returned(List<PlaQty> plaQties, User user) {
        plaQties.forEach(plaQty -> {
            PlaQty plaQtyOut = plaQtyService.selectById(plaQty.getId());
            plaQtyOut.setReturned(1);
            if(Cools.isEmpty(plaQtyOut.getReturned())){
                plaQtyOut.setReturned(plaQty.getOrderWeight());
            }else {
                plaQtyOut.setReturned(plaQty.getOrderWeight()+plaQtyOut.getReturned());
            }
            plaQtyService.updateById(plaQtyOut);
            PlaQty plaQtyReturned = new PlaQty();
@@ -101,17 +107,23 @@
            plaQtyReturned.setLocNo(plaQtyOut.getLocNo());
            plaQtyReturned.setOrderNo(plaQtyOut.getOrderNo());
            plaQtyReturned.setPakoutTime(Utils.getDateStr(new Date()));
            plaQtyReturned.setOrderWeight(0 - plaQtyOut.getOrderWeight());
            plaQtyReturned.setOrderWeight(plaQty.getOrderWeight());
            plaQtyReturned.setTransfer("退回入库");
            plaQtyReturned.setHandlerBy(user.getUsername());
            plaQtyReturned.setCustomer(plaQtyOut.getCustomer());
            plaQtyReturned.setMemo(plaQty.getMemo());
            plaQtyService.insert(plaQtyReturned);
            //直接更新pla的库存
            Pla pla = this.selectByBatchAndPackageNo(plaQty.getBatch(), plaQty.getPackageNo());
            pla.setStatus("待入库");
            //pla.setStatus(GlobleParameter.PLA_STATUS_0);
            pla.setWeightAnfme(plaQty.getOrderWeight());
            pla.setStatus(GlobleParameter.PLA_STATUS_1);
            this.updateById(pla);
            SaasUtils.insertLog(0,pla.getLocNo(),pla.getBatch()+","+pla.getPackageNo(),plaQty.getOrderWeight(),user.getUsername());
        });
    }
}
src/main/java/com/zy/asrs/task/OrderLogScheduler.java
@@ -7,7 +7,6 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
@@ -23,7 +22,7 @@
    @Value("${erp.enable}")
    private boolean isERP;
    @Scheduled(cron = "0/10 * * * * ? ")
    //@Scheduled(cron = "0/10 * * * * ? ")
    private void execute(){
        List<Order> orders = orderService.selectToBeHistoryOrder(isERP);
        if (orders.isEmpty()) {
src/main/java/com/zy/asrs/utils/PlaExcelListener.java
New file
@@ -0,0 +1,97 @@
package com.zy.asrs.utils;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.Pla;
import com.zy.asrs.entity.param.GlobleParameter;
import com.zy.asrs.service.PlaService;
import com.zy.common.entity.MatExcel;
import com.zy.common.entity.PlaExcel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by vincent on 2019-11-25
 */
@Slf4j
public class PlaExcelListener extends AnalysisEventListener<PlaExcel> {
    private int total = 0;
    private Long userId;
    public PlaExcelListener() {
    }
    public PlaExcelListener(Long userId) {
        this.userId = userId;
    }
    /**
     * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收
     */
    private static final int BATCH_COUNT = 50;
    private final List<MatExcel> list = new ArrayList<>();
    /**
     * 这里会一行行的返回头
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
    }
    /**
     * 这个每一条数据解析都会来调用
     */
    @Override
    public void invoke(PlaExcel excel, AnalysisContext ctx) {
        PlaService plaService = SpringUtils.getBean(PlaService.class);
        Date now = new Date();
        // 商品
        if(Cools.isEmpty(excel.getBatch()) || Cools.isEmpty(excel.getPackageNo())){
            return;
        }
        Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo());
        if (pla == null) {
            pla = excel;
            pla.setStep(2);
            pla.setCreateTime(new Date());
            pla.setStatus(GlobleParameter.PLA_STATUS_0);
            if (!plaService.insert(pla)) {
                throw new CoolException("保存商品信息失败,商品编码:" + excel.getMatnr());
            }
            total++;
        }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_0)){
            excel.setId(pla.getId());
            excel.setCreateTime(pla.getCreateTime());
            excel.setModifyTime(pla.getModifyTime());
            excel.setStep(2);
            excel.setStatus(GlobleParameter.PLA_STATUS_0);
            BeanUtils.copyProperties(excel,pla);
            plaService.updateById(pla);
            total++;
        }
    }
    /**
     * 所有数据解析完成了调用
     * 适合事务
     */
    @Override
    public void doAfterAllAnalysed(AnalysisContext ctx) {
        log.info("新增{}条物料信息!", total);
    }
    public int getTotal() {
        return total;
    }
}
src/main/java/com/zy/common/entity/PlaExcel.java
New file
@@ -0,0 +1,16 @@
package com.zy.common.entity;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.zy.asrs.entity.Pla;
import lombok.Data;
/**
 * 0.A 1.B 2.C 3.D 4.E 5.F 6.G 7.H 8.I
 * 9.J 10.K 11.L 12.M 13.N 14.O 15.P 16.Q 17.R 18.S
 * 19.T 20.U 21.V 22.W 23.X 24.Y 25.Z
 */
@Data
@ExcelIgnoreUnannotated
public class PlaExcel extends Pla {
}
src/main/java/com/zy/common/web/BaseController.java
@@ -169,6 +169,9 @@
                column = field.getName();
            }
            if (!set.contains(column)) {
                if(Cools.eq(column,"pakinTime")){
                    continue;
                }
                columns.add(column);
            }
        }
src/main/webapp/static/js/cool.js
@@ -40,6 +40,9 @@
    if(type){
        inputDomVal = inputDomVal + "," + type;
    }
    if(getForeignKeyQuery(val) === 'orderDetlQuery'){
        inputDomVal = inputDomVal + "," + $('#orderNo').val();
    }
    //debugger;
    selectDom.length = 0;
    var defaultOption = new Option("取消选择", "");
@@ -61,6 +64,9 @@
                    option.addr = list[i].addr;
                    option.phone = list[i].phone;
                    option.customer = list[i].customer;
                    option.allocate = list[i].allocate;
                    option.weight =  list[i].weight;
                    option.type = list[i].type;
                    selectDom.options[i+1] = option;
                }
                selectDom.style.display='block';
@@ -99,18 +105,23 @@
    } else {
        cacd.val(selectOptionDom.html());
        realDom.val(selectOptionDom.attr("title"));
        if(selectOptionDom[0].phone){
            $('#phone').val(selectOptionDom[0].phone);
        if(selectOptionDom[0].type === "docType"){
            $('#weight').val("");
            $('#maktxV').val("");
        }
        if(selectOptionDom[0].addr){
            $('#addr').val(selectOptionDom[0].addr);
        if(selectOptionDom[0].type === "order" || selectOptionDom[0].type === "locOwner"){
            $('#allocate').val(selectOptionDom[0].allocate ? selectOptionDom[0].allocate : "");
            $('#customer').val(selectOptionDom[0].customer ? selectOptionDom[0].customer : "");
            $('#phone').val(selectOptionDom[0].phone ? selectOptionDom[0].phone : "");
            $('#addr').val(selectOptionDom[0].addr ? selectOptionDom[0].addr : "");
        }
        if(selectOptionDom[0].customer){
            $('#customerR').val(selectOptionDom[0].customer);
        if(selectOptionDom[0].type === "returned"){
            $('#customer').val(selectOptionDom[0].customer ? selectOptionDom[0].customer : "");
            tableReload();
        }
        }else {
            $('#customerR').val("");
        if(selectOptionDom[0].type === "orderDetl"){
            $('#weight').val(selectOptionDom[0].weight);
        }
    }
    inputDom.val("");
@@ -138,7 +149,7 @@
                {field: 'id', title: 'id', hide:true},
                {field: 'batch', title: '批号'},
                {field: 'packageNo', title: '包号'},
                {field: 'orderWeight', title: '重量'}
                {field: 'orderWeight', title: '重量',edit:true}
            ]],
            request: {
src/main/webapp/static/js/order/order.js
@@ -47,6 +47,8 @@
            {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 160, width: 160},
            {field: 'createTime$', title: '创建时间', minWidth: 200, width: 200},
            {field: 'settle$', align: 'center', title: '状态', templet: '#settleTpl',  minWidth: 160, width: 160},
            {field: 'cstmrName', align: 'center',title: '客户名称'},
            {field: 'itemName', align: 'center',title: '调拨到'},
            {field: 'memo', align: 'center',title: '备注', hide: true},
            {field: 'createBy$', align: 'center', title: '操作员',  minWidth: 160, width: 160},
            {align: 'center', title: '操作', toolbar: '#operate', width: 260}
@@ -152,6 +154,8 @@
        var data = obj.data;
        var layEvent = obj.event;
        if (layEvent === 'edit') {
            showEditModel(data);
        } else if (layEvent === 'del') {
@@ -188,24 +192,22 @@
                        cellMinWidth: 100,
                        cols: [[
                            {type: 'numbers'},
                            // {field: 'matnr', title: '商品编码', width: 160},
                            // {field: 'maktx', title: '商品名称', width: 160},
                            //
                            // {field: 'batch', title: '批号'},
                            {field: 'batch', title: '批次'},
                            {field: 'brand', title: '牌号'},
                            {field: 'fingerMeltingMin', title: '最小熔指'},
                            {field: 'fingerMeltingMax', title: '最大熔指'},
                            {field: 'fusingPointMin', title: '最小熔点'},
                            {field: 'fusingPointMax', title: '最大熔点'},
                            {field: 'yellownessMin', title: '最小黄度'},
                            {field: 'yellownessMax', title: '最大黄度'},
                            {field: 'opacityMin', title: '最小不透明度'},
                            {field: 'opacityMax', title: '最大不透明度'},
                            {field: 'matnr', title: '商品编码', width: 160},
                            {field: 'maktx', title: '商品名称', width: 160},
                            {field: 'batch', title: '批号'},
                            {field: 'anfme', title: '数量'},
                            {field: 'workQty', title: '作业数量'},
                            {field: 'qty', title: '完成数量', style: 'font-weight: bold'},
                            // {field: 'unit', title: '单位'},
                            // {
                            //     field: 'createTime$', title: '创建时间', sort: true, templet: function (d) {
                            //         return util.toDateString(d.createTime);
                            //     },  width: 180
                            // },
                            // {field: 'inQty', title: '已入库量'},
                            // {field: 'color', title: '颜色'},
                            // {field: 'specs', title: '规格'},
                        ]],
                        request: {
                            pageName: 'curr',
@@ -260,10 +262,6 @@
                    let nList = admin.util.deepClone(xxDataList);
                    console.log(nList);
                    for (let xi = 0; xi < nList.length; xi++) {
                        if(!nList[xi].anfme){
                            layer.msg('明细数量不合法', {icon: 2});
                            return false;
                        }
                        if (nList[xi].anfme <= 0){
                            layer.msg('明细数量不合法', {icon: 2});
                            return false;
@@ -286,6 +284,11 @@
                            orderId: Number(data.field.id),
                            docType: Number(data.field.docType),
                            orderNo: data.field.orderNo,
                            cstmr: data.field.cstmr,
                            cstmrName: data.field.cstmrName,
                            tel: data.field.tel,
                            number: data.field.number,
                            itemName: data.field.itemName,
                            orderDetlList: nList
                        }),
                        contentType:'application/json;charset=UTF-8',
@@ -316,24 +319,14 @@
                    cellMinWidth: 100,
                    cols: [[
                        {type: 'numbers', title: '#'},
                        // {field: 'matnr', title: '商品编码', width: 160},
                        // {field: 'maktx', title: '商品名称', width: 200},
                        // {field: 'specs', title: '规格'},
                        {field: 'matnr', title: '商品编码', width: 160},
                        {field: 'maktx', title: '商品名称', width: 200},
                        {field: 'specs', title: '规格'},
                        {field: 'batch', title: '批次', edit: true},
                        {field: 'brand', title: '牌号', edit: true},
                        {field: 'fingerMeltingMin', title: '最小熔指', edit: true},
                        {field: 'fingerMeltingMax', title: '最大熔指', edit: true},
                        {field: 'fusingPointMin', title: '最小熔点', edit: true},
                        {field: 'fusingPointMax', title: '最大熔点', edit: true},
                        {field: 'yellownessMin', title: '最小黄度', edit: true},
                        {field: 'yellownessMax', title: '最大黄度', edit: true},
                        {field: 'opacityMin', title: '最小不透明度', edit: true},
                        {field: 'opacityMax', title: '最大不透明度', edit: true},
                        {field: 'anfme', title: '重量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                        {field: 'anfme', title: '数量(修改)', style: 'color: blue;font-weight: bold', edit: true, minWidth: 110, width: 110},
                        // {field: 'payment', title: '货物状态',align: 'center', templet: '#payment'},
                        {field: 'qty', title: '作业重量',  minWidth: 100, width: 100},
                        {field: 'qty', title: '作业数量',  minWidth: 100, width: 100},
                        // {field: 'unit', title: '单位', width: 80},
                        {field: 'memo', title: '备注' , edit: true},
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
@@ -435,7 +428,7 @@
                        }
                    }
                    data[obj.field] = obj.value;
                   insTbSSXM.reloadData({data: xxDataList,scrollPos: true});
                    insTbSSXM.reloadData({data: xxDataList,scrollPos: true});
                });
                $('#matAddBtnComment').click(function () {
@@ -444,9 +437,6 @@
                // 显示添加明细表单弹窗
                function showEditModel2(exp) {
                    xxDataList.push({});
                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                    return;
                    admin.open({
                        type: 1,
                        offset: '150px',
src/main/webapp/static/js/order/out.js
@@ -30,23 +30,15 @@
        height: 'full-120',
        where: {order_id: 9999999999},
        cols: [[
            {type: 'checkbox'},
            {type: 'numbers', title: '#'},
            {field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl'},
            {field: 'fingerMeltingMin', title: '最小熔指'},
            {field: 'fingerMeltingMax', title: '最大熔指'},
            {field: 'fusingPointMin', title: '最小熔点'},
            {field: 'fusingPointMax', title: '最大熔点'},
            {field: 'yellownessMin', title: '最小黄度'},
            {field: 'yellownessMax', title: '最大黄度'},
            {field: 'opacityMin', title: '最小不透明度'},
            {field: 'opacityMax', title: '最大不透明度'},
            // ,{field: 'matnr', align: 'center',title: '商品编码', width: 160}
            // ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            {type: 'checkbox'}
            ,{type: 'numbers', title: '#'}
            ,{field: 'orderNo', align: 'center',title: '单据编号', templet: '#orderNoTpl', width: 160}
            ,{field: 'matnr', align: 'center',title: '商品编码', width: 160}
            ,{field: 'maktx', align: 'center',title: '商品名称', width: 200}
            ,{field: 'anfme', align: 'center',title: '总数量', style: 'font-weight: bold'}
            ,{field: 'enableQty', align: 'center',title: '待出数量', style: 'font-weight: bold'}
            // ,{field: 'unit', align: 'center',title: '单位', hide: true}
            // ,{field: 'barcode', align: 'center',title: '商品条码', hide: true}
            ,{field: 'unit', align: 'center',title: '单位', hide: true}
            ,{field: 'barcode', align: 'center',title: '商品条码', hide: true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 160}
        ]],
        request: {
@@ -152,16 +144,13 @@
                                cols: [[
                                    // {type: 'checkbox', merge: ['orderNo']},
                                    {field: 'orderNo', title: '单据编号', merge: true, align: 'center'},
                                    {field: 'batch', title: '批号', merge: true, align: 'center'},
                                    {field: 'packageNo', title: '包号', align: 'center'},
                                    {field: 'orderDetlId', title: 'id', align: 'center',hide:true},
                                    {field: 'qtyAnfme', title: '出库数量', align: 'center'},
                                    {field: 'locNo', title: '库位号', align: 'center',templet: '#locNoTpl'},
                                    {field: 'title', title: '商品', merge: true, align: 'center', width: 350},
                                    {field: 'hostId', title: 'id', align: 'center'},
                                    // { title: '剩余需求量', align: 'center' , width: 120, toolbar: '#checkNeedQty'},
                                    // {field: 'anfme', title: '实际数量', align: 'center', width: 90, style: 'font-weight: bold'},
                                    // { title: '出库数量', align: 'center',field: 'anfme', width: 90, style: 'font-weight: bold; color: red'},
                                    // {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'},
                                    // {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'},
                                    { title: '出库数量', align: 'center',field: 'anfme', width: 90, style: 'font-weight: bold; color: red'},
                                    {field: 'locNo', title: '货位', align: 'center', width: 100, templet: '#locNoTpl'},
                                    {field: 'staNos', align: 'center', title: '出库站', merge: ['locNo'], templet: '#tbBasicTbStaNos'},
                                    // {type: 'checkbox', merge: ['locNo']},
                                ]],
                                done: function (res) {
src/main/webapp/static/js/pla/plaDetl.js
@@ -6,65 +6,88 @@
var data = [];
var checkStatus = [];
var dataCheck = [];
var admin;
function getCol() {
    var cols = [
        {field: 'id', title: 'id', align: 'center',hide:true}
        ,{type: 'checkbox'}
        ,{field: 'pakinTime', title: '入库时间', align: 'center'}
        ,{field: 'batch', align: 'center',title: '批号'}
        ,{field: 'packageNo', align: 'center',title: '包号'}
        ,{field: 'brand', align: 'center',title: '牌号'}
        ,{field: 'weight', align: 'center',title: '重量(KG)', hide:true}
        ,{field: 'workshop', align: 'center',title: '生产车间', hide:true}
        ,{field: 'line', align: 'center',title: '生产线', hide:true}
        ,{field: 'packageType', align: 'center',title: '包装类型'}
        ,{field: 'zpalletType', align: 'center',title: '托盘类型'}
        ,{field: 'filmWrap', align: 'center',title: '缠膜', edit: true}
        ,{field: 'fingerMelting', align: 'center',title: '熔指(g/10min)'}
        ,{field: 'fusingPoint', align: 'center',title: '熔点(℃)'}
        ,{field: 'vadf1', align: 'center',title: '挥发份1(%)', hide:true}
        ,{field: 'vadf2', align: 'center',title: '挥发份2(%)', hide:true}
        ,{field: 'yellowness', align: 'center',title: '黄度',  hide:true}
        ,{field: 'opacity', align: 'center',title: '不透明度(0-100%)', hide:true}
        ,{field: 'water', align: 'center',title: '水分(ppm)', hide:true}
        ,{field: 'l', align: 'center',title: 'l值', edit: true, hide:true}
        ,{field: 'a', align: 'center',title: 'a值', edit: true, hide:true}
        ,{field: 'b', align: 'center',title: 'b值', edit: true, hide:true}
        ,{field: 'fillIn', align: 'center',title: '填充(%)', edit: true}
        ,{field: 'massState', align: 'center',title: '质量状态', hide:true}
        ,{field: 'problem', align: 'center',title: '质量问题', hide:true}
        ,{field: 'stash', align: 'center',title: '仓库', edit:true}
        ,{field: 'locNo', align: 'center',title: '库位', edit:true}
        ,{field: 'weightAnfme', align: 'center',title: '剩余重量(KG)', edit:true}
        ,{field: 'status', align: 'center',title: '状态', edit:true}
        ,{align: 'center', title: '明细', toolbar: '#tbLook'}
        ,{field: 'orderNo', align: 'center',title: '单号', edit:true}
        ,{field: 'pakoutTime', align: 'center',title: '出库时间', edit:true}
        ,{field: 'orderWeight', align: 'center',title: '重量', edit:true}
        ,{field: 'handlerBy', align: 'center',title: '经办人', edit:true}
        ,{field: 'transfer', align: 'center',title: '流转形式', edit:true}
        ,{field: 'customer', align: 'center',title: '客户名称', edit:true}
        ,{field: 'allocate', align: 'center',title: '调拨到', edit:true}
        ,{field: 'memo', align: 'center',title: '备注', edit:true}
        ,{field: 'pakinTime$', title: '入库时间', align: 'center'}
        ,{field: 'owner', align: 'center',title: '主体',edit:true}
        ,{field: 'type', align: 'center',title: '物资类别',hide:true,edit:true}
        ,{field: 'proOrderNo', align: 'center',title: '单号',hide:true,edit:true}
        ,{field: 'matnr', align: 'center',title: '存货编码',hide:true,edit:true}
        ,{field: 'batch', align: 'center',title: '批号',edit:true}
        ,{field: 'packageNo', align: 'center',title: '包号',edit:true}
        ,{field: 'brand', align: 'center',title: '牌号',edit:true}
        ,{field: 'weight', align: 'center',title: '重量(KG)',edit:true}
        ,{field: 'workshop', align: 'center',title: '生产车间',hide:true,edit:true}
        ,{field: 'line', align: 'center',title: '生产线',hide:true,edit:true}
        ,{field: 'proDate', align: 'center',title: '生产日期',edit:true}
        ,{field: 'packageType', align: 'center',title: '包装类型',edit:true}
        ,{field: 'zpalletType', align: 'center',title: '托盘类型',edit:true}
        ,{field: 'filmWrap', align: 'center',title: '缠膜',edit:true}
        ,{field: 'fingerMelting', align: 'center',title: '熔指(g/10min)',edit:true}
        ,{field: 'fusingPoint', align: 'center',title: '熔点(℃)',edit:true}
        ,{field: 'vadf1', align: 'center',title: '挥发份1(%)', hide:true,edit:true}
        ,{field: 'vadf2', align: 'center',title: '挥发份2(%)', hide:true,edit:true}
        ,{field: 'yellowness', align: 'center',title: '黄度',edit:true}
        ,{field: 'opacity', align: 'center',title: '不透明度(0-100%)',edit:true}
        ,{field: 'water', align: 'center',title: '水分(ppm)', hide:true,edit:true}
        ,{field: 'l', align: 'center',title: 'l值', hide:true,edit:true}
        ,{field: 'a', align: 'center',title: 'a值', hide:true,edit:true}
        ,{field: 'b', align: 'center',title: 'b值', hide:true,edit:true}
        ,{field: 'fillIn', align: 'center',title: '填充(%)',hide:true,edit:true}
        ,{field: 'massState', align: 'center',title: '质量状态',edit:true}
        ,{field: 'problem', align: 'center',title: '备注',edit:true}
        ,{field: 'stash', align: 'center',title: '仓库',edit:true}
        ,{field: 'locNo', align: 'center',title: '库位',edit:true}
        ,{field: 'weightAnfme', align: 'center',title: '剩余重量(KG)',edit:true}
        ,{field: 'qtyAnfme', align: 'center',title: '待出库重量(KG)',hide:true}
        ,{field: 'status', align: 'center',title: '状态', templet: setState ,edit:true}
        ,{align: 'center', title: '流转明细', toolbar: '#tbLook'}
        ,{field: 'orderNo', align: 'center',title: '单号', hide:true}
        ,{field: 'pakoutTime', align: 'center',title: '出库时间', hide:true}
        ,{field: 'orderWeight', align: 'center',title: '重量', hide:true}
        ,{field: 'handlerBy', align: 'center',title: '经办人', hide:true}
        ,{field: 'transfer', align: 'center',title: '流转形式', hide:true}
        ,{field: 'customer', align: 'center',title: '客户名称', hide:true}
        ,{field: 'allocate', align: 'center',title: '调拨到', hide:true}
        ,{field: 'memo', align: 'center',title: '备注', hide:true}
    ];
    return cols;
}
function setState(data){
    if(data.status === "待入库"){
        return  "<span style='color: orange'>待入库</span>"
    }else if(data.status === "已入库"){
        return  "<span style='color: blue'>已入库</span>"
    }else if(data.status === "待出库"){
        return  "<span style='color: red'>待出库</span>"
    }else if(data.status === "部分出库"){
        return  "<span style='color: black'>部分出库</span>"
    }else if(data.status === "全部出库"){
        return  "<span style='color: gray'>全部出库</span>"
    }
}
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).use(['table','laydate', 'form', 'admin'], function() {
}).extend({
    dropdown: 'dropdown/dropdown',
}).use(['table','laydate', 'form', 'admin', 'dropdown'], function() {
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
    var layDate = layui.laydate;
    var form = layui.form;
    var admin = layui.admin;
    admin = layui.admin;
    // 数据渲染
    tableIns = table.render({
        elem: '#plaDetl',
        headers: {token: localStorage.getItem('token')},
        url: baseUrl+'/pla/list/auth?step=3',
        url: baseUrl+'/pla/list/auth?step=2',
        page: true,
        limit: 16,
        limits: [16, 30, 50, 100, 200, 500],
@@ -119,7 +142,7 @@
                type: 1,
                title: false,
                area: '1200px',
                offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'],
                offset: ['600px', (left - 1200 + $a.outerWidth()) + 'px'],
                shade: .01,
                shadeClose: true,
                fixed: false,
@@ -168,6 +191,41 @@
                    });
                }
            });
        }
    })
    // 监听头工具栏事件
    table.on('toolbar(plaDetl)', function (obj) {
        var checkStatus = table.checkStatus(obj.config.id)
        switch(obj.event) {
            case 'updateData':
                var data = checkStatus.data;
                if (data.length === 0){
                    layer.msg('请选择数据');
                } else {
                    layer.confirm('确定修改'+(data.length===1?'此':data.length)+'条数据吗', function(){
                        $.ajax({
                            url: baseUrl+"/pla/update/auth",
                            headers: {'token': localStorage.getItem('token')},
                            data: JSON.stringify(data),
                            contentType:'application/json;charset=UTF-8',
                            method: 'POST',
                            traditional:true,
                            success: function (res) {
                                if (res.code === 200){
                                    layer.closeAll();
                                    tableReload(false);
                                } else if (res.code === 403){
                                    top.location.href = baseUrl+"/";
                                } else {
                                    layer.msg(res.msg)
                                }
                            }
                        })
                    });
                }
                break;
        }
    })
@@ -259,7 +317,6 @@
                    layer.msg("有未填写字段");
                    return;
                }
                data[i].step = 3;
                dataSave.push(data[i]);
            }else {
                dataOld.push(data[i]);
@@ -371,13 +428,22 @@
    $(document).on('click','#sellout', function () {
        let data = table.cache.plaDetl;
        let dataSave = [];
        let dataOld = [];
        var data = table.cache.plaDetl;
        var dataSave = [];
        var dataOld = [];
        var brand;
        for(var i=0; i<data.length; i++){
            if(data[i].LAY_CHECKED){
                if(data[i].status === "待入库" || data[i].status === "全部出库"){
                    layer.msg("选中的明细还未入库或者已全部出库,请重新选择");
                if(data[i].status === "待入库" || data[i].status === "全部出库"|| data[i].weightAnfme <= data[i].qtyAnfme){
                    layer.msg("选中的明细还未入库或者已全部出库或者没有剩余可出重量,请重新选择");
                    return;
                }
                brand = brand ? brand : data[i].brand;
                if( brand != data[i].brand){
                    layer.msg("选中的明细中含有多种牌号,请重新选择");
                    return;
                }
                dataSave.push(data[i]);
@@ -391,20 +457,16 @@
            layer.msg("未勾选,请先勾选需要更改的库存");
            return;
        }
        if(dataSave.length > 1){
            layer.msg("请勾选一条库存明细");
            return;
        }
        layer.open({
            type: 2,
            title: '卖出',
            title: '出库',
            maxmin: true,
            area: ['800px', top.detailHeight],
            shadeClose: false,
            content: 'sellout.html',
            success: function(layero, index){
                layer.getChildFrame('#data-detail-submit-edit', index).hide();
                //layer.getChildFrame('#data-detail-submit-edit', index).hide();
                top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
                layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
@@ -449,7 +511,7 @@
            shadeClose: false,
            content: 'pickup.html',
            success: function(layero, index){
                layer.getChildFrame('#data-detail-submit-edit', index).hide();
                //layer.getChildFrame('#data-detail-submit-edit', index).hide();
                top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
                layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
@@ -483,4 +545,58 @@
    parent.layer.closeAll();
});
// excel导入模板下载
function excelMouldDownload(){
    layer.load(1, {shade: [0.1,'#fff']});
    location.href = baseUrl + "/pla/excel/import/mould";
    layer.closeAll('loading');
}
// excel导入
function importExcel() {
    $("#importExcel").trigger("click");
}
function upload(obj){
    if(!obj.files) {
        return;
    }
    var file = obj.files[0];
    admin.confirm('确认同步 [' + file.name +'] 文件吗?', function (index) {
        layer.load(1, {shade: [0.1,'#fff']});
        var url = baseUrl + "/pla/excel/import/auth";
        var form = new FormData();
        form.append("file", file);
        xhr = new XMLHttpRequest();
        xhr.open("post", url, true); //post方式,url为服务器请求地址,true 该参数规定请求是否异步处理。
        xhr.setRequestHeader('token', localStorage.getItem('token'));
        xhr.onload = uploadComplete; //请求完成
        xhr.onerror =  uploadFailed; //请求失败
        xhr.onloadend = function () { // // 上传完成重置文件流
            layer.closeAll('loading');
            $("#importExcel").val("");
        };
        // xhr.upload.onprogress = progressFunction;//【上传进度调用方法实现】
        xhr.upload.onloadstart = function(){//上传开始执行方法
            ot = new Date().getTime();   //设置上传开始时间
            oloaded = 0;//设置上传开始时,以上传的文件大小为0
        };
        xhr.send(form);
    }, function(index){
        $("#importExcel").val("");
    });
}
function uploadComplete(evt) {
    var res = JSON.parse(evt.target.responseText);
    if(res.code === 200) {
        layer.msg(res.msg, {icon: 1});
        loadTree("");
    } else {
        layer.msg(res.msg, {icon: 2});
    }
}
function uploadFailed(evt) {
    var res = JSON.parse(evt.target.responseText);
    layer.msg(res.msg, {icon: 2});
}
src/main/webapp/static/js/pla/waitingPakin.js
@@ -143,7 +143,6 @@
                    layer.msg("有未填写字段");
                    return;
                }
                data[i].step = 3;
                data[i].status = "待入库";
                data[i].weightAnfme = data[i].weight;
                dataSave.push(data[i]);
src/main/webapp/views/order/order.html
@@ -8,7 +8,7 @@
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
        <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <!--    <link rel="stylesheet" href="../../static/css/common.css" media="all">-->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
@@ -89,16 +89,16 @@
<script type="text/html" id="operate">
    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="printExcel">导出Excel</a>
    {{# if (d.settle == 0 || d.settle == 1) { }}
        <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
        <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">删除</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs btn-delete" lay-event="del">删除</a>
    {{# } }}
    {{# if (d.settle == 2) { }}
    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">完结</a>
    {{# } }}
<!--    {{# if ((d.settle == 0 || d.settle == 1) && (d.docType == 1 || d.docType == 11 || d.docType == 14 || d.docType == 17 || d.docType == 18)) { }}-->
<!--    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="manPrint">生成拣货单</a>-->
<!--    {{# } }}-->
    <!--    {{# if ((d.settle == 0 || d.settle == 1) && (d.docType == 1 || d.docType == 11 || d.docType == 14 || d.docType == 17 || d.docType == 18)) { }}-->
    <!--    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="manPrint">生成拣货单</a>-->
    <!--    {{# } }}-->
    <a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="btnPrint">打印</a>
</script>
<!-- 表格操作列 -->
@@ -149,7 +149,43 @@
            <label class="layui-form-label">单据编号:</label>
            <div class="layui-input-block">
                <input id="orderNo" name="orderNo" placeholder="输入单据编号" type="text" class="layui-input" maxlength="20" lay-verType="tips" />
<!--                lay-verify="required"-->
                <!--                lay-verify="required"-->
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">客户名称:</label>
            <div class="layui-input-block cool-auto-complete">
                <input id="customer" name="cstmr" class="layui-input" type="text" style="display: none" >
                <input id="customerV" name="cstmrName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                <div class="cool-auto-complete-window">
                    <input class="cool-auto-complete-window-input" data-key="locOwnerQueryBylocOwner" onkeyup="autoLoad(this.getAttribute('data-key'))">
                    <select class="cool-auto-complete-window-select" data-key="locOwnerQueryBylocOwnerSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label">客户电话:</label>
            <div class="layui-input-block">
                <input id="phone" name="tel" class="layui-input" type="text" readonly="readonly">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">客户地址:</label>
            <div class="layui-input-block">
                <input id="addr" name="number" class="layui-input" type="text" readonly="readonly">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">调拨到 :</label>
            <div class="layui-input-block cool-auto-complete">
                <input id="allocate" name="itemName" class="layui-input" type="text" style="display: none">
                <input id="allocateV" name="itemName" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                <div class="cool-auto-complete-window">
                    <input class="cool-auto-complete-window-input" data-key="configTypeQueryByAllocate" data-value="allocate" onkeyup="autoLoad(this.getAttribute('data-key'))">
                    <select class="cool-auto-complete-window-select" data-key="configTypeQueryByAllocateSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item" style="position: relative;">
@@ -178,7 +214,7 @@
    <form id="matEditForm" lay-filter="matEditForm" class="layui-form model-form">
        <input name="experimentId" type="hidden"/>
        <div class="layui-form-item" style="float: left">
            <label class="layui-form-label">批号 - 多选</label>
            <label class="layui-form-label">物料 - 多选</label>
            <div class="layui-input-block">
                <div id="mat" name="mat">
                </div>
src/main/webapp/views/order/out.html
@@ -175,13 +175,13 @@
<script type="text/html" id="tbBasicTbStaNos">
    <div class="ew-select-fixed">
        {{#if (d.manu!='平库') {}}
            <select class="order-sta-select" lay-filter="tbBasicTbStaNos">
                {{#if (d.staNos!=null) {}}
                {{# for(let i=0; i<d.staNos.length; i++) { }}
                <option value="{{d.staNos[i]}}">{{d.staNos[i]}}</option>
                {{# } }}
                {{# } }}
            </select>
        <select class="order-sta-select" lay-filter="tbBasicTbStaNos">
            {{#if (d.staNos!=null) {}}
            {{# for(let i=0; i<d.staNos.length; i++) { }}
            <option value="{{d.staNos[i]}}">{{d.staNos[i]}}</option>
            {{# } }}
            {{# } }}
        </select>
        {{# } }}
    </div>
</script>
@@ -196,7 +196,7 @@
<script type="text/html" id="locNoTpl">
    <span name="locNo"
          {{# if( d.locNo){ }}
          {{# if( d.lack === false){ }}
          class="layui-badge layui-badge-green" >{{d.locNo}}</span>
    {{# } else { }}
    class="layui-badge layui-badge-red" >库存不足</span>
src/main/webapp/views/pla/plaDetl.html
@@ -9,7 +9,7 @@
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/admin.css?v=318" media="all">
    <link rel="stylesheet" href="../../static/css/cool.css" media="all">
    <link rel="stylesheet" href="../../static/css/common.css" media="all">
    <style>
        html {
            height: 100%;
@@ -27,7 +27,7 @@
        .layui-card-header {
            border-bottom: none;
        }
        #search-box {
        .search-box {
            padding: 30px 0 10px 0;
        }
        #search-box .layui-inline:first-child {
@@ -109,49 +109,120 @@
<!-- 功能区 -->
<div class="function-area">
    <button id="rework" style="alignment: right" class="function-btn">重做</button>
<!--    <button id="rework" style="alignment: right" class="function-btn">重做</button>-->
    <button id="updateZpallet" style="alignment: right" class="function-btn1">换包装/托盘/缠膜</button>  |
    <button id="sellout" style="alignment: right" class="function-btn">卖出</button>
    <button id="pickup" style="alignment: right" class="function-btn">取货</button>  |
    <button id="sellout" style="alignment: right" class="function-btn">出库</button>
<!--    <button id="pickup" style="alignment: right" class="function-btn">取货</button>  |-->
    <button id="returned" style="alignment: right" class="function-btn">退回</button>
</div>
<!-- 搜索栏 -->
<div id="search-box" class="layui-form layui-card-header">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="batch" placeholder="批号" autocomplete="off">
<div id="search-box" >
    <div class="layui-form layui-card-header">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="batch" placeholder="批号" autocomplete="off">
            </div>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="package_no" placeholder="包号" autocomplete="off">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="package_no" placeholder="包号" autocomplete="off">
            </div>
        </div>
    </div>
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="brand" placeholder="牌号" autocomplete="off">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="brand" placeholder="牌号" autocomplete="off">
            </div>
        </div>
    </div>
    <!--    <div class="layui-inline">-->
    <!--        <div class="layui-input-inline">-->
    <!--            <input class="layui-input" type="text" name="row" placeholder="排数" autocomplete="off">-->
    <!--        </div>-->
    <!--    </div>-->
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="status" placeholder="状态" autocomplete="off">
            </div>
        </div>
    </div>
        <!--    <div class="layui-inline">-->
        <!--        <div class="layui-input-inline">-->
        <!--            <input class="layui-input" type="text" name="row" placeholder="排数" autocomplete="off">-->
        <!--        </div>-->
        <!--    </div>-->
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off">
            </div>
        </div>
    <!-- 待添加 -->
    <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
        <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button>
        <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button>
        <!--        <button id="unreason" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="unreason">查看异常数据</button>-->
        <!-- 待添加 -->
        <div id="data-search-btn" class="layui-btn-container layui-form-item" style="display: inline-block">
            <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button>
            <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button>
            <!--        <button id="unreason" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="unreason">查看异常数据</button>-->
        </div>
    </div>
    <div class="layui-form layui-card-header">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="finger_meltingMin" placeholder="最小熔指" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="finger_meltingMax" placeholder="最大熔指" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="fusing_pointMin" placeholder="最小熔点" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="fusing_pointMax" placeholder="最大熔点" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="yellownessMin" placeholder="最小黄度" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="yellownessMax" placeholder="最大黄度" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="opacityMin" placeholder="最小不透明度" autocomplete="off">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="opacityMax" placeholder="最大不透明度" autocomplete="off">
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="toolbar">
    <div class="layui-btn-container">
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-delete" lay-event="deleteData" style="display: none">删除</button>
        <button class="layui-btn layui-btn-sm layui-btn-danger" id="btn-update" lay-event="updateData" style="display: none">修改</button>
        <!-- 商品/物料 数据中心 -->
        <div class="dropdown-menu" style="float: right">
            <button class="layui-btn layui-btn-primary layui-border-black icon-btn layui-btn-sm">&nbsp;数据同步 <i class="layui-icon layui-icon-drop"></i></button>
            <ul class="dropdown-menu-nav dark">
                <div class="dropdown-anchor"></div>
                <li class="title">1st menu</li>
                <li><a onclick="excelMouldDownload()" style="font-size: 12px"><i class="layui-icon layui-icon-template-1"></i>模板下载</a></li>
                <li><a onclick="importExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-upload"></i>导入 Excel</a></li>
                <li style="display: none"><input id="importExcel" type="file" onchange="upload(this)" ></li>
                <hr>
                <li class="title">2nd menu</li>
                <li><a onclick="exportExcel()" style="font-size: 12px"><i class="layui-icon layui-icon-export"></i>导出 Excel</a></li>
            </ul>
        </div>
        <!--        <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="float: right;margin-right: -10px">导出</button>-->
    </div>
</script>
<!-- 行 -->
<script type="text/html" id="operate">
@@ -164,7 +235,7 @@
<script type="text/html" id="tbLook">
    <span class="layui-text">
        <a href="javascript:;" lay-event="look">
            <i class="layui-icon" style="font-size: 12px;">&#xe61a;</i> 更多
            <i class="layui-icon" style="font-size: 12px;">&#xe61a;</i> 查看明细
        </a>
    </span>
</script>
src/main/webapp/views/pla/returned.html
@@ -28,9 +28,9 @@
            </div>
        </div>
        <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
            <label class="layui-form-label"><span class="not-null">*</span>客户名称:</label>
            <label class="layui-form-label">客户名称:</label>
            <div class="layui-input-inline">
                <input id="customerR" class="layui-input" type="text" lay-verify="required" readonly="readonly">
                <input id="customer" class="layui-input" type="text" readonly="readonly">
            </div>
        </div>
        <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
@@ -126,7 +126,6 @@
        // 数据修改动作
        form.on('submit(save)', function () {
            debugger
            let data = table.cache.formSSXMTable;
            let dataSave = [];
            for(var i in data){
src/main/webapp/views/pla/sellout.html
@@ -17,54 +17,65 @@
    <form id="detail" class="layui-form" style="text-align: center">
        <div class="layui-form layui-card-header">
            <div class="layui-inline"  style="width:83%;margin-top: 0px;margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>订单号 :</label>
                <div class="layui-input-inline">
                    <input id="orderNo" class="layui-input" type="text" lay-verify="required" >
                </div>
            </div>
            <div class="layui-inline"  style="width:40%;margin-top: 0px;margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>客户名称:</label>
                <label class="layui-form-label"><span class="not-null">*</span>订单 号:</label>
                <div class="layui-input-inline cool-auto-complete">
                    <input id="customer" class="layui-input" type="text" style="display: none" lay-verify="required">
                    <input id="customerV" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                    <input id="orderNo" class="layui-input" type="text" style="display: none" lay-verify="required">
                    <input id="orderNoV" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                    <div class="cool-auto-complete-window">
                        <input class="cool-auto-complete-window-input" data-key="locOwnerQueryBylocOwner" onkeyup="autoLoad(this.getAttribute('data-key'))">
                        <select class="cool-auto-complete-window-select" data-key="locOwnerQueryBylocOwnerSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                        <input class="cool-auto-complete-window-input" data-key="orderQueryByorderId" onkeyup="autoLoad(this.getAttribute('data-key'))">
                        <select class="cool-auto-complete-window-select" data-key="orderQueryByorderIdSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-inline"  style="width:40%;margin-top: 0px;margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>客户电话:</label>
                <label class="layui-form-label"><span class="not-null">*</span>牌  号:</label>
                <div class="layui-input-inline cool-auto-complete">
                    <input id="maktx" class="layui-input" type="text" style="display: none" lay-verify="required">
                    <input id="maktxV" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                    <div class="cool-auto-complete-window">
                        <input class="cool-auto-complete-window-input" data-key="orderDetlQueryByMaktx" onkeyup="autoLoad(this.getAttribute('data-key'))">
                        <select class="cool-auto-complete-window-select" data-key="orderDetlQueryByMaktxSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-inline"  style="width:40%; margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>订单重量:</label>
                <div class="layui-input-inline">
                    <input id="phone" class="layui-input" type="text" lay-verify="required" readonly="readonly">
                    <input id="weight" class="layui-input" type="text" lay-verify="required" readonly="readonly">
                </div>
            </div>
            <div class="layui-inline"  style="width:40%;margin-top: 0px;margin-bottom: 5px;">
                <label class="layui-form-label">客户名称:</label>
                <div class="layui-input-inline">
                    <input id="customer" class="layui-input" type="text" readonly="readonly">
                </div>
            </div>
            <div class="layui-inline"  style="width:40%;margin-top: 0px;margin-bottom: 5px;">
                <label class="layui-form-label">客户电话:</label>
                <div class="layui-input-inline">
                    <input id="phone" class="layui-input" type="text" readonly="readonly">
                </div>
            </div>
            <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>客户地址:</label>
                <label class="layui-form-label">客户地址:</label>
                <div class="layui-input-inline">
                    <input id="addr" class="layui-input" type="text" lay-verify="required" readonly="readonly">
                    <input id="addr" class="layui-input" type="text" readonly="readonly">
                </div>
            </div>
            <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>发货重量:</label>
                <div class="layui-input-inline">
                    <input id="weight" class="layui-input" type="text" lay-verify="required" placeholder="KG">
                    <input id="qtyWeight" class="layui-input" type="text" lay-verify="required" readonly="readonly">
                </div>
            </div>
        </div>
        <div class="layui-form layui-card-header">
            <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
                <label class="layui-form-label"><span class="not-null">*</span>调拨到 :</label>
                <div class="layui-input-inline cool-auto-complete">
                    <input id="allocate" class="layui-input" type="text" style="display: none" lay-verify="required">
                    <input id="allocateV" class="layui-input cool-auto-complete-div" onclick="autoShow(this.id)" type="text" onfocus=this.blur()>
                    <div class="cool-auto-complete-window">
                        <input class="cool-auto-complete-window-input" data-key="configTypeQueryByAllocate" data-value="allocate" onkeyup="autoLoad(this.getAttribute('data-key'))">
                        <select class="cool-auto-complete-window-select" data-key="configTypeQueryByAllocateSelect" onchange="confirmed(this.getAttribute('data-key'))" multiple="multiple">
                        </select>
                    </div>
                <label class="layui-form-label">调拨 到:</label>
                <div class="layui-input-inline">
                    <input id="allocate" class="layui-input" type="text" readonly="readonly">
                </div>
            </div>
            <div class="layui-inline"  style="width:83%; margin-bottom: 5px;">
@@ -106,16 +117,43 @@
<script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
<script type="text/javascript" src="../../static/js/pla/plaDetl.js" charset="utf-8"></script>
<!-- 表单弹窗 -->
<script type="text/html" id="editDialog">
    <form id="editForm" lay-filter="editForm" class="layui-form" style="text-align: center">
        <table class="layui-table" id="detailTable" lay-filter="detailTable"></table>
        <div class="layui-btn-container layui-form-item">
            <button class="layui-btn layui-btn-normal" type="button" lay-submit ew-event="closeDialog">取消</button>
            <button class="layui-btn layui-btn-normal" type="button" lay-submit lay-filter="detailEditSubmit" lay-submit>保存</button>
        </div>
    </form>
</script>
</html>
<script>
    $('body').keydown(function () {
        if (event.keyCode === 13) {
            return;
        }
    });
    var checkData = [];
    var detailData = [];
    var deliveryTime;
    function child(data){
        checkData = data;
        var allWeight = 0;
        for (var i in checkData){
            allWeight += (checkData[i].weightAnfme - checkData[i].qtyAnfme)
        }
        $('#qtyWeight').val(allWeight);
        delivery();
    }
    //显示4天内预约出库的时间
    function delivery(){
        $.ajax({
            url: baseUrl+"/plaQty/delivery/auth",
@@ -164,30 +202,66 @@
        var layer = layui.layer;
        var table = layui.table;
        // 数据修改动作
        form.on('submit(edit)', function () {
            var dataList = [];
            for (var i in checkData){
                var data = {
                    "batch" : checkData[i].batch,
                    "packageNo" : checkData[i].packageNo,
                    "weight" : checkData[i].weightAnfme - checkData[i].qtyAnfme,
                }
                dataList.push(data);
            }
            if(detailData.length > 0){
                dataList = detailData;
            }
            layer.open({
                type: 1,
                title: "数量修改",
                content: $('#editDialog').html(),
                area: '700px',
                success: function (layero, dIndex) {
                    // 明细表格
                    tableIns = table.render({
                        elem: '#detailTable',
                        data: dataList,
                        limit: 100,
                        even: true,
                        cellMinWidth: 50,
                        cols: [[
                            {field: 'batch', title: '批号', width: 160},
                            {field: 'packageNo', title: '包号', width: 200},
                            {field: 'weight', title: '数量',edit: true},
                        ]],
                    });
                }
            })
        })
        // 数据提交动作
        form.on('submit(save)', function () {
            for(var i in checkData){
                checkData[i].packageType = $('#packageTypeV').val();
                checkData[i].zpalletType = $('#zpalletTypeV').val();
                checkData[i].filmWrap = $('#filmWrapV').val();
                checkData[i].step = 3;
            if($('#maktxV').val() != checkData[0].brand){
                layer.msg("选中的库存牌号与订单牌号不一致,请重新选择订单");
                return;
            }
            checkData[0].type = 'sellOut';
            for (var i in checkData){
                checkData[i].type = 'sellOut';
                checkData[i].orderNo = $('#orderNoV').val();
                checkData[i].customer = $('#customer').val();
                checkData[i].phone = $('#phone').val();
                checkData[i].addr = $('#addr').val();
                checkData[i].orderWeight = detailData[i] ? detailData[i].weight : checkData[i].weightAnfme;
                checkData[i].allocate = $('#allocate').val();
                checkData[i].memo = $('#memo').val();
                checkData[i].pakoutTime = deliveryTime;
            }
            checkData[0].orderNo = $('#orderNo').val();
            checkData[0].customer = $('#customerV').val();
            checkData[0].phone = $('#phone').val();
            checkData[0].addr = $('#addr').val();
            checkData[0].orderWeight = $('#weight').val();
            checkData[0].allocate = $('#allocateV').val();
            checkData[0].memo = $('#memo').val();
            if(!deliveryTime){
                layer.msg("请选择发货时间");
                return;
            }
            checkData[0].pakoutTime = deliveryTime;
            $.ajax({
                url: baseUrl+"/pla/sellout/auth",
@@ -212,6 +286,25 @@
            })
        });
        form.on('submit(detailEditSubmit)', function () {
            detailData = table.cache.detailTable;
            var allWeight = +0;
            for (var i in checkData){
                //检测修改的数量是否小于等于最大可出库数量
                if(detailData[i].weight <= checkData[i].weightAnfme - checkData[i].qtyAnfme){
                    checkData[i].orderWeight = detailData[i].weight;
                    allWeight = allWeight + Number(detailData[i].weight);
                }else {
                    layer.msg("批号:" + detailData[i].batch + ",包号:" + detailData[i].packageNo + "可出库重量小于修改后的数量,请重新填写");
                    return;
                }
            }
            $('#qtyWeight').val(allWeight);
            layer.closeAll();
        })
        function tableReload(child) {
            var searchData = {};
            $.each($('#search-box [name]').serializeArray(), function() {