fix:备货区组盘
This commit is contained in:
@@ -53,7 +53,7 @@ public class MdPbPapervehicle implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 修改时间
|
* 修改时间
|
||||||
*/
|
*/
|
||||||
private Long update_optid;
|
private String update_optid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改人
|
* 修改人
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.b_lms.bst.ivt.stockingivt.controller;
|
package org.nl.b_lms.bst.ivt.stockingivt.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.TableDataInfo;
|
import org.nl.common.TableDataInfo;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lyd
|
* @author lyd
|
||||||
* @date 2024-02-26
|
* @date 2024-02-26
|
||||||
@@ -29,15 +31,15 @@ public class BstIvtStockingivtController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
@Log("查询备货区点位库存表")
|
@Log("查询备货区点位库存表")
|
||||||
//@SaCheckPermission("@el.check('bstIvtStockingivt:list')")
|
//@SaCheckPermission("@el.check('bstIvtStockingivt:list')")
|
||||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) {
|
||||||
return new ResponseEntity<>(TableDataInfo.build(bstIvtStockingivtService.queryAll(whereJson,page)),HttpStatus.OK);
|
return new ResponseEntity<>(TableDataInfo.build(bstIvtStockingivtService.queryAll(whereJson, page)), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增备货区点位库存表")
|
@Log("新增备货区点位库存表")
|
||||||
//@SaCheckPermission("@el.check('bstIvtStockingivt:add')")
|
//@SaCheckPermission("@el.check('bstIvtStockingivt:add')")
|
||||||
public ResponseEntity
|
public ResponseEntity
|
||||||
<Object> create(@Validated @RequestBody BstIvtStockingivt entity){
|
<Object> create(@Validated @RequestBody BstIvtStockingivt entity) {
|
||||||
bstIvtStockingivtService.create(entity);
|
bstIvtStockingivtService.create(entity);
|
||||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
@@ -45,7 +47,7 @@ public class BstIvtStockingivtController {
|
|||||||
@PutMapping
|
@PutMapping
|
||||||
@Log("修改备货区点位库存表")
|
@Log("修改备货区点位库存表")
|
||||||
//@SaCheckPermission("@el.check('bstIvtStockingivt:edit')")
|
//@SaCheckPermission("@el.check('bstIvtStockingivt:edit')")
|
||||||
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtStockingivt entity){
|
public ResponseEntity<Object> update(@Validated @RequestBody BstIvtStockingivt entity) {
|
||||||
bstIvtStockingivtService.update(entity);
|
bstIvtStockingivtService.update(entity);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
@@ -58,5 +60,12 @@ public class BstIvtStockingivtController {
|
|||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log("操作管芯托盘库存")
|
||||||
|
//@SaCheckPermission("@el.check('bstIvtStockingivt:del')")
|
||||||
|
@PostMapping("operateIvt")
|
||||||
|
public ResponseEntity<Object> operateIvt(@RequestBody JSONObject param) {
|
||||||
|
return new ResponseEntity<>(bstIvtStockingivtService.operateIvt(param), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.b_lms.bst.ivt.stockingivt.service;
|
package org.nl.b_lms.bst.ivt.stockingivt.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
@@ -75,4 +76,6 @@ public interface IBstIvtStockingivtService extends IService<BstIvtStockingivt> {
|
|||||||
* @return /
|
* @return /
|
||||||
*/
|
*/
|
||||||
BstIvtStockingivt getCanMovePointOne(String location, String pointType);
|
BstIvtStockingivt getCanMovePointOne(String location, String pointType);
|
||||||
|
|
||||||
|
JSONObject operateIvt(JSONObject jsonObject) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,16 @@ package org.nl.b_lms.bst.ivt.stockingivt.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.b_lms.bst.ivt.papervehicle.service.IMdPbPapervehicleService;
|
||||||
|
import org.nl.b_lms.bst.ivt.papervehicle.service.dao.MdPbPapervehicle;
|
||||||
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
import org.nl.b_lms.sch.tasks.slitter.constant.SlitterConstant;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
@@ -16,6 +20,7 @@ import org.nl.b_lms.bst.ivt.stockingivt.service.IBstIvtStockingivtService;
|
|||||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.mapper.BstIvtStockingivtMapper;
|
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.mapper.BstIvtStockingivtMapper;
|
||||||
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
import org.nl.b_lms.bst.ivt.stockingivt.service.dao.BstIvtStockingivt;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,8 +28,8 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 服务实现
|
|
||||||
* @author lyd
|
* @author lyd
|
||||||
|
* @description 服务实现
|
||||||
* @date 2024-02-26
|
* @date 2024-02-26
|
||||||
**/
|
**/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -33,9 +38,11 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
private BstIvtStockingivtMapper bstIvtStockingivtMapper;
|
||||||
|
@Autowired
|
||||||
|
private IMdPbPapervehicleService PapervehicleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<BstIvtStockingivt> queryAll(Map whereJson, PageQuery page){
|
public IPage<BstIvtStockingivt> queryAll(Map whereJson, PageQuery page) {
|
||||||
LambdaQueryWrapper<BstIvtStockingivt> lam = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BstIvtStockingivt> lam = new LambdaQueryWrapper<>();
|
||||||
IPage<BstIvtStockingivt> pages = new Page<>(page.getPage() + 1, page.getSize());
|
IPage<BstIvtStockingivt> pages = new Page<>(page.getPage() + 1, page.getSize());
|
||||||
bstIvtStockingivtMapper.selectPage(pages, lam);
|
bstIvtStockingivtMapper.selectPage(pages, lam);
|
||||||
@@ -102,4 +109,54 @@ public class BstIvtStockingivtServiceImpl extends ServiceImpl<BstIvtStockingivtM
|
|||||||
return bstIvtStockingivtMapper.getCanMovePointOne(location, pointType);
|
return bstIvtStockingivtMapper.getCanMovePointOne(location, pointType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JSONObject operateIvt(JSONObject jsonObject) {
|
||||||
|
String vehicle_code = jsonObject.getString("vehicle_code");
|
||||||
|
String row_num = jsonObject.getString("row_num");
|
||||||
|
String material_code = jsonObject.getString("material_code");
|
||||||
|
String material_name = jsonObject.getString("material_name");
|
||||||
|
|
||||||
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||||
|
String nickName = SecurityUtils.getCurrentNickName();
|
||||||
|
String now = DateUtil.now();
|
||||||
|
|
||||||
|
//1-绑定;2-清除
|
||||||
|
String type = jsonObject.getString("type");
|
||||||
|
if (type.equals("1")) {
|
||||||
|
//查询当前载具和排是否存在库存
|
||||||
|
MdPbPapervehicle papervehicle = PapervehicleService.getOne(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||||
|
.eq(MdPbPapervehicle::getRow_num, row_num));
|
||||||
|
if (ObjectUtil.isNotEmpty(papervehicle) && !papervehicle.getMaterial_code().equals(material_code)) {
|
||||||
|
throw new BadRequestException("当前排物料为【" + papervehicle.getMaterial_code() + "】,与绑定的物料不同,如需要请先清除库存,再进行绑定!");
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotEmpty(papervehicle)) {
|
||||||
|
papervehicle.setQty(jsonObject.getBigDecimal("qty"));
|
||||||
|
papervehicle.setUpdate_optid(currentUserId);
|
||||||
|
papervehicle.setUpdate_optname(nickName);
|
||||||
|
papervehicle.setUpdate_time(now);
|
||||||
|
PapervehicleService.updateById(papervehicle);
|
||||||
|
} else {
|
||||||
|
papervehicle = new MdPbPapervehicle();
|
||||||
|
papervehicle.setIvt_id(IdUtil.getSnowflake(1, 1).nextIdStr());
|
||||||
|
papervehicle.setVehicle_code(vehicle_code);
|
||||||
|
papervehicle.setRow_num(row_num);
|
||||||
|
papervehicle.setMaterial_code(material_code);
|
||||||
|
papervehicle.setMaterial_name(material_name);
|
||||||
|
papervehicle.setQty(jsonObject.getBigDecimal("qty"));
|
||||||
|
papervehicle.setUpdate_optid(currentUserId);
|
||||||
|
papervehicle.setUpdate_optname(nickName);
|
||||||
|
papervehicle.setUpdate_time(now);
|
||||||
|
PapervehicleService.save(papervehicle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.equals("2")) {
|
||||||
|
PapervehicleService.remove(new LambdaQueryWrapper<MdPbPapervehicle>().eq(MdPbPapervehicle::getVehicle_code, vehicle_code)
|
||||||
|
.eq(MdPbPapervehicle::getRow_num, row_num));
|
||||||
|
}
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
result.put("status", HttpStatus.OK.value());
|
||||||
|
result.put("message", "操作成功!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user