bug修复
This commit is contained in:
parent
0c0bf6426c
commit
dc48d42b24
|
|
@ -40,8 +40,13 @@ public class TreeNode {
|
|||
@ApiModelProperty(value = "实时库存")
|
||||
private Long storageNum;
|
||||
|
||||
private Long num;
|
||||
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String manageType;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeNode> children = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -347,5 +347,9 @@ public class LeaseApplyInfo extends BaseEntity{
|
|||
*/
|
||||
private List<String> projectIdList;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private String leaseTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,13 @@ public class SelectController {
|
|||
return service.getDeviceTypeTree(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设备类型树")
|
||||
@PostMapping("getDeviceTypeTreeTwo")
|
||||
public AjaxResult getDeviceTypeTreeTwo(@RequestBody SelectDto dto){
|
||||
return service.getDeviceTypeTreeTwo(dto);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "退料设备类型树")
|
||||
@PostMapping("getBackDeviceTypeTree")
|
||||
public AjaxResult getBackDeviceTypeTree(@RequestBody SelectDto dto){
|
||||
|
|
|
|||
|
|
@ -299,4 +299,6 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
List<TypeTreeNode> getBzUseTypeTreeL4(BackApplyInfo bean);
|
||||
|
||||
List<TreeNode> getDeviceTypeTreeTwo(SelectDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ public interface SelectService {
|
|||
*/
|
||||
AjaxResult getDeviceTypeTree(SelectDto dto);
|
||||
|
||||
AjaxResult getDeviceTypeTreeTwo(SelectDto dto);
|
||||
|
||||
AjaxResult getBackDeviceTypeTree(SelectDto dto);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -433,6 +433,24 @@ public class SelectServiceImpl implements SelectService {
|
|||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceTypeTreeTwo(SelectDto dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
List<TreeNode> list = new ArrayList<>();
|
||||
try {
|
||||
list = mapper.getDeviceTypeTreeTwo(dto);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TreeBuild treeBuild = new TreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("单位树/归属部门/所属上级-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getBackDeviceTypeTree(SelectDto dto) {
|
||||
List<TypeTreeNode> groupList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.bonus.material.ma.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.domain.PutInStorageBean;
|
||||
import com.bonus.material.ma.domain.SavePutInfoDto;
|
||||
import com.bonus.material.ma.domain.SupplierInfo;
|
||||
import com.bonus.material.ma.service.WarehousingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.java.Log;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 入库盘点
|
||||
*/
|
||||
@Api(tags = " 入库盘点")
|
||||
@RestController
|
||||
@RequestMapping("/warehousing")
|
||||
@Slf4j
|
||||
public class WarehousingController extends BaseController {
|
||||
@Autowired
|
||||
private WarehousingService warehousingService;
|
||||
|
||||
/**
|
||||
* 查询入库盘点列表
|
||||
*/
|
||||
@ApiOperation(value = "获取入库盘点列表")
|
||||
@GetMapping("/getList")
|
||||
public TableDataInfo getList(PutInStorageBean bean) {
|
||||
startPage();
|
||||
List<PutInStorageBean> list = warehousingService.getList(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询供应商管理列表
|
||||
*/
|
||||
@ApiOperation(value = "查询供应商管理列表")
|
||||
@GetMapping("/supplierInfoList")
|
||||
public TableDataInfo supplierInfoList(SupplierInfo maSupplierInfo)
|
||||
{
|
||||
List<SupplierInfo> list = warehousingService.selectMaSupplierInfoList(maSupplierInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增入库盘点")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/addList")
|
||||
public AjaxResult savePutInfo(@RequestBody SavePutInfoDto dto) {
|
||||
return warehousingService.savePutInfo(dto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据入库单号查看详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "根据入库单号查看详情")
|
||||
@GetMapping("/getDetail")
|
||||
public TableDataInfo getDetail(PutInStorageBean bean) {
|
||||
startPage();
|
||||
List<PutInStorageBean> list = warehousingService.getDetails(bean);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
package com.bonus.material.ma.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 表单类型表单集合
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 17:53
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("表单类型表单集合")
|
||||
public class MachIneDto {
|
||||
|
||||
/**
|
||||
* 判断为数量还是编号,true为编号
|
||||
*/
|
||||
@ApiModelProperty(value = "判断为数量还是编号,true为编号")
|
||||
private Boolean isCode;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
/** 机具ID */
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer infoId;
|
||||
|
||||
/** 设备编号 */
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private String maCode;
|
||||
|
||||
/** 二维码 */
|
||||
@ApiModelProperty(value = "二维码")
|
||||
private String qrCode;
|
||||
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 主信息
|
||||
*/
|
||||
@ApiModelProperty(value = "主信息")
|
||||
private Integer info;
|
||||
|
||||
/** 出厂编码 */
|
||||
@ApiModelProperty(value = "出厂编码")
|
||||
private String outFacCode;
|
||||
|
||||
/** 生产厂家 */
|
||||
@ApiModelProperty(value = "生产厂家")
|
||||
private String maVender;
|
||||
|
||||
/** 本次检修日期 */
|
||||
@ApiModelProperty(value = "本次检修日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date thisCheckTime;
|
||||
|
||||
/** 下次检修日期 */
|
||||
@ApiModelProperty(value = "下次检修日期")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date nextCheckTime;
|
||||
|
||||
/** 单价 */
|
||||
@ApiModelProperty(value = "单价")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
/** 编码 */
|
||||
@ApiModelProperty(value = "编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 入库形式
|
||||
*/
|
||||
@ApiModelProperty(value = "入库形式")
|
||||
private String putInType;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String proId;
|
||||
|
||||
/**
|
||||
* 表单备注
|
||||
*/
|
||||
@ApiModelProperty(value = "表单备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "上方页面入库数量")
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer totalNum;
|
||||
|
||||
/**
|
||||
* 检验人
|
||||
*/
|
||||
@ApiModelProperty(value = "检验人")
|
||||
private String checkMan;
|
||||
|
||||
/**
|
||||
* 入库数量
|
||||
*/
|
||||
@ApiModelProperty(value = "表单集合入库数量")
|
||||
private Integer putInStoreNum;
|
||||
|
||||
}
|
||||
|
|
@ -329,4 +329,6 @@ public class Machine extends BaseEntity {
|
|||
private int devType;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer manageType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,101 @@
|
|||
package com.bonus.material.ma.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description 入库盘点
|
||||
*/
|
||||
@Data
|
||||
public class PutInStorageBean extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
@ApiModelProperty(value = "id")
|
||||
private Integer id;
|
||||
|
||||
/** 入库形式 */
|
||||
@ApiModelProperty(value = "入库形式")
|
||||
private String putInType;
|
||||
|
||||
/** 关键字 */
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
/** 入库数量 */
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
private BigDecimal num;
|
||||
|
||||
/** 创建者 */
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Integer creator;
|
||||
|
||||
/** 入库人 */
|
||||
@ApiModelProperty(value = "入库人")
|
||||
private String modelName;
|
||||
|
||||
/** 盘点入库单号 */
|
||||
@ApiModelProperty(value = "盘点入库单号")
|
||||
private String kindName;
|
||||
|
||||
/** 设备编号 */
|
||||
@ApiModelProperty(value = "设备编号")
|
||||
private String maCode;
|
||||
|
||||
/** 单位ID */
|
||||
@ApiModelProperty(value = "单位ID")
|
||||
private String unitId;
|
||||
|
||||
/** 单位名称 */
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
/** 工程ID */
|
||||
@ApiModelProperty(value = "工程ID")
|
||||
private String projectId;
|
||||
|
||||
/** 工程名称 */
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
/** 创建日期 */
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private String createDate;
|
||||
|
||||
/** 备注 */
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/** 主信息 */
|
||||
@ApiModelProperty(value = "主信息")
|
||||
private Integer info;
|
||||
|
||||
/** 库房 */
|
||||
@ApiModelProperty(value = "库房")
|
||||
private Integer ram;
|
||||
|
||||
/** 设备工器具类型 */
|
||||
@ApiModelProperty(value = "设备工器具类型")
|
||||
private Integer type;
|
||||
|
||||
/** 设备工器具类型名称 */
|
||||
@ApiModelProperty(value = "设备工器具类型名称")
|
||||
private String typeName;
|
||||
|
||||
/** 规格型号 */
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
/** 设备主键 */
|
||||
@ApiModelProperty(value = "设备主键")
|
||||
private Integer machine;
|
||||
|
||||
|
||||
private String code;
|
||||
|
||||
private Integer infoId;
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
package com.bonus.material.ma.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新增盘点入库接口实体类dto
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 14:22
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel("新增盘点入库接口实体类dto")
|
||||
public class SavePutInfoDto extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 判断为数量还是编号,true为编号
|
||||
*/
|
||||
@ApiModelProperty(value = "判断为数量还是编号,true为编号")
|
||||
private Boolean isCode;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
@ApiModelProperty(value = "类型id")
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 主信息
|
||||
*/
|
||||
@ApiModelProperty(value = "主信息")
|
||||
private Integer info;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@ApiModelProperty(value = "数量")
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 库房
|
||||
*/
|
||||
@ApiModelProperty(value = "库房")
|
||||
private Integer ram;
|
||||
|
||||
/**
|
||||
* 设备工器具类型
|
||||
*/
|
||||
@ApiModelProperty(value = "设备工器具类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 设备主键
|
||||
*/
|
||||
@ApiModelProperty(value = "设备主键")
|
||||
private Integer machine;
|
||||
|
||||
/**
|
||||
* 入库形式
|
||||
*/
|
||||
@ApiModelProperty(value = "入库形式")
|
||||
private String putInType;
|
||||
|
||||
/**
|
||||
* 盘点入库单号
|
||||
*/
|
||||
@ApiModelProperty(value = "盘点入库单号")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 单位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitId;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String proId;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
@ApiModelProperty(value = "创建者")
|
||||
private Long creator;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createDate;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
/**
|
||||
* 检验人
|
||||
*/
|
||||
@ApiModelProperty(value = "检验人")
|
||||
private String checkMan;
|
||||
|
||||
/**
|
||||
* 表单类型表单集合
|
||||
*/
|
||||
private List<MachIneDto> machIneDtoList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.bonus.material.ma.domain.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 返回异常枚举类
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/29 14:43
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExceptionEnum {
|
||||
|
||||
PARAM_NULL(1001, "参数为空"),
|
||||
IOT_CODE_DUPLICATE(1002, "设备编号重复"),
|
||||
IOT_TO_DELETE(1003, "该iot设备绑定相关类型设备,无法删除"),
|
||||
SUCCESS(200, "操作成功"),
|
||||
SAVE_TO_DATABASE(500, "新增保存失败,请联系管理员!!!"),
|
||||
DELETE_TO_DATABASE(500, "删除失败,请联系管理员!!!"),
|
||||
BIND_TO_DATABASE(500, "绑定失败,请联系管理员!!!"),
|
||||
UN_BIND_TO_DATABASE(500, "解绑失败,请联系管理员!!!"),
|
||||
UPDATE_TO_DATABASE(500, "修改失败,请联系管理员!!!"),
|
||||
|
||||
RETURN_DATA_IS_EMPTY(501, "返回数据为空!!"),
|
||||
IOT_ENCODING_ERROR(502, "输入的IOT编码有误,请输入正确的编码!!!");
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.ma.domain.vo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 后端生产随机编码通用方法(格式:今日年月日日期-随机4位编码 20240328-0001)
|
||||
* @Author ma_sh
|
||||
* @create 2024/3/28 17:42
|
||||
*/
|
||||
public class FieldGenerator {
|
||||
|
||||
public static String generateField() {
|
||||
LocalDate today = LocalDate.now();
|
||||
String currentDate = today.format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
// 生成UUID并取后4位,转换为纯数字类型
|
||||
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
String uuidLast4Digits = uuid.substring(uuid.length() - 7);
|
||||
int uuidLast4DigitsNumeric = Integer.parseInt(uuidLast4Digits, 16);
|
||||
return currentDate + "-" + String.format("%07d", uuidLast4DigitsNumeric % 10000);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.bonus.material.ma.domain.vo;
|
||||
|
||||
/**
|
||||
* @Author:梁超
|
||||
* @date:2024/1/30 - 14:09
|
||||
*/
|
||||
public class GlobalContants {
|
||||
public static final int NUM1 = 9;
|
||||
public static final int NUM2 = 100;
|
||||
public static final int NUM3 = 99;
|
||||
public static final int NUM4 = 1000;
|
||||
|
||||
public static final int NUM5 = 68;
|
||||
public static final int NUM6 = 24;
|
||||
}
|
||||
|
|
@ -204,4 +204,12 @@ public interface MachineMapper
|
|||
List<Machine> getElectronicLabelByWsMaInfo(Machine machine);
|
||||
|
||||
List<Machine> getHisByCodeNewByWsMaInfo(Machine machine);
|
||||
|
||||
LeaseApplyInfo getLeaseParentId(Machine machine);
|
||||
|
||||
LeaseApplyInfo getLeaseUnitAndProject(LeaseApplyInfo leaseInfo);
|
||||
|
||||
LeaseApplyInfo getBackParentId(Machine machine);
|
||||
|
||||
LeaseApplyInfo getBackUnitAndProject(LeaseApplyInfo leaseInfoBack);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package com.bonus.material.ma.mapper;
|
||||
|
||||
|
||||
import com.bonus.material.ma.domain.MachIneDto;
|
||||
import com.bonus.material.ma.domain.PutInStorageBean;
|
||||
import com.bonus.material.ma.domain.SupplierInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 入库盘点
|
||||
* @author hay
|
||||
* @date 2024/3/27 13:33
|
||||
*/
|
||||
@Mapper
|
||||
public interface WarehousingMapper {
|
||||
|
||||
/**
|
||||
* 查询入库盘点列表
|
||||
* @param bean
|
||||
* @return 结果
|
||||
*/
|
||||
List<PutInStorageBean> getList(PutInStorageBean bean);
|
||||
|
||||
|
||||
List<SupplierInfo> selectMaSupplierInfoList(SupplierInfo maSupplierInfo);
|
||||
|
||||
|
||||
int selectByMaCode(String maCode);
|
||||
|
||||
/**
|
||||
* 插入ma_type_put_in_storage_info表
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
int saveInfo(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 新增ma_machine表
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
int insertMachine(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 新增ma_type_put_in_storage_details表
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
Integer saveDetails(MachIneDto machIneDto);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* @param nowDate
|
||||
* @return
|
||||
*/
|
||||
int selectTaskNumByMonth(@Param("date") Date nowDate);
|
||||
|
||||
/**
|
||||
* 更新matype表中num数量
|
||||
* @param typeId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
int updateMaType(@Param("typeId") String typeId, @Param("num") Integer num);
|
||||
|
||||
List<PutInStorageBean> getDetails(PutInStorageBean bean);
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.bonus.material.ma.service;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.ma.domain.PutInStorageBean;
|
||||
import com.bonus.material.ma.domain.SavePutInfoDto;
|
||||
import com.bonus.material.ma.domain.SupplierInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 入库盘点
|
||||
* @author hay
|
||||
* @date 2024/3/27 13:31
|
||||
*/
|
||||
public interface WarehousingService {
|
||||
|
||||
/**
|
||||
* 查询入库盘点列表
|
||||
* @param bean
|
||||
* @return 结果
|
||||
*/
|
||||
List<PutInStorageBean> getList(PutInStorageBean bean);
|
||||
|
||||
List<SupplierInfo> selectMaSupplierInfoList(SupplierInfo maSupplierInfo);
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
AjaxResult savePutInfo(SavePutInfoDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 根据入库单号查看详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<PutInStorageBean> getDetails(PutInStorageBean bean);
|
||||
}
|
||||
|
|
@ -338,8 +338,36 @@ public class MachineServiceImpl implements IMachineService
|
|||
Machine checkNum = machineMapper.getCheckNumByQrcode(machine);
|
||||
//报废时间
|
||||
Machine scrapTime = machineMapper.getScrapTimeByQrcode(machine);
|
||||
//3根据机具id查询领退工程
|
||||
Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
|
||||
// //3根据机具id查询领退工程
|
||||
// Machine leaseInfo = machineMapper.getLeaseInfoByQrcode(machine);
|
||||
|
||||
// 根据maid查询领料任务
|
||||
LeaseApplyInfo leaseInfo = machineMapper.getLeaseParentId(machine);
|
||||
if (leaseInfo.getParentId() == null){
|
||||
baseInfo.setLeaseTime(null);
|
||||
baseInfo.setLeaseUnit(null);
|
||||
baseInfo.setLeaseProject(null);
|
||||
}else{
|
||||
LeaseApplyInfo leaseDetail = machineMapper.getLeaseUnitAndProject(leaseInfo);
|
||||
baseInfo.setLeaseTime(String.valueOf(leaseDetail.getLeaseTime()));
|
||||
baseInfo.setLeaseUnit(leaseDetail.getUnitName());
|
||||
baseInfo.setLeaseProject(leaseDetail.getProjectName());
|
||||
}
|
||||
|
||||
// 根据maid查询退料任务
|
||||
LeaseApplyInfo leaseInfoBack = machineMapper.getBackParentId(machine);
|
||||
if (leaseInfoBack.getParentId() == null){
|
||||
baseInfo.setBackTime(null);
|
||||
baseInfo.setBackUnit(null);
|
||||
baseInfo.setBackProject(null);
|
||||
}else{
|
||||
LeaseApplyInfo leaseDetailBack = machineMapper.getBackUnitAndProject(leaseInfoBack);
|
||||
baseInfo.setBackTime(String.valueOf(leaseDetailBack.getLeaseTime()));
|
||||
baseInfo.setBackUnit(leaseDetailBack.getUnitName());
|
||||
baseInfo.setBackProject(leaseDetailBack.getProjectName());
|
||||
}
|
||||
|
||||
|
||||
if (inTime != null){
|
||||
Integer taskId = inTime.getTaskId();
|
||||
if(taskId != null){
|
||||
|
|
@ -368,14 +396,6 @@ public class MachineServiceImpl implements IMachineService
|
|||
baseInfo.setScrapTime("暂无");
|
||||
}
|
||||
|
||||
if(leaseInfo != null){
|
||||
baseInfo.setLeaseTime(leaseInfo.getLeaseTime());
|
||||
baseInfo.setLeaseUnit(leaseInfo.getLeaseUnit());
|
||||
baseInfo.setLeaseProject(leaseInfo.getLeaseProject());
|
||||
baseInfo.setBackTime(leaseInfo.getBackTime());
|
||||
baseInfo.setBackUnit(leaseInfo.getBackUnit());
|
||||
baseInfo.setBackProject(leaseInfo.getBackProject());
|
||||
}
|
||||
return success(baseInfo);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,284 @@
|
|||
package com.bonus.material.ma.service.impl;
|
||||
|
||||
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.ma.domain.MachIneDto;
|
||||
import com.bonus.material.ma.domain.PutInStorageBean;
|
||||
import com.bonus.material.ma.domain.SavePutInfoDto;
|
||||
import com.bonus.material.ma.domain.SupplierInfo;
|
||||
import com.bonus.material.ma.domain.vo.ExceptionEnum;
|
||||
import com.bonus.material.ma.domain.vo.FieldGenerator;
|
||||
import com.bonus.material.ma.domain.vo.GlobalContants;
|
||||
import com.bonus.material.ma.mapper.WarehousingMapper;
|
||||
import com.bonus.material.ma.service.WarehousingService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author hay
|
||||
* @description 入库盘点
|
||||
* @date 2024/3/27 13:32
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WarehousingServiceImpl implements WarehousingService {
|
||||
|
||||
@Autowired
|
||||
private WarehousingMapper warehousingMapper;
|
||||
|
||||
// @Autowired
|
||||
// private PurchaseInputMapper purchaseInputMapper;
|
||||
|
||||
/**
|
||||
* 查询入库盘点列表
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PutInStorageBean> getList(PutInStorageBean bean) {
|
||||
return warehousingMapper.getList(bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SupplierInfo> selectMaSupplierInfoList(SupplierInfo maSupplierInfo)
|
||||
{
|
||||
return warehousingMapper.selectMaSupplierInfoList(maSupplierInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成code编码
|
||||
* @return
|
||||
*/
|
||||
public String genderBackCode() {
|
||||
log.info("enter method genderBackCode");
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
Date nowDate = DateUtils.getNowDate();
|
||||
String format = dateFormat.format(nowDate);
|
||||
int taskNum = warehousingMapper.selectTaskNumByMonth(nowDate) + 1;
|
||||
String code = "";
|
||||
if (taskNum > GlobalContants.NUM1 && taskNum < GlobalContants.NUM2) {
|
||||
code = "PD" + format + "-00" + taskNum;
|
||||
} else if (taskNum > GlobalContants.NUM3 && taskNum < GlobalContants.NUM4) {
|
||||
code = "PD" + format + "-0" + taskNum;
|
||||
} else {
|
||||
code = "PD" + format + "-000" + taskNum;
|
||||
}
|
||||
log.info("end method genderBackCode" + code);
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增入库盘点
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult savePutInfo(SavePutInfoDto dto) {
|
||||
log.info("新增入库盘点入参dto:{}", dto);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
dto.setCreator(userId);
|
||||
String code = genderBackCode();
|
||||
List<MachIneDto> machIneDtoList = dto.getMachIneDtoList();
|
||||
//判断提交表单中是否存在相同编码
|
||||
for (int i = 0; i < machIneDtoList.size() - 1; i++) {
|
||||
for (int j = i + 1; j < machIneDtoList.size(); j++) {
|
||||
if (StringUtils.isNotEmpty(machIneDtoList.get(i).getMaCode()) && StringUtils.isNotEmpty(machIneDtoList.get(j).getMaCode())
|
||||
&& machIneDtoList.get(i).getMaCode().equals(machIneDtoList.get(j).getMaCode())) {
|
||||
throw new ServiceException("列表中包含以下相同的设备编码,请修改后重新提交:" + machIneDtoList.get(i).getMaCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
//判断提交中设备编码是否与库中相同
|
||||
if (CollectionUtils.isNotEmpty(machIneDtoList)) {
|
||||
for (MachIneDto machIneDto : machIneDtoList) {
|
||||
if (StringUtils.isNotBlank(machIneDto.getMaCode())) {
|
||||
int count = selectByMaCode(machIneDto.getMaCode());
|
||||
if (count != 0) {
|
||||
throw new ServiceException("以下设备编码与库中数据存在重复,请修改后重新提交:" + machIneDto.getMaCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int res;
|
||||
try {
|
||||
//1. 判断是数量还是编号入库,保存到不同表
|
||||
//1.1 如果是编号入库
|
||||
if (dto.getIsCode()) {
|
||||
res = insertMaMachineInfo(dto, code);
|
||||
if (res == 0) {
|
||||
log.error("insertMaMachineInfo方法插入异常");
|
||||
throw new RuntimeException("insertMaMachineInfo方法插入异常");
|
||||
}
|
||||
//去修改ma_type里面的库存num,根据前端传的数量追加
|
||||
res = updateMaTypeInfo(dto.getTypeId(), dto.getNum());
|
||||
if (res == 0) {
|
||||
log.error("updateMaTypeInfo方法修改异常");
|
||||
throw new RuntimeException("updateMaTypeInfo方法修改异常");
|
||||
}
|
||||
} else {
|
||||
//2.插入ma_type_put_in_storage_info表和ma_type_put_in_storage_details表
|
||||
res = insertPutInfo(dto, code);
|
||||
if (res == 0) {
|
||||
log.error("insertPutInfo方法插入异常");
|
||||
throw new RuntimeException("insertPutInfo方法插入异常");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("保存入库盘点异常:{}",e.getMessage());
|
||||
// 添加事务回滚逻辑,保证入库全部成功或者全部失败
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error(ExceptionEnum.SAVE_TO_DATABASE.getCode(), ExceptionEnum.SAVE_TO_DATABASE.getMsg());
|
||||
}
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备编码code查重
|
||||
* @param maCode
|
||||
* @return
|
||||
*/
|
||||
private int selectByMaCode(String maCode) {
|
||||
return warehousingMapper.selectByMaCode(maCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编号新增,插入ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param dto
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private int insertMaMachineInfo(SavePutInfoDto dto, String code) {
|
||||
int res = 0;
|
||||
if (dto.getNum() != null) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(0);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setNum(dto.getNum());
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
machIneDto.setTypeId(dto.getTypeId());
|
||||
machIneDto.setUnitId(dto.getUnitId());
|
||||
machIneDto.setProId(dto.getProId());
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
res += insertInfo(machIneDto);
|
||||
machIneDto.setInfoId(machIneDto.getId());
|
||||
}
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
machIneDto.setTypeId(dto.getTypeId());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setNum(dto.getNum());
|
||||
machIneDto.setCheckMan(dto.getCheckMan());
|
||||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertMachineInfo(machIneDto);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入ma_type_put_in_storage_info表,返回主键id
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
private int insertInfo(MachIneDto machIneDto) {
|
||||
return warehousingMapper.saveInfo(machIneDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取,保持到ma_machine、ma_machine_label和ma_label_bind
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
private int insertMachineInfo(MachIneDto machIneDto) {
|
||||
int res = warehousingMapper.insertMachine(machIneDto);
|
||||
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取
|
||||
* @param machIneDto
|
||||
* @return
|
||||
*/
|
||||
private int insertTypePutInStorageInfo(MachIneDto machIneDto) {
|
||||
//ma_type_put_in_storage_details表
|
||||
return warehousingMapper.saveDetails(machIneDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法抽取,追加ma_type表里面的num
|
||||
* @param typeId
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
private int updateMaTypeInfo(String typeId, Integer num) {
|
||||
return warehousingMapper.updateMaType(typeId, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入表方法
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
private int insertPutInfo(SavePutInfoDto dto, String code) {
|
||||
int res = 0;
|
||||
Integer total = dto.getMachIneDtoList().stream()
|
||||
.map(MachIneDto::getPutInStoreNum)
|
||||
.filter(num -> num != null)
|
||||
.collect(Collectors.summingInt(Integer::intValue));
|
||||
if (CollectionUtils.isNotEmpty(dto.getMachIneDtoList())) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(0);
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setIsCode(dto.getIsCode());
|
||||
machIneDto.setTotalNum(total);
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
res += insertInfo(machIneDto);
|
||||
machIneDto.setInfoId(machIneDto.getId());
|
||||
}
|
||||
for (int i = 0; i < dto.getMachIneDtoList().size(); i++) {
|
||||
MachIneDto machIneDto = dto.getMachIneDtoList().get(i);
|
||||
machIneDto.setCreator(dto.getCreator());
|
||||
machIneDto.setPutInType(dto.getPutInType());
|
||||
machIneDto.setRemarks(dto.getRemarks());
|
||||
machIneDto.setCode(code);
|
||||
machIneDto.setInfoId(dto.getMachIneDtoList().get(0).getInfoId());
|
||||
res += insertTypePutInStorageInfo(machIneDto);
|
||||
//根据类型追加ma_type表里面的num
|
||||
res += updateMaTypeInfo(machIneDto.getTypeId(), machIneDto.getPutInStoreNum());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据入库单号查看详情
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PutInStorageBean> getDetails(PutInStorageBean bean) {
|
||||
return warehousingMapper.getDetails(bean);
|
||||
}
|
||||
}
|
||||
|
|
@ -903,4 +903,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY
|
||||
mt.type_id
|
||||
</select>
|
||||
<select id="getDeviceTypeTreeTwo" resultType="com.bonus.common.biz.domain.TreeNode">
|
||||
SELECT mt.type_id AS id,
|
||||
mt.type_name AS label,
|
||||
mt.parent_id AS parentId,
|
||||
mt.unit_name AS unitName,
|
||||
mt.storage_num as num,
|
||||
mt.model_code AS modelCode,
|
||||
mt.manage_type AS manageType
|
||||
FROM ma_type mt
|
||||
WHERE mt.del_flag = '0'
|
||||
<if test="level!=null and level!=''">
|
||||
<if test="level == 2">
|
||||
AND mt.level IN ('1','2')
|
||||
</if>
|
||||
<if test="level == 3">
|
||||
AND mt.level IN ('1','2','3')
|
||||
</if>
|
||||
<if test="level == 4">
|
||||
AND mt.level IN ('1','2','3','4')
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -807,6 +807,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mm.check_man as checkMan,
|
||||
mm.this_check_time as thisCheckTime,
|
||||
mm.next_check_time as nextCheckTime,
|
||||
mt.manage_type as manageType,
|
||||
mm.in_out_num as inOutNum,
|
||||
mt.jiju_type as jiJuType,
|
||||
mt.is_check as isCheck,
|
||||
|
|
@ -838,6 +839,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
wmi.check_man as checkMan,
|
||||
wmi.this_check_time as thisCheckTime,
|
||||
wmi.next_check_time as nextCheckTime,
|
||||
1 as manageType,
|
||||
'' as inOutNum,
|
||||
'1' as jiJuType,
|
||||
'' as isCheck,
|
||||
|
|
@ -900,4 +902,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="maId != null">and wmi.id = #{maId}</if>
|
||||
LIMIT 100
|
||||
</select>
|
||||
<select id="getLeaseParentId" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
select parent_id as parentId from lease_out_details where ma_id = #{maId} order by create_time desc limit 1
|
||||
</select>
|
||||
<select id="getLeaseUnitAndProject" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
select
|
||||
bu.unit_name as unitName,
|
||||
bp.pro_name as projectName,
|
||||
DATE_FORMAT(lai.create_time, '%Y-%m-%d') as leaseTime
|
||||
from lease_apply_info lai
|
||||
left join tm_task_agreement tta on lai.task_id = tta.task_id
|
||||
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
left join bm_unit bu on bai.unit_id = bu.unit_id
|
||||
left join bm_project bp on bai.project_id = bp.pro_id
|
||||
where lai.id = #{parentId}
|
||||
</select>
|
||||
<select id="getBackParentId" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
select parent_id as parentId from back_check_details where ma_id = #{maId} order by create_time desc limit 1
|
||||
</select>
|
||||
<select id="getBackUnitAndProject" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
select
|
||||
bu.unit_name as unitName,
|
||||
bp.pro_name as projectName,
|
||||
DATE_FORMAT(ba.create_time, '%Y-%m-%d') as leaseTime
|
||||
from back_apply_info ba
|
||||
left join tm_task_agreement tta on ba.task_id = tta.task_id
|
||||
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||
left join bm_unit bu on bai.unit_id = bu.unit_id
|
||||
left join bm_project bp on bai.project_id = bp.pro_id
|
||||
where ba.id = #{parentId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,221 @@
|
|||
<?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.bonus.material.ma.mapper.WarehousingMapper">
|
||||
<select id="getList" resultType="com.bonus.material.ma.domain.PutInStorageBean">
|
||||
SELECT
|
||||
psi.id as id,
|
||||
case when psi.put_in_type = 0 then '库存盘点入库'
|
||||
else ''
|
||||
end as putInType,
|
||||
psi.code as code,
|
||||
su.nick_name as modelName,
|
||||
psi.create_time as createDate,
|
||||
psi.remarks as remark,
|
||||
GROUP_CONCAT(DISTINCT mt1.type_name) AS kindName
|
||||
FROM ma_type_put_in_storage_info psi
|
||||
left join sys_user su on psi.creator = su.user_id
|
||||
left join ma_type_put_in_storage_details psd on psi.id = psd.info_id
|
||||
left join ma_type mt on psd.type_id = mt.type_id and mt.del_flag = '0'
|
||||
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
WHERE 1=1
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
psi.code LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
su.nick_name LIKE CONCAT('%',#{keyWord},'%') OR
|
||||
psi.remarks LIKE CONCAT('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
GROUP BY psi.id
|
||||
ORDER BY psi.create_time DESC
|
||||
</select>
|
||||
<select id="selectMaSupplierInfoList" resultType="com.bonus.material.ma.domain.SupplierInfo">
|
||||
SELECT
|
||||
supplier_id as supplierId ,
|
||||
supplier as supplier
|
||||
FROM ma_supplier_info
|
||||
</select>
|
||||
|
||||
<select id="selectByMaCode" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from ma_machine
|
||||
<where>
|
||||
<if test="maCode != null ">and ma_code = #{maCode}</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectTaskNumByMonth" resultType="java.lang.Integer">
|
||||
select count(*) from ma_type_put_in_storage_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
|
||||
</select>
|
||||
|
||||
<insert id="saveInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO ma_type_put_in_storage_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="putInType != null and putInType != ''">put_in_type,</if>
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
num,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="totalNum != null and totalNum != 0">
|
||||
num,
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="typeId != null and typeId != ''">type_id,</if>
|
||||
<if test="creator != null and creator != ''">creator,</if>
|
||||
<if test="code != null and code != ''">code,</if>
|
||||
<if test="remarks != null and remarks != ''">remarks,</if>
|
||||
create_time
|
||||
</trim>
|
||||
VALUES
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="putInType != null and putInType != ''">#{putInType},</if>
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
#{num},
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="totalNum != null and totalNum != 0">
|
||||
#{totalNum},
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="creator != null and creator != ''">#{creator},</if>
|
||||
<if test="code != null and code != ''">#{code},</if>
|
||||
<if test="remarks != null and remarks != ''">#{remarks},</if>
|
||||
sysdate()
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="saveDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO ma_type_put_in_storage_details (
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
num,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
num,
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="infoId != null and infoId != ''">
|
||||
info_id,
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
type_id,
|
||||
</if>
|
||||
<if test="maId != null and maId != ''">
|
||||
ma_id,
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remarks,
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
ma_code,
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
VALUES (
|
||||
<choose>
|
||||
<when test="isCode and num != null and num != 0">
|
||||
1,
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="putInStoreNum != null and putInStoreNum != 0">
|
||||
#{putInStoreNum},
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<trim prefix="" suffixOverrides=",">
|
||||
<if test="infoId != null and infoId != ''">
|
||||
#{infoId},
|
||||
</if>
|
||||
<if test="typeId != null and typeId != ''">
|
||||
#{typeId},
|
||||
</if>
|
||||
<if test="maId != null and maId != ''">
|
||||
#{maId},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="maCode != null and maCode != ''">
|
||||
#{maCode},
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertMachine" useGeneratedKeys="true" keyProperty="maId">
|
||||
insert into ma_machine (
|
||||
<if test="typeId != null and typeId != '' ">type_id,</if>
|
||||
<if test="maCode != null and maCode != '' ">ma_code,</if>
|
||||
ma_status,
|
||||
<if test="buyPrice != null and buyPrice != ''">buy_price,</if>
|
||||
<if test="maVender != null and maVender != ''">ma_vender,</if>
|
||||
<if test="checkMan != null and checkMan != ''">check_man,</if>
|
||||
<if test="outFacCode != null and outFacCode != ''">out_fac_code,</if>
|
||||
<if test="thisCheckTime != null">this_check_time,</if>
|
||||
<if test="nextCheckTime != null">next_check_time,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="typeId != null and typeId != ''">#{typeId},</if>
|
||||
<if test="maCode != null and maCode != ''">#{maCode},</if>
|
||||
1,
|
||||
<if test="buyPrice != null and buyPrice != ''">#{buyPrice},</if>
|
||||
<if test="maVender != null and maVender != ''">#{maVender},</if>
|
||||
<if test="checkMan != null and checkMan != ''">#{checkMan},</if>
|
||||
<if test="outFacCode != null and outFacCode != ''">#{outFacCode},</if>
|
||||
<if test="thisCheckTime != null">#{thisCheckTime},</if>
|
||||
<if test="nextCheckTime != null">#{nextCheckTime},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateMaType">
|
||||
UPDATE ma_type
|
||||
SET storage_num = IFNULL(storage_num, 0) + #{num},
|
||||
update_time = now()
|
||||
<where>
|
||||
<if test="typeId != null ">and type_id = #{typeId}</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<select id="getDetails" resultType="com.bonus.material.ma.domain.PutInStorageBean">
|
||||
SELECT
|
||||
case when psi.put_in_type = 0 then '库存盘点入库'
|
||||
else ''
|
||||
end as putInType,
|
||||
psd.ma_code as maCode,
|
||||
psd.num as num,
|
||||
mt2.type_name as typeName,
|
||||
mt.type_name as typeModelName,
|
||||
su.nick_name as modelName,
|
||||
psi.create_time as createDate,
|
||||
psd.remarks as remark
|
||||
FROM ma_type_put_in_storage_info psi
|
||||
LEFT JOIN ma_type_put_in_storage_details psd on psi.id = psd.info_id
|
||||
LEFT JOIN ma_type mt on mt.type_id = psd.type_id
|
||||
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
|
||||
LEFT JOIN sys_user su on su.user_id = psi.creator
|
||||
where
|
||||
1 = 1
|
||||
<if test="infoId != null and infoId != ''">
|
||||
and psi.id = #{infoId}
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
and (
|
||||
mt2.type_name like concat('%',#{keyWord},'%') or
|
||||
su.user_name like concat('%',#{keyWord},'%') or
|
||||
mt.type_name like concat('%',#{keyWord},'%') or
|
||||
psd.ma_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue