8/20 工位绑定单据类型
parent
5e1d1e51e2
commit
1bb1291753
@ -0,0 +1,57 @@
|
|||||||
|
package com.glxp.api.controller.basic;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.controller.BaseController;
|
||||||
|
import com.glxp.api.req.basic.WorkBindBusTypeRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.basic.UserWorkResponse;
|
||||||
|
import com.glxp.api.res.basic.WorkBindWorkResponse;
|
||||||
|
import com.glxp.api.service.basic.SysWorkplaceDocumentService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (SysWorkplaceDocument)表控制层
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-08-20 16:58:57
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class SysWorkplaceDocumentController extends BaseController {
|
||||||
|
/**
|
||||||
|
* 服务对象
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private SysWorkplaceDocumentService sysWorkplaceDocumentService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/udiwms/sysWorkplace/getWorkBindBusTypes")
|
||||||
|
public BaseResponse getUserBindWork(WorkBindBusTypeRequest request){
|
||||||
|
List<WorkBindWorkResponse> page = sysWorkplaceDocumentService.filterList(request);
|
||||||
|
PageInfo<WorkBindWorkResponse> pageInfo = new PageInfo<>(page);
|
||||||
|
PageSimpleResponse<WorkBindWorkResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(page);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/udiwms/sysWorkplace/workBindBusType")
|
||||||
|
public BaseResponse workBindBusType(@RequestBody WorkBindBusTypeRequest request){
|
||||||
|
Long userId = this.getUserId();
|
||||||
|
Boolean save = sysWorkplaceDocumentService.bindBusType(request,userId);
|
||||||
|
if (!save){
|
||||||
|
return ResultVOUtils.error("该工位已经绑定该单据类型");
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success("绑定成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.glxp.api.dao.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.dao.BaseMapperPlus;
|
||||||
|
import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity;
|
||||||
|
import com.glxp.api.req.basic.WorkBindBusTypeRequest;
|
||||||
|
import com.glxp.api.res.basic.WorkBindWorkResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (SysWorkplaceDocument)表数据库访问层
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-08-20 16:58:57
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysWorkplaceDocumentDao extends BaseMapperPlus<SysWorkplaceDocumentDao, SysWorkplaceDocumentEntity, SysWorkplaceDocumentEntity>{
|
||||||
|
|
||||||
|
List<WorkBindWorkResponse> filterList(WorkBindBusTypeRequest request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
|||||||
|
package com.glxp.api.entity.basic;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (SysWorkplaceDocument)表实体类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-08-20 16:58:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName(value = "sys_workplace_document")
|
||||||
|
public class SysWorkplaceDocumentEntity {
|
||||||
|
//主键id
|
||||||
|
@TableField(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
//工位编码
|
||||||
|
@TableField(value = "workplaceCode")
|
||||||
|
private Long workplacecode;
|
||||||
|
|
||||||
|
|
||||||
|
//单据编码
|
||||||
|
@TableField(value = "documentTypeCode")
|
||||||
|
private String documentTypeCode;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "createTime")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateTime")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(value = "`createUser`")
|
||||||
|
private String createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
@TableField(value = "updateUser")
|
||||||
|
private String updateUser;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.glxp.api.req.basic;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.ListPageRequest;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2024/8/14 18:55
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WorkBindBusTypeRequest extends ListPageRequest {
|
||||||
|
private List<String> documentTypeCode;
|
||||||
|
private String workplaceCode;
|
||||||
|
private String busKey;
|
||||||
|
private String workKey;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.glxp.api.res.basic;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : zhangsan
|
||||||
|
* @date : 2024/8/20 17:57
|
||||||
|
* @modyified By :
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WorkBindWorkResponse {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
|
private Long workplaceId;
|
||||||
|
/**
|
||||||
|
* 工位名称
|
||||||
|
*/
|
||||||
|
private String workplaceName;
|
||||||
|
/**
|
||||||
|
* 所属仓库
|
||||||
|
*/
|
||||||
|
private Integer invCode;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remake;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String chargeUser;
|
||||||
|
|
||||||
|
|
||||||
|
private Long constituencies;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Integer operationType;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer checkInsert;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer warnType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String unitTittle;
|
||||||
|
|
||||||
|
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
|
||||||
|
private String invName;
|
||||||
|
|
||||||
|
|
||||||
|
private String labelId;
|
||||||
|
private Integer corpType;
|
||||||
|
private String remark;
|
||||||
|
private String code;
|
||||||
|
private String name;
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package com.glxp.api.service.basic;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.glxp.api.dao.basic.SysWorkplaceDocumentDao;
|
||||||
|
import com.glxp.api.entity.basic.BasicCollectUserEntity;
|
||||||
|
import com.glxp.api.entity.basic.SysWorkplaceDocumentEntity;
|
||||||
|
import com.glxp.api.req.basic.WorkBindBusTypeRequest;
|
||||||
|
import com.glxp.api.res.basic.WorkBindWorkResponse;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (SysWorkplaceDocument)表服务接口
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2024-08-20 16:58:57
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysWorkplaceDocumentService extends ServiceImpl<SysWorkplaceDocumentDao, SysWorkplaceDocumentEntity> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysWorkplaceDocumentDao sysWorkplaceDocumentDao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<WorkBindWorkResponse> filterList(WorkBindBusTypeRequest request) {
|
||||||
|
List<WorkBindWorkResponse> list = sysWorkplaceDocumentDao.filterList(request);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean bindBusType(WorkBindBusTypeRequest request,Long userId) {
|
||||||
|
List<String> documentTypeCodes = request.getDocumentTypeCode();
|
||||||
|
for (String documentTypeCode: documentTypeCodes) {
|
||||||
|
SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentDao.selectOne(new LambdaQueryWrapper<SysWorkplaceDocumentEntity>()
|
||||||
|
.eq(SysWorkplaceDocumentEntity::getWorkplacecode, request.getWorkplaceCode())
|
||||||
|
.eq(SysWorkplaceDocumentEntity::getDocumentTypeCode,documentTypeCode));
|
||||||
|
if (sysWorkplaceDocumentEntity != null){
|
||||||
|
//该用户已经绑定改工位
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String documentTypeCode: documentTypeCodes) {
|
||||||
|
SysWorkplaceDocumentEntity entity = new SysWorkplaceDocumentEntity();
|
||||||
|
entity.setId(IdUtil.getSnowflakeNextId());
|
||||||
|
entity.setWorkplacecode(Long.valueOf(request.getWorkplaceCode()));
|
||||||
|
entity.setDocumentTypeCode(documentTypeCode);
|
||||||
|
entity.setCreateTime(new Date());
|
||||||
|
entity.setUpdateTime(new Date());
|
||||||
|
entity.setUpdateUser(userId.toString());
|
||||||
|
entity.setCreateUser(userId.toString());
|
||||||
|
int insert = sysWorkplaceDocumentDao.insert(entity);
|
||||||
|
if (insert == 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
|||||||
|
<?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.glxp.api.dao.basic.SysWorkplaceDocumentDao">
|
||||||
|
<select id="filterList" resultType="com.glxp.api.res.basic.WorkBindWorkResponse">
|
||||||
|
select
|
||||||
|
swd.id,sw.workplaceName,sw.invCode,sw.workplaceId,sw.constituencies,sw.operationType,sw.checkInsert,sw.warnType,sw.unitTittle,sw.corpType,
|
||||||
|
bcb.code,bcb.name,bcb.remark as remark,sw.createTime as createTime
|
||||||
|
from sys_workplace_document swd
|
||||||
|
left join basic_collect_bustype bcb on swd.documentTypeCode = bcb.code
|
||||||
|
left join sys_workplace sw on swd.workplaceCode = sw.workplaceId
|
||||||
|
<where>
|
||||||
|
<if test=" workplaceCode != null and workplaceCode != ''">
|
||||||
|
AND swd.workplaceCode = #{workplaceCode}
|
||||||
|
</if>
|
||||||
|
<if test="busKey != null and busKey != ''">
|
||||||
|
AND (bcb.code like concat('%', #{busKey}, '%')
|
||||||
|
or bcb.name like concat('%', #{busKey}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue