kangwei :采购入库相关接口
正在显示
33 个修改的文件
包含
465 行增加
和
105 行删除
... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
5 | import com.baomidou.mybatisplus.core.toolkit.Constants; | 5 | import com.baomidou.mybatisplus.core.toolkit.Constants; |
6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | import com.skua.tool.annotation.Anonymous; | ||
7 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
... | @@ -26,6 +27,7 @@ public interface CommonSqlMapper { | ... | @@ -26,6 +27,7 @@ public interface CommonSqlMapper { |
26 | 27 | ||
27 | Page<Map<String, Object>> queryWrapperForPage(Page<?> page, @Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | 28 | Page<Map<String, Object>> queryWrapperForPage(Page<?> page, @Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); |
28 | 29 | ||
30 | @Anonymous | ||
29 | List<Map<String, Object>> queryForList(@Param("sql") String sql); | 31 | List<Map<String, Object>> queryForList(@Param("sql") String sql); |
30 | 32 | ||
31 | List<Map<String, Object>> queryWrapperForList(@Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | 33 | List<Map<String, Object>> queryWrapperForList(@Param("sql") String sql, @Param(Constants.WRAPPER) QueryWrapper<?> queryWrapper); | ... | ... |
... | @@ -30,7 +30,6 @@ public class SkApplication { | ... | @@ -30,7 +30,6 @@ public class SkApplication { |
30 | "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" + | 30 | "Doc: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" + |
31 | "----------------------------------------------------------"); | 31 | "----------------------------------------------------------"); |
32 | } | 32 | } |
33 | |||
34 | // @Configuration | 33 | // @Configuration |
35 | // @Profile("dev") | 34 | // @Profile("dev") |
36 | // @ComponentScan(lazyInit = true) | 35 | // @ComponentScan(lazyInit = true) | ... | ... |
... | @@ -42,13 +42,6 @@ import com.alibaba.fastjson.JSON; | ... | @@ -42,13 +42,6 @@ import com.alibaba.fastjson.JSON; |
42 | import io.swagger.annotations.Api; | 42 | import io.swagger.annotations.Api; |
43 | import io.swagger.annotations.ApiOperation; | 43 | import io.swagger.annotations.ApiOperation; |
44 | 44 | ||
45 | /** | ||
46 | * <pre> | ||
47 | * erp分销合同 | ||
48 | * </pre> | ||
49 | * @author 开发者姓名 | ||
50 | * @version V0.1, 开发时间 | ||
51 | */ | ||
52 | @Slf4j | 45 | @Slf4j |
53 | @Api(tags="erp分销合同") | 46 | @Api(tags="erp分销合同") |
54 | @RestController("webDistributContractController") | 47 | @RestController("webDistributContractController") | ... | ... |
... | @@ -45,7 +45,6 @@ public class ErpCommonController { | ... | @@ -45,7 +45,6 @@ public class ErpCommonController { |
45 | @Autowired | 45 | @Autowired |
46 | private IEquipmentSparepartTypeService equipmentSparepartTypeService; | 46 | private IEquipmentSparepartTypeService equipmentSparepartTypeService; |
47 | 47 | ||
48 | |||
49 | @AutoLog(value = "ERP-采购计划--物料列表") | 48 | @AutoLog(value = "ERP-采购计划--物料列表") |
50 | @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表") | 49 | @ApiOperation(value = "ERP-采购计划--物料列表", notes = "ERP-采购计划--物料列表") |
51 | @RequestMapping(value = "/sparepartList", method = RequestMethod.GET) | 50 | @RequestMapping(value = "/sparepartList", method = RequestMethod.GET) | ... | ... |
... | @@ -13,10 +13,12 @@ import com.skua.core.aspect.annotation.AutoLog; | ... | @@ -13,10 +13,12 @@ import com.skua.core.aspect.annotation.AutoLog; |
13 | import com.skua.core.query.QueryGenerator; | 13 | import com.skua.core.query.QueryGenerator; |
14 | import com.skua.core.util.ConvertUtils; | 14 | import com.skua.core.util.ConvertUtils; |
15 | import com.skua.modules.erp.entity.MaterialAcceptanceForm; | 15 | import com.skua.modules.erp.entity.MaterialAcceptanceForm; |
16 | import com.skua.modules.erp.entity.MaterialIN; | ||
16 | import com.skua.modules.erp.service.IMaterialAcceptanceFormService; | 17 | import com.skua.modules.erp.service.IMaterialAcceptanceFormService; |
17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 18 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
18 | import com.baomidou.mybatisplus.core.metadata.IPage; | 19 | import com.baomidou.mybatisplus.core.metadata.IPage; |
19 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 20 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
21 | import com.skua.modules.erp.service.IMaterialINService; | ||
20 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
21 | 23 | ||
22 | import org.apache.commons.lang3.StringUtils; | 24 | import org.apache.commons.lang3.StringUtils; |
... | @@ -49,7 +51,8 @@ import io.swagger.annotations.ApiOperation; | ... | @@ -49,7 +51,8 @@ import io.swagger.annotations.ApiOperation; |
49 | public class MaterialAcceptanceFormController { | 51 | public class MaterialAcceptanceFormController { |
50 | @Autowired | 52 | @Autowired |
51 | private IMaterialAcceptanceFormService materialAcceptanceFormService; | 53 | private IMaterialAcceptanceFormService materialAcceptanceFormService; |
52 | 54 | @Autowired | |
55 | private IMaterialINService materialINService; | ||
53 | /** | 56 | /** |
54 | * <pre> | 57 | * <pre> |
55 | * 分页列表查询 | 58 | * 分页列表查询 |
... | @@ -108,6 +111,10 @@ public class MaterialAcceptanceFormController { | ... | @@ -108,6 +111,10 @@ public class MaterialAcceptanceFormController { |
108 | materialAcceptanceForm.setConfirmStatus("9"); | 111 | materialAcceptanceForm.setConfirmStatus("9"); |
109 | } | 112 | } |
110 | materialAcceptanceFormService.save(materialAcceptanceForm); | 113 | materialAcceptanceFormService.save(materialAcceptanceForm); |
114 | |||
115 | MaterialIN materialIN =materialINService.getById(materialAcceptanceForm.getId()); | ||
116 | materialIN.setConfirmStatus(materialAcceptanceForm.getConfirmStatus()); | ||
117 | materialINService.updateById( materialIN); | ||
111 | result.success("添加成功!"); | 118 | result.success("添加成功!"); |
112 | } catch (Exception e) { | 119 | } catch (Exception e) { |
113 | log.error(e.getMessage(),e); | 120 | log.error(e.getMessage(),e); |
... | @@ -146,6 +153,9 @@ public class MaterialAcceptanceFormController { | ... | @@ -146,6 +153,9 @@ public class MaterialAcceptanceFormController { |
146 | }else { | 153 | }else { |
147 | materialAcceptanceFormService.updateById(materialAcceptanceForm); | 154 | materialAcceptanceFormService.updateById(materialAcceptanceForm); |
148 | } | 155 | } |
156 | MaterialIN materialIN =materialINService.getById(materialAcceptanceForm.getId()); | ||
157 | materialIN.setConfirmStatus(materialAcceptanceForm.getConfirmStatus()); | ||
158 | materialINService.updateById( materialIN); | ||
149 | 159 | ||
150 | //TODO 返回false说明什么? | 160 | //TODO 返回false说明什么? |
151 | result.success("修改成功!"); | 161 | result.success("修改成功!"); | ... | ... |
... | @@ -167,7 +167,6 @@ public class MaterialINController { | ... | @@ -167,7 +167,6 @@ public class MaterialINController { |
167 | queryWrapper.gt("audit_status" , "0");// >0 | 167 | queryWrapper.gt("audit_status" , "0");// >0 |
168 | queryWrapper.ne("audit_status" , "2"); // 不等于2 | 168 | queryWrapper.ne("audit_status" , "2"); // 不等于2 |
169 | } | 169 | } |
170 | queryWrapper.eq("confirm_status","2"); | ||
171 | 170 | ||
172 | queryWrapper.orderByDesc("arrive_time"); | 171 | queryWrapper.orderByDesc("arrive_time"); |
173 | IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper); | 172 | IPage<MaterialIN> pageList = materialINService.page(page, queryWrapper); |
... | @@ -203,6 +202,7 @@ public class MaterialINController { | ... | @@ -203,6 +202,7 @@ public class MaterialINController { |
203 | queryWrapper.eq("audit_status","3"); | 202 | queryWrapper.eq("audit_status","3"); |
204 | List<MaterialIN> pageList = materialINService.list( queryWrapper);*/ | 203 | List<MaterialIN> pageList = materialINService.list( queryWrapper);*/ |
205 | 204 | ||
205 | |||
206 | List<ArrivalRecordExcelExportVO> pageList = materialINService.queryArrivalRecordByList(materialIN); | 206 | List<ArrivalRecordExcelExportVO> pageList = materialINService.queryArrivalRecordByList(materialIN); |
207 | 207 | ||
208 | result.setSuccess(true); | 208 | result.setSuccess(true); |
... | @@ -225,15 +225,7 @@ public class MaterialINController { | ... | @@ -225,15 +225,7 @@ public class MaterialINController { |
225 | return result; | 225 | return result; |
226 | } | 226 | } |
227 | //arrivalRecord | 227 | //arrivalRecord |
228 | /** | 228 | |
229 | * <pre> | ||
230 | * 添加 | ||
231 | * </pre> | ||
232 | * @param materialIN | ||
233 | * @return | ||
234 | * @author 开发者姓名, 开发时间 | ||
235 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
236 | */ | ||
237 | @AutoLog(value = "erp--物料(药剂)入库-添加") | 229 | @AutoLog(value = "erp--物料(药剂)入库-添加") |
238 | @ApiOperation(value="erp--物料(药剂)入库-添加", notes="erp--物料(药剂)入库-添加") | 230 | @ApiOperation(value="erp--物料(药剂)入库-添加", notes="erp--物料(药剂)入库-添加") |
239 | @PostMapping(value = "/add") | 231 | @PostMapping(value = "/add") |
... | @@ -251,15 +243,7 @@ public class MaterialINController { | ... | @@ -251,15 +243,7 @@ public class MaterialINController { |
251 | } | 243 | } |
252 | return result; | 244 | return result; |
253 | } | 245 | } |
254 | /** | 246 | |
255 | * <pre> | ||
256 | * 编辑 | ||
257 | * </pre> | ||
258 | * @param materialIN | ||
259 | * @return | ||
260 | * @author 开发者姓名, 开发时间 | ||
261 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
262 | */ | ||
263 | @AutoLog(value = "erp--物料(药剂)入库-编辑") | 247 | @AutoLog(value = "erp--物料(药剂)入库-编辑") |
264 | @ApiOperation(value="erp--物料(药剂)入库-编辑", notes="erp--物料(药剂)入库-编辑") | 248 | @ApiOperation(value="erp--物料(药剂)入库-编辑", notes="erp--物料(药剂)入库-编辑") |
265 | @PutMapping(value = "/edit") | 249 | @PutMapping(value = "/edit") |
... | @@ -277,15 +261,7 @@ public class MaterialINController { | ... | @@ -277,15 +261,7 @@ public class MaterialINController { |
277 | } | 261 | } |
278 | return result; | 262 | return result; |
279 | } | 263 | } |
280 | /** | 264 | |
281 | * <pre> | ||
282 | * 通过id删除 | ||
283 | * </pre> | ||
284 | * @param id | ||
285 | * @return | ||
286 | * @author 开发者姓名, 开发时间 | ||
287 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
288 | */ | ||
289 | @AutoLog(value = "erp--物料(药剂)入库-通过id删除") | 265 | @AutoLog(value = "erp--物料(药剂)入库-通过id删除") |
290 | @ApiOperation(value="erp--物料(药剂)入库-通过id删除", notes="erp--物料(药剂)入库-通过id删除") | 266 | @ApiOperation(value="erp--物料(药剂)入库-通过id删除", notes="erp--物料(药剂)入库-通过id删除") |
291 | @DeleteMapping(value = "/delete") | 267 | @DeleteMapping(value = "/delete") |
... | @@ -299,15 +275,6 @@ public class MaterialINController { | ... | @@ -299,15 +275,6 @@ public class MaterialINController { |
299 | return Result.ok("删除成功!"); | 275 | return Result.ok("删除成功!"); |
300 | } | 276 | } |
301 | 277 | ||
302 | /** | ||
303 | * <pre> | ||
304 | * 批量删除 | ||
305 | * </pre> | ||
306 | * @param ids | ||
307 | * @return | ||
308 | * @author 开发者姓名, 开发时间 | ||
309 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
310 | */ | ||
311 | @AutoLog(value = "erp--物料(药剂)入库-批量删除") | 278 | @AutoLog(value = "erp--物料(药剂)入库-批量删除") |
312 | @ApiOperation(value="erp--物料(药剂)入库-批量删除", notes="erp--物料(药剂)入库-批量删除") | 279 | @ApiOperation(value="erp--物料(药剂)入库-批量删除", notes="erp--物料(药剂)入库-批量删除") |
313 | @DeleteMapping(value = "/deleteBatch") | 280 | @DeleteMapping(value = "/deleteBatch") |
... | @@ -321,15 +288,7 @@ public class MaterialINController { | ... | @@ -321,15 +288,7 @@ public class MaterialINController { |
321 | } | 288 | } |
322 | return result; | 289 | return result; |
323 | } | 290 | } |
324 | /** | 291 | |
325 | * <pre> | ||
326 | * 通过id查询 | ||
327 | * </pre> | ||
328 | * @param id | ||
329 | * @return | ||
330 | * @author 开发者姓名, 开发时间 | ||
331 | * @Description: TODO(这里描述这个方法的需求变更情况) | ||
332 | */ | ||
333 | @AutoLog(value = "erp--物料(药剂)入库-通过id查询") | 292 | @AutoLog(value = "erp--物料(药剂)入库-通过id查询") |
334 | @ApiOperation(value="erp--物料(药剂)入库-通过id查询", notes="erp--物料(药剂)入库-通过id查询") | 293 | @ApiOperation(value="erp--物料(药剂)入库-通过id查询", notes="erp--物料(药剂)入库-通过id查询") |
335 | @GetMapping(value = "/queryById") | 294 | @GetMapping(value = "/queryById") | ... | ... |
... | @@ -14,6 +14,7 @@ import com.skua.modules.erp.service.IERPPurchaseContractService; | ... | @@ -14,6 +14,7 @@ import com.skua.modules.erp.service.IERPPurchaseContractService; |
14 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 14 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
15 | import com.baomidou.mybatisplus.core.metadata.IPage; | 15 | import com.baomidou.mybatisplus.core.metadata.IPage; |
16 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 16 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
17 | import com.skua.modules.erp.vo.MaterialSearchVO; | ||
17 | import com.skua.modules.erp.vo.PurchaseContractVO; | 18 | import com.skua.modules.erp.vo.PurchaseContractVO; |
18 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
19 | import org.apache.commons.lang3.StringUtils; | 20 | import org.apache.commons.lang3.StringUtils; |
... | @@ -83,15 +84,16 @@ public class PurchaseContractController { | ... | @@ -83,15 +84,16 @@ public class PurchaseContractController { |
83 | @AutoLog(value = "erp采购合同-有权限的采购合同集合") | 84 | @AutoLog(value = "erp采购合同-有权限的采购合同集合") |
84 | @ApiOperation(value="erp采购合同-有权限的采购合同集合", notes="erp采购合同-有权限的采购合同集合") | 85 | @ApiOperation(value="erp采购合同-有权限的采购合同集合", notes="erp采购合同-有权限的采购合同集合") |
85 | @GetMapping(value = "/purchaseContractList") | 86 | @GetMapping(value = "/purchaseContractList") |
86 | public Result<List<ERPPurchaseContract>> purchaseContractList() { | 87 | public Result<List<ERPPurchaseContract>> purchaseContractList(MaterialSearchVO materialSearchVO) { |
87 | Result<List<ERPPurchaseContract>> result = new Result<List<ERPPurchaseContract>>(); | 88 | Result<List<ERPPurchaseContract>> result = new Result<List<ERPPurchaseContract>>(); |
88 | QueryWrapper<ERPPurchaseContract> queryWrapper = new QueryWrapper<ERPPurchaseContract> (); // QueryGenerator.initQueryWrapper(ERPPurchaseContract, req.getParameterMap()); | 89 | /* QueryWrapper<ERPPurchaseContract> queryWrapper = new QueryWrapper<ERPPurchaseContract> (); // QueryGenerator.initQueryWrapper(ERPPurchaseContract, req.getParameterMap()); |
89 | /* queryWrapper.like("departs", BaseContextHandler.getRealDepartId());*/ | 90 | *//* queryWrapper.like("departs", BaseContextHandler.getRealDepartId());*//* |
90 | |||
91 | // 需要添加条件判断 | 91 | // 需要添加条件判断 |
92 | queryWrapper.like("departs",BaseContextHandler.getRealDepartId()); | 92 | //queryWrapper.like("departs",BaseContextHandler.getRealDepartId());P |
93 | queryWrapper.orderByDesc("create_time"); | 93 | queryWrapper.eq("status","3");//审核通过的数据 |
94 | List<ERPPurchaseContract> purchaseContractList = purchaseContractService.list( queryWrapper); | 94 | queryWrapper.orderByDesc("create_time");*/ |
95 | |||
96 | List<ERPPurchaseContract> purchaseContractList = purchaseContractService.getListByDistributId( materialSearchVO); | ||
95 | 97 | ||
96 | /*Set<ERPPurchaseContract> dataList = new HashSet<>(); | 98 | /*Set<ERPPurchaseContract> dataList = new HashSet<>(); |
97 | HashSet set = new HashSet(purchaseContractList); | 99 | HashSet set = new HashSet(purchaseContractList); |
... | @@ -132,7 +134,7 @@ public class PurchaseContractController { | ... | @@ -132,7 +134,7 @@ public class PurchaseContractController { |
132 | if(purchaseContractEntity ==null) { | 134 | if(purchaseContractEntity ==null) { |
133 | result.error500("未找到对应实体"); | 135 | result.error500("未找到对应实体"); |
134 | }else { | 136 | }else { |
135 | String errorMsg = purchaseContractService.checkPurchaseContract(purchaseContractVO , purchaseContractEntity.getContractCode(),0); | 137 | String errorMsg = purchaseContractService.checkPurchaseContract(purchaseContractVO , purchaseContractEntity.getContractCode(),1); |
136 | if(StringUtils.isNotEmpty( errorMsg )){ | 138 | if(StringUtils.isNotEmpty( errorMsg )){ |
137 | result.error500( errorMsg ); | 139 | result.error500( errorMsg ); |
138 | }else{ | 140 | }else{ | ... | ... |
... | @@ -113,6 +113,10 @@ public class MaterialIN { | ... | @@ -113,6 +113,10 @@ public class MaterialIN { |
113 | @Excel(name = "采购总价", width = 15) | 113 | @Excel(name = "采购总价", width = 15) |
114 | @ApiModelProperty(value = "采购总价") | 114 | @ApiModelProperty(value = "采购总价") |
115 | private String purchaseTotalPrice; | 115 | private String purchaseTotalPrice; |
116 | |||
117 | @Excel(name = "物料数量", width = 15) | ||
118 | @ApiModelProperty(value = "物料数量") | ||
119 | private String materialNum; | ||
116 | /**分销总价*/ | 120 | /**分销总价*/ |
117 | @Excel(name = "分销总价", width = 15) | 121 | @Excel(name = "分销总价", width = 15) |
118 | @ApiModelProperty(value = "分销总价") | 122 | @ApiModelProperty(value = "分销总价") |
... | @@ -198,4 +202,12 @@ public class MaterialIN { | ... | @@ -198,4 +202,12 @@ public class MaterialIN { |
198 | @ApiModelProperty(value = "物料类别") | 202 | @ApiModelProperty(value = "物料类别") |
199 | private String sparepartTypeName; | 203 | private String sparepartTypeName; |
200 | 204 | ||
205 | |||
206 | |||
207 | @ApiModelProperty(value = "入库编号") | ||
208 | private String equipmentInId; | ||
209 | |||
210 | @ApiModelProperty(value = "出库编号") | ||
211 | private String equipmentOutId; | ||
212 | |||
201 | } | 213 | } | ... | ... |
... | @@ -77,7 +77,7 @@ public class PurchaseMaterial { | ... | @@ -77,7 +77,7 @@ public class PurchaseMaterial { |
77 | /**备注*/ | 77 | /**备注*/ |
78 | @Excel(name = "备注", width = 15) | 78 | @Excel(name = "备注", width = 15) |
79 | @ApiModelProperty(value = "备注") | 79 | @ApiModelProperty(value = "备注") |
80 | private java.lang.String remarks; | 80 | private java.lang.String remark; |
81 | 81 | ||
82 | 82 | ||
83 | @TableField(exist=false) | 83 | @TableField(exist=false) | ... | ... |
... | @@ -2,10 +2,21 @@ package com.skua.modules.erp.mapper; | ... | @@ -2,10 +2,21 @@ package com.skua.modules.erp.mapper; |
2 | 2 | ||
3 | import com.skua.modules.erp.entity.ERPPurchaseContract; | 3 | import com.skua.modules.erp.entity.ERPPurchaseContract; |
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
5 | import com.skua.modules.erp.vo.MaterialSearchVO; | ||
6 | import com.skua.tool.annotation.Anonymous; | ||
7 | |||
8 | import java.util.List; | ||
5 | 9 | ||
6 | /** | 10 | /** |
7 | * 采购合同 | 11 | * 采购合同 |
8 | */ | 12 | */ |
9 | public interface ERPPurchaseContractMapper extends BaseMapper<ERPPurchaseContract> { | 13 | public interface ERPPurchaseContractMapper extends BaseMapper<ERPPurchaseContract> { |
10 | 14 | ||
15 | /*** | ||
16 | * 根据分销编号查询采购合同列表 | ||
17 | * @param materialSearchVO | ||
18 | * @return | ||
19 | */ | ||
20 | @Anonymous | ||
21 | List<ERPPurchaseContract> getListByDistributId(MaterialSearchVO materialSearchVO); | ||
11 | } | 22 | } | ... | ... |
... | @@ -8,6 +8,7 @@ import com.skua.modules.erp.entity.DistributContract; | ... | @@ -8,6 +8,7 @@ import com.skua.modules.erp.entity.DistributContract; |
8 | import com.skua.modules.erp.vo.MaterialSearchVO; | 8 | import com.skua.modules.erp.vo.MaterialSearchVO; |
9 | import com.skua.modules.erp.vo.PurchaseMaterialVO; | 9 | import com.skua.modules.erp.vo.PurchaseMaterialVO; |
10 | import com.skua.modules.erp.vo.PurchasePlanSearchVO; | 10 | import com.skua.modules.erp.vo.PurchasePlanSearchVO; |
11 | import com.skua.tool.annotation.Anonymous; | ||
11 | import org.apache.ibatis.annotations.Param; | 12 | import org.apache.ibatis.annotations.Param; |
12 | import com.skua.modules.erp.entity.PurchaseMaterial; | 13 | import com.skua.modules.erp.entity.PurchaseMaterial; |
13 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 14 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
... | @@ -64,6 +65,7 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> { | ... | @@ -64,6 +65,7 @@ public interface PurchaseMaterialMapper extends BaseMapper<PurchaseMaterial> { |
64 | * @param materialSearchVO | 65 | * @param materialSearchVO |
65 | * @return | 66 | * @return |
66 | */ | 67 | */ |
68 | @Anonymous | ||
67 | public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,@Param("param") MaterialSearchVO materialSearchVO); | 69 | public IPage<PurchaseMaterialVO> queryPurchaseMaterialListByIn(Page<PurchaseMaterialVO> page,@Param("param") MaterialSearchVO materialSearchVO); |
68 | 70 | ||
69 | /*** | 71 | /*** | ... | ... |
... | @@ -2,4 +2,13 @@ | ... | @@ -2,4 +2,13 @@ |
2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
3 | <mapper namespace="com.skua.modules.erp.mapper.ERPPurchaseContractMapper"> | 3 | <mapper namespace="com.skua.modules.erp.mapper.ERPPurchaseContractMapper"> |
4 | 4 | ||
5 | <!-- 根据分销编号查询采购合同列表 --> | ||
6 | <select id="getListByDistributId" resultType="com.skua.modules.erp.entity.ERPPurchaseContract"> | ||
7 | select pc.* from erp_purchase_contract pc where pc.id in ( | ||
8 | select DISTINCT pm.contract_id from erp_purchase_material pm , erp_distribut_material dm | ||
9 | where dm.good_code = dm.good_code and dm.contract_id = '1849328644967497730' | ||
10 | ) | ||
11 | and pc.status = 3 | ||
12 | order by pc.create_time desc | ||
13 | </select> | ||
5 | </mapper> | 14 | </mapper> | ... | ... |
... | @@ -60,18 +60,16 @@ | ... | @@ -60,18 +60,16 @@ |
60 | 60 | ||
61 | <!-- 药剂入库查询结果:物料清单--> | 61 | <!-- 药剂入库查询结果:物料清单--> |
62 | <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO"> | 62 | <select id="queryPurchaseMaterialListByIn" resultType="com.skua.modules.erp.vo.PurchaseMaterialVO"> |
63 | select dm.distribut_price ,dm.distribut_total_price , st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', | 63 | select st.item_text as 'sparepart_type_name',sm.supp_name as 'supplier_name', aaa.* |
64 | aaa.* | ||
65 | from ( | 64 | from ( |
66 | select pm.* ,pc.depart_id,pc.contract_code 'purchase_contract_code',pc.project_name | 65 | select pc.depart_id,pc.contract_code 'purchase_contract_code',pc.project_name ,dm.distribut_price ,dm.distribut_total_price,dm.material_num,pm.* |
67 | from erp_purchase_material pm , erp_purchase_contract pc | 66 | from erp_purchase_material pm , erp_purchase_contract pc ,erp_distribut_material dm |
68 | where pm.contract_id =pc.id and pc.id = #{param.purchaseContractId} | 67 | where pm.contract_id =pc.id and pm.good_code = dm.good_code and pc.id = #{param.purchaseContractId} and dm.contract_id = #{param.distributContractId} |
69 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pc.departs like '%' #{param.departId}'%'</if> | 68 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pc.departs like '%' #{param.departId}'%'</if> |
70 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if> | 69 | <if test="param.sparepartCode != null and param.sparepartCode !=''"> and pm.sparepart_code =#{param.sparepartCode}</if> |
71 | <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type in (${param.sparepartType}) </if> | 70 | <if test="param.sparepartType != null and param.sparepartType !=''"> and pm.sparepart_type in (${param.sparepartType}) </if> |
72 | <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like '%' #{param.sparepartName}'%'</if> | 71 | <if test="param.sparepartName != null and param.sparepartName !=''"> and pm.sparepart_name like '%' #{param.sparepartName}'%'</if> |
73 | )aaa | 72 | )aaa |
74 | left join erp_distribut_material dm on (aaa.good_code = dm.good_code and aaa.depart_id) | ||
75 | left join equipment_sparepart_type st on st.id = aaa.sparepart_type | 73 | left join equipment_sparepart_type st on st.id = aaa.sparepart_type |
76 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id | 74 | left join ajh_supplier_manage sm on sm.id = aaa.supplier_id |
77 | 75 | ... | ... |
... | @@ -20,6 +20,9 @@ | ... | @@ -20,6 +20,9 @@ |
20 | <if test="ev.sparepartName != null and ev.sparepartName != '' "> | 20 | <if test="ev.sparepartName != null and ev.sparepartName != '' "> |
21 | AND pi.sparepart_name like '%'#{ev.sparepartName}'%' | 21 | AND pi.sparepart_name like '%'#{ev.sparepartName}'%' |
22 | </if> | 22 | </if> |
23 | <if test="ev.purpose != null and ev.purpose != '' "> | ||
24 | AND pi.purpose like '%'#{ev.purpose}'%' | ||
25 | </if> | ||
23 | <if test="ev.applyYear != null and ev.applyYear != '' "> | 26 | <if test="ev.applyYear != null and ev.applyYear != '' "> |
24 | and pp.apply_year = #{ev.applyYear} | 27 | and pp.apply_year = #{ev.applyYear} |
25 | </if> | 28 | </if> | ... | ... |
... | @@ -6,6 +6,7 @@ import com.skua.modules.erp.entity.ERPPurchaseContract; | ... | @@ -6,6 +6,7 @@ import com.skua.modules.erp.entity.ERPPurchaseContract; |
6 | import com.baomidou.mybatisplus.extension.service.IService; | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
7 | import com.skua.modules.erp.entity.PurchaseMaterial; | 7 | import com.skua.modules.erp.entity.PurchaseMaterial; |
8 | import com.skua.modules.erp.entity.PurchasePlanItem; | 8 | import com.skua.modules.erp.entity.PurchasePlanItem; |
9 | import com.skua.modules.erp.vo.MaterialSearchVO; | ||
9 | import com.skua.modules.erp.vo.PurchaseContractVO; | 10 | import com.skua.modules.erp.vo.PurchaseContractVO; |
10 | import com.skua.modules.erp.vo.PurchaseMaterialVO; | 11 | import com.skua.modules.erp.vo.PurchaseMaterialVO; |
11 | import com.skua.modules.erp.vo.PurchasePlanSearchVO; | 12 | import com.skua.modules.erp.vo.PurchasePlanSearchVO; |
... | @@ -78,4 +79,11 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac | ... | @@ -78,4 +79,11 @@ public interface IERPPurchaseContractService extends IService<ERPPurchaseContrac |
78 | * @return | 79 | * @return |
79 | */ | 80 | */ |
80 | int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception; | 81 | int syncEquipmentIn(PurchaseContractVO purchaseContractVO)throws Exception; |
82 | |||
83 | /*** | ||
84 | * 根据分销编号查询采购合同列表 | ||
85 | * @param materialSearchVO | ||
86 | * @return | ||
87 | */ | ||
88 | List<ERPPurchaseContract> getListByDistributId(MaterialSearchVO materialSearchVO); | ||
81 | } | 89 | } | ... | ... |
... | @@ -17,7 +17,7 @@ public interface IMaterialINService extends IService<MaterialIN> { | ... | @@ -17,7 +17,7 @@ public interface IMaterialINService extends IService<MaterialIN> { |
17 | * 审核药剂入库单 | 17 | * 审核药剂入库单 |
18 | * @param materialINVO | 18 | * @param materialINVO |
19 | */ | 19 | */ |
20 | public void auditMaterialINVO(MaterialINVO materialINVO); | 20 | String auditMaterialINVO(MaterialINVO materialINVO); |
21 | 21 | ||
22 | /*** | 22 | /*** |
23 | * 列表查询到货记录列表 | 23 | * 列表查询到货记录列表 | ... | ... |
... | @@ -49,7 +49,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -49,7 +49,7 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
49 | errMsg ="操作失败,货号["+ goodsCode +"]重复!"; | 49 | errMsg ="操作失败,货号["+ goodsCode +"]重复!"; |
50 | } | 50 | } |
51 | int count = 0; | 51 | int count = 0; |
52 | if(!oldContractCode.equals(distributContractVO.getContractCode())){ | 52 | if(!distributContractVO.getContractCode().equals(oldContractCode)){ |
53 | count = this.baseMapper.checkContractCode(distributContractVO.getContractCode() ); | 53 | count = this.baseMapper.checkContractCode(distributContractVO.getContractCode() ); |
54 | if(count > checkCount ){ | 54 | if(count > checkCount ){ |
55 | errMsg = "合同编号["+distributContractVO.getContractCode()+"]重复"; | 55 | errMsg = "合同编号["+distributContractVO.getContractCode()+"]重复"; |
... | @@ -137,9 +137,6 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -137,9 +137,6 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
137 | public int checkGoodCodeAndDepartId(String goodsCode ,String departId){ | 137 | public int checkGoodCodeAndDepartId(String goodsCode ,String departId){ |
138 | return materialMapper.checkGoodCodeAndDepartId( goodsCode ,departId ); | 138 | return materialMapper.checkGoodCodeAndDepartId( goodsCode ,departId ); |
139 | } | 139 | } |
140 | |||
141 | |||
142 | |||
143 | /*** | 140 | /*** |
144 | * 删除DistributContractVOVO | 141 | * 删除DistributContractVOVO |
145 | * @param contractId | 142 | * @param contractId |
... | @@ -149,7 +146,6 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -149,7 +146,6 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
149 | // ge根据计划编号删除清单集合 | 146 | // ge根据计划编号删除清单集合 |
150 | materialMapper.delByContractId( contractId ) ; | 147 | materialMapper.delByContractId( contractId ) ; |
151 | } | 148 | } |
152 | |||
153 | /*** | 149 | /*** |
154 | * 根据id查询DistributContractVOVO | 150 | * 根据id查询DistributContractVOVO |
155 | * @param contractId | 151 | * @param contractId |
... | @@ -158,13 +154,11 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -158,13 +154,11 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
158 | public DistributContractVO queryById(String contractId){ | 154 | public DistributContractVO queryById(String contractId){ |
159 | DistributContract distributContract = this.baseMapper.selectById( contractId ); | 155 | DistributContract distributContract = this.baseMapper.selectById( contractId ); |
160 | DistributContractVO distributContractVO = new DistributContractVO(); | 156 | DistributContractVO distributContractVO = new DistributContractVO(); |
161 | |||
162 | if(distributContract != null ){ | 157 | if(distributContract != null ){ |
163 | BeanUtils.copyProperties(distributContract,distributContractVO); | 158 | BeanUtils.copyProperties(distributContract,distributContractVO); |
164 | List<DistributMaterial> materialList = materialMapper.queryListByContractId( contractId ); | 159 | List<DistributMaterial> materialList = materialMapper.queryListByContractId( contractId ); |
165 | distributContractVO.setMaterialList( materialList ); | 160 | distributContractVO.setMaterialList( materialList ); |
166 | } | 161 | } |
167 | |||
168 | return distributContractVO; | 162 | return distributContractVO; |
169 | } | 163 | } |
170 | 164 | ||
... | @@ -192,11 +186,9 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM | ... | @@ -192,11 +186,9 @@ public class DistributContractServiceImpl extends ServiceImpl<DistributContractM |
192 | if("2".equals( distributContractVO.getApproveState() )){ | 186 | if("2".equals( distributContractVO.getApproveState() )){ |
193 | distributContractVO.setStatus( "2" ); | 187 | distributContractVO.setStatus( "2" ); |
194 | } | 188 | } |
195 | |||
196 | this.baseMapper.updateById( distributContractVO ) ; | 189 | this.baseMapper.updateById( distributContractVO ) ; |
197 | // ge根据计划编号删除清单集合 | 190 | // ge根据计划编号删除清单集合 |
198 | materialMapper.delByContractId(distributContractVO.getId() ) ; | 191 | materialMapper.delByContractId(distributContractVO.getId() ) ; |
199 | |||
200 | if( distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ | 192 | if( distributContractVO.getMaterialList() != null && !distributContractVO.getMaterialList().isEmpty()){ |
201 | for(DistributMaterial material : distributContractVO.getMaterialList()){ | 193 | for(DistributMaterial material : distributContractVO.getMaterialList()){ |
202 | material.setId(null); | 194 | material.setId(null); | ... | ... |
... | @@ -9,6 +9,7 @@ import com.skua.modules.erp.mapper.ApproveRecordMapper; | ... | @@ -9,6 +9,7 @@ import com.skua.modules.erp.mapper.ApproveRecordMapper; |
9 | import com.skua.modules.erp.mapper.ERPPurchaseContractMapper; | 9 | import com.skua.modules.erp.mapper.ERPPurchaseContractMapper; |
10 | import com.skua.modules.erp.mapper.PurchaseMaterialMapper; | 10 | import com.skua.modules.erp.mapper.PurchaseMaterialMapper; |
11 | import com.skua.modules.erp.service.IERPPurchaseContractService; | 11 | import com.skua.modules.erp.service.IERPPurchaseContractService; |
12 | import com.skua.modules.erp.vo.MaterialSearchVO; | ||
12 | import com.skua.modules.erp.vo.PurchaseContractVO; | 13 | import com.skua.modules.erp.vo.PurchaseContractVO; |
13 | import com.skua.modules.guest.util.DateUtil; | 14 | import com.skua.modules.guest.util.DateUtil; |
14 | import com.skua.modules.quartz.util.BaseUtil; | 15 | import com.skua.modules.quartz.util.BaseUtil; |
... | @@ -49,7 +50,8 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -49,7 +50,8 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
49 | public String checkPurchaseContract(PurchaseContractVO purchaseContractVO,String oldContractCode ,int checkCount){ | 50 | public String checkPurchaseContract(PurchaseContractVO purchaseContractVO,String oldContractCode ,int checkCount){ |
50 | String result = null; | 51 | String result = null; |
51 | int count = 0; | 52 | int count = 0; |
52 | if(!oldContractCode.equals(purchaseContractVO.getContractCode())){ | 53 | |
54 | if(!purchaseContractVO.getContractCode().equals(oldContractCode)){ | ||
53 | count = purchaseMaterialMapper.checkContractCode(purchaseContractVO.getContractCode() ); | 55 | count = purchaseMaterialMapper.checkContractCode(purchaseContractVO.getContractCode() ); |
54 | if(count > checkCount ){ | 56 | if(count > checkCount ){ |
55 | result = "合同编号["+purchaseContractVO.getContractCode()+"]重复"; | 57 | result = "合同编号["+purchaseContractVO.getContractCode()+"]重复"; |
... | @@ -190,10 +192,10 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -190,10 +192,10 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
190 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 | 192 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 |
191 | if("1".equals( purchaseContractVO.getApproveState() )){ | 193 | if("1".equals( purchaseContractVO.getApproveState() )){ |
192 | purchaseContractVO.setStatus( "3" ); | 194 | purchaseContractVO.setStatus( "3" ); |
195 | inStock = true; | ||
193 | } | 196 | } |
194 | if("2".equals( purchaseContractVO.getApproveState() )){ | 197 | if("2".equals( purchaseContractVO.getApproveState() )){ |
195 | purchaseContractVO.setStatus( "4" ); | 198 | purchaseContractVO.setStatus( "2" ); |
196 | inStock = true; | ||
197 | } | 199 | } |
198 | 200 | ||
199 | this.baseMapper.updateById( purchaseContractVO ) ; | 201 | this.baseMapper.updateById( purchaseContractVO ) ; |
... | @@ -220,6 +222,15 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -220,6 +222,15 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
220 | } | 222 | } |
221 | } | 223 | } |
222 | } | 224 | } |
225 | |||
226 | /*** | ||
227 | * 根据分销编号查询采购合同列表 | ||
228 | * @param materialSearchVO | ||
229 | * @return | ||
230 | */ | ||
231 | public List<ERPPurchaseContract> getListByDistributId(MaterialSearchVO materialSearchVO){ | ||
232 | return this.baseMapper.getListByDistributId(materialSearchVO); | ||
233 | } | ||
223 | /*** | 234 | /*** |
224 | * 同步入库 | 235 | * 同步入库 |
225 | * @param purchaseContractVO | 236 | * @param purchaseContractVO |
... | @@ -229,20 +240,21 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -229,20 +240,21 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
229 | EquipmentInDTO equipmentInDTO = new EquipmentInDTO(); | 240 | EquipmentInDTO equipmentInDTO = new EquipmentInDTO(); |
230 | // EquipmentIn equipmentIn = new EquipmentIn(); | 241 | // EquipmentIn equipmentIn = new EquipmentIn(); |
231 | //入库类型 | 242 | //入库类型 |
243 | equipmentInDTO.setInType("8");//统购入库 | ||
232 | equipmentInDTO.setDepartId( purchaseContractVO.getDepartId() );//所属厂站 | 244 | equipmentInDTO.setDepartId( purchaseContractVO.getDepartId() );//所属厂站 |
233 | equipmentInDTO.setSuppliesWarehouseId( purchaseContractVO.getInWarehouseId() ) ;//入库仓库 | 245 | equipmentInDTO.setSuppliesWarehouseId( purchaseContractVO.getInWarehouseId() ) ;//入库仓库 |
234 | equipmentInDTO.setInDate(DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); | 246 | equipmentInDTO.setInDate( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); |
235 | equipmentInDTO.setUseBy( BaseContextHandler.getUserId() ) ;//经办人 | 247 | equipmentInDTO.setUseBy( BaseContextHandler.getUserId() ) ;//经办人 |
236 | equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间 | 248 | equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间 |
237 | equipmentInDTO.setRemark( purchaseContractVO.getRemark() );//备注 | 249 | equipmentInDTO.setRemark( purchaseContractVO.getRemark() );//备注 |
238 | 250 | ||
239 | List<EquipmentInChild> equipmentInChildrenList = new ArrayList<>(); | 251 | List<EquipmentInChild> equipmentInChildrenList = new ArrayList<>(); |
240 | EquipmentInChild equipmentInChild = new EquipmentInChild();// | 252 | EquipmentInChild equipmentInChild = null;//new EquipmentInChild();// |
241 | if(purchaseContractVO.getMaterialList() != null ){ | 253 | if(purchaseContractVO.getMaterialList() != null ){ |
242 | for( PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){ | 254 | for( PurchaseMaterial purchaseMaterial : purchaseContractVO.getMaterialList()){ |
243 | equipmentInChild = new EquipmentInChild();// | 255 | equipmentInChild = new EquipmentInChild();// |
244 | equipmentInChild.setSparepartId( purchaseMaterial.getSparepartId());//物料编号 | 256 | equipmentInChild.setSparepartId( purchaseMaterial.getSparepartId());//物料编号 |
245 | equipmentInChild.setInNum( new BigDecimal(purchaseMaterial.getPurchaseNum())); //物料类别 | 257 | equipmentInChild.setInNum( new BigDecimal(purchaseMaterial.getPurchaseNum())); //物料数量 |
246 | equipmentInChild.setBatchNum(purchaseMaterial.getGoodCode() ) ;//批次号 | 258 | equipmentInChild.setBatchNum(purchaseMaterial.getGoodCode() ) ;//批次号 |
247 | 259 | ||
248 | equipmentInChildrenList.add( equipmentInChild ) ; | 260 | equipmentInChildrenList.add( equipmentInChild ) ; |
... | @@ -262,7 +274,4 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr | ... | @@ -262,7 +274,4 @@ public class ERPPurchaseContractServiceImpl extends ServiceImpl<ERPPurchaseContr |
262 | this.baseMapper.updateById(purchaseContractVO ) ; | 274 | this.baseMapper.updateById(purchaseContractVO ) ; |
263 | return 1; | 275 | return 1; |
264 | } | 276 | } |
265 | |||
266 | |||
267 | |||
268 | } | 277 | } | ... | ... |
1 | package com.skua.modules.erp.service.impl; | 1 | package com.skua.modules.erp.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
3 | import com.baomidou.mybatisplus.core.metadata.IPage; | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
4 | import com.skua.core.context.BaseContextHandler; | 5 | import com.skua.core.context.BaseContextHandler; |
6 | import com.skua.core.context.SpringContextUtils; | ||
7 | import com.skua.modules.equipment.dto.EquipmentInDTO; | ||
8 | import com.skua.modules.equipment.dto.EquipmentOutDTO; | ||
9 | import com.skua.modules.equipment.entity.EquipmentInChild; | ||
10 | import com.skua.modules.equipment.service.IEquipmentInService; | ||
11 | import com.skua.modules.equipment.service.IEquipmentOutService; | ||
5 | import com.skua.modules.erp.entity.ApproveRecord; | 12 | import com.skua.modules.erp.entity.ApproveRecord; |
6 | import com.skua.modules.erp.entity.MaterialIN; | 13 | import com.skua.modules.erp.entity.MaterialIN; |
7 | import com.skua.modules.erp.mapper.ApproveRecordMapper; | 14 | import com.skua.modules.erp.mapper.ApproveRecordMapper; |
... | @@ -9,11 +16,20 @@ import com.skua.modules.erp.mapper.MaterialINMapper; | ... | @@ -9,11 +16,20 @@ import com.skua.modules.erp.mapper.MaterialINMapper; |
9 | import com.skua.modules.erp.service.IMaterialINService; | 16 | import com.skua.modules.erp.service.IMaterialINService; |
10 | import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO; | 17 | import com.skua.modules.erp.vo.ArrivalRecordExcelExportVO; |
11 | import com.skua.modules.erp.vo.MaterialINVO; | 18 | import com.skua.modules.erp.vo.MaterialINVO; |
19 | import com.skua.modules.guest.util.DateUtil; | ||
20 | import com.skua.modules.supplies.entity.SuppliesWarehouse; | ||
21 | import com.skua.modules.supplies.service.ISuppliesWarehouseService; | ||
22 | import org.apache.commons.lang3.StringUtils; | ||
23 | import org.springframework.beans.factory.annotation.Autowired; | ||
24 | import org.springframework.jdbc.core.JdbcTemplate; | ||
12 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
13 | |||
14 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 26 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
27 | import org.springframework.transaction.annotation.Transactional; | ||
15 | 28 | ||
16 | import javax.annotation.Resource; | 29 | import javax.annotation.Resource; |
30 | import java.math.BigDecimal; | ||
31 | import java.util.ArrayList; | ||
32 | import java.util.Date; | ||
17 | import java.util.List; | 33 | import java.util.List; |
18 | 34 | ||
19 | /** | 35 | /** |
... | @@ -24,15 +40,38 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -24,15 +40,38 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
24 | 40 | ||
25 | @Resource | 41 | @Resource |
26 | private ApproveRecordMapper recordMapper; | 42 | private ApproveRecordMapper recordMapper; |
43 | @Autowired | ||
44 | private IEquipmentInService equipmentInService; | ||
45 | @Autowired | ||
46 | private IEquipmentOutService equipmentOutService; | ||
47 | @Autowired | ||
48 | private ISuppliesWarehouseService warehouseService; | ||
49 | |||
27 | /*** | 50 | /*** |
28 | * 审核药剂入库单 | 51 | * 审核药剂入库单 |
29 | * @param materialINVO | 52 | * @param materialINVO |
30 | */ | 53 | */ |
31 | public void auditMaterialINVO(MaterialINVO materialINVO){ | 54 | @Transactional |
55 | public String auditMaterialINVO(MaterialINVO materialINVO){ | ||
56 | boolean inAndOutStock = false; | ||
57 | String errMsg = null; | ||
58 | QueryWrapper<SuppliesWarehouse> queryWrapper = new QueryWrapper<SuppliesWarehouse>(); | ||
59 | queryWrapper.eq("depart_id",materialINVO.getDepartId()); | ||
60 | warehouseService.list(); | ||
61 | //主库数据源 | ||
62 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
63 | String warehouseSql = "select id from supplies_warehouse where depart_id = '"+materialINVO.getDepartId()+"' order by create_time desc limit 1"; | ||
64 | String inWarehouseId = masterDB.queryForObject( warehouseSql,String.class ); | ||
65 | if(StringUtils.isEmpty(inWarehouseId)){ | ||
66 | String departSql = "select depart_name from sys_depart where id = '"+materialINVO.getDepartId()+"'"; | ||
67 | String departName = masterDB.queryForObject( warehouseSql,String.class ); | ||
68 | return "所属厂站["+departName+"]下没有找到仓库信息!"; | ||
69 | } | ||
32 | //保存 | 70 | //保存 |
33 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 | 71 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 |
34 | if("1".equals( materialINVO.getApproveState() )){ | 72 | if("1".equals( materialINVO.getApproveState() )){ |
35 | materialINVO.setAuditStatus( "3" ); | 73 | materialINVO.setAuditStatus( "3" ); |
74 | inAndOutStock = true; | ||
36 | } | 75 | } |
37 | if("2".equals( materialINVO.getApproveState() )){ | 76 | if("2".equals( materialINVO.getApproveState() )){ |
38 | materialINVO.setAuditStatus( "2" ); | 77 | materialINVO.setAuditStatus( "2" ); |
... | @@ -42,6 +81,21 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -42,6 +81,21 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
42 | //审批记录 | 81 | //审批记录 |
43 | ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState()); | 82 | ApproveRecord record = new ApproveRecord( "YJIN", materialINVO.getApplyUser(), materialINVO.getId(), BaseContextHandler.getUserId(), materialINVO.getApproveMessage(), materialINVO.getApproveState()); |
44 | recordMapper.insert( record ) ; | 83 | recordMapper.insert( record ) ; |
84 | |||
85 | // 审核通过,生成入库单据、物料单 | ||
86 | if(inAndOutStock ){ | ||
87 | try { | ||
88 | //出库 | ||
89 | syncEquipmentOut(materialINVO); | ||
90 | //入库 | ||
91 | syncEquipmentIn(materialINVO,inWarehouseId); | ||
92 | } catch (Exception e) { | ||
93 | e.printStackTrace(); | ||
94 | |||
95 | } | ||
96 | } | ||
97 | |||
98 | return errMsg; | ||
45 | } | 99 | } |
46 | 100 | ||
47 | /*** | 101 | /*** |
... | @@ -70,4 +124,60 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia | ... | @@ -70,4 +124,60 @@ public class MaterialINServiceImpl extends ServiceImpl<MaterialINMapper, Materia |
70 | public IPage<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, MaterialIN materialIN) { | 124 | public IPage<MaterialIN> selectAuditMaterialINByPage(IPage<MaterialIN> page, MaterialIN materialIN) { |
71 | return page.setRecords(baseMapper.selectAuditMaterialINByPage(page, materialIN)); | 125 | return page.setRecords(baseMapper.selectAuditMaterialINByPage(page, materialIN)); |
72 | } | 126 | } |
127 | |||
128 | |||
129 | /*** | ||
130 | * 出库 | ||
131 | * @return | ||
132 | */ | ||
133 | public int syncEquipmentOut(MaterialINVO materialINVO){ | ||
134 | EquipmentOutDTO equipmentOutDTO = new EquipmentOutDTO(); | ||
135 | |||
136 | |||
137 | //equipmentOutService.saveEquipmentOut(equipmentOutDTO); | ||
138 | return 1; | ||
139 | } | ||
140 | |||
141 | /*** | ||
142 | * 同步入库 | ||
143 | * @param materialINVO | ||
144 | * @return | ||
145 | */ | ||
146 | public int syncEquipmentIn(MaterialINVO materialINVO,String inWarehouseId) throws Exception{ | ||
147 | EquipmentInDTO equipmentInDTO = new EquipmentInDTO(); | ||
148 | // EquipmentIn equipmentIn = new EquipmentIn(); | ||
149 | //入库类型 | ||
150 | equipmentInDTO.setInType("8");//统购入库 | ||
151 | equipmentInDTO.setDepartId( materialINVO.getDepartId() );//所属厂站 | ||
152 | |||
153 | equipmentInDTO.setSuppliesWarehouseId( inWarehouseId ) ;//入库仓库 | ||
154 | equipmentInDTO.setInDate( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss")); | ||
155 | equipmentInDTO.setUseBy( BaseContextHandler.getUserId() ) ;//经办人 | ||
156 | equipmentInDTO.setChooseTime( DateUtil.formatDate(new Date(),"yyyy-MM-dd HH:mm:ss") );//经办时间 | ||
157 | equipmentInDTO.setRemark( materialINVO.getRemark() );//备注 | ||
158 | |||
159 | List<EquipmentInChild> equipmentInChildrenList = new ArrayList<>(); | ||
160 | EquipmentInChild equipmentInChild = new EquipmentInChild();// | ||
161 | |||
162 | equipmentInChild.setSparepartId( materialINVO.getSparepartId());//物料编号 | ||
163 | equipmentInChild.setInNum( new BigDecimal(materialINVO.getMaterialNum())); //物料数量 | ||
164 | equipmentInChild.setBatchNum(materialINVO.getGoodCode() ) ;//批次号 | ||
165 | |||
166 | equipmentInChildrenList.add( equipmentInChild ) ; | ||
167 | |||
168 | |||
169 | equipmentInDTO.setEquipmentInChildList( equipmentInChildrenList ); | ||
170 | //调用接口入库 | ||
171 | equipmentInService.saveEquipmentIn(equipmentInDTO ) ; | ||
172 | |||
173 | |||
174 | /* ERPPurchaseContract erpPurchaseContract = this.baseMapper.selectById(purchaseContractVO.getId()); | ||
175 | if(erpPurchaseContract == null ){ | ||
176 | throw new Exception("采购合同记录不存在"); | ||
177 | }*/ | ||
178 | materialINVO.setEquipmentInId( equipmentInDTO.getId() ) ;//记录入库单号 | ||
179 | log.debug("记录入库单号{"+equipmentInDTO.getId()+"},入库单号:"+equipmentInDTO.getInOrder()); | ||
180 | this.baseMapper.updateById(materialINVO ) ; | ||
181 | return 1; | ||
182 | } | ||
73 | } | 183 | } | ... | ... |
... | @@ -121,7 +121,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur | ... | @@ -121,7 +121,7 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur |
121 | */ | 121 | */ |
122 | @Transactional | 122 | @Transactional |
123 | public void auditPurchasePlan(PurchasePlanVO purchasePlanVO){ | 123 | public void auditPurchasePlan(PurchasePlanVO purchasePlanVO){ |
124 | boolean warehousing = false;//是否入库 | 124 | |
125 | //保存 | 125 | //保存 |
126 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 | 126 | //purchasePlan.getApproveState() 审批状态 1通过2不通过 |
127 | if("1".equals( purchasePlanVO.getApproveState() )){ | 127 | if("1".equals( purchasePlanVO.getApproveState() )){ |
... | @@ -129,8 +129,6 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur | ... | @@ -129,8 +129,6 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur |
129 | } | 129 | } |
130 | if("2".equals( purchasePlanVO.getApproveState() )){ | 130 | if("2".equals( purchasePlanVO.getApproveState() )){ |
131 | purchasePlanVO.setStatus( "2" ); | 131 | purchasePlanVO.setStatus( "2" ); |
132 | //发送入库单据,物料库存增加 | ||
133 | warehousing = true; | ||
134 | } | 132 | } |
135 | 133 | ||
136 | this.baseMapper.updateById( purchasePlanVO ) ; | 134 | this.baseMapper.updateById( purchasePlanVO ) ; |
... | @@ -147,10 +145,6 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur | ... | @@ -147,10 +145,6 @@ public class PurchasePlanServiceImpl extends ServiceImpl<PurchasePlanMapper, Pur |
147 | ApproveRecord record = new ApproveRecord( "CGJH", purchasePlanVO.getApplyUser(), purchasePlanVO.getId(), BaseContextHandler.getUserId(), purchasePlanVO.getApproveMessage(), purchasePlanVO.getApproveState()); | 145 | ApproveRecord record = new ApproveRecord( "CGJH", purchasePlanVO.getApplyUser(), purchasePlanVO.getId(), BaseContextHandler.getUserId(), purchasePlanVO.getApproveMessage(), purchasePlanVO.getApproveState()); |
148 | recordMapper.insert( record ) ; | 146 | recordMapper.insert( record ) ; |
149 | 147 | ||
150 | if(warehousing){//创建入库单据、入库物料单 | ||
151 | |||
152 | |||
153 | } | ||
154 | } | 148 | } |
155 | 149 | ||
156 | /*** | 150 | /*** | ... | ... |
... | @@ -16,6 +16,9 @@ public class MaterialSearchVO { | ... | @@ -16,6 +16,9 @@ public class MaterialSearchVO { |
16 | @ApiModelProperty(value = "采购合同编号") | 16 | @ApiModelProperty(value = "采购合同编号") |
17 | private String purchaseContractId; | 17 | private String purchaseContractId; |
18 | 18 | ||
19 | @ApiModelProperty(value = "分销合同编号") | ||
20 | private String distributContractId; | ||
21 | |||
19 | @ApiModelProperty(value = "物料编号") | 22 | @ApiModelProperty(value = "物料编号") |
20 | private String sparepartCode; | 23 | private String sparepartCode; |
21 | 24 | ... | ... |
... | @@ -24,7 +24,6 @@ public class PurchaseContractVO extends ERPPurchaseContract { | ... | @@ -24,7 +24,6 @@ public class PurchaseContractVO extends ERPPurchaseContract { |
24 | @ApiModelProperty(value = "采购合同物料清单集合") | 24 | @ApiModelProperty(value = "采购合同物料清单集合") |
25 | private List<PurchaseMaterial> materialList = null; | 25 | private List<PurchaseMaterial> materialList = null; |
26 | 26 | ||
27 | |||
28 | /**审批状态*/ | 27 | /**审批状态*/ |
29 | @TableField(exist=false) | 28 | @TableField(exist=false) |
30 | @ApiModelProperty(value = "审批状态 1通过2不通过") | 29 | @ApiModelProperty(value = "审批状态 1通过2不通过") | ... | ... |
... | @@ -72,7 +72,7 @@ public class PurchaseMaterialVO { | ... | @@ -72,7 +72,7 @@ public class PurchaseMaterialVO { |
72 | /**备注*/ | 72 | /**备注*/ |
73 | @Excel(name = "备注", width = 15) | 73 | @Excel(name = "备注", width = 15) |
74 | @ApiModelProperty(value = "备注") | 74 | @ApiModelProperty(value = "备注") |
75 | private java.lang.String remarks; | 75 | private java.lang.String remark; |
76 | 76 | ||
77 | 77 | ||
78 | @TableField(exist=false) | 78 | @TableField(exist=false) | ... | ... |
... | @@ -35,6 +35,9 @@ public class PurchasePlanSearchVO { | ... | @@ -35,6 +35,9 @@ public class PurchasePlanSearchVO { |
35 | private String sparepartAttribute; | 35 | private String sparepartAttribute; |
36 | 36 | ||
37 | 37 | ||
38 | @ApiModelProperty(value = "用途") | ||
39 | private String purpose; | ||
40 | |||
38 | 41 | ||
39 | @ApiModelProperty(value = "开始时间") | 42 | @ApiModelProperty(value = "开始时间") |
40 | private String startTime; | 43 | private String startTime; | ... | ... |
1 | package com.skua.modules.threedimensional.controller; | 1 | package com.skua.modules.threedimensional.controller; |
2 | 2 | ||
3 | import com.skua.core.api.vo.Result; | ||
4 | import com.skua.core.aspect.annotation.AutoLog; | ||
5 | import com.skua.modules.report.vo.JnhbReportData; | ||
6 | import com.skua.modules.threedimensional.service.IJTDisplayScreenService; | ||
7 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; | ||
3 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
9 | import io.swagger.annotations.ApiOperation; | ||
4 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
11 | import org.springframework.beans.factory.annotation.Autowired; | ||
12 | import org.springframework.web.bind.annotation.GetMapping; | ||
5 | import org.springframework.web.bind.annotation.RequestMapping; | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
6 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
7 | 15 | ||
16 | import java.util.List; | ||
17 | |||
8 | @Slf4j | 18 | @Slf4j |
9 | @Api(tags = "对外展示集团大屏") | 19 | @Api(tags = "对外展示集团大屏") |
10 | @RestController | 20 | @RestController |
11 | @RequestMapping("/jtDisplayscreendata") | 21 | @RequestMapping("/jtDisplayscreendata") |
12 | public class JTDisplayScreenController { | 22 | public class JTDisplayScreenController { |
23 | @Autowired | ||
24 | private IJTDisplayScreenService displayScreenService ; | ||
25 | |||
26 | @AutoLog(value = "厂站记录") | ||
27 | @ApiOperation(value = "厂长列表", notes = "厂长列表") | ||
28 | @GetMapping(value = "/factoryList") | ||
29 | public Result<List<SysFactoryInfoVO>> factoryList(String time) { | ||
30 | Result<List<SysFactoryInfoVO>> result = new Result<>(); | ||
31 | List<SysFactoryInfoVO> list = displayScreenService.getFactoryList(time); | ||
32 | result.setResult(list); | ||
33 | return result; | ||
34 | } | ||
13 | } | 35 | } | ... | ... |
sk-module-biz/src/main/java/com/skua/modules/threedimensional/service/IJTDisplayScreenService.java
0 → 100644
1 | package com.skua.modules.threedimensional.service; | ||
2 | |||
3 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; | ||
4 | import java.util.List; | ||
5 | |||
6 | public interface IJTDisplayScreenService { | ||
7 | |||
8 | /*** | ||
9 | * 厂站列表 | ||
10 | * @param time | ||
11 | * @return | ||
12 | */ | ||
13 | List<SysFactoryInfoVO> getFactoryList(String time ); | ||
14 | } |
1 | package com.skua.modules.threedimensional.service.impl; | ||
2 | |||
3 | import com.skua.common.report.ReportViewUtil; | ||
4 | import com.skua.core.context.SpringContextUtils; | ||
5 | import com.skua.core.util.DateUtils; | ||
6 | import com.skua.modules.threedimensional.service.IJTDisplayScreenService; | ||
7 | import com.skua.modules.threedimensional.vo.SysFactoryInfoVO; | ||
8 | import org.springframework.jdbc.core.JdbcTemplate; | ||
9 | import org.springframework.stereotype.Service; | ||
10 | |||
11 | import java.util.List; | ||
12 | |||
13 | |||
14 | /** | ||
15 | * 对外展示集团大屏 | ||
16 | */ | ||
17 | @Service | ||
18 | public class JTDisplayScreenServiceImpl implements IJTDisplayScreenService { | ||
19 | private static String view2119 = "2119ecbf53a1d2d0708258ff67cfd9e1"; | ||
20 | /*** | ||
21 | * | ||
22 | * @return | ||
23 | */ | ||
24 | public List<SysFactoryInfoVO> getFactoryList(String time ){ | ||
25 | List<SysFactoryInfoVO> factoryInfoVOList = null; | ||
26 | String startDate = time+"-01"; | ||
27 | String endDate = time+"-31";; | ||
28 | String departId = null; | ||
29 | |||
30 | String yesterday = DateUtils.getYesterday(); | ||
31 | |||
32 | // | ||
33 | String departIdSql ="select GROUP_CONCAT(fi.depart_id ) from sys_factory_info fi ,sys_depart d where fi.depart_id = d.id and d.depart_type =1 "; | ||
34 | String departIds = null; | ||
35 | String dataViewName2119 = ReportViewUtil.buildViewLike(view2119,"CSL", departIds, startDate, endDate); | ||
36 | System.out.println("********************************************"); | ||
37 | System.out.println(dataViewName2119); | ||
38 | |||
39 | //主库数据源 | ||
40 | JdbcTemplate masterDB = (JdbcTemplate) SpringContextUtils.getBean("master"); | ||
41 | |||
42 | String sql = "select " + " sum(v1.CSL)/10000 " + " from "+dataViewName2119+" v1 " ; | ||
43 | |||
44 | |||
45 | return factoryInfoVOList; | ||
46 | } | ||
47 | } |
1 | package com.skua.modules.threedimensional.vo; | ||
2 | |||
3 | import io.swagger.annotations.ApiModel; | ||
4 | import io.swagger.annotations.ApiModelProperty; | ||
5 | import lombok.Data; | ||
6 | import lombok.EqualsAndHashCode; | ||
7 | import lombok.experimental.Accessors; | ||
8 | |||
9 | @Data | ||
10 | @EqualsAndHashCode(callSuper = false) | ||
11 | @Accessors(chain = true) | ||
12 | @ApiModel(value = "sys_factory_info对象", description = "厂区详细信息") | ||
13 | public class SysFactoryInfoVO { | ||
14 | @ApiModelProperty(value = "主键") | ||
15 | private String id; | ||
16 | |||
17 | @ApiModelProperty(value = "水厂名称") | ||
18 | private String departName; | ||
19 | |||
20 | @ApiModelProperty(value = "经度") | ||
21 | private String proLongitude; | ||
22 | |||
23 | @ApiModelProperty(value = "纬度") | ||
24 | private String proLatitude; | ||
25 | |||
26 | @ApiModelProperty(value = "昨日处理水量") | ||
27 | private String csl_lastDay; | ||
28 | |||
29 | @ApiModelProperty(value = "本月累计处理水量") | ||
30 | private String csl_month; | ||
31 | |||
32 | @ApiModelProperty(value = "日均处理水量") | ||
33 | private String csl_avg_day; | ||
34 | |||
35 | @ApiModelProperty(value = "本年处理水量") | ||
36 | private String csl_year; | ||
37 | |||
38 | } |
... | @@ -10,7 +10,6 @@ import java.util.List; | ... | @@ -10,7 +10,6 @@ import java.util.List; |
10 | import java.util.Map; | 10 | import java.util.Map; |
11 | import java.util.UUID; | 11 | import java.util.UUID; |
12 | import java.util.concurrent.CountDownLatch; | 12 | import java.util.concurrent.CountDownLatch; |
13 | import java.util.concurrent.ThreadPoolExecutor; | ||
14 | import java.util.stream.Collectors; | 13 | import java.util.stream.Collectors; |
15 | 14 | ||
16 | import javax.servlet.http.HttpServletRequest; | 15 | import javax.servlet.http.HttpServletRequest; | ... | ... |
... | @@ -2,8 +2,10 @@ package com.skua.modules.equipment.service; | ... | @@ -2,8 +2,10 @@ package com.skua.modules.equipment.service; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.baomidou.mybatisplus.extension.service.IService; | 4 | import com.baomidou.mybatisplus.extension.service.IService; |
5 | import com.skua.modules.equipment.dto.EquipmentOutDTO; | ||
5 | import com.skua.modules.equipment.entity.EquipmentOut; | 6 | import com.skua.modules.equipment.entity.EquipmentOut; |
6 | import com.skua.modules.equipment.vo.EquipmentOutExcel; | 7 | import com.skua.modules.equipment.vo.EquipmentOutExcel; |
8 | import org.apache.kafka.common.errors.InterruptException; | ||
7 | 9 | ||
8 | import java.util.List; | 10 | import java.util.List; |
9 | 11 | ||
... | @@ -14,4 +16,11 @@ public interface IEquipmentOutService extends IService<EquipmentOut> { | ... | @@ -14,4 +16,11 @@ public interface IEquipmentOutService extends IService<EquipmentOut> { |
14 | 16 | ||
15 | List<EquipmentOutExcel> queryExport(QueryWrapper<EquipmentOut> queryWrapper); | 17 | List<EquipmentOutExcel> queryExport(QueryWrapper<EquipmentOut> queryWrapper); |
16 | 18 | ||
19 | /*** | ||
20 | * 新增出库 | ||
21 | * @param equipmentOutDTO | ||
22 | * @return | ||
23 | */ | ||
24 | String saveEquipmentOut(EquipmentOutDTO equipmentOutDTO) throws Exception; | ||
25 | |||
17 | } | 26 | } | ... | ... |
... | @@ -2,14 +2,35 @@ package com.skua.modules.equipment.service.impl; | ... | @@ -2,14 +2,35 @@ package com.skua.modules.equipment.service.impl; |
2 | 2 | ||
3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
5 | import com.skua.core.util.DateUtils; | ||
6 | import com.skua.modules.equipment.dto.EquipmentOutDTO; | ||
5 | import com.skua.modules.equipment.entity.EquipmentOut; | 7 | import com.skua.modules.equipment.entity.EquipmentOut; |
8 | import com.skua.modules.equipment.entity.EquipmentOutChild; | ||
9 | import com.skua.modules.equipment.entity.EquipmentSparepart; | ||
6 | import com.skua.modules.equipment.mapper.EquipmentOutMapper; | 10 | import com.skua.modules.equipment.mapper.EquipmentOutMapper; |
11 | import com.skua.modules.equipment.service.IEquipmentOutChildService; | ||
7 | import com.skua.modules.equipment.service.IEquipmentOutService; | 12 | import com.skua.modules.equipment.service.IEquipmentOutService; |
13 | import com.skua.modules.equipment.service.IEquipmentSparepartService; | ||
8 | import com.skua.modules.equipment.vo.EquipmentOutExcel; | 14 | import com.skua.modules.equipment.vo.EquipmentOutExcel; |
15 | import com.skua.modules.flow.utils.ObjectUtil; | ||
16 | import com.skua.modules.supplies.entity.EquipmentSparepartSupplies; | ||
17 | import com.skua.modules.supplies.service.IEquipmentSparepartSuppliesService; | ||
18 | import com.skua.tool.util.BeanExtUtils; | ||
19 | import com.skua.tool.util.UniqIdUtils; | ||
20 | import org.apache.commons.lang.StringUtils; | ||
21 | import org.springframework.beans.BeanUtils; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
23 | import org.springframework.beans.factory.annotation.Qualifier; | ||
24 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
10 | import org.springframework.stereotype.Service; | 25 | import org.springframework.stereotype.Service; |
26 | import org.springframework.transaction.support.TransactionTemplate; | ||
11 | 27 | ||
28 | import javax.annotation.Resource; | ||
29 | import java.math.BigDecimal; | ||
30 | import java.util.Date; | ||
12 | import java.util.List; | 31 | import java.util.List; |
32 | import java.util.UUID; | ||
33 | import java.util.concurrent.CountDownLatch; | ||
13 | 34 | ||
14 | /** | 35 | /** |
15 | * 出库 | 36 | * 出库 |
... | @@ -18,9 +39,102 @@ import java.util.List; | ... | @@ -18,9 +39,102 @@ import java.util.List; |
18 | public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, EquipmentOut> implements IEquipmentOutService { | 39 | public class EquipmentOutServiceImpl extends ServiceImpl<EquipmentOutMapper, EquipmentOut> implements IEquipmentOutService { |
19 | 40 | ||
20 | @Autowired | 41 | @Autowired |
42 | @Qualifier("taskExecutor") | ||
43 | private ThreadPoolTaskExecutor taskExecutor; | ||
44 | @Resource | ||
21 | private EquipmentOutMapper equipmentOutMapper; | 45 | private EquipmentOutMapper equipmentOutMapper; |
46 | |||
47 | @Autowired | ||
48 | private IEquipmentOutChildService iEquipmentOutChildService; | ||
49 | @Autowired | ||
50 | private IEquipmentSparepartService iEquipmentSparepartService; | ||
51 | |||
52 | @Autowired | ||
53 | private TransactionTemplate transactionTemplate; | ||
54 | @Autowired | ||
55 | private IEquipmentSparepartSuppliesService sparepartSuppliesService; | ||
56 | |||
22 | @Override | 57 | @Override |
23 | public List<EquipmentOutExcel> queryExport(QueryWrapper<EquipmentOut> queryWrapper) { | 58 | public List<EquipmentOutExcel> queryExport(QueryWrapper<EquipmentOut> queryWrapper) { |
24 | return equipmentOutMapper.queryExport(queryWrapper); | 59 | return equipmentOutMapper.queryExport(queryWrapper); |
25 | } | 60 | } |
61 | /*** | ||
62 | * 新增出库 | ||
63 | * @param equipmentOutDTO | ||
64 | * @return | ||
65 | */ | ||
66 | public String saveEquipmentOut(EquipmentOutDTO equipmentOutDTO) throws Exception { | ||
67 | String errMsg = null; | ||
68 | if (equipmentOutDTO.getEquipmentOutChildList() == null || equipmentOutDTO.getEquipmentOutChildList().isEmpty()) { | ||
69 | errMsg = "请选择出库备件"; | ||
70 | return errMsg; | ||
71 | } | ||
72 | // 出库单号 | ||
73 | if (StringUtils.isEmpty(equipmentOutDTO.getOutOrder())) { | ||
74 | String outOrder = "CK-" + DateUtils.format(new Date(), "YYYYMMdd" + "-" + System.currentTimeMillis()); | ||
75 | equipmentOutDTO.setOutOrder(outOrder); | ||
76 | } | ||
77 | // 出库表主键 | ||
78 | String outId = UUID.randomUUID().toString().replaceAll("-", ""); | ||
79 | equipmentOutDTO.setId(outId); | ||
80 | EquipmentOut equipmentOut = BeanExtUtils.bean2Bean(equipmentOutDTO, EquipmentOut.class); | ||
81 | equipmentOut.setInventoryUpdateTime(new Date()); | ||
82 | this.baseMapper.insert(equipmentOut); | ||
83 | CountDownLatch countDownLatch = new CountDownLatch(equipmentOutDTO.getEquipmentOutChildList().size()); | ||
84 | for (EquipmentOutChild equipmentOutChild : equipmentOutDTO.getEquipmentOutChildList()) { | ||
85 | equipmentOutChild.setId(UniqIdUtils.getInstance().getUniqID()); | ||
86 | equipmentOutChild.setOutId(outId); | ||
87 | taskExecutor.execute(() -> { | ||
88 | try { | ||
89 | String sparepartId = equipmentOutChild.getSparepartId(); | ||
90 | String suppliesWarehouseId = equipmentOutDTO.getSuppliesWarehouseId(); | ||
91 | |||
92 | //根据物资id和仓库id获取库存 | ||
93 | QueryWrapper<EquipmentSparepart> sparepartQueryWrapper = new QueryWrapper<>(); | ||
94 | sparepartQueryWrapper.eq("supplies_id", sparepartId).eq("supplies_warehouse_id", suppliesWarehouseId); | ||
95 | EquipmentSparepart equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); | ||
96 | if (ObjectUtil.isEmpty(equipmentSparepart)) { | ||
97 | //物料信息 | ||
98 | EquipmentSparepartSupplies supplies = sparepartSuppliesService.getById(sparepartId); | ||
99 | equipmentSparepart = new EquipmentSparepart(); | ||
100 | BeanUtils.copyProperties(supplies, equipmentSparepart); | ||
101 | equipmentSparepart.setId(null); | ||
102 | equipmentSparepart.setStorageNum(BigDecimal.ZERO); | ||
103 | equipmentSparepart.setSuppliesId(sparepartId); | ||
104 | equipmentSparepart.setSuppliesWarehouseId(suppliesWarehouseId); | ||
105 | //如果没有物料库存信息,新增库存信息为0 | ||
106 | iEquipmentSparepartService.saveOrUpdate(equipmentSparepart); | ||
107 | equipmentSparepart = iEquipmentSparepartService.getOne(sparepartQueryWrapper); | ||
108 | |||
109 | } | ||
110 | BigDecimal resetStorageNum = equipmentSparepart.getStorageNum().subtract(equipmentOutChild.getOutNum()); | ||
111 | if (resetStorageNum.doubleValue() < 0) { | ||
112 | return; | ||
113 | } | ||
114 | Integer version = equipmentSparepart.getVersion(); | ||
115 | String id = equipmentSparepart.getId(); | ||
116 | Integer executeRes = transactionTemplate.execute(transactionStatus -> { | ||
117 | int val0 = iEquipmentSparepartService.updateStorageNumById(id, resetStorageNum.doubleValue(), version); | ||
118 | if (val0 == 1 && iEquipmentOutChildService.saveOrUpdate(equipmentOutChild)) { | ||
119 | return 1; | ||
120 | } else { | ||
121 | transactionStatus.setRollbackOnly(); | ||
122 | return 0; | ||
123 | } | ||
124 | }); | ||
125 | // if (executeRes != null && executeRes == 1) { | ||
126 | // | ||
127 | // } | ||
128 | |||
129 | } catch (Exception e) { | ||
130 | e.printStackTrace(); | ||
131 | //log.error("异常error: {}", e.getMessage()); | ||
132 | } finally { | ||
133 | countDownLatch.countDown(); | ||
134 | } | ||
135 | }); | ||
136 | } | ||
137 | countDownLatch.await(); | ||
138 | return errMsg ; | ||
139 | } | ||
26 | } | 140 | } | ... | ... |
... | @@ -150,6 +150,9 @@ public class MybatisInterceptor implements Interceptor { | ... | @@ -150,6 +150,9 @@ public class MybatisInterceptor implements Interceptor { |
150 | || "com.skua.modules.erp.mapper.DistributMaterialMapper.queryListByContractId".equals(sqlId) //采购-分销合同 | 150 | || "com.skua.modules.erp.mapper.DistributMaterialMapper.queryListByContractId".equals(sqlId) //采购-分销合同 |
151 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.selectList".equals(sqlId) //采购合同 | 151 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.selectList".equals(sqlId) //采购合同 |
152 | || "com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper.selectList".equals(sqlId) //物料 | 152 | || "com.skua.modules.supplies.mapper.EquipmentSparepartSuppliesMapper.selectList".equals(sqlId) //物料 |
153 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.selectList".equals(sqlId) //采购合同列表 | ||
154 | || "com.skua.modules.erp.mapper.DistributContractMapper.selectList".equals(sqlId) //分销合同列表 | ||
155 | || "com.skua.modules.erp.mapper.ERPPurchaseContractMapper.getListByDistributId".equals(sqlId) | ||
153 | || "com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper.selectList".equals(sqlId) //点表 | 156 | || "com.skua.modules.system.datestandard.mapper.SysMonitorMetricInfoMapper.selectList".equals(sqlId) //点表 |
154 | ) { | 157 | ) { |
155 | log.debug("************************------sqlId------**************************" + sqlId); | 158 | log.debug("************************------sqlId------**************************" + sqlId); | ... | ... |
-
请 注册 或 登录 后发表评论