Commit 927269fc07e112997b0bd0d8f400bf89771a1fdf
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # .idea/workspace.xml
Showing
2 changed files
with
101 additions
and
10 deletions
src/main/java/com/huaheng/pc/config/materialMultiple/controller/MaterialMultipleController.java
... | ... | @@ -9,15 +9,13 @@ import com.huaheng.common.utils.StringUtils; |
9 | 9 | import com.huaheng.common.utils.security.ShiroUtils; |
10 | 10 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
11 | 11 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
12 | 13 | import com.huaheng.framework.web.domain.AjaxResult; |
13 | 14 | import com.huaheng.framework.web.page.PageDomain; |
14 | 15 | import com.huaheng.framework.web.page.TableDataInfo; |
15 | 16 | import com.huaheng.framework.web.page.TableSupport; |
16 | 17 | import com.huaheng.pc.config.materialMultiple.domain.MaterialMultiple; |
17 | 18 | import com.huaheng.pc.config.materialMultiple.service.MaterialMultipleService; |
18 | -import com.huaheng.pc.config.materialUnit.domain.MaterialUnit; | |
19 | -import com.huaheng.pc.general.material.domain.Material; | |
20 | -import com.huaheng.pc.general.material.service.MaterialService; | |
21 | 19 | import io.swagger.annotations.ApiOperation; |
22 | 20 | import io.swagger.annotations.ApiParam; |
23 | 21 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
... | ... | @@ -31,17 +29,50 @@ import java.util.List; |
31 | 29 | |
32 | 30 | @Controller |
33 | 31 | @RequestMapping("/config/materialMultiple") |
34 | -public class MaterialMultipleController { | |
32 | +public class MaterialMultipleController extends BaseController { | |
35 | 33 | |
36 | 34 | @Resource |
37 | 35 | private MaterialMultipleService materialMultipleService; |
38 | 36 | |
39 | 37 | private String prefix = "config/materialMultiple"; |
40 | 38 | |
41 | - @RequiresPermissions("config:materialUnit:view") | |
39 | + @RequiresPermissions("config:materialMultiple:view") | |
42 | 40 | @GetMapping() |
43 | - public String materialUnit() { | |
44 | - return prefix + "/materialUnit"; | |
41 | + public String materialMultiple() { | |
42 | + return prefix + "/materialMultiple"; | |
43 | + } | |
44 | + | |
45 | + /** | |
46 | + * 查询单位转换列表 | |
47 | + */ | |
48 | + @ApiOperation(value="查看单位转换列表", notes="根据物料编码、名称、创建时间获取单位转换列表", httpMethod = "POST") | |
49 | + @RequiresPermissions("config:materialMultiple:list") | |
50 | + @Log(title = "配置-单位转换",operating = "单位转换列表", action = BusinessType.GRANT) | |
51 | + @PostMapping("/list") | |
52 | + @ResponseBody | |
53 | + public TableDataInfo list(@ApiParam(name="receiptType",value="物料编码、名称") MaterialMultiple materialMultiple, | |
54 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | |
55 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | |
56 | + LambdaQueryWrapper<MaterialMultiple> lambdaQueryWrapper = Wrappers.lambdaQuery(); | |
57 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
58 | + Integer pageNum = pageDomain.getPageNum(); | |
59 | + Integer pageSize = pageDomain.getPageSize(); | |
60 | + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), MaterialMultiple::getCreated, createdBegin) | |
61 | + .lt(StringUtils.isNotEmpty(createdEnd), MaterialMultiple::getCreated, createdEnd) | |
62 | + .eq(StringUtils.isNotEmpty(materialMultiple.getMaterialCode()), MaterialMultiple::getMaterialCode, materialMultiple.getMaterialCode()) | |
63 | + .eq(StringUtils.isNotEmpty(materialMultiple.getMaterialName()), MaterialMultiple::getMaterialName, materialMultiple.getMaterialName()) | |
64 | + .in(MaterialMultiple::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
65 | + .eq(MaterialMultiple::getWarehouseCode, ShiroUtils.getWarehouseCode()); | |
66 | + | |
67 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | |
68 | + /*使用分页查询*/ | |
69 | + Page<MaterialMultiple> page = new Page<>(pageNum, pageSize); | |
70 | + IPage<MaterialMultiple> iPage = materialMultipleService.page(page, lambdaQueryWrapper); | |
71 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
72 | + } else { | |
73 | + List<MaterialMultiple> list = materialMultipleService.list(lambdaQueryWrapper); | |
74 | + return getDataTable(list); | |
75 | + } | |
45 | 76 | } |
46 | 77 | |
47 | 78 | /** |
... | ... | @@ -52,5 +83,68 @@ public class MaterialMultipleController { |
52 | 83 | return prefix + "/add"; |
53 | 84 | } |
54 | 85 | |
86 | + /** | |
87 | + * 新增保存单位转换 | |
88 | + */ | |
89 | + @ApiOperation(value="新增单位转换", notes="新增单位转换", httpMethod = "POST") | |
90 | + @RequiresPermissions("config:materialMultiple:add") | |
91 | + @Log(title = "配置-单位转换",operating = "新增单位转换", action = BusinessType.INSERT) | |
92 | + @PostMapping("/add") | |
93 | + @ResponseBody | |
94 | + public AjaxResult addSave(MaterialMultiple materialMultiple) { | |
95 | + LambdaQueryWrapper<MaterialMultiple> lambda = Wrappers.lambdaQuery(); | |
96 | + lambda.eq(MaterialMultiple::getCompanyCode,materialMultiple.getCompanyCode()) | |
97 | + .eq(MaterialMultiple::getMaterialCode, materialMultiple) | |
98 | + .eq(MaterialMultiple::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
99 | + .eq(MaterialMultiple::getUnitId1, materialMultiple.getUnitId1()) | |
100 | + .eq(MaterialMultiple::getUnitId2, materialMultiple.getUnitId2()); | |
101 | + if (materialMultipleService.list(lambda) == null){ | |
102 | + return AjaxResult.error("该信息已存在"); | |
103 | + } | |
104 | + materialMultiple.setCreatedBy(ShiroUtils.getLoginName()); | |
105 | + materialMultiple.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
106 | + return toAjax(materialMultipleService.save(materialMultiple)); | |
107 | + } | |
55 | 108 | |
109 | + /** | |
110 | + * 修改单位转换 | |
111 | + */ | |
112 | + @GetMapping("/edit/{id}") | |
113 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
114 | + MaterialMultiple materialMultiple = materialMultipleService.getById(id); | |
115 | + mmap.put("materialMultiple", materialMultiple); | |
116 | + return prefix + "/edit"; | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * 修改保存单位转换 | |
121 | + */ | |
122 | + @ApiOperation(value="修改单位转换信息", notes="修改单位转换信息", httpMethod = "POST") | |
123 | + @RequiresPermissions("config:warehouse:edit") | |
124 | + @Log(title = "配置-单位转换",operating = "修改单位转换", action = BusinessType.UPDATE) | |
125 | + @PostMapping("/edit") | |
126 | + @ResponseBody | |
127 | + public AjaxResult editSave(MaterialMultiple materialMultiple) { | |
128 | + materialMultiple.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
129 | + return toAjax(materialMultipleService.updateById(materialMultiple)); | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * 删除单位转换 | |
134 | + */ | |
135 | + @ApiOperation(value="删除单位转换", notes="单条删除或批量删除单位转换,示例1或1,2,3", httpMethod = "POST") | |
136 | + @RequiresPermissions("config:receiptType:remove") | |
137 | + @Log(title = "配置-单位转换",operating = "删除单位转换", action = BusinessType.DELETE) | |
138 | + @PostMapping( "/remove") | |
139 | + @ResponseBody | |
140 | + public AjaxResult remove(String ids) { | |
141 | + if (StringUtils.isEmpty(ids)) { | |
142 | + return AjaxResult.error("id不能为空"); | |
143 | + } | |
144 | + List<Integer> list = new ArrayList<>(); | |
145 | + for (Integer id : Convert.toIntArray(ids)) { | |
146 | + list.add(id); | |
147 | + } | |
148 | + return toAjax(materialMultipleService.removeByIds(list)); | |
149 | + } | |
56 | 150 | } |
... | ... |
src/main/java/com/huaheng/pc/inventory/inventoryDetail/controller/InventoryDetailController.java
... | ... | @@ -9,16 +9,13 @@ import com.huaheng.common.utils.security.ShiroUtils; |
9 | 9 | import com.huaheng.framework.aspectj.lang.annotation.Log; |
10 | 10 | import com.huaheng.framework.aspectj.lang.constant.BusinessType; |
11 | 11 | import com.huaheng.framework.web.controller.BaseController; |
12 | -import com.huaheng.framework.web.domain.AjaxResult; | |
13 | 12 | import com.huaheng.framework.web.page.PageDomain; |
14 | 13 | import com.huaheng.framework.web.page.TableDataInfo; |
15 | 14 | import com.huaheng.framework.web.page.TableSupport; |
16 | 15 | import com.huaheng.pc.general.material.service.MaterialServiceImpl; |
17 | 16 | import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail; |
18 | 17 | import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService; |
19 | -import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader; | |
20 | 18 | import com.huaheng.pc.inventory.inventoryHeader.service.InventoryHeaderService; |
21 | -import org.apache.shiro.authz.annotation.RequiresPermissions; | |
22 | 19 | import org.springframework.stereotype.Controller; |
23 | 20 | import org.springframework.web.bind.annotation.GetMapping; |
24 | 21 | import org.springframework.web.bind.annotation.PostMapping; |
... | ... |