Commit e783cec357bde19b3a19cfd1f003822d1a79cd74
1 parent
77bfeaf7
添加物料控制类
Showing
8 changed files
with
268 additions
and
58 deletions
.gitignore
.idea/workspace.xml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <project version="4"> |
3 | 3 | <component name="ChangeListManager"> |
4 | - <list default="true" id="9ff7b25e-dc1a-4859-8a0c-00039489e359" name="Default Changelist" comment="用户查询修改"> | |
5 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_baomidou_mybatis_plus_3_1_2.xml" afterDir="false" /> | |
6 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_baomidou_mybatis_plus_annotation_3_1_2.xml" afterDir="false" /> | |
7 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_baomidou_mybatis_plus_boot_starter_3_1_2.xml" afterDir="false" /> | |
8 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_baomidou_mybatis_plus_core_3_1_2.xml" afterDir="false" /> | |
9 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__com_baomidou_mybatis_plus_extension_3_1_2.xml" afterDir="false" /> | |
10 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__commons_fileupload_commons_fileupload_1_4.xml" afterDir="false" /> | |
11 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__commons_io_commons_io_2_2.xml" afterDir="false" /> | |
12 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_mybatis_mybatis_3_5_1.xml" afterDir="false" /> | |
13 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_mybatis_mybatis_spring_2_0_1.xml" afterDir="false" /> | |
14 | - <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_projectlombok_lombok_1_18_8.xml" afterDir="false" /> | |
15 | - <change beforePath="$PROJECT_DIR$/.idea/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.gitignore" afterDir="false" /> | |
16 | - <change beforePath="$PROJECT_DIR$/.idea/compiler.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" /> | |
4 | + <list default="true" id="9ff7b25e-dc1a-4859-8a0c-00039489e359" name="Default Changelist" comment=""> | |
5 | + <change afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/controller/MaterialController.java" afterDir="false" /> | |
17 | 6 | <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
7 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/domain/Material.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/domain/Material.java" afterDir="false" /> | |
8 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/service/MaterialService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/service/MaterialService.java" afterDir="false" /> | |
9 | + <change beforePath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/service/MaterialServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/material/service/MaterialServiceImpl.java" afterDir="false" /> | |
10 | + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/general/location/add.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/general/location/add.html" afterDir="false" /> | |
11 | + <change beforePath="$PROJECT_DIR$/src/main/resources/templates/general/location/location.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/general/location/location.html" afterDir="false" /> | |
18 | 12 | </list> |
19 | 13 | <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> |
20 | 14 | <option name="SHOW_DIALOG" value="false" /> |
... | ... | @@ -54,14 +48,7 @@ |
54 | 48 | <item name="@172.16.29.45" type="feb32156:DbDataSourceImpl" /> |
55 | 49 | <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" /> |
56 | 50 | <item name="wms_v2: schema" type="76f4a085:MysqlImplModel$Schema" /> |
57 | - <item name="location: table" type="285a2a93:MysqlImplModel$Table" /> | |
58 | - </path> | |
59 | - <path> | |
60 | - <item name="Database" type="3277223f:DatabaseStructure$DbRootGroup" /> | |
61 | - <item name="@172.16.29.45" type="feb32156:DbDataSourceImpl" /> | |
62 | - <item name="schemas" type="d4e8921:DatabaseStructure$FamilyGroup" /> | |
63 | - <item name="wms_v2: schema" type="76f4a085:MysqlImplModel$Schema" /> | |
64 | - <item name="location_type: table" type="285a2a93:MysqlImplModel$Table" /> | |
51 | + <item name="material: table" type="285a2a93:MysqlImplModel$Table" /> | |
65 | 52 | </path> |
66 | 53 | </expand> |
67 | 54 | <select /> |
... | ... | @@ -120,11 +107,14 @@ |
120 | 107 | <property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1565255020864" /> |
121 | 108 | <property name="database.console.LAST_STATE" value="true" /> |
122 | 109 | <property name="last_opened_file_path" value="$PROJECT_DIR$/../WMSV1" /> |
110 | + <property name="node.js.detected.package.eslint" value="true" /> | |
111 | + <property name="node.js.path.for.package.eslint" value="project" /> | |
123 | 112 | <property name="node.js.path.for.package.tslint" value="project" /> |
113 | + <property name="node.js.selected.package.eslint" value="(autodetect)" /> | |
124 | 114 | <property name="node.js.selected.package.tslint" value="(autodetect)" /> |
125 | - <property name="project.structure.last.edited" value="Project" /> | |
126 | - <property name="project.structure.proportion" value="0.0" /> | |
127 | - <property name="project.structure.side.proportion" value="0.0" /> | |
115 | + <property name="project.structure.last.edited" value="Modules" /> | |
116 | + <property name="project.structure.proportion" value="0.15" /> | |
117 | + <property name="project.structure.side.proportion" value="0.2" /> | |
128 | 118 | <property name="settings.editor.selected.configurable" value="preferences.pluginManager" /> |
129 | 119 | </component> |
130 | 120 | <component name="RecentsManager"> |
... | ... | @@ -137,6 +127,11 @@ |
137 | 127 | </key> |
138 | 128 | </component> |
139 | 129 | <component name="RunDashboard"> |
130 | + <option name="configurationTypes"> | |
131 | + <set> | |
132 | + <option value="SpringBootApplicationConfigurationType" /> | |
133 | + </set> | |
134 | + </option> | |
140 | 135 | <option name="ruleStates"> |
141 | 136 | <list> |
142 | 137 | <RuleState> |
... | ... | @@ -148,36 +143,36 @@ |
148 | 143 | </list> |
149 | 144 | </option> |
150 | 145 | </component> |
151 | - <component name="RunManager" selected="Spring Boot.HuaHengApplication"> | |
152 | - <configuration name="CreateCode" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true"> | |
153 | - <option name="MAIN_CLASS_NAME" value="com.huaheng.test.CreateCode" /> | |
154 | - <module name="WMSV1" /> | |
155 | - <extension name="coverage"> | |
156 | - <pattern> | |
157 | - <option name="PATTERN" value="com.huaheng.test.*" /> | |
158 | - <option name="ENABLED" value="true" /> | |
159 | - </pattern> | |
160 | - </extension> | |
146 | + <component name="RunManager"> | |
147 | + <configuration name="HuaHengApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" activateToolWindowBeforeRun="false" singleton="false" nameIsGenerated="true"> | |
148 | + <module name="huaheng" /> | |
149 | + <option name="SPRING_BOOT_MAIN_CLASS" value="com.huaheng.HuaHengApplication" /> | |
150 | + <option name="DEBUG_MODE" value="true" /> | |
151 | + <option name="HIDE_BANNER" value="true" /> | |
152 | + <option name="ALTERNATIVE_JRE_PATH" /> | |
153 | + <option name="UPDATE_ACTION_UPDATE_POLICY" value="UpdateClassesAndResources" /> | |
154 | + <option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" /> | |
161 | 155 | <method v="2"> |
162 | 156 | <option name="Make" enabled="true" /> |
163 | 157 | </method> |
164 | 158 | </configuration> |
165 | - <configuration name="HuaHengApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot"> | |
166 | - <module name="WMSV1" /> | |
159 | + <configuration default="true" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" activateToolWindowBeforeRun="false"> | |
160 | + <module name="huaheng" /> | |
167 | 161 | <option name="SPRING_BOOT_MAIN_CLASS" value="com.huaheng.HuaHengApplication" /> |
162 | + <option name="DEBUG_MODE" value="true" /> | |
163 | + <option name="HIDE_BANNER" value="true" /> | |
164 | + <option name="ALTERNATIVE_JRE_PATH" /> | |
165 | + <option name="UPDATE_ACTION_UPDATE_POLICY" value="UpdateClassesAndResources" /> | |
166 | + <option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" /> | |
168 | 167 | <method v="2"> |
169 | 168 | <option name="Make" enabled="true" /> |
170 | 169 | </method> |
171 | 170 | </configuration> |
172 | - <recent_temporary> | |
173 | - <list> | |
174 | - <item itemvalue="Application.CreateCode" /> | |
175 | - </list> | |
176 | - </recent_temporary> | |
177 | 171 | </component> |
178 | 172 | <component name="ServiceViewManager"> |
179 | 173 | <option name="allServicesViewState"> |
180 | 174 | <serviceView> |
175 | + <option name="contentProportion" value="0.17955652" /> | |
181 | 176 | <treeState> |
182 | 177 | <expand /> |
183 | 178 | <select /> |
... | ... | @@ -185,6 +180,7 @@ |
185 | 180 | <option name="groupByContributor" value="true" /> |
186 | 181 | </serviceView> |
187 | 182 | </option> |
183 | + <option name="selectedView" value="0" /> | |
188 | 184 | </component> |
189 | 185 | <component name="StructureViewFactory"> |
190 | 186 | <option name="ACTIVE_ACTIONS" value=",SHOW_PROPERTIES,SHOW_ANONYMOUS,SHOW_LAMBDA,SHOW_INTERFACES,VISIBILITY_SORTER" /> |
... | ... | @@ -213,6 +209,9 @@ |
213 | 209 | <workItem from="1565244881255" duration="620000" /> |
214 | 210 | <workItem from="1565245587599" duration="32000" /> |
215 | 211 | <workItem from="1565245636976" duration="7465000" /> |
212 | + <workItem from="1565336358595" duration="3615000" /> | |
213 | + <workItem from="1565339991037" duration="87000" /> | |
214 | + <workItem from="1565340093097" duration="3717000" /> | |
216 | 215 | </task> |
217 | 216 | <task id="LOCAL-00001" summary="用户查询修改"> |
218 | 217 | <created>1565058322310</created> |
... | ... | @@ -277,7 +276,14 @@ |
277 | 276 | <option name="project" value="LOCAL" /> |
278 | 277 | <updated>1565335994460</updated> |
279 | 278 | </task> |
280 | - <option name="localTasksCounter" value="10" /> | |
279 | + <task id="LOCAL-00010" summary="git忽略"> | |
280 | + <created>1565336618584</created> | |
281 | + <option name="number" value="00010" /> | |
282 | + <option name="presentableId" value="LOCAL-00010" /> | |
283 | + <option name="project" value="LOCAL" /> | |
284 | + <updated>1565336618584</updated> | |
285 | + </task> | |
286 | + <option name="localTasksCounter" value="11" /> | |
281 | 287 | <servers /> |
282 | 288 | </component> |
283 | 289 | <component name="TypeScriptGeneratedFilesManager"> |
... | ... | @@ -323,12 +329,14 @@ |
323 | 329 | </option> |
324 | 330 | </component> |
325 | 331 | <component name="VcsManagerConfiguration"> |
332 | + <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> | |
326 | 333 | <MESSAGE value="用户查询修改" /> |
327 | 334 | <MESSAGE value="库区设置编辑" /> |
328 | 335 | <MESSAGE value="zone修改" /> |
329 | 336 | <MESSAGE value="回退" /> |
330 | 337 | <MESSAGE value="修改表格分页获取总记录数" /> |
331 | - <option name="LAST_COMMIT_MESSAGE" value="修改表格分页获取总记录数" /> | |
338 | + <MESSAGE value="git忽略" /> | |
339 | + <option name="LAST_COMMIT_MESSAGE" value="git忽略" /> | |
332 | 340 | </component> |
333 | 341 | <component name="XDebuggerManager"> |
334 | 342 | <breakpoint-manager> |
... | ... | @@ -339,9 +347,9 @@ |
339 | 347 | <option name="timeStamp" value="11" /> |
340 | 348 | </line-breakpoint> |
341 | 349 | <line-breakpoint enabled="true" type="java-line"> |
342 | - <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/general/company/controller/CompanyController.java</url> | |
343 | - <line>56</line> | |
344 | - <option name="timeStamp" value="13" /> | |
350 | + <url>file://$PROJECT_DIR$/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java</url> | |
351 | + <line>21</line> | |
352 | + <option name="timeStamp" value="14" /> | |
345 | 353 | </line-breakpoint> |
346 | 354 | </breakpoints> |
347 | 355 | </breakpoint-manager> |
... | ... |
src/main/java/com/huaheng/pc/general/material/controller/MaterialController.java
0 → 100644
1 | +package com.huaheng.pc.general.material.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.common.utils.security.ShiroUtils; | |
10 | +import com.huaheng.framework.aspectj.lang.annotation.Log; | |
11 | +import com.huaheng.framework.aspectj.lang.constant.BusinessType; | |
12 | +import com.huaheng.framework.web.controller.BaseController; | |
13 | +import com.huaheng.framework.web.domain.AjaxResult; | |
14 | +import com.huaheng.framework.web.page.PageDomain; | |
15 | +import com.huaheng.framework.web.page.TableDataInfo; | |
16 | +import com.huaheng.framework.web.page.TableSupport; | |
17 | +import com.huaheng.pc.general.location.domain.Location; | |
18 | +import com.huaheng.pc.general.location.service.LocationService; | |
19 | +import com.huaheng.pc.general.material.domain.Material; | |
20 | +import com.huaheng.pc.general.material.service.MaterialService; | |
21 | +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | |
22 | +import io.swagger.annotations.Api; | |
23 | +import io.swagger.annotations.ApiOperation; | |
24 | +import io.swagger.annotations.ApiParam; | |
25 | +import org.apache.shiro.authz.annotation.RequiresPermissions; | |
26 | +import org.springframework.stereotype.Controller; | |
27 | +import org.springframework.ui.ModelMap; | |
28 | +import org.springframework.web.bind.annotation.*; | |
29 | + | |
30 | +import javax.annotation.Resource; | |
31 | +import java.util.List; | |
32 | +import java.util.Map; | |
33 | + | |
34 | +@Api(tags={"物料控制类"}) | |
35 | +@Controller | |
36 | +@RequestMapping("/general/material") | |
37 | +public class MaterialController extends BaseController { | |
38 | + | |
39 | + private String prefix = "general/material"; | |
40 | + | |
41 | + private MaterialService materialService; | |
42 | + | |
43 | + @RequiresPermissions("general:material:view") | |
44 | + @GetMapping() | |
45 | + public String material() { | |
46 | + return prefix + "/material"; | |
47 | + } | |
48 | + | |
49 | + /** | |
50 | + * 查询物料列表 | |
51 | + */ | |
52 | + @ApiOperation(value="查看物料列表", | |
53 | + notes="根据物料编码、名称、规格、物料类别、创建时间获取物料的详细信息", | |
54 | + httpMethod = "POST") | |
55 | + @RequiresPermissions("general:material:list") | |
56 | + @Log(title = "通用-物料管理", operating = "查看物料列表", action = BusinessType.GRANT) | |
57 | + @PostMapping("/list") | |
58 | + @ResponseBody | |
59 | + public TableDataInfo list( | |
60 | + @ApiParam(name="location",value="物料编码、名称、规格、物料类别") Material material, | |
61 | + @ApiParam(name = "createdBegin", value = "起止时间") String createdBegin, | |
62 | + @ApiParam(name = "createdEnd", value = "结束时间") String createdEnd) { | |
63 | + | |
64 | + PageDomain pageDomain = TableSupport.buildPageRequest(); | |
65 | + Integer pageNum = pageDomain.getPageNum(); | |
66 | + Integer pageSize = pageDomain.getPageSize(); | |
67 | + LambdaQueryWrapper<Material> lambda = Wrappers.lambdaQuery(); | |
68 | + lambda.gt(StringUtils.isNotEmpty(createdBegin), Material::getCreated, createdBegin) | |
69 | + .lt(StringUtils.isNotEmpty(createdEnd), Material::getCreated, createdEnd) | |
70 | + .eq(StringUtils.isNotEmpty(material.getCode()), Material::getCode, material.getCode()) | |
71 | + .eq(StringUtils.isNotEmpty(material.getName()), Material::getName, material.getName()) | |
72 | + .eq(StringUtils.isNotEmpty(material.getType()), Material::getType, material.getType()) | |
73 | + .like(StringUtils.isNotEmpty(material.getSpec()), Material::getSpec, material.getSpec()) | |
74 | + .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
75 | + .in(Material::getCompanyCode, ShiroUtils.getCompanyCodeList()) | |
76 | + .ne(Material::getDeleted, false); | |
77 | + | |
78 | + if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){ | |
79 | + /*使用分页查询*/ | |
80 | + Page<Material> page = new Page<>(pageNum, pageSize); | |
81 | + IPage<Material> iPage = materialService.page(page, lambda); | |
82 | + return getMpDataTable(iPage.getRecords(), iPage.getTotal()); | |
83 | + } else { | |
84 | + List<Material> list = materialService.list(lambda); | |
85 | + return getDataTable(list); | |
86 | + } | |
87 | + } | |
88 | + | |
89 | + /** | |
90 | + * 新增物料 | |
91 | + */ | |
92 | + @GetMapping("/add") | |
93 | + public String add() { | |
94 | + return prefix + "/add"; | |
95 | + } | |
96 | + | |
97 | + /** | |
98 | + * 新增保存物料 | |
99 | + */ | |
100 | + @ApiOperation(value="新增物料", notes="新增物料", httpMethod = "POST") | |
101 | + @RequiresPermissions("general:material:add") | |
102 | + @Log(title = "通用-物料管理", operating = "新增物料", action = BusinessType.INSERT) | |
103 | + @PostMapping("/add") | |
104 | + @ResponseBody | |
105 | + public AjaxResult addSave(Material material) { | |
106 | + | |
107 | + LambdaQueryWrapper<Material> lambda = Wrappers.lambdaQuery(); | |
108 | + lambda.eq(Material::getCode, material.getCode()) | |
109 | + .eq(Material::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
110 | + .eq(Material::getDeleted, false); | |
111 | + Map<String, Object> map = materialService.getMap(lambda); | |
112 | + if (map != null) { | |
113 | + return AjaxResult.error("物料已经存在"); | |
114 | + } | |
115 | + | |
116 | + material.setWarehouseCode(ShiroUtils.getWarehouseCode()); | |
117 | + material.setCreatedBy(ShiroUtils.getLoginName()); | |
118 | + material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
119 | + return AjaxResult.toAjax(materialService.save(material)); | |
120 | + } | |
121 | + | |
122 | + /** | |
123 | + * 修改物料 | |
124 | + */ | |
125 | + @GetMapping("/edit/{id}") | |
126 | + public String edit(@PathVariable("id") Integer id, ModelMap mmap) { | |
127 | + Material material = materialService.getById(id); | |
128 | + mmap.put("material", material); | |
129 | + return prefix + "/edit"; | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * 修改保存物料 | |
134 | + */ | |
135 | + @ApiOperation(value="修改物料", notes="修改物料", httpMethod = "POST") | |
136 | + @RequiresPermissions("general:material:edit") | |
137 | + @Log(title = "通用-物料管理", operating = "修改物料", action = BusinessType.UPDATE) | |
138 | + @PostMapping("/edit") | |
139 | + @ResponseBody | |
140 | + public AjaxResult editSave(Material material) { | |
141 | + material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
142 | + return toAjax(materialService.updateById(material)); | |
143 | + } | |
144 | + | |
145 | + /** | |
146 | + * 删除物料 | |
147 | + */ | |
148 | + @RequiresPermissions("general:material:remove") | |
149 | + @Log(title = "通用-物料管理", operating = "删除物料", action = BusinessType.DELETE) | |
150 | + @PostMapping( "/remove") | |
151 | + @ResponseBody | |
152 | + public AjaxResult remove(String ids) { | |
153 | + if (StringUtils.isEmpty(ids)){ | |
154 | + return AjaxResult.error("id不能为空"); | |
155 | + } else { | |
156 | + return materialService.removeByIds(ids); | |
157 | + } | |
158 | + } | |
159 | + | |
160 | +} | |
... | ... |
src/main/java/com/huaheng/pc/general/material/domain/Material.java
... | ... | @@ -273,6 +273,11 @@ public class Material implements Serializable { |
273 | 273 | @ApiModelProperty(value="自定义字段8") |
274 | 274 | private String userDef8; |
275 | 275 | |
276 | + /* 删除标记*/ | |
277 | + @TableField(value = "deleted") | |
278 | + @ApiModelProperty(value = "删除标记") | |
279 | + private Boolean deleted; | |
280 | + | |
276 | 281 | private static final long serialVersionUID = 1L; |
277 | 282 | |
278 | 283 | public static final String COL_CODE = "code"; |
... | ... | @@ -346,4 +351,6 @@ public class Material implements Serializable { |
346 | 351 | public static final String COL_USERDEF7 = "userDef7"; |
347 | 352 | |
348 | 353 | public static final String COL_USERDEF8 = "userDef8"; |
354 | + | |
355 | + public static final String COL_DELETED = "deleted"; | |
349 | 356 | } |
350 | 357 | \ No newline at end of file |
... | ... |
src/main/java/com/huaheng/pc/general/material/service/MaterialService.java
1 | 1 | package com.huaheng.pc.general.material.service; |
2 | 2 | |
3 | +import com.huaheng.framework.web.domain.AjaxResult; | |
3 | 4 | import com.huaheng.pc.general.material.domain.Material; |
4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | 6 | public interface MaterialService extends IService<Material>{ |
6 | 7 | |
8 | + AjaxResult removeByIds(String ids); | |
7 | 9 | |
8 | 10 | } |
... | ... |
src/main/java/com/huaheng/pc/general/material/service/MaterialServiceImpl.java
1 | 1 | package com.huaheng.pc.general.material.service; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
5 | +import com.huaheng.common.support.Convert; | |
6 | +import com.huaheng.common.utils.security.ShiroUtils; | |
7 | +import com.huaheng.framework.web.domain.AjaxResult; | |
8 | +import com.huaheng.pc.receipt.receiptDetail.domain.ReceiptDetail; | |
9 | +import com.huaheng.pc.receipt.receiptDetail.service.ReceiptDetailService; | |
3 | 10 | import org.springframework.stereotype.Service; |
4 | 11 | import javax.annotation.Resource; |
5 | 12 | import java.util.List; |
13 | +import java.util.Map; | |
14 | + | |
6 | 15 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | 16 | import com.huaheng.pc.general.material.mapper.MaterialMapper; |
8 | 17 | import com.huaheng.pc.general.material.domain.Material; |
... | ... | @@ -10,4 +19,31 @@ import com.huaheng.pc.general.material.service.MaterialService; |
10 | 19 | @Service |
11 | 20 | public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService{ |
12 | 21 | |
22 | + @Resource | |
23 | + private ReceiptDetailService receiptDetailService; | |
24 | + | |
25 | + @Override | |
26 | + public AjaxResult removeByIds(String ids) { | |
27 | + int count = 0; | |
28 | + for (Integer id : Convert.toIntArray(ids)) { | |
29 | + Material material = this.getById(id); | |
30 | + | |
31 | + LambdaQueryWrapper<ReceiptDetail> lambda = Wrappers.lambdaQuery(); | |
32 | + lambda.eq(ReceiptDetail::getWarehouseCode, ShiroUtils.getWarehouseCode()) | |
33 | + .eq(ReceiptDetail::getMaterialCode, material.getCode()) | |
34 | + .eq(ReceiptDetail::getDeleted, false) | |
35 | + .last("LIMIT 1"); | |
36 | + | |
37 | + Map<String, Object> map = receiptDetailService.getMap(lambda); | |
38 | + if (map != null) { | |
39 | + return AjaxResult.error("存货编码(" + material.getCode() +")存在入库单,不能删除!"); | |
40 | + } | |
41 | + material.setDeleted(true); | |
42 | + material.setLastUpdatedBy(ShiroUtils.getLoginName()); | |
43 | + if (this.updateById(material)){ | |
44 | + count++; | |
45 | + } | |
46 | + } | |
47 | + return AjaxResult.success("成功删除"+count+"条记录"); | |
48 | + } | |
13 | 49 | } |
... | ... |
src/main/resources/templates/general/location/add.html
... | ... | @@ -46,15 +46,11 @@ |
46 | 46 | </div> |
47 | 47 | </div> |
48 | 48 | <div class="form-group"> |
49 | - <label class="col-sm-3 control-label">是否有效:</label> | |
49 | + <label class="col-sm-3 control-label">库位状态:</label> | |
50 | 50 | <div class="col-sm-8"> |
51 | - <div class="onoffswitch"> | |
52 | - <input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="enable" name="enable"> | |
53 | - <label class="onoffswitch-label" for="enable"> | |
54 | - <span class="onoffswitch-inner"></span> | |
55 | - <span class="onoffswitch-switch"></span> | |
56 | - </label> | |
57 | - </div> | |
51 | + <select id="status" name="status" class="form-control" th:with="statusList=${@dict.getType('locationStatus')}"> | |
52 | + <option th:each="item : ${statusList}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option> | |
53 | + </select> | |
58 | 54 | </div> |
59 | 55 | </div> |
60 | 56 | <div class="form-group"> |
... | ... |
src/main/resources/templates/general/location/location.html
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | var editFlag = [[${@permission.hasPermi('general:location:edit')}]]; |
87 | 87 | var removeFlag = [[${@permission.hasPermi('general:location:remove')}]]; |
88 | 88 | var datas = [[${@dict.getType('sys_normal_disable')}]]; |
89 | - var locationTypes = [[${@locationType.getLocationPrefix()}]]; | |
89 | + var locationTypes = [[${@dict.getType('locationType')}]]; | |
90 | 90 | var locationStatus = [[${@dict.getType('locationStatus')}]]; |
91 | 91 | |
92 | 92 | $(function() { |
... | ... | @@ -134,14 +134,14 @@ |
134 | 134 | { |
135 | 135 | field : 'name', |
136 | 136 | title : '名称', |
137 | - visible : 'false' | |
137 | + visible : false | |
138 | 138 | }, |
139 | 139 | { |
140 | 140 | field : 'locationType', |
141 | 141 | title : '库位类型' , |
142 | 142 | align: 'center', |
143 | 143 | formatter: function(value, row, index) { |
144 | - return $.table.selectPrefixToName(locationTypes, value); | |
144 | + return $.table.selectDictLabel(locationTypes, value); | |
145 | 145 | } |
146 | 146 | }, |
147 | 147 | { |
... | ... | @@ -156,7 +156,7 @@ |
156 | 156 | { |
157 | 157 | field : 'zoneId', |
158 | 158 | title : '库区Id' , |
159 | - visible:false | |
159 | + visible : false | |
160 | 160 | }, |
161 | 161 | { |
162 | 162 | field : 'zoneCode', |
... | ... |