zjj
2024-03-28 613a4f53f24672cc7e202f6f40a9d51bae904e40
#平库转立库
1个文件已添加
7个文件已修改
521 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/MobileController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/LocNormal.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/CombParam.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/MobileService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/common.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pda/combLToP.html 226 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pda/index.html 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -52,6 +52,13 @@
        return R.ok();
    }
    @RequestMapping("/combLtoP/auth")
    @ManagerAuth(memo = "移库组托")
    public R combLtoP(@RequestBody CombParam combParam){
        mobileService.combLtoP(combParam, getUserId());
        return R.ok();
    }
    /**
     * 组托-批量
     */
src/main/java/com/zy/asrs/entity/LocNormal.java
@@ -26,6 +26,7 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value= "自增ID")
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value= "物料")
src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -26,6 +26,16 @@
    // 小车取货点
    private Integer agvSite;
    private Integer move;
    public Integer getMove() {
        return move;
    }
    public void setMove(Integer move) {
        this.move = move;
    }
    public String getWarehouse() {
        return warehouse;
    }
src/main/java/com/zy/asrs/service/MobileService.java
@@ -10,6 +10,8 @@
     */
    void comb(CombParam param, Long userId);
    void combLtoP(CombParam param, Long userId);
    /**
     * 组托-批量
     * @param param
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -23,6 +23,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
@@ -51,6 +52,8 @@
    private LocMastService locMastService;
    @Autowired
    private LocDetlService locDetlService;
    @Autowired
    private LocNormalService locNormalService;
    @Override
    @Transactional
@@ -87,6 +90,7 @@
                    waitPakin.setModiUser(userId);
                    waitPakin.setModiTime(new Date());
                    VersionUtils.setWaitPakIn(waitPakin, matCode);
                    waitPakin.setBrand("N");
//                    waitPakin.setMatnr(matCode.getMatNo()+"|"+combMat.getMnemonic()); //产品编码|生产单号
//                    waitPakin.setBname(matCode.getMatNo());
                    // 如果生成单号不为空插入生产单号
@@ -161,7 +165,7 @@
                waitPakin.setMnemonic(param.getProductCode()); // 助记码
                waitPakin.setSupplier(param.getProductCode()); // 默认供应商
                waitPakin.setWarehouse(param.getProductCode()); // 默认仓库
                waitPakin.setBrand(param.getProductCode()); // 品牌
                waitPakin.setBrand("N"); // 品牌
                waitPakin.setAltme(param.getProductCode()); // 单位
                if (!waitPakinService.insert(waitPakin)) {
@@ -205,6 +209,7 @@
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(new Date());
                waitPakin.setSupplier(combMat.getSupplier());
                waitPakin.setBrand("N");
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存数据失败");
                }
@@ -274,6 +279,264 @@
    }
    @Override
    @Transactional
    public void combLtoP(CombParam param, Long userId) {
        if (Cools.isEmpty(param.getBarcode())) {
            throw new CoolException(BaseRes.PARAM);
        }
        if (Cools.isEmpty(param.getCombMats()) && Cools.isEmpty(param.getProductCode())) {
            throw new CoolException(BaseRes.PARAM);
        }
        int waitPakinCount = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().
                        eq("zpallet", param.getBarcode())
                //.eq("io_status", "N")
        );
        int wrkMastCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
        int locDetlCount = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
        if (waitPakinCount > 0 || wrkMastCount > 0 || locDetlCount > 0) {
            throw new CoolException("条码数据已存在");
        }
        if (Cools.isEmpty(param.getBillNo())) {
            if (Cools.isEmpty(param.getProductCode())) {
                for (CombParam.CombMat combMat : param.getCombMats()) {
                    MatCode matCode = matCodeService.selectById(combMat.getMatNo());
                    if (Cools.isEmpty(matCode)) {
                        throw new CoolException("物料数据错误");
                    }
                    WaitPakin waitPakin = new WaitPakin();
                    waitPakin.setZpallet(param.getBarcode());   // 托盘码
                    waitPakin.setStatus("Y");    // 状态
                    waitPakin.setAnfme(combMat.getCount());  // 数量
                    waitPakin.setIoStatus("N");     // 入出状态
                    waitPakin.setAppeUser(userId);
                    waitPakin.setAppeTime(new Date());
                    waitPakin.setModiUser(userId);
                    waitPakin.setModiTime(new Date());
                    VersionUtils.setWaitPakIn(waitPakin, matCode);
                    if (param.getMove() == 1){
                            waitPakin.setBrand("Y");
                    }else {
                        waitPakin.setBrand("N");
                    }
//                    waitPakin.setMatnr(matCode.getMatNo()+"|"+combMat.getMnemonic()); //产品编码|生产单号
//                    waitPakin.setBname(matCode.getMatNo());
                    // 如果生成单号不为空插入生产单号
                    if (!Cools.isEmpty(combMat.getMnemonic())) {
                        waitPakin.setMnemonic(combMat.getMnemonic());
                    }
                    if (!waitPakinService.insert(waitPakin)) {
                        throw new CoolException("保存数据失败");
                    }
                    if (param.getMove() == 1){
                        EntityWrapper<LocNormal> locNormalEntityWrapper = new EntityWrapper<>();
                        locNormalEntityWrapper.eq("matnr",waitPakin.getMatnr());
                        locNormalEntityWrapper.eq("mnemonic",waitPakin.getMnemonic());
                        locNormalEntityWrapper.eq("state","1");
                        LocNormal locNormal = locNormalService.selectOne(locNormalEntityWrapper);
                        if (Cools.isEmpty(locNormal)){
                            throw new CoolException("未找到平库相同库存");
                        }
                        if (combMat.getCount() < locNormal.getAnfme().doubleValue()){
                            locNormal.setAnfme(locNormal.getAnfme().subtract(BigDecimal.valueOf(combMat.getCount())));
                            boolean update = locNormalService.update(locNormal, locNormalEntityWrapper);
                            if (!update){
                                throw new CoolException("更新库存数据有误");
                            }
                        }else if (combMat.getCount() == locNormal.getAnfme().doubleValue()){
                            boolean delete = locNormalService.delete(locNormalEntityWrapper);
                            if (!delete){
                                throw new CoolException("删除库存数据出错");
                            }
                        }else {
                            throw new CoolException("库存数据有误");
                        }
                    }
                }
                // 小车入库搬运命令 ----------------------------------------------------
//                if (!Cools.isEmpty(param.getAgvSite())) {
//                    // 判断是否有空闲小车
//                    if (basAgvService.haveIdleAgv()) {
//                        AgvCommand command = new AgvCommand();
//                        command.setAgvId(0);
//                        command.setInterCode(basAgvService.getAgvWorkNo());
//                        command.setBeginLoc(String.valueOf(param.getAgvSite()));
//                        command.setEndLoc("1088");
//                        log.info(JSON.toJSONString(command));
//                        String result;
//                        try {
//                            result = new HttpHandler.Builder()
//                                    .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty")
//                                    .setJson(JSON.toJSONString(command))
//                                    .build()
//                                    .doPost();
//                        } catch (IOException e) {
//                            e.printStackTrace();
//                            throw new CoolException("访问AGV接口失败");
//                        }
//                        AgvResult agvResult = JSON.parseObject(result, AgvResult.class);
//                        log.info(JSON.toJSONString(agvResult));
//                        if (!agvResult.getResult()) {
//                            log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain());
//                            throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain());
//                        }
//                    } else {
//                        throw new CoolException("没有空闲小车");
//                    }
//
//                }
//                // 判断无通知单号supplier的入库数据,CPICMO插入数据
//                List<CombParam.CombMat> erpMatList = param.getCombMats();
//                for (CombParam.CombMat es : erpMatList) {
//                    if (Cools.isEmpty(es.getSupplier())) {
//                        String maxKeySql = "select min(FInterID) as num from CPICMO";
//                        List<ERPselectParam> maxKeyList = erpSqlServer.select(maxKeySql, ERPselectParam.class);
//                        Integer maxKey = maxKeyList.get(0).getNum();
//                        String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop,Fflag_rw) values (0, ''{6}'', '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, {5,number,#}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378, 1)";
//                        ErpSql = MessageFormat.format(ErpSql, maxKey - 1, es.getCount(), es.getCount(), es.getCount(), es.getMatNo(), es.getCount(), es.getMnemonic());
//                        erpSqlServer.update(ErpSql);
//                    }
//                }
            } else {
                WaitPakin waitPakin = new WaitPakin();
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setStatus("Y");    // 状态
                waitPakin.setAnfme((double) 1);  // 数量
                waitPakin.setIoStatus("N");     // 入出状态
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(new Date());
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(new Date());
                waitPakin.setMatnr(param.getProductCode()); // 物料编号
                waitPakin.setMaktx(param.getProductCode()); // 物料描述
                waitPakin.setLgnum(param.getProductCode()); // 规格
                waitPakin.setType(param.getProductCode()); // 物料类别
                waitPakin.setMnemonic(param.getProductCode()); // 助记码
                waitPakin.setSupplier(param.getProductCode()); // 默认供应商
                waitPakin.setWarehouse(param.getProductCode()); // 默认仓库
                if (param.getMove() == 1){
                    waitPakin.setBrand("Y");
                }else {
                    waitPakin.setBrand("N");
                }
                waitPakin.setAltme(param.getProductCode()); // 单位
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存数据失败");
                }
//                // 判断无通知单号supplier的入库数据,CPICMO插入数据
//                List<CombParam.CombMat> erpMatList = param.getCombMats();
//                for (CombParam.CombMat es : erpMatList) {
//                    if (Cools.isEmpty(es.getSupplier())) {
//                        String maxKeySql = "select min(FInterID) as num from CPICMO";
//                        List<ERPselectParam> maxKeyList = erpSqlServer.select(maxKeySql, ERPselectParam.class);
//                        Integer maxKey = maxKeyList.get(0).getNum();
//                        String ErpSql = "insert into CPICMO(FBrNo, FSourceBillNo, FBillNo, FTranType, FStatus, FMRP, FItemID, FQty, FCommitQty, FSourceEntryID, FClosed, FUnitID, FAuxCommitQty, FCancellation, FQtyFinish, FQtyScrap, FQtyLost, FAuxQtyFinish, FAuxQtyScrap, FAuxQtyLost, FMrpClosed, FBomInterID, FQtyPass, FAuxQtyPass, FQtyBack, FAuxQtyBack, FFinishTime, FReadyTIme, FPowerCutTime, FFixTime, FWaitItemTime, FWaitToolTime, FTaskID, FWorkTypeID, FCostObjID, FStockQty, FAuxStockQty, FSuspend, FReleasedQty, FReleasedAuxQty, FUnScheduledQty, FUnScheduledAuxQty, FSubEntryID, FScheduleID, FPlanOrderInterID, FProcessPrice, FProcessFee, FGMPBatchNo, FGMPCollectRate, FGMPItemBalance, FGMPBulkQty, FCustID, FMRPLockFlag, FHandworkClose, FInHighLimit, FInHighLimitQty, FInLowLimit, FInLowLimitQty, FChangeTimes, FCheckCommitQty, FAuxCheckCommitQty, FPlanConfirmed, FPlanMode, FMTONo, FPrintCount, FFinClosed, FStockFlag, FStartFlag, FVchBillNo, FVchInterID, FCardClosed, FHRReadyTime, FSourceTranType, FSourceInterId, FInterID, FAuxQty, FAuxInHighLimitQty, FAuxInLowLimitQty, Fnumber, FWorkShop, Fflag_rw) values (0, ''{6}'', '0', 85, 0, 1052, 0, 0, 0, 0, 0, 250, {5,number,#}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14036, '0', 0, 0, 14215, 0, '0', 0, 1059, 0, 0, 0, 0, {0,number,#}, {1,number,#}, {2,number,#}, {3,number,#}, ''{4}'', 11378, 1)";
//                        ErpSql = MessageFormat.format(ErpSql, maxKey - 1, es.getCount(), es.getCount(), es.getCount(), es.getMatNo(), es.getCount(), es.getMnemonic());
//                        erpSqlServer.update(ErpSql);
//                    }
//                }
            }
        } else {
            // 关联通知单组托
            for (CombParam.CombMat combMat : param.getCombMats()) {
                WaitPakin one = waitPakinService.selectOne(new EntityWrapper<WaitPakin>()
                        .eq("supplier", combMat.getSupplier())
                        .eq("matnr", combMat.getMatNo())
                        .isNull("zpallet"));
                if (one == null) {
                    throw new CoolException("通知单不存在" + combMat.getMatNo() + "数据!");
                }
                if (combMat.getCount() > one.getAnfme()) {
                    throw new CoolException(combMat.getMatNo() + "物料数量不足!");
                }
                MatCode matCode = matCodeService.selectById(combMat.getMatNo());
                if (Cools.isEmpty(matCode)) {
                    throw new CoolException("物料数据错误");
                }
                WaitPakin waitPakin = one.clone();
                waitPakin.setZpallet(param.getBarcode());   // 托盘码
                waitPakin.setAnfme(combMat.getCount());  // 数量
                waitPakin.setAppeUser(userId);
                waitPakin.setAppeTime(new Date());
                waitPakin.setModiUser(userId);
                waitPakin.setModiTime(new Date());
                waitPakin.setSupplier(combMat.getSupplier());
                waitPakin.setBrand("N");
                if (!waitPakinService.insert(waitPakin)) {
                    throw new CoolException("保存数据失败");
                }
                // 减少通知单上该物料组托数量
                if (waitPakin.getAnfme() >= one.getAnfme()) {
                    waitPakinService.delete(new EntityWrapper<WaitPakin>()
                            .eq("supplier", combMat.getSupplier())
                            .eq("matnr", combMat.getMatNo())
                            .eq("mnemonic", param.getMnemonic())
                            .isNull("zpallet"));
                } else {
                    Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>();
                    if ("".equals(param.getMnemonic())) {
                        wrapper.eq("supplier", combMat.getSupplier())
                                .eq("matnr", combMat.getMatNo())
                                .isNull("zpallet");
                    } else {
                        wrapper.eq("supplier", combMat.getSupplier())
                                .eq("matnr", combMat.getMatNo())
                                .eq("mnemonic", param.getMnemonic())
                                .isNull("zpallet");
                    }
                    WaitPakin pakin = new WaitPakin();
                    pakin.setAnfme(one.getAnfme() - waitPakin.getAnfme());
                    if (!waitPakinService.update(pakin, wrapper)) {
                        throw new CoolException("更新数据失败");
                    }
                }
            }
            // 小车入库搬运命令 ----------------------------------------------------
//            if (!Cools.isEmpty(param.getCombMats()) && !Cools.isEmpty(param.getAgvSite())) {
//                // 判断是否有空闲小车
//                if (basAgvService.haveIdleAgv()) {
//                    AgvCommand command = new AgvCommand();
//                    command.setAgvId(0);
//                    command.setInterCode(basAgvService.getAgvWorkNo());
//                    command.setBeginLoc(String.valueOf(param.getAgvSite()));
//                    command.setEndLoc("1088");
//                    log.info(JSON.toJSONString(command));
//                    String result;
//                    try {
//                        result = new HttpHandler.Builder()
//                                .setUri(agvUrl + "/api/interfaceTask/SendTaskByThirdParty")
//                                .setJson(JSON.toJSONString(command))
//                                .build()
//                                .doPost();
//                    } catch (IOException e) {
//                        e.printStackTrace();
//                        throw new CoolException("访问AGV接口失败");
//                    }
//                    AgvResult agvResult = JSON.parseObject(result, AgvResult.class);
//                    log.info(JSON.toJSONString(agvResult));
//                    if (!agvResult.getResult()) {
//                        log.error("agv命令发送失败[agvId={}],错误信息={}", command.getAgvId(), agvResult.getExplain());
//                        throw new CoolException("agv命令发送失败[agvId=" + command.getAgvId() + "],错误信息=" + agvResult.getExplain());
//                    }
//                } else {
//                    throw new CoolException("没有空闲小车");
//                }
//
//            }
        }
    }
    @Override
    @Transactional
src/main/webapp/static/js/common.js
@@ -222,7 +222,7 @@
    ,{field: 'mnemonic', align: 'center',title: '生产单号'}
    ,{field: 'supplier', align: 'center',title: '通知单号'}
    // ,{field: 'warehouse', align: 'center',title: '产地'}
    // ,{field: 'brand', align: 'center',title: '品牌'}
    ,{field: 'brand', align: 'center',title: '移库'}
    // ,{field: 'altme', align: 'center',title: '单位'}
    ,{field: 'zpallet', align: 'center',title: '托盘条码'}
]
src/main/webapp/views/pda/combLToP.html
New file
@@ -0,0 +1,226 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <title>组托</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/pda.css" media="all">
    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
    <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/handlebars/handlebars-v4.5.3.js"></script>
    <style>
    </style>
</head>
<body>
<!-- 头部 -->
<header>
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label">托盘码</label>
            <div class="layui-input-block">
                <input class="layui-input" type="number" id="code" onkeyup="findCode(this)" oninput="if(value.length>8)value=value.slice(0,8)" placeholder="扫码 / 输入" autocomplete="off">
            </div>
        </div>
        <div class="layui-form-item" style="margin-top: 5px">
            <label class="layui-form-label">平仓物料</label>
            <div class="layui-input-block" style="width: 150px">
                <select name="interest" lay-filter="closeThePosition">
                    <option value="">是否移库</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div>
        <div style="margin: 5px 5px">
            <button id="mat-btn" type="button" class="layui-btn layui-btn-normal" onclick="getMat()"><i class="layui-icon">+</i>提取</button>
        </div>
    </form>
</header>
<!-- 主体 -->
<main>
    <table class="layui-table" id="chooseData" lay-filter="chooseData"></table>
</main>
<!-- 尾部 -->
<footer>
    <div class="layui-btn-container">
        <button type="button" id="reset-btn" class="layui-btn layui-btn-primary" onclick="reset()">重置</button>
        <button type="button" id="comb-btn" class="layui-btn layui-btn-normal " onclick="comb()" style="margin-left: 20px">组托</button>
        <button type="button" id="retrun-btn" class="layui-btn layui-btn-primary " onclick="back()" style="margin-left: 20px">返回</button>
        <span id="tips"></span>
    </div>
</footer>
</body>
<script>
    var tableIns;
    let move = 0;
    layui.use(['table','laydate', 'form'], function() {
        var table = layui.table;
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        tableIns = table.render({
            elem: '#chooseData',
            data: [],
            width: 320,
            limit: 500,
            cellMinWidth: 50,
            cols: [[
                {field: 'matNo', align: 'center', title: '物料编码'},
                {field: 'mnemonic', align: 'center', title: '生产单号'},
                {field: 'count', align: 'center', title: '数量', style:'color: blue', width:50},
                {field: 'matName', align: 'center', title: '物料名称'}
            ]],
            done: function (res, curr, count) {
            }
        });
        form.on('select(closeThePosition)', function(data){
            move = data.value;
            // console.log(data.elem); //得到select原始DOM对象
            console.log(move); //得到被选中的值
            // console.log(data.othis); //得到美化后的DOM对象
        });
    });
    window.onload = function(){document.getElementById("code").focus();}
    function findCode(el) {
        if (el.value.length === 7) {
            $('#mat-btn').focus();
            getMat();
        }
    }
    var matCodeLayerIdx;
    function getMat() {
        matCodeLayerIdx = layer.open({
            type: 2,
            title: '提取物料',
            shade: [0.3,'#000'],
            area: ['90%', '90%'],
            content: 'matQuery.html',
            success: function(layero, index){
                $('.layui-layer-title').css('font-size', '16px');
            },
            end: function () {
                $('#mat-btn').focus();
            }
        });
    }
    // 添加表格数据
    var matData = [];
    function addTableData(data) {
        if (isEmpty(data.matName)){
            tips("提取失败", true);
            return;
        }
        let toPush = true;
        for (var j=0;j<matData.length;j++){
            if (data.matNo === matData[j].matNo) {
                matData[j].count = Number(matData[j].count) + Number(data.count);
                toPush  = false;
            }
        }
        if (toPush) {
            matData.push(data);
        }
        tips("提取成功");
        tableIns.reload({data: matData});
    }
    // 重置
    function reset() {
        $('#code').val("");
        matData = [];
        tableIns.reload({data: matData});
    }
    // 组托
    function comb() {
        let barcode = $('#code').val();
        let closeThePosition = $('#closeThePosition').val();
        console.log(closeThePosition);
        if (isEmpty(barcode)) {
            tips("托盘条码为空", true);
            // document.getElementById("code").focus();
            return;
        }
        if (move === 0){
            tips("请选择是否为移库", true);
            // document.getElementById("code").focus();
            return;
        }
        if (barcode.length !== 7) {
            tips("条码必须为7位", true);
            return;
        }
        if (matData.length === 0) {
            tips("请提取物料", true);
            return;
        }
        $.ajax({
            url: baseUrl+"/mobile/combLtoP/auth",
            headers: {'token': localStorage.getItem('token')},
            data: JSON.stringify({
                barcode: barcode,
                move: move,
                combMats: matData
            }),
            contentType:'application/json;charset=UTF-8',
            method: 'POST',
            async: false,
            success: function (res) {
                if (res.code === 200) {
                    reset();
                    tips("组托成功")
                } else if (res.code === 403) {
                    top.location.href = baseUrl + "/pda";
                } else {
                    tips(res.msg, true)
                }
            }
        })
    }
    /**
     * 提示信息
     * @param msg 提示内容
     * @param warn true:红色字体
     */
    function tips(msg, warn) {
        // var tips = $('#tips');
        // tips.html(msg);
        // tips.css("color", warn?"red":'#666');
        layer.msg(msg, {icon: warn?2:1})
    }
    document.onkeyup = function (e) {
        if (window.event)//如果window.event对象存在,就以此事件对象为准
            e = window.event;
        var key = e.charCode || e.keyCode;
        if (key === 115) {
            $("#comb-btn").focus();
            comb();
        } else if (key === 113) {
            $("#code").val("");
            $("#code").focus();
        }
    }
    function back() {
        parent.backIndex();
    }
</script>
</html>
src/main/webapp/views/pda/index.html
@@ -128,6 +128,14 @@
            <div id="locNormalOut" onclick="nav(this.id)" class="nav-font-size">平仓成品出库</div>
        </td>
    </tr>
    <tr>
        <td>
            <div id="combLToP" onclick="nav(this.id)" class="nav-font-size">立库移库组托</div>
        </td>
<!--        <td>-->
<!--            <div id="locNormalOut" onclick="nav(this.id)" class="nav-font-size">平仓成品出库</div>-->
<!--        </td>-->
    </tr>
</table>
<!-- 主体内容 -->