jyy
2021-01-26 ab2879bbcb846256cc182198b9c04e50fbc276c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.matrix.system.hiveErp.action;
 
import com.matrix.core.constance.MatrixConstance;
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.core.tools.DateUtil;
import com.matrix.core.tools.WebUtil;
import com.matrix.core.tools.excl.ExcelSheetPO;
import com.matrix.core.tools.excl.ExcelVersion;
import com.matrix.system.common.bean.SysUsers;
import com.matrix.system.common.tools.ResponseHeadUtil;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.action.BaseController;
import com.matrix.system.hive.bean.ShoppingGoods;
import com.matrix.system.hive.bean.SysStoreInfo;
import com.matrix.system.hive.dao.SysStoreInfoDao;
import com.matrix.system.hive.service.SysStoreInfoService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
 
 
/**
 * 库存
 *
 * @author jiangyouyao
 * @date 2016-07-20
 */
@Controller
@RequestMapping(value = "hiveErp/store")
public class ErpStoreController extends BaseController {
    @Resource
    private SysStoreInfoService currentService;
 
    @Resource
    private SysStoreInfoDao sysStoreInfoDao;
 
 
    //记录编辑前的值Before_Edit_Value
    public static final String BEV = "Store_BEV";
 
    public static final String fnCode = "store";
    public static final String fnCode1 = "store1";
    public static final String fnCode2 = "store2";
    public static final String search = ":search";
    public static final String edit = ":edit";
    public static final String del = ":del";
    public static final String add = ":add";
    public static final String excelOut = ":excelOut";
 
 
    /**
     * 列表显示
     */
    @RequestMapping(value = "/showList")
    public @ResponseBody
    AjaxResult showList(SysStoreInfo sysStoreInfo, PaginationVO pageVo) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
        sysStoreInfo.setCompanyId(users.getCompanyId());
        return showList(currentService, sysStoreInfo, pageVo);
    }
 
    /**
     * 按产品批次显示
     * @param sysStoreInfo
     * @param pageVo
     * @return
     */
    @RequestMapping(value = "/showCountList")
    public @ResponseBody
    AjaxResult showCountList(SysStoreInfo sysStoreInfo, PaginationVO pageVo) {
        SysUsers users = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY);
 
       sysStoreInfo.setCompanyId(users.getCompanyId());
 
        List<SysStoreInfo> dataList = sysStoreInfoDao.selectCountInPage(sysStoreInfo, pageVo);
        AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS,  dataList, sysStoreInfoDao.selectCountTotalRecord(sysStoreInfo));
        return result;
    }
 
 
 
    /**
     * 新增或修改页面
     */
    @RequestMapping(value = "/addOrModify")
    public @ResponseBody
    AjaxResult addOrModify(SysStoreInfo sysStoreInfo) {
 
        if (!getMe().getShopRole().equals(Dictionary.FLAG_YES_Y)) {
            sysStoreInfo.setStoreId(getMe().getShopId());
        }
 
        if (sysStoreInfo.getId() != null) {
 
            return modify(currentService, sysStoreInfo, "库存");
        } else {
 
            return add(currentService, sysStoreInfo, "库存");
        }
    }
 
    /**
     * 进入修改界面
     */
    @RequestMapping(value = "/editForm")
    public String editForm(Long id) {
        SysStoreInfo sysStoreInfo;
        if (id != null) {
            sysStoreInfo = currentService.findById(id);
            WebUtil.getRequest().setAttribute("obj", sysStoreInfo);
        }
        return "admin/hive/products/goods-form";
    }
 
 
    /**
     * 删除
     */
    @RequestMapping(value = "/del")
    public @ResponseBody
    AjaxResult del(String keys) {
 
        return remove(currentService, keys);
    }
 
 
}