Merge remote-tracking branch 'origin/master'
commit
131438ed45
@ -0,0 +1,32 @@
|
||||
DROP TABLE IF EXISTS `stack_code`;
|
||||
CREATE TABLE `stack_code` (
|
||||
`id` int NOT NULL,
|
||||
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||||
`orderIdFk` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for stack_order
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `stack_order`;
|
||||
CREATE TABLE `stack_order` (
|
||||
`id` int NOT NULL,
|
||||
`orderId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||||
`exportStatus` tinyint NULL DEFAULT NULL,
|
||||
`status` tinyint NULL DEFAULT NULL,
|
||||
`createTime` datetime(0) NULL DEFAULT NULL,
|
||||
`updateTime` datetime(0) NULL DEFAULT NULL,
|
||||
`customerId` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@ -0,0 +1,98 @@
|
||||
package com.glxp.udi.admin.controller.product;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.glxp.udi.admin.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.udi.admin.common.res.BaseResponse;
|
||||
import com.glxp.udi.admin.req.info.DeleteRequest;
|
||||
import com.glxp.udi.admin.req.product.StackUploadRequest;
|
||||
import com.glxp.udi.admin.service.auth.CustomerService;
|
||||
import com.glxp.udi.admin.common.util.ResultVOUtils;
|
||||
import com.glxp.udi.admin.entity.product.StackOrder;
|
||||
import com.glxp.udi.admin.req.product.StackOrderFilterRequest;
|
||||
import com.glxp.udi.admin.res.PageSimpleResponse;
|
||||
import com.glxp.udi.admin.service.product.StackCodeService;
|
||||
import com.glxp.udi.admin.service.product.StackOrderService;
|
||||
import com.glxp.udi.admin.common.enums.ResultEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class StackOrderController {
|
||||
|
||||
@Resource
|
||||
StackOrderService stackOrderService;
|
||||
@Resource
|
||||
StackCodeService stackCodeService;
|
||||
@Resource
|
||||
private CustomerService customerService;
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@GetMapping("/udims/stack/order/filter")
|
||||
public BaseResponse filterOrder(StackOrderFilterRequest stackOrderFilterRequest, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
stackOrderFilterRequest.setCustomerId(customerService.getCustomerId() + "");
|
||||
IPage<StackOrder> page = stackOrderService.filterList(stackOrderFilterRequest);
|
||||
PageSimpleResponse<StackOrder> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(page.getTotal());
|
||||
pageSimpleResponse.setList(page.getRecords());
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udims/stack/order/update")
|
||||
public BaseResponse updateStack(@RequestBody StackOrder stackOrderEntity, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
stackOrderService.updateOrder(stackOrderEntity);
|
||||
return ResultVOUtils.success("更新成功");
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udims/stack/order/delete")
|
||||
public BaseResponse deleteStack(@RequestBody DeleteRequest deleteRequest, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
stackOrderService.deleteById(Integer.parseInt(deleteRequest.getId()));
|
||||
return ResultVOUtils.success("更新成功");
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("")
|
||||
@PostMapping("/udims/stack/order/upload")
|
||||
public BaseResponse uploadStack(@RequestBody StackUploadRequest stackUploadRequest, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
StackOrder stackOrderEntity = stackUploadRequest.getStackOrderEntity();
|
||||
if (stackOrderEntity == null) {
|
||||
return ResultVOUtils.error(500, "上传数据不能为空!");
|
||||
}
|
||||
if (stackOrderService.isExit(stackOrderEntity.getOrderId())) {
|
||||
return ResultVOUtils.error(500, "垛号已存在,请勿重复提交!");
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(stackUploadRequest.getStackCodeEntityList())) {
|
||||
return ResultVOUtils.error(500, "提交失败,该垛号未关联条码!");
|
||||
}
|
||||
stackOrderEntity.setCustomerId(customerService.getCustomerId() + "");
|
||||
|
||||
stackOrderService.insertOrder(stackOrderEntity);
|
||||
stackCodeService.batchInsert(stackUploadRequest.getStackCodeEntityList());
|
||||
return ResultVOUtils.success("上传成功!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.glxp.udi.admin.dao.product;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.udi.admin.entity.product.StackCode;
|
||||
|
||||
public interface StackCodeDao extends BaseMapper<StackCode> {
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.glxp.udi.admin.dao.product;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.udi.admin.entity.product.StackOrder;
|
||||
|
||||
public interface StackOrderDao extends BaseMapper<StackOrder> {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.glxp.udi.admin.entity.product;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 建垛条码
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class StackCode {
|
||||
private Integer id;
|
||||
private String code;
|
||||
private String orderIdFk;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.glxp.udi.admin.entity.product;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 建垛单据
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class StackOrder {
|
||||
|
||||
private Integer id;
|
||||
private String orderId;
|
||||
private String name;
|
||||
private Integer exportStatus;
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private String customerId;
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.glxp.udi.admin.entity.product;
|
||||
|
||||
/**
|
||||
* 生产管理
|
||||
*/
|
@ -0,0 +1,17 @@
|
||||
package com.glxp.udi.admin.req.product;
|
||||
|
||||
import com.glxp.udi.admin.req.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class StackOrderFilterRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
private String orderId;
|
||||
private String name;
|
||||
private Integer exportStatus;
|
||||
private Integer status;
|
||||
private String customerId;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.glxp.udi.admin.req.product;
|
||||
|
||||
import com.glxp.udi.admin.entity.product.StackCode;
|
||||
import com.glxp.udi.admin.entity.product.StackOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StackUploadRequest {
|
||||
private StackOrder stackOrderEntity;
|
||||
private List<StackCode> stackCodeEntityList;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.glxp.udi.admin.service.product;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.glxp.udi.admin.dao.product.StackCodeDao;
|
||||
import com.glxp.udi.admin.entity.product.StackCode;
|
||||
import org.apache.ibatis.session.ExecutorType;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.TransactionIsolationLevel;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StackCodeService {
|
||||
|
||||
|
||||
@Resource
|
||||
SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
|
||||
public void batchInsert(List<StackCode> stackCodeEntityList) {
|
||||
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
|
||||
if (CollUtil.isNotEmpty(stackCodeEntityList)) {
|
||||
StackCodeDao mapper = batchSession.getMapper(StackCodeDao.class);
|
||||
stackCodeEntityList.forEach(stackCodeEntity -> {
|
||||
mapper.insert(stackCodeEntity);
|
||||
});
|
||||
batchSession.commit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.glxp.udi.admin.service.product;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.glxp.udi.admin.dao.product.StackOrderDao;
|
||||
import com.glxp.udi.admin.entity.product.StackOrder;
|
||||
import com.glxp.udi.admin.req.product.StackOrderFilterRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class StackOrderService {
|
||||
|
||||
@Resource
|
||||
StackOrderDao stackOrderDao;
|
||||
|
||||
|
||||
public IPage<StackOrder> filterList(StackOrderFilterRequest stackOrderFilterRequest) {
|
||||
IPage<StackOrder> page = new Page<>(stackOrderFilterRequest.getPage(), stackOrderFilterRequest.getLimit());
|
||||
QueryWrapper<StackOrder> wrapper = new QueryWrapper<>();
|
||||
|
||||
wrapper.eq(stackOrderFilterRequest.getId() != null, "id", stackOrderFilterRequest.getId())
|
||||
.eq(StrUtil.isNotBlank(stackOrderFilterRequest.getOrderId()), "orderId", stackOrderFilterRequest.getOrderId())
|
||||
.eq(stackOrderFilterRequest.getExportStatus() != null, "exportStatus", stackOrderFilterRequest.getExportStatus())
|
||||
.eq(stackOrderFilterRequest.getStatus() != null, "status", stackOrderFilterRequest.getStatus())
|
||||
.orderByDesc("updateTime");
|
||||
return stackOrderDao.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
|
||||
public void updateOrder(StackOrder stackOrderEntity) {
|
||||
stackOrderDao.updateById(stackOrderEntity);
|
||||
}
|
||||
|
||||
public boolean isExit(String orderId) {
|
||||
return stackOrderDao.exists(new QueryWrapper<StackOrder>().eq("orderId", orderId));
|
||||
}
|
||||
|
||||
public void insertOrder(StackOrder stackOrderEntity) {
|
||||
stackOrderDao.insert(stackOrderEntity);
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
stackOrderDao.deleteById(id);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue