自动化立体仓库 - WMS系统
#
luxiaotao1123
2021-08-27 cb2ef0d32782054eaf0a5c00290e049aaca84fd5
#
2个文件已修改
140 ■■■■■ 已修改文件
src/main/java/com/zy/ints/controller/WaitMatinController.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/waitMatin/waitMatin.html 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/ints/controller/WaitMatinController.java
@@ -9,6 +9,7 @@
import com.core.common.Cools;
import com.core.common.DateUtils;
import com.core.common.R;
import com.core.exception.CoolException;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.MatCode;
import com.zy.asrs.service.MatCodeService;
@@ -17,12 +18,10 @@
import com.zy.ints.entity.WaitMatin;
import com.zy.ints.service.WaitMatinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
@RestController
public class WaitMatinController extends BaseController {
@@ -35,8 +34,8 @@
    @RequestMapping(value = "/waitMatin/head/page/auth")
    @ManagerAuth
    public R headPage(@RequestParam(defaultValue = "1")Integer curr,
                          @RequestParam(defaultValue = "10")Integer limit,
                          @RequestParam Map<String, Object> param){
                      @RequestParam(defaultValue = "10")Integer limit,
                      @RequestParam Map<String, Object> param){
        if (!Cools.isEmpty(param.get("modi_time"))){
            String val = String.valueOf(param.get("modi_time"));
            if (val.contains(RANGE_TIME_LINK)) {
@@ -48,7 +47,6 @@
        }
        return R.ok(waitMatinService.getHeadPage(toPage(curr, limit, param, WaitMatin.class)));
    }
    /*************************************** xm-select ***********************************************/
@@ -114,9 +112,25 @@
    @RequestMapping(value = "/waitMatin/add/auth")
    @ManagerAuth
    public R add(WaitMatin waitMatin) {
        waitMatinService.insert(waitMatin);
        return R.ok();
    @Transactional
    public R add(@RequestBody List<WaitMatin> waitMatins) {
        if (Cools.isEmpty(waitMatins)) {
            return R.parse(BaseRes.PARAM);
        }
        int i = 1;
        Date now = new Date();
        for (WaitMatin waitMatin : waitMatins) {
            waitMatin.setSeqNo(i);
            waitMatin.setAppeTime(now);
            waitMatin.setAppeUser(getUserId());
            waitMatin.setModiTime(now);
            waitMatin.setModiUser(getUserId());
            if (!waitMatinService.insert(waitMatin)) {
                throw new CoolException("添加单据明细失败");
            }
            i++;
        }
        return R.ok("添加成功");
    }
    @RequestMapping(value = "/waitMatin/update/auth")
@@ -131,11 +145,11 @@
    @RequestMapping(value = "/waitMatin/delete/auth")
    @ManagerAuth
    public R delete(@RequestParam(value="ids[]") Long[] ids){
         for (Long id : ids){
            waitMatinService.deleteById(id);
    public R delete(@RequestParam String billNo){
        if (!waitMatinService.delete(new EntityWrapper<WaitMatin>().eq("bill_no", billNo))) {
            throw new CoolException("删除单据明细失败");
        }
        return R.ok();
        return R.ok("删除成功");
    }
    @RequestMapping(value = "/waitMatin/export/auth")
src/main/webapp/views/waitMatin/waitMatin.html
@@ -196,7 +196,7 @@
            if (layEvent === 'edit') {
                showEditModel(data);
            } else if (layEvent === 'del') {
                doDel(data.experimentTypeId);
                doDel(data.billNo);
            } else if (layEvent === 'look') {
                var $a = $(obj.tr).find('a[lay-event="look"]');
                var offset = $a.offset();
@@ -273,28 +273,50 @@
                    form.val('editForm', expTpe);
                    // 表单提交事件
                    form.on('submit(waitMatinEditSubmit)', function (data) {
                        if (isExpAdd) {
                            if (xxDataList.length <= 0) {
                                layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
                                return false;
                            }
                            var nList = admin.util.deepClone(xxDataList);
                            for (var xi = 0; xi < nList.length; xi++) {
                                nList[xi].experimentId = undefined;
                            }
                            data.field.expListJson = JSON.stringify(nList);
                        // 组装数据
                        if (xxDataList.length <= 0) {
                            layer.tips('请添加单据明细', '#matAddBtnComment', {tips: [1, '#ff4c4c']});
                            return false;
                        }
                        layer.load(2);
                        $.get(url, data.field, function (res) {
                            layer.closeAll('loading');
                            if (res.code === 200) {
                                layer.close(dIndex);
                                insTb.reload({page: {curr: 1}});
                                layer.msg(res.msg, {icon: 1});
                            } else {
                                layer.msg(res.msg, {icon: 2});
                        var param = [];
                        var nList = admin.util.deepClone(xxDataList);
                        for (var xi = 0; xi < nList.length; xi++) {
                            if (nList[xi].qty > 0) {
                                param.push({
                                    billNo: data.field.billNo,
                                    billType: data.field.billType,
                                    matNo: nList[xi].matNo,
                                    matName: nList[xi].matName,
                                    qty: nList[xi].qty,
                                })
                            }
                        }, 'json');
                        }
                        if (param.length === 0) {
                            layer.msg('单据明细数量不合法', {icon: 2});
                            return false;
                        }
                        if (isExpAdd) {
                            layer.load(2);
                            $.ajax({
                                url: baseUrl+"/waitMatin/add/auth",
                                headers: {'token': localStorage.getItem('token')},
                                data: JSON.stringify(param),
                                contentType:'application/json;charset=UTF-8',
                                method: 'POST',
                                success: function (res) {
                                    layer.closeAll('loading');
                                    if (res.code === 200){
                                        layer.close(dIndex);
                                        insTb.reload({page: {curr: 1}});
                                        layer.msg(res.msg, {icon: 1});
                                    } else if (res.code === 403){
                                        top.location.href = baseUrl+"/";
                                    }else {
                                        layer.msg(res.msg, {icon: 2});
                                    }
                                }
                            })
                        }
                        return false;
                    });
                    // 明细表格
@@ -457,25 +479,35 @@
            });
        }
        // 删除
        function doDel(experimentTypeId) {
        // 删除单据
        function doDel(billNo) {
            layer.confirm('确定要删除吗?', {
                shade: .1,
                skin: 'layui-layer-admin'
            }, function (i) {
                layer.close(i);
                layer.load(2);
                $.post('../../json/ok.json', {
                    experimentTypeId: experimentTypeId
                }, function (res) {
                    layer.closeAll('loading');
                    if (res.code === 200) {
                        layer.msg(res.msg, {icon: 1});
                        insTb.reload({page: {curr: 1}});
                    } else {
                        layer.msg(res.msg, {icon: 2});
                $.ajax({
                    url: baseUrl+"/waitMatin/delete/auth",
                    headers: {'token': localStorage.getItem('token')},
                    data: {
                        billNo: billNo
                    },
                    // contentType:'application/json;charset=UTF-8',
                    method: 'POST',
                    success: function (res) {
                        layer.closeAll('loading');
                        if (res.code === 200){
                            insTb.reload({page: {curr: 1}});
                            layer.msg(res.msg, {icon: 1});
                        } else if (res.code === 403){
                            top.location.href = baseUrl+"/";
                        }else {
                            layer.msg(res.msg, {icon: 2});
                        }
                    }
                }, 'json');
                })
            });
        }