Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
# Conflicts:
# rsf-admin/src/i18n/en.js
# rsf-admin/src/i18n/zh.js
| | |
| | | locRevise: 'Loc Revise', |
| | | statisticReport: 'Statistical Report', |
| | | locDeadReport: 'Locs Dead Report', |
| | | stockStatistic: 'Stock Statistic', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | startTime: "startTime", |
| | | endTime: "endTime", |
| | | }, |
| | | stockStatistic: { |
| | | id: "id", |
| | | dayTime: "dayTime", |
| | | taskType: "taskType", |
| | | taskStatus: "taskStatus", |
| | | maktx: "maktx", |
| | | matnrCode: "matnrCode", |
| | | count: "count", |
| | | batch: "batch", |
| | | anfme: "anfme", |
| | | unit: "unit", |
| | | }, |
| | | delivery: { |
| | | code: "code", |
| | | platId: "platId", |
| | |
| | | wkType: 'Work Type', |
| | | orderType: "orderType", |
| | | orderItemId: "orderItemId", |
| | | sourceCode: "sourceCode", |
| | | matnrId: "matnrId", |
| | | maktx: "maktx", |
| | | matnrCode: "matnrCode", |
| | |
| | | locRevise: '库存调整', |
| | | statisticReport: '日志报表', |
| | | locDeadReport : '库存停滞报表', |
| | | stockStatistic: '日库存统计', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | useStatus: '库位状态', |
| | | locAreaId: '逻辑分区' |
| | | }, |
| | | stockStatistic: { |
| | | id: "id", |
| | | dayTime: "日期", |
| | | taskType: "任务类型", |
| | | taskStatus: "任务状态", |
| | | maktx: "物料名称", |
| | | matnrCode: "物料编码", |
| | | count: "次数", |
| | | batch: "批次", |
| | | anfme: "数量", |
| | | unit: "单位", |
| | | }, |
| | | locType: { |
| | | name: "库位类型", |
| | | code: "编号", |
| | |
| | | |
| | | InTaskMsgDto inTaskMsgDto = new InTaskMsgDto(); |
| | | |
| | | int sRow = deviceBind.getStartRow(); |
| | | int eRow = deviceBind.getEndRow(); |
| | | int deviceQty = deviceBind.getDeviceQty(); |
| | | |
| | | |
| | | // ===============>>>> 开始执行 |
| | | curRow = deviceBind.getCurrentRow(); |
| | | |
| | | //此程序用于优化堆垛机异常时的运行时间 |
| | | for (int i = times; i <= deviceQty * 2; i++) { |
| | | //获取排 |
| | | int[] locNecessaryParameters = LocUtils.LocNecessaryParameters(deviceBind, curRow, deviceQty); |
| | | curRow = locNecessaryParameters[1]; |
| | | channel = locNecessaryParameters[2]; |
| | | rowCount = locNecessaryParameters[0]; |
| | | nearRow = locNecessaryParameters[3]; |
| | | break; |
| | | } |
| | | |
| | | |
| | | if (nearRow == 0) { |
| | | throw new CoolException("无可用堆垛机"); |
| | | } |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table = "man_revise_log_item"; |
| | | generator.tableDesc = "库位调整历史"; |
| | | generator.table = "view_stock_statistic"; |
| | | generator.tableDesc = "日库存统计"; |
| | | generator.packagePath = "com.vincent.rsf.server.manager"; |
| | | |
| | | generator.build(); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskResouceType; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class LocItemDeadController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping("/locDeadReport/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocItem, BaseParam> pageParam = new PageParam<>(baseParam, LocItem.class); |
| | | QueryWrapper<LocItem> wrapper = pageParam.buildWrapper(true); |
| | | /**拼接扩展字段*/ |
| | | PageParam<LocItem, BaseParam> page = locItemService.page(pageParam, wrapper); |
| | | List<LocItem> records = page.getRecords(); |
| | | for (LocItem record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | | Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex()); |
| | | record.setExtendFields(fields); |
| | | } |
| | | } |
| | | page.setRecords(records); |
| | | |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping("/locDeadReport/useO/page") |
| | | public R locUseOPage(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocItem, BaseParam> pageParam = new PageParam<>(baseParam, LocItem.class); |
| | | QueryWrapper<LocItem> locItemQueryWrapper = pageParam.buildWrapper(true); |
| | | String applySql = String.format( |
| | | "EXISTS (SELECT 1 FROM man_loc ml " + |
| | | "WHERE ml.use_status = '%s'" + |
| | | "AND ml.id = man_loc_item.loc_id " + |
| | | ")", |
| | | LocStsType.LOC_STS_TYPE_F.type |
| | | ); |
| | | locItemQueryWrapper.apply(applySql); |
| | | /**拼接扩展字段*/ |
| | | PageParam<LocItem, BaseParam> page = locItemService.page(pageParam, locItemQueryWrapper); |
| | | List<LocItem> records = page.getRecords(); |
| | | for (LocItem record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | | Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex()); |
| | | record.setExtendFields(fields); |
| | | } |
| | | } |
| | | page.setRecords(records); |
| | | |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | /** |
| | | * 生成库存出库任务 |
| | | * @param param |
| | | * @return |
| | | */ |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @ApiOperation("生成库存出库任务") |
| | | @PostMapping("/locDeadReport/generate/task") |
| | | public R generateTask(@RequestBody LocToTaskParams param) { |
| | | if (Objects.isNull(param)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | try { |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 生成移库任务 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @ApiOperation("生成移库任务") |
| | | @PostMapping("/locDeadReport/move/task") |
| | | public R genMoveTask(@RequestBody LocToTaskParams map) { |
| | | if (Objects.isNull(map)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return R.ok("任务生成成功").add(locItemService.genMoveTask(map, getLoginUserId())); |
| | | } |
| | | |
| | | /** |
| | | * 生成盘点出库任务 |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @ApiOperation("生成盘点出库任务") |
| | | @PostMapping("/locDeadReport/check/task") |
| | | public R genStatisticalTask(@RequestBody LocToTaskParams map) { |
| | | if (Objects.isNull(map)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | map.setType(Constants.TASK_TYPE_OUT_CHECK); |
| | | |
| | | try { |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, map, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | return R.ok("任务生成成功"); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping("/locDeadReport/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locItemService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping({"/locDeadReport/many/{ids}", "/locDeadReport/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locItemService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @GetMapping("/locDeadReport/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locItemService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:save')") |
| | | @OperationLog("Create 库位明细") |
| | | @PostMapping("/locDeadReport/save") |
| | | public R save(@RequestBody LocItem locItem) { |
| | | locItem.setCreateBy(getLoginUserId()); |
| | | locItem.setCreateTime(new Date()); |
| | | locItem.setUpdateBy(getLoginUserId()); |
| | | locItem.setUpdateTime(new Date()); |
| | | if (!locItemService.save(locItem)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(locItem); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:update')") |
| | | @OperationLog("Update 库位明细") |
| | | @PostMapping("/locDeadReport/update") |
| | | public R update(@RequestBody LocItem locItem) { |
| | | locItem.setUpdateBy(getLoginUserId()); |
| | | locItem.setUpdateTime(new Date()); |
| | | if (!locItemService.updateById(locItem)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(locItem); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:remove')") |
| | | @OperationLog("Delete 库位明细") |
| | | @PostMapping("/locDeadReport/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!locItemService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping("/locDeadReport/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<LocItem> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocItem::getId, condition); |
| | | } |
| | | locItemService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:statisticReport:list')") |
| | | @PostMapping("/locDeadReport/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(locItemService.list(), LocItem.class), response); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stock:list')") |
| | | @PostMapping("/inStock/num/page") |
| | | public R inStockpage(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Stock, BaseParam> pageParam = new PageParam<>(baseParam, Stock.class); |
| | | return R.ok().add(stockService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stock:list')") |
| | | @PostMapping("/stock/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(stockService.list()); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.StockStatistic; |
| | | import com.vincent.rsf.server.manager.service.StockStatisticService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class StockStatisticController extends BaseController { |
| | | |
| | | @Autowired |
| | | private StockStatisticService stockStatisticService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<StockStatistic, BaseParam> pageParam = new PageParam<>(baseParam, StockStatistic.class); |
| | | return R.ok().add(stockStatisticService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(stockStatisticService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping({"/stockStatistic/many/{ids}", "/stockStatistics/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(stockStatisticService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @GetMapping("/stockStatistic/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(stockStatisticService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:save')") |
| | | @OperationLog("Create 日库存统计") |
| | | @PostMapping("/stockStatistic/save") |
| | | public R save(@RequestBody StockStatistic stockStatistic) { |
| | | if (!stockStatisticService.save(stockStatistic)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(stockStatistic); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:update')") |
| | | @OperationLog("Update 日库存统计") |
| | | @PostMapping("/stockStatistic/update") |
| | | public R update(@RequestBody StockStatistic stockStatistic) { |
| | | if (!stockStatisticService.updateById(stockStatistic)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(stockStatistic); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:remove')") |
| | | @OperationLog("Delete 日库存统计") |
| | | @PostMapping("/stockStatistic/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!stockStatisticService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<StockStatistic> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(StockStatistic::getId, condition); |
| | | } |
| | | stockStatisticService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:stockStatistic:list')") |
| | | @PostMapping("/stockStatistic/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(stockStatisticService.list(), StockStatistic.class), response); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "InStockNum", description = "日入库统计") |
| | | public class InStockNum implements Serializable { |
| | | |
| | | public static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty("物料名称") |
| | | private String maktx; |
| | | |
| | | @ApiModelProperty("物料编码") |
| | | private String matnrCode; |
| | | |
| | | @ApiModelProperty("数量") |
| | | private Double anfme; |
| | | |
| | | @ApiModelProperty("单位") |
| | | private String unit; |
| | | |
| | | @ApiModelProperty("批次") |
| | | private String batch; |
| | | |
| | | @ApiModelProperty("日期") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd") |
| | | private Date dayTime; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.vincent.rsf.framework.common.DateUtils; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.WarehouseAreasService; |
| | | import com.vincent.rsf.server.system.constant.DictTypeCode; |
| | |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public Double getReviseQty() { |
| | | return this.anfme; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | |
| | | } |
| | | } |
| | | |
| | | public Integer getDeadTime() { |
| | | if (null == this.createTime){ return null; } |
| | | return DateUtils.diff(createTime, new Date()); |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "LocItemDead", description = "库存停滞") |
| | | public class LocItemDead { |
| | | |
| | | |
| | | } |
| | |
| | | public String getType$(){ |
| | | if (null == this.type){ return null; } |
| | | switch (this.type){ |
| | | case 0: |
| | | case 1: |
| | | return " 库存调整"; |
| | | case 2: |
| | | return " 盘点调整"; |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("view_stock_statistic") |
| | | public class StockStatistic implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private String dayTime; |
| | | |
| | | /** |
| | | * 任务类型 |
| | | */ |
| | | @ApiModelProperty(value= "任务类型") |
| | | private Integer taskType; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
| | | @ApiModelProperty(value= "任务状态") |
| | | private Integer taskStatus; |
| | | |
| | | /** |
| | | * 物料名称 |
| | | */ |
| | | @ApiModelProperty(value= "物料名称") |
| | | private String maktx; |
| | | |
| | | /** |
| | | * 物料编码 |
| | | */ |
| | | @ApiModelProperty(value= "物料编码") |
| | | private String matnrCode; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private Long count; |
| | | |
| | | /** |
| | | * 库存批次 |
| | | */ |
| | | @ApiModelProperty(value= "库存批次") |
| | | private String batch; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | private Double anfme; |
| | | |
| | | /** |
| | | * 库存单位 |
| | | */ |
| | | @ApiModelProperty(value= "库存单位") |
| | | private String unit; |
| | | |
| | | public StockStatistic() {} |
| | | |
| | | public StockStatistic(Long id,String dayTime,Integer taskType,Integer taskStatus,String maktx,String matnrCode,Long count,String batch,Double anfme,String unit) { |
| | | this.id = id; |
| | | this.dayTime = dayTime; |
| | | this.taskType = taskType; |
| | | this.taskStatus = taskStatus; |
| | | this.maktx = maktx; |
| | | this.matnrCode = matnrCode; |
| | | this.count = count; |
| | | this.batch = batch; |
| | | this.anfme = anfme; |
| | | this.unit = unit; |
| | | } |
| | | |
| | | // StockStatistic stockStatistic = new StockStatistic( |
| | | // null, // ID[非空] |
| | | // null, // |
| | | // null, // 任务类型 |
| | | // null, // 任务状态 |
| | | // null, // 物料名称 |
| | | // null, // 物料编码 |
| | | // null, // [非空] |
| | | // null, // 库存批次 |
| | | // null, // |
| | | // null // 库存单位 |
| | | // ); |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | | return false; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.vincent.rsf.server.manager.entity.StockStatistic; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface StockStatisticMapper extends BaseMapper<StockStatistic> { |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.manager.entity.StockStatistic; |
| | | |
| | | public interface StockStatisticService extends IService<StockStatistic> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.exception.BusinessException; |
| | | import com.vincent.rsf.server.manager.entity.DeliveryItem; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.DeliveryMapper; |
| | | import com.vincent.rsf.server.manager.entity.Delivery; |
| | |
| | | throw new BusinessException("数据错误:单据信息不存在!!"); |
| | | } |
| | | deliveries.forEach(delivery -> { |
| | | if (delivery.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val)){ |
| | | if (delivery.getExceStatus().equals(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val)){ |
| | | if (!this.removeById(delivery.getId())) { |
| | | throw new CoolException("主单删除失败!!"); |
| | | } |
| | | if (!deliveryItemService.removeById(delivery.getId())) { |
| | | if (!deliveryItemService.remove(new LambdaQueryWrapper<DeliveryItem>().eq(DeliveryItem::getDeliveryId,delivery.getId()))) { |
| | | throw new CoolException("单据明细删除失败!1"); |
| | | } |
| | | } else { |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.ReviseLogItemParams; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLog; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.mapper.ReviseLogItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.ReviseLogItem; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.ReviseLogItemService; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.ReviseLogService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("reviseLogItemService") |
| | | public class ReviseLogItemServiceImpl extends ServiceImpl<ReviseLogItemMapper, ReviseLogItem> implements ReviseLogItemService { |
| | |
| | | private LocItemService locItemService; |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private ReviseLogItemService reviseLogItemService; |
| | | @Autowired |
| | | private LocReviseService locReviseService; |
| | | |
| | | |
| | | /** |
| | | * 保存库存调整历史单明细 |
| | | * |
| | | * @param reviseLogItem |
| | | * @return |
| | | */ |
| | |
| | | if (Objects.isNull(reviseLog)) { |
| | | throw new RuntimeException("库存历史单据不存在!!"); |
| | | } |
| | | Loc locItem = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getCode, reviseLog.getLocCode())); |
| | | if (Objects.isNull(locItem)) { |
| | | if (Objects.isNull(loc)) { |
| | | throw new RuntimeException("库位库存不存在!!"); |
| | | } |
| | | List<ReviseLogItem> items = reviseLogItem.getItems(); |
| | | |
| | | this.remove(new LambdaQueryWrapper<ReviseLogItem>() |
| | | .eq(ReviseLogItem::getLocId, loc.getId())); |
| | | |
| | | items.forEach(item -> { |
| | | ReviseLogItem logItem = new ReviseLogItem(); |
| | | BeanUtils.copyProperties(item, logItem); |
| | | logItem.setReviseLogId(reviseLogItem.getReviseLogId()) |
| | | .setUpdateBy(userId) |
| | | .setCreateBy(userId) |
| | | .setLocId(locItem.getId()) |
| | | .setLocCode(locItem.getCode()); |
| | | .setLocId(loc.getId()) |
| | | .setLocCode(loc.getCode()); |
| | | if (Objects.isNull(item.getAnfme())) { |
| | | item.setAnfme(0.0); |
| | | logItem.setAnfme(0.0); |
| | | } |
| | | if (!this.save(logItem)) { |
| | | if (!this.saveOrUpdate(logItem)) { |
| | | throw new RuntimeException("库存明细调整失败"); |
| | | } |
| | | |
| | | LocItem one = locItemService.getOne(new LambdaQueryWrapper<LocItem>() |
| | | .eq(LocItem::getMatnrId, logItem.getMatnrId()) |
| | | .eq(LocItem::getBatch, logItem.getBatch()) |
| | | .eq(LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | .eq(StringUtils.isNotBlank(logItem.getBatch()), LocItem::getBatch, logItem.getBatch()) |
| | | .eq(StringUtils.isNotBlank(logItem.getFieldsIndex()), LocItem::getFieldsIndex, logItem.getFieldsIndex()) |
| | | .eq(LocItem::getLocCode, logItem.getLocCode())); |
| | | if (Objects.isNull(one)) { |
| | | throw new RuntimeException("库存明细不存在!!"); |
| | | LocItem locDetl = new LocItem(); |
| | | BeanUtils.copyProperties(logItem, locDetl); |
| | | locDetl.setLocId(loc.getId()) |
| | | .setLocCode(loc.getCode()) |
| | | .setAnfme(logItem.getReviseQty()) |
| | | .setUpdateBy(userId) |
| | | .setId(null) |
| | | .setCreateBy(userId); |
| | | if (!locItemService.save(locDetl)) { |
| | | throw new CoolException("库存明细保存失败!!"); |
| | | } |
| | | |
| | | } else { |
| | | one.setAnfme(logItem.getReviseQty()); |
| | | |
| | | if (!locItemService.updateById(one)) { |
| | | throw new RuntimeException("库存明细修改失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | List<ReviseLog> list = reviseLogService.list(new LambdaQueryWrapper<ReviseLog>().eq(ReviseLog::getReviseId, reviseLog.getReviseId())); |
| | | if (Objects.isNull(list)) { |
| | | throw new RuntimeException("数据错误:库存调整单不存在!!"); |
| | | } |
| | | List<Long> reviseIds = list.stream().map(ReviseLog::getId).collect(Collectors.toList()); |
| | | List<ReviseLogItem> logItems = reviseLogItemService.list(new LambdaQueryWrapper<ReviseLogItem>() |
| | | .in(ReviseLogItem::getReviseLogId, reviseIds)); |
| | | |
| | | Double anfems = logItems.stream().mapToDouble(ReviseLogItem::getAnfme).sum(); |
| | | Double reviseQty = logItems.stream().mapToDouble(ReviseLogItem::getReviseQty).sum(); |
| | | |
| | | if (!locReviseService.update(new LambdaUpdateWrapper<LocRevise>() |
| | | .eq(LocRevise::getId, reviseLog.getReviseId()) |
| | | .set(LocRevise::getAnfme, anfems) |
| | | .set(LocRevise::getReviseQty, reviseQty))) { |
| | | throw new RuntimeException("库存调整单修改失败!!"); |
| | | } |
| | | return items; |
| | | } |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.vincent.rsf.server.manager.mapper.StockStatisticMapper; |
| | | import com.vincent.rsf.server.manager.entity.StockStatistic; |
| | | import com.vincent.rsf.server.manager.service.StockStatisticService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("stockStatisticService") |
| | | public class StockStatisticServiceImpl extends ServiceImpl<StockStatisticMapper, StockStatistic> implements StockStatisticService { |
| | | |
| | | } |
New file |
| | |
| | | -- save stockStatistic record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.stockStatistic', '0', '/manager/stockStatistic', 'stockStatistic', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 日库存统计', '', '1', 'manager:stockStatistic:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 日库存统计', '', '1', 'manager:stockStatistic:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 日库存统计', '', '1', 'manager:stockStatistic:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 日库存统计', '', '1', 'manager:stockStatistic:remove', '3', '1', '1'); |
| | | |
| | | -- locale menu name |
| | | stockStatistic: 'StockStatistic', |
| | | |
| | | -- locale field |
| | | stockStatistic: { |
| | | id: "id", |
| | | dayTime: "dayTime", |
| | | taskType: "taskType", |
| | | taskStatus: "taskStatus", |
| | | maktx: "maktx", |
| | | matnrCode: "matnrCode", |
| | | count: "count", |
| | | batch: "batch", |
| | | anfme: "anfme", |
| | | unit: "unit", |
| | | }, |
| | | |
| | | -- ResourceContent |
| | | import stockStatistic from './stockStatistic'; |
| | | |
| | | case 'stockStatistic': |
| | | return stockStatistic; |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vincent.rsf.server.manager.mapper.StockStatisticMapper"> |
| | | |
| | | </mapper> |