王佳豪
2021-05-05 e72d75462010729913d1127bd3c1418726b41992
1.平仓入库erp单号对应功能实现
2个文件已修改
58 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/locNormal/locNormalIn.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocNormalServiceImpl.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.entity.LocNormal;
import com.zy.asrs.mapper.LocNormalMapper;
import com.zy.asrs.mapper.OutStockMapper;
@@ -55,34 +56,43 @@
        if (list.size() > 0) {
            for (Integer i = 0; i < list.size(); i++) {
                if (!Cools.isEmpty(list.get(i).getSupplier())) { // 存在入库单号的才进行erp更新
                    String sql = "update CPICMO set FAuxCommitQty = (FAuxCommitQty + {0,number,#}) where 1=1 and Fnumber = ''{1}'' and FBillNo = ''{2}''";
                    sql = MessageFormat.format(sql, list.get(i).getAnfme(), list.get(i).getMatnr(), list.get(i).getSupplier());
                    if (erpSqlServer.update(sql) > 0) {
                        sql = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''";
                        sql = MessageFormat.format(sql, list.get(i).getMatnr(), list.get(i).getSupplier());
                        List<CPICMO> select = erpSqlServer.select(sql, CPICMO.class);
                        CPICMO cpicmo = select.get(0);
                        boolean complete = false;
                        if (cpicmo.getFQty() > 0) {
                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) {
                                complete = true;
                    String sqlSelect = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''";
                    sqlSelect = MessageFormat.format(sqlSelect, list.get(i).getMatnr(), list.get(i).getSupplier());
                    List<CPICMO> CPICMOList = erpSqlServer.select(sqlSelect,CPICMO.class);
                    if (CPICMOList.size() > 0) { //  说明erp有对应的入库单
                        String sql = "update CPICMO set FAuxCommitQty = (FAuxCommitQty + {0,number,#}) where 1=1 and Fnumber = ''{1}'' and FBillNo = ''{2}''";
                        sql = MessageFormat.format(sql, list.get(i).getAnfme(), list.get(i).getMatnr(), list.get(i).getSupplier());
                        if (erpSqlServer.update(sql) > 0) {
                            sql = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''";
                            sql = MessageFormat.format(sql, list.get(i).getMatnr(), list.get(i).getSupplier());
                            List<CPICMO> select = erpSqlServer.select(sql, CPICMO.class);
                            CPICMO cpicmo = select.get(0);
                            boolean complete = false;
                            if (cpicmo.getFQty() > 0) {
                                if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) {
                                    complete = true;
                                }
                            } else {
                                if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) {
                                    complete = true;
                                }
                            }
                        } else {
                            if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) {
                                complete = true;
                            if (complete) {
                                if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) {
                                    log.error("{}平仓入库单标记完成失败", list.get(i).getSupplier());
                                }
                            }
                        }
                        if (complete) {
                            if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) {
                                log.error("{}平仓入库单标记完成失败", list.get(i).getSupplier());
                            }
                        }
                    } else {
                        throw new CoolException("ERP查询不到对应通知单");
                    }
                } else {
                    throw new CoolException("通知单号不可为空");
                }
            }
            // 平仓入库逻辑
            baseMapper.locNormalIn(list);
        }
        // 平仓入库逻辑
        baseMapper.locNormalIn(list);
    }
    /**
src/main/webapp/static/js/locNormal/locNormalIn.js
@@ -17,11 +17,11 @@
    ];
    var locNormalColsSelf = [
        {field: 'mnemonic', align: 'center',title: '生产单号', edit: 'text'}
        ,{field: 'supplier', align: 'center',title: '通知单号', edit: 'text'}
        ,{field: 'matnr', align: 'center',title: '物料编码'}
        ,{field: 'maktx', align: 'center',title: '物料名称', width: 400}
        ,{field: 'lgnum', align: 'center',title: '规格'}
        ,{field: 'type', align: 'center',title: '物料类别'}
        ,{field: 'supplier', align: 'center',title: '通知单号', edit: 'text'}
        ,{field: 'brand', align: 'center',title: '品牌', hide: true}
        ,{field: 'altme', align: 'center',title: '单位', hide: true}
    ];
@@ -89,6 +89,10 @@
                        layer.msg("请输入生产单号");
                        return;
                    }
                    if (matCodeData[i].supplier == null || matCodeData[i].supplier == '' || matCodeData[i].supplier == undefined) {
                        layer.msg("请输入通知单号");
                        return;
                    }
                }
                // 判断库区是否为空
                var warehouse = $('#putSiteSelect').val();