Commit f71482cffc51e00c02b2a0d7372513b50bacad58
1 parent
2ebb5e32
添加商品详情
Showing
7 changed files
with
457 additions
and
0 deletions
src/main/java/com/huaheng/pc/general/bom/controller/BomDetailController.java
0 → 100644
1 | +package com.huaheng.pc.general.bom.controller; | ||
2 | + | ||
3 | +import com.huaheng.pc.general.bom.domain.BomDetail; | ||
4 | +import com.huaheng.pc.general.bom.service.BomDetailService; | ||
5 | +import org.springframework.stereotype.Controller; | ||
6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
7 | + | ||
8 | +import javax.annotation.Resource; | ||
9 | + | ||
10 | +@Controller | ||
11 | +@RequestMapping("/general/bomDetail") | ||
12 | +public class BomDetailController { | ||
13 | + | ||
14 | + private String prefix = "general/bomDetail"; | ||
15 | + | ||
16 | + @Resource | ||
17 | + private BomDetailService bomDetailService; | ||
18 | +} |
src/main/java/com/huaheng/pc/general/bom/controller/BomHeaderController.java
0 → 100644
1 | +package com.huaheng.pc.general.bom.controller; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
6 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||
7 | +import com.huaheng.common.support.Convert; | ||
8 | +import com.huaheng.common.utils.StringUtils; | ||
9 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | ||
10 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | ||
11 | +import com.huaheng.framework.web.controller.BaseController; | ||
12 | +import com.huaheng.framework.web.domain.AjaxResult; | ||
13 | +import com.huaheng.framework.web.page.PageDomain; | ||
14 | +import com.huaheng.framework.web.page.TableDataInfo; | ||
15 | +import com.huaheng.framework.web.page.TableSupport; | ||
16 | +import com.huaheng.pc.general.bom.domain.BomDetail; | ||
17 | +import com.huaheng.pc.general.bom.domain.BomHeader; | ||
18 | +import com.huaheng.pc.general.bom.service.BomDetailService; | ||
19 | +import com.huaheng.pc.general.bom.service.BomHeaderService; | ||
20 | +import io.swagger.annotations.ApiOperation; | ||
21 | +import io.swagger.annotations.ApiParam; | ||
22 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | ||
23 | +import org.springframework.stereotype.Controller; | ||
24 | +import org.springframework.ui.ModelMap; | ||
25 | +import org.springframework.web.bind.annotation.*; | ||
26 | + | ||
27 | +import javax.annotation.Resource; | ||
28 | +import java.util.ArrayList; | ||
29 | +import java.util.List; | ||
30 | + | ||
31 | +@Controller | ||
32 | +@RequestMapping("/general/bomHeader") | ||
33 | +public class BomHeaderController extends BaseController { | ||
34 | + | ||
35 | + private String prefix = "general/bomHeader"; | ||
36 | + | ||
37 | + @Resource | ||
38 | + private BomHeaderService bomHeaderService; | ||
39 | + | ||
40 | + @Resource | ||
41 | + private BomDetailService bomDetailService; | ||
42 | + | ||
43 | + @RequiresPermissions("general:bomHeader:view") | ||
44 | + @GetMapping() | ||
45 | + public String company() { | ||
46 | + return prefix + "/bomHeader"; | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * 查询商品列表 | ||
51 | + */ | ||
52 | + @ApiOperation(value="查看商品列表", notes="根据物料编码、物料名称、货主编码、创建时间获取商品信息", httpMethod = "POST") | ||
53 | + @RequiresPermissions("general:bomHeader:list") | ||
54 | + @Log(title = "通用-商品管理", operating = "查看商品列表", action = BusinessType.GRANT) | ||
55 | + @PostMapping("/list") | ||
56 | + @ResponseBody | ||
57 | + public TableDataInfo list( | ||
58 | + @ApiParam(name="bomHeader",value="物料编码、物料名称、货主编码") BomHeader bomHeader, | ||
59 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | ||
60 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | ||
61 | + LambdaQueryWrapper<BomHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
62 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | ||
63 | + Integer pageNum = pageDomain.getPageNum(); | ||
64 | + Integer pageSize = pageDomain.getPageSize(); | ||
65 | + lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), BomHeader::getCreated, createdBegin) | ||
66 | + .lt(StringUtils.isNotEmpty(createdEnd), BomHeader::getCreated, createdEnd) | ||
67 | + .eq(StringUtils.isNotEmpty(bomHeader.getMaterialCode()), BomHeader::getMaterialCode, bomHeader.getMaterialCode()) | ||
68 | + .eq(StringUtils.isNotEmpty(bomHeader.getMaterialName()), BomHeader::getMaterialName, bomHeader.getMaterialName()) | ||
69 | + .eq(StringUtils.isNotEmpty(bomHeader.getCompanyCode()), BomHeader::getCompanyCode, bomHeader.getCompanyCode()); | ||
70 | + | ||
71 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | ||
72 | + /*使用分页查询*/ | ||
73 | + Page<BomHeader> page = new Page<>(pageNum, pageSize); | ||
74 | + IPage<BomHeader> iPage = bomHeaderService.page(page, lambdaQueryWrapper); | ||
75 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | ||
76 | + } else { | ||
77 | + List<BomHeader> list = bomHeaderService.list(lambdaQueryWrapper); | ||
78 | + return getDataTable(list); | ||
79 | + } | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * 新增商品 | ||
84 | + */ | ||
85 | + @GetMapping("/add") | ||
86 | + public String add() { | ||
87 | + return prefix + "/add"; | ||
88 | + } | ||
89 | + | ||
90 | + /** | ||
91 | + * 新增保存商品 | ||
92 | + */ | ||
93 | + @ApiOperation(value="新增商品", notes="新增商品", httpMethod = "POST") | ||
94 | + @RequiresPermissions("general:bomHeader:add") | ||
95 | + @Log(title = "通用-商品", operating = "新增商品", action = BusinessType.INSERT) | ||
96 | + @PostMapping("/add") | ||
97 | + @ResponseBody | ||
98 | + public AjaxResult addSave(@ApiParam(name = "containerType", value = "商品类型", required = true) | ||
99 | + BomHeader bomHeader) { | ||
100 | + return toAjax(bomHeaderService.save(bomHeader)); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * 修改商品 | ||
105 | + */ | ||
106 | + @GetMapping("/edit/{id}") | ||
107 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | ||
108 | + mmap.put("bomHeader", bomHeaderService.getById(id)); | ||
109 | + return prefix + "/edit"; | ||
110 | + } | ||
111 | + | ||
112 | + /** | ||
113 | + * 修改保存商品 | ||
114 | + */ | ||
115 | + @ApiOperation(value="修改商品", notes="修改商品", httpMethod = "POST") | ||
116 | + @RequiresPermissions("general:bomHeader:edit") | ||
117 | + @Log(title = "通用-商品", operating = "修改商品", action = BusinessType.UPDATE) | ||
118 | + @PostMapping("/edit") | ||
119 | + @ResponseBody | ||
120 | + public AjaxResult editSave( | ||
121 | + @ApiParam(name = "bomHeader", value = "商品实体类", required = true)BomHeader bomHeader) { | ||
122 | + return toAjax(bomHeaderService.updateById(bomHeader)); | ||
123 | + } | ||
124 | + | ||
125 | + /** | ||
126 | + * 删除容器 | ||
127 | + */ | ||
128 | + @ApiOperation(value="删除商品", notes="根据id批量删除商品,参数示例1,2,3", httpMethod = "POST") | ||
129 | + @RequiresPermissions("general:bomHeader:remove") | ||
130 | + @Log(title = "通用-商品", operating = "删除商品", action = BusinessType.DELETE) | ||
131 | + @PostMapping( "/remove") | ||
132 | + @ResponseBody | ||
133 | + public AjaxResult remove(String ids) { | ||
134 | + if (StringUtils.isEmpty(ids)){ | ||
135 | + return AjaxResult.error("id不能为空"); | ||
136 | + } | ||
137 | + List<Integer> list = new ArrayList<>(); | ||
138 | + for (Integer id : Convert.toIntArray(ids)) { | ||
139 | + | ||
140 | + LambdaQueryWrapper<BomDetail> lambda = Wrappers.lambdaQuery(); | ||
141 | + List<BomDetail> bomDetailList = bomDetailService.list(lambda.eq(BomDetail::getBomId, id)); | ||
142 | + if (bomDetailList.size() != 0) { | ||
143 | + list.add(id); | ||
144 | + } else { | ||
145 | + return AjaxResult.error("商品编码为(" + id + ")存在商品详情"); | ||
146 | + } | ||
147 | + } | ||
148 | + return toAjax(bomHeaderService.removeByIds(list)); | ||
149 | + } | ||
150 | + | ||
151 | +} |
src/main/java/com/huaheng/pc/general/bom/domain/BomDetail.java
0 → 100644
1 | +package com.huaheng.pc.general.bom.domain; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.IdType; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
6 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
7 | +import io.swagger.annotations.ApiModel; | ||
8 | +import io.swagger.annotations.ApiModelProperty; | ||
9 | +import java.io.Serializable; | ||
10 | +import java.util.Date; | ||
11 | +import lombok.Data; | ||
12 | + | ||
13 | +@ApiModel(value="com.huaheng.pc.general.bom.domain.BomDetail") | ||
14 | +@Data | ||
15 | +@TableName(value = "bom_detail") | ||
16 | +public class BomDetail implements Serializable { | ||
17 | + /** | ||
18 | + * 内部号 | ||
19 | + */ | ||
20 | + @TableId(value = "id", type = IdType.AUTO) | ||
21 | + @ApiModelProperty(value="内部号") | ||
22 | + private Integer id; | ||
23 | + | ||
24 | + /** | ||
25 | + * 仓库代码 | ||
26 | + */ | ||
27 | + @TableField(value = "warehouseCode") | ||
28 | + @ApiModelProperty(value="仓库代码") | ||
29 | + private String warehouseCode; | ||
30 | + | ||
31 | + /** | ||
32 | + * 货主 | ||
33 | + */ | ||
34 | + @TableField(value = "companyCode") | ||
35 | + @ApiModelProperty(value="货主") | ||
36 | + private String companyCode; | ||
37 | + | ||
38 | + /** | ||
39 | + * 物料清单内部号 | ||
40 | + */ | ||
41 | + @TableField(value = "bomId") | ||
42 | + @ApiModelProperty(value="物料清单内部号") | ||
43 | + private Integer bomId; | ||
44 | + | ||
45 | + /** | ||
46 | + * 物料编码 | ||
47 | + */ | ||
48 | + @TableField(value = "materialCode") | ||
49 | + @ApiModelProperty(value="物料编码") | ||
50 | + private String materialCode; | ||
51 | + | ||
52 | + /** | ||
53 | + * 物料名称 | ||
54 | + */ | ||
55 | + @TableField(value = "materialName") | ||
56 | + @ApiModelProperty(value="物料名称") | ||
57 | + private String materialName; | ||
58 | + | ||
59 | + /** | ||
60 | + * 数量单位 | ||
61 | + */ | ||
62 | + @TableField(value = "materialUnit") | ||
63 | + @ApiModelProperty(value="数量单位") | ||
64 | + private String materialUnit; | ||
65 | + | ||
66 | + /** | ||
67 | + * 组套层次 | ||
68 | + */ | ||
69 | + @TableField(value = "buildLevel") | ||
70 | + @ApiModelProperty(value="组套层次") | ||
71 | + private Integer buildLevel; | ||
72 | + | ||
73 | + /** | ||
74 | + * 序号 | ||
75 | + */ | ||
76 | + @TableField(value = "buildSequence") | ||
77 | + @ApiModelProperty(value="序号") | ||
78 | + private Integer buildSequence; | ||
79 | + | ||
80 | + /** | ||
81 | + * 每成品需要数量 | ||
82 | + */ | ||
83 | + @TableField(value = "qty") | ||
84 | + @ApiModelProperty(value="每成品需要数量") | ||
85 | + private Integer qty; | ||
86 | + | ||
87 | + /** | ||
88 | + * 分配规则 | ||
89 | + */ | ||
90 | + @TableField(value = "allocationRule") | ||
91 | + @ApiModelProperty(value="分配规则") | ||
92 | + private String allocationRule; | ||
93 | + | ||
94 | + /** | ||
95 | + * 从货位 | ||
96 | + */ | ||
97 | + @TableField(value = "fromLocation") | ||
98 | + @ApiModelProperty(value="从货位") | ||
99 | + private String fromLocation; | ||
100 | + | ||
101 | + /** | ||
102 | + * 有效 | ||
103 | + */ | ||
104 | + @TableField(value = "enable") | ||
105 | + @ApiModelProperty(value="有效") | ||
106 | + private Boolean enable; | ||
107 | + | ||
108 | + /** | ||
109 | + * 创建时间 | ||
110 | + */ | ||
111 | + @TableField(value = "created") | ||
112 | + @ApiModelProperty(value="创建时间") | ||
113 | + private Date created; | ||
114 | + | ||
115 | + /** | ||
116 | + * 创建用户 | ||
117 | + */ | ||
118 | + @TableField(value = "createdBy") | ||
119 | + @ApiModelProperty(value="创建用户") | ||
120 | + private String createdBy; | ||
121 | + | ||
122 | + /** | ||
123 | + * 创建时间 | ||
124 | + */ | ||
125 | + @TableField(value = "lastUpdated") | ||
126 | + @ApiModelProperty(value="创建时间") | ||
127 | + private Date lastUpdated; | ||
128 | + | ||
129 | + /** | ||
130 | + * 更新用户 | ||
131 | + */ | ||
132 | + @TableField(value = "lastUpdatedBy") | ||
133 | + @ApiModelProperty(value="更新用户") | ||
134 | + private String lastUpdatedBy; | ||
135 | + | ||
136 | + /** | ||
137 | + * 数据版本 | ||
138 | + */ | ||
139 | + @TableField(value = "version") | ||
140 | + @ApiModelProperty(value="数据版本") | ||
141 | + private Integer version; | ||
142 | + | ||
143 | + /** | ||
144 | + * 自定义字段1 | ||
145 | + */ | ||
146 | + @TableField(value = "userDef1") | ||
147 | + @ApiModelProperty(value="自定义字段1") | ||
148 | + private String userDef1; | ||
149 | + | ||
150 | + /** | ||
151 | + * 自定义字段2 | ||
152 | + */ | ||
153 | + @TableField(value = "userDef2") | ||
154 | + @ApiModelProperty(value="自定义字段2") | ||
155 | + private String userDef2; | ||
156 | + | ||
157 | + /** | ||
158 | + * 自定义字段3 | ||
159 | + */ | ||
160 | + @TableField(value = "userDef3") | ||
161 | + @ApiModelProperty(value="自定义字段3") | ||
162 | + private String userDef3; | ||
163 | + | ||
164 | + /** | ||
165 | + * 自定义字段4 | ||
166 | + */ | ||
167 | + @TableField(value = "userDef4") | ||
168 | + @ApiModelProperty(value="自定义字段4") | ||
169 | + private String userDef4; | ||
170 | + | ||
171 | + /** | ||
172 | + * 自定义字段5 | ||
173 | + */ | ||
174 | + @TableField(value = "userDef5") | ||
175 | + @ApiModelProperty(value="自定义字段5") | ||
176 | + private String userDef5; | ||
177 | + | ||
178 | + /** | ||
179 | + * 自定义字段6 | ||
180 | + */ | ||
181 | + @TableField(value = "userDef6") | ||
182 | + @ApiModelProperty(value="自定义字段6") | ||
183 | + private String userDef6; | ||
184 | + | ||
185 | + /** | ||
186 | + * 自定义字段7 | ||
187 | + */ | ||
188 | + @TableField(value = "userDef7") | ||
189 | + @ApiModelProperty(value="自定义字段7") | ||
190 | + private String userDef7; | ||
191 | + | ||
192 | + /** | ||
193 | + * 自定义字段8 | ||
194 | + */ | ||
195 | + @TableField(value = "userDef8") | ||
196 | + @ApiModelProperty(value="自定义字段8") | ||
197 | + private String userDef8; | ||
198 | + | ||
199 | + /** | ||
200 | + * 处理标记 | ||
201 | + */ | ||
202 | + @TableField(value = "processStamp") | ||
203 | + @ApiModelProperty(value="处理标记") | ||
204 | + private String processStamp; | ||
205 | + | ||
206 | + private static final long serialVersionUID = 1L; | ||
207 | + | ||
208 | + public static final String COL_WAREHOUSECODE = "warehouseCode"; | ||
209 | + | ||
210 | + public static final String COL_COMPANYCODE = "companyCode"; | ||
211 | + | ||
212 | + public static final String COL_BOMID = "bomId"; | ||
213 | + | ||
214 | + public static final String COL_MATERIALCODE = "materialCode"; | ||
215 | + | ||
216 | + public static final String COL_MATERIALNAME = "materialName"; | ||
217 | + | ||
218 | + public static final String COL_MATERIALUNIT = "materialUnit"; | ||
219 | + | ||
220 | + public static final String COL_BUILDLEVEL = "buildLevel"; | ||
221 | + | ||
222 | + public static final String COL_BUILDSEQUENCE = "buildSequence"; | ||
223 | + | ||
224 | + public static final String COL_QTY = "qty"; | ||
225 | + | ||
226 | + public static final String COL_ALLOCATIONRULE = "allocationRule"; | ||
227 | + | ||
228 | + public static final String COL_FROMLOCATION = "fromLocation"; | ||
229 | + | ||
230 | + public static final String COL_ENABLE = "enable"; | ||
231 | + | ||
232 | + public static final String COL_CREATED = "created"; | ||
233 | + | ||
234 | + public static final String COL_CREATEDBY = "createdBy"; | ||
235 | + | ||
236 | + public static final String COL_LASTUPDATED = "lastUpdated"; | ||
237 | + | ||
238 | + public static final String COL_LASTUPDATEDBY = "lastUpdatedBy"; | ||
239 | + | ||
240 | + public static final String COL_VERSION = "version"; | ||
241 | + | ||
242 | + public static final String COL_USERDEF1 = "userDef1"; | ||
243 | + | ||
244 | + public static final String COL_USERDEF2 = "userDef2"; | ||
245 | + | ||
246 | + public static final String COL_USERDEF3 = "userDef3"; | ||
247 | + | ||
248 | + public static final String COL_USERDEF4 = "userDef4"; | ||
249 | + | ||
250 | + public static final String COL_USERDEF5 = "userDef5"; | ||
251 | + | ||
252 | + public static final String COL_USERDEF6 = "userDef6"; | ||
253 | + | ||
254 | + public static final String COL_USERDEF7 = "userDef7"; | ||
255 | + | ||
256 | + public static final String COL_USERDEF8 = "userDef8"; | ||
257 | + | ||
258 | + public static final String COL_PROCESSSTAMP = "processStamp"; | ||
259 | +} | ||
0 | \ No newline at end of file | 260 | \ No newline at end of file |
src/main/java/com/huaheng/pc/general/bom/mapper/BomDetailMapper.java
0 → 100644
1 | +package com.huaheng.pc.general.bom.mapper; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import com.huaheng.pc.general.bom.domain.BomDetail; | ||
5 | + | ||
6 | +public interface BomDetailMapper extends BaseMapper<BomDetail> { | ||
7 | +} | ||
0 | \ No newline at end of file | 8 | \ No newline at end of file |
src/main/java/com/huaheng/pc/general/bom/service/BomDetailService.java
0 → 100644
src/main/java/com/huaheng/pc/general/bom/service/BomDetailServiceImpl.java
0 → 100644
1 | +package com.huaheng.pc.general.bom.service; | ||
2 | + | ||
3 | +import org.springframework.stereotype.Service; | ||
4 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||
5 | +import com.huaheng.pc.general.bom.domain.BomDetail; | ||
6 | +import com.huaheng.pc.general.bom.mapper.BomDetailMapper; | ||
7 | + | ||
8 | +@Service | ||
9 | +public class BomDetailServiceImpl extends ServiceImpl<BomDetailMapper, BomDetail> implements BomDetailService{ | ||
10 | + | ||
11 | +} |
src/main/java/com/huaheng/pc/general/carrier/domain/Carrier.java
@@ -10,6 +10,9 @@ import java.io.Serializable; | @@ -10,6 +10,9 @@ import java.io.Serializable; | ||
10 | import java.util.Date; | 10 | import java.util.Date; |
11 | import lombok.Data; | 11 | import lombok.Data; |
12 | 12 | ||
13 | +/** | ||
14 | + * 承运商 | ||
15 | + */ | ||
13 | @ApiModel(value="com.huaheng.pc.general.carrier.domain.Carrier") | 16 | @ApiModel(value="com.huaheng.pc.general.carrier.domain.Carrier") |
14 | @Data | 17 | @Data |
15 | @TableName(value = "carrier") | 18 | @TableName(value = "carrier") |