二级库功能开发
This commit is contained in:
parent
257446afe4
commit
c53fda1ba1
|
|
@ -69,6 +69,14 @@ public class MaMachine extends BaseEntity {
|
||||||
@ApiModelProperty(value = "机具编号")
|
@ApiModelProperty(value = "机具编号")
|
||||||
@Excel(name = "设备编码", sort = 4)
|
@Excel(name = "设备编码", sort = 4)
|
||||||
private String maCode;
|
private String maCode;
|
||||||
|
|
||||||
|
private String modelName;
|
||||||
|
private String typeName;
|
||||||
|
private String manageType;
|
||||||
|
private String nuitName;
|
||||||
|
private Integer receiveNum;
|
||||||
|
private String maIds;
|
||||||
|
private Integer id;
|
||||||
/**
|
/**
|
||||||
* 原编号
|
* 原编号
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ import com.bonus.sgzb.common.log.enums.BusinessType;
|
||||||
import com.bonus.sgzb.common.security.annotation.Logical;
|
import com.bonus.sgzb.common.security.annotation.Logical;
|
||||||
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.sgzb.material.domain.SecondLotConfig;
|
||||||
|
import com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
@ -61,6 +63,9 @@ public class TmTaskController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private LeaseUserBookService leaseUserBookService;
|
private LeaseUserBookService leaseUserBookService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SecondaryWarehouseMapper secondaryWarehouseMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领料审核通过,分公司,分管,机具分公司统一接口
|
* 领料审核通过,分公司,分管,机具分公司统一接口
|
||||||
|
|
@ -182,6 +187,13 @@ public class TmTaskController extends BaseController {
|
||||||
return AjaxResult.error("手机号格式错误");
|
return AjaxResult.error("手机号格式错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 查询改领料单位下面有没有配置二级库
|
||||||
|
SecondLotConfig config = new SecondLotConfig();
|
||||||
|
config.setUnitId(task.getUnitId());
|
||||||
|
SecondLotConfig secondLotConfig = secondaryWarehouseMapper.selectConfigByLotId(config);
|
||||||
|
if (secondLotConfig == null) {
|
||||||
|
return AjaxResult.error("该领料单位未配置二级库,请先配置");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String code = tmTaskService.genderLeaseCode();
|
String code = tmTaskService.genderLeaseCode();
|
||||||
if (StringUtils.isEmpty(code)) {
|
if (StringUtils.isEmpty(code)) {
|
||||||
|
|
@ -192,7 +204,9 @@ public class TmTaskController extends BaseController {
|
||||||
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
|
boolean addTaskResult = tmTaskService.insertSelective(task) > 0;
|
||||||
|
|
||||||
//任务与协议建立关联关系
|
//任务与协议建立关联关系
|
||||||
|
if (task.getAgreementId() != null){
|
||||||
boolean i = tmTaskService.insertAgreement(task) > 0;
|
boolean i = tmTaskService.insertAgreement(task) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (addTaskResult && task.getLeaseApplyInfo() != null) {
|
if (addTaskResult && task.getLeaseApplyInfo() != null) {
|
||||||
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
|
if (CollUtil.isEmpty(task.getLeaseApplyDetails())) {
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@ public class WarehouseKeeperController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取库管员配置列表")
|
@ApiOperation(value = "获取库管员配置列表")
|
||||||
@GetMapping("/warehouseKeeperInfoAll")
|
@GetMapping("/warehouseKeeperInfoAll")
|
||||||
public TableDataInfo getWarehouseKeeperInfoAll(WarehouseKeeper bean)
|
public TableDataInfo getWarehouseKeeperInfoAll(WarehouseKeeper bean) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<WarehouseKeeper> list = warehouseKeeperService.getWarehouseKeeperInfoAll(bean);
|
List<WarehouseKeeper> list = warehouseKeeperService.getWarehouseKeeperInfoAll(bean);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -40,6 +39,7 @@ public class WarehouseKeeperController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库管员配置-根据人员名称查询左侧列表
|
* 库管员配置-根据人员名称查询左侧列表
|
||||||
|
*
|
||||||
* @param userName
|
* @param userName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -48,6 +48,7 @@ public class WarehouseKeeperController extends BaseController {
|
||||||
public AjaxResult getMaUserList(String userName) {
|
public AjaxResult getMaUserList(String userName) {
|
||||||
return AjaxResult.success(warehouseKeeperService.getMaUserList(userName));
|
return AjaxResult.success(warehouseKeeperService.getMaUserList(userName));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("库管员配置-保存")
|
@ApiOperation("库管员配置-保存")
|
||||||
@Log(title = "库管员配置-保存", businessType = BusinessType.INSERT)
|
@Log(title = "库管员配置-保存", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/addList")
|
@PostMapping("/addList")
|
||||||
|
|
@ -61,8 +62,7 @@ public class WarehouseKeeperController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "库管员配置-删除")
|
@ApiOperation(value = "库管员配置-删除")
|
||||||
@PostMapping("/remove")
|
@PostMapping("/remove")
|
||||||
public AjaxResult remove(@Validated @RequestBody WarehouseKeeper bean )
|
public AjaxResult remove(@Validated @RequestBody WarehouseKeeper bean) {
|
||||||
{
|
|
||||||
return toAjax(warehouseKeeperService.deleteByIds(bean));
|
return toAjax(warehouseKeeperService.deleteByIds(bean));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,4 +49,6 @@ public interface WarehouseKeeperMapper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int deleteByIdsAll(String[] typeIds);
|
int deleteByIdsAll(String[] typeIds);
|
||||||
|
|
||||||
|
List<Integer> getUsers(String typeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ public class MaLabelBindServiceImpl implements IMaLabelBindService {
|
||||||
maMachine.setMaCode(maLabelBind.getMaCode());
|
maMachine.setMaCode(maLabelBind.getMaCode());
|
||||||
maMachine.setTypeId(maLabelBind.getTypeId());
|
maMachine.setTypeId(maLabelBind.getTypeId());
|
||||||
maMachine.setQrCode(maLabelBind.getLabelCode());
|
maMachine.setQrCode(maLabelBind.getLabelCode());
|
||||||
|
maMachine.setAssetsCode(maLabelBind.getAssetsCode());
|
||||||
maLabelBindMapper.insertMaLabel(maMachine);
|
maLabelBindMapper.insertMaLabel(maMachine);
|
||||||
//根据typeId修改库存
|
//根据typeId修改库存
|
||||||
maLabelBindMapper.updateMatypeNum(maLabelBind.getTypeId());
|
maLabelBindMapper.updateMatypeNum(maLabelBind.getTypeId());
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,7 @@ public class MaLabelBindVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "关键字")
|
@ApiModelProperty(value = "关键字")
|
||||||
private String keyWord;
|
private String keyWord;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "固定资产编码")
|
||||||
|
private String assetsCode;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bonus.sgzb.material.controller;
|
package com.bonus.sgzb.material.controller;
|
||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||||
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
import com.bonus.sgzb.common.core.web.controller.BaseController;
|
||||||
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
|
|
@ -27,6 +28,46 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SecondaryWarehouseService service;
|
private SecondaryWarehouseService service;
|
||||||
|
|
||||||
|
@ApiOperation(value = "二级库配置列表")
|
||||||
|
@GetMapping("/listConfig")
|
||||||
|
public AjaxResult listConfig(SecondLotConfig bean) {
|
||||||
|
startPage();
|
||||||
|
List<SecondLotConfig> list = service.listConfig(bean);
|
||||||
|
return AjaxResult.success(getDataTable(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "二级库配置新增")
|
||||||
|
@PostMapping("/addConfig")
|
||||||
|
public AjaxResult config(@RequestBody SecondLotConfig bean) {
|
||||||
|
return service.addConfig(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "二级库配置修改")
|
||||||
|
@PostMapping("/updateConfig")
|
||||||
|
public AjaxResult updateConfig(@RequestBody SecondLotConfig bean) {
|
||||||
|
return service.updateConfig(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "二级库配置修改")
|
||||||
|
@PostMapping("/delConfig")
|
||||||
|
public AjaxResult delConfig(@RequestBody SecondLotConfig bean) {
|
||||||
|
return service.delConfig(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "班组列表")
|
||||||
|
@GetMapping("/listTeamGroup")
|
||||||
|
public AjaxResult listTeamGroup(TeamGroup bean) {
|
||||||
|
startPage();
|
||||||
|
List<TeamGroup> list = service.listTeamGroup(bean);
|
||||||
|
return AjaxResult.success(getDataTable(list));
|
||||||
|
}
|
||||||
|
@ApiOperation(value = "新增班组")
|
||||||
|
@PostMapping("/addTeamGroup")
|
||||||
|
public AjaxResult addTeamGroup(@RequestBody TeamGroup bean) {
|
||||||
|
return service.addTeamGroup(bean);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取二级库列表
|
* 获取二级库列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -37,14 +78,25 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
List<SecondaryWarehouse> list = service.getList(bean);
|
List<SecondaryWarehouse> list = service.getList(bean);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
@ApiOperation(value = "获取二级库(在用、在库)编码机具")
|
||||||
|
@GetMapping("/getMaStatusByMaId")
|
||||||
|
public TableDataInfo getMaStatusByMaId(SecondaryWarehouse bean) {
|
||||||
|
startPage();
|
||||||
|
List<MaMachine> list = service.getMaStatusByMaId(bean);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
/* @ApiOperation(value = "获取二级库(在用、在库)数量机具")
|
||||||
|
@GetMapping("/getDevCount")
|
||||||
|
public Integer getDevCount(SecondaryWarehouse bean) {
|
||||||
|
return service.getDevCount(bean);
|
||||||
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二级库导出
|
* 二级库导出
|
||||||
*/
|
*/
|
||||||
@Log(title = "二级库导出", businessType = BusinessType.EXPORT)
|
@Log(title = "二级库导出", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportList")
|
@PostMapping("/exportList")
|
||||||
public void exportList(HttpServletResponse response, @RequestBody SecondaryWarehouse bean)
|
public void exportList(HttpServletResponse response, @RequestBody SecondaryWarehouse bean) {
|
||||||
{
|
|
||||||
if (bean.getLeaseType().equals(0)) {
|
if (bean.getLeaseType().equals(0)) {
|
||||||
SecondaryWarehouseVo bean1 = new SecondaryWarehouseVo();
|
SecondaryWarehouseVo bean1 = new SecondaryWarehouseVo();
|
||||||
BeanUtils.copyProperties(bean, bean1);
|
BeanUtils.copyProperties(bean, bean1);
|
||||||
|
|
@ -63,7 +115,7 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "出库/退库操作")
|
@ApiOperation(value = "出库/退库操作")
|
||||||
@PostMapping("/operate")
|
@PostMapping("/operate")
|
||||||
@Log(title = "二级库管理--出库退库操作")
|
@Log(title = "二级库管理--出库/退库/归还操作")
|
||||||
public AjaxResult operate(@RequestBody TeamLeaseInfo bean) {
|
public AjaxResult operate(@RequestBody TeamLeaseInfo bean) {
|
||||||
int i = service.addNewOperate(bean);
|
int i = service.addNewOperate(bean);
|
||||||
return toAjax(i);
|
return toAjax(i);
|
||||||
|
|
@ -85,8 +137,7 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "出库台账导出", businessType = BusinessType.EXPORT)
|
@Log(title = "出库台账导出", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportOperateList")
|
@PostMapping("/exportOperateList")
|
||||||
public void exportOperateList(HttpServletResponse response, @RequestBody TeamLeaseInfo bean)
|
public void exportOperateList(HttpServletResponse response, @RequestBody TeamLeaseInfo bean) {
|
||||||
{
|
|
||||||
List<TeamLeaseInfo> list = service.getOperateList(bean);
|
List<TeamLeaseInfo> list = service.getOperateList(bean);
|
||||||
ExcelUtil<TeamLeaseInfo> util = new ExcelUtil<TeamLeaseInfo>(TeamLeaseInfo.class);
|
ExcelUtil<TeamLeaseInfo> util = new ExcelUtil<TeamLeaseInfo>(TeamLeaseInfo.class);
|
||||||
util.exportExcel(response, list, "出库台账导出");
|
util.exportExcel(response, list, "出库台账导出");
|
||||||
|
|
@ -97,8 +148,7 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "回库台账导出", businessType = BusinessType.EXPORT)
|
@Log(title = "回库台账导出", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/exportIntOperateList")
|
@PostMapping("/exportIntOperateList")
|
||||||
public void exportIntOperateList(HttpServletResponse response, @RequestBody TeamLeaseInfo bean)
|
public void exportIntOperateList(HttpServletResponse response, @RequestBody TeamLeaseInfo bean) {
|
||||||
{
|
|
||||||
List<TeamLeaseInfo> list = service.getOperateList(bean);
|
List<TeamLeaseInfo> list = service.getOperateList(bean);
|
||||||
List<TeamLeaseInfoTwo> listTwo = Convert.toList(TeamLeaseInfoTwo.class, list);
|
List<TeamLeaseInfoTwo> listTwo = Convert.toList(TeamLeaseInfoTwo.class, list);
|
||||||
ExcelUtil<TeamLeaseInfoTwo> util = new ExcelUtil<TeamLeaseInfoTwo>(TeamLeaseInfoTwo.class);
|
ExcelUtil<TeamLeaseInfoTwo> util = new ExcelUtil<TeamLeaseInfoTwo>(TeamLeaseInfoTwo.class);
|
||||||
|
|
@ -108,7 +158,7 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 获取进场、退场、场内库存记录
|
* 获取进场、退场、场内库存记录
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取进场、退场、场内库存记录")
|
@ApiOperation(value = "获取出入库记录")
|
||||||
@GetMapping("/getRecords")
|
@GetMapping("/getRecords")
|
||||||
public TableDataInfo getRecords(TeamLeaseInfo bean) {
|
public TableDataInfo getRecords(TeamLeaseInfo bean) {
|
||||||
startPage();
|
startPage();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bonus.sgzb.material.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/12/30 - 13:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SecondLotConfig {
|
||||||
|
private Long id;
|
||||||
|
//二级库名称
|
||||||
|
private String name;
|
||||||
|
// 往来单位id
|
||||||
|
private Long unitId;
|
||||||
|
// 往来单位名称
|
||||||
|
private String unitName;
|
||||||
|
//创建人
|
||||||
|
private String creater;
|
||||||
|
//创建时间
|
||||||
|
private String createTime;
|
||||||
|
//修改人
|
||||||
|
private String updater;
|
||||||
|
//修改时间
|
||||||
|
private String updateTime;
|
||||||
|
}
|
||||||
|
|
@ -27,10 +27,22 @@ public class SecondaryWarehouse {
|
||||||
*机具类型id
|
*机具类型id
|
||||||
*/
|
*/
|
||||||
private String typeId;
|
private String typeId;
|
||||||
|
/**
|
||||||
|
*机具类型(0编码 1数量)
|
||||||
|
*/
|
||||||
|
private String manageType;
|
||||||
|
/**
|
||||||
|
*设备编码
|
||||||
|
*/
|
||||||
|
private String maCode;
|
||||||
/**
|
/**
|
||||||
*机具id
|
*机具id
|
||||||
*/
|
*/
|
||||||
private String maId;
|
private String maId;
|
||||||
|
/**
|
||||||
|
*机具id
|
||||||
|
*/
|
||||||
|
private String maIds;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -126,5 +138,13 @@ public class SecondaryWarehouse {
|
||||||
*/
|
*/
|
||||||
@Excel(name = "领用数量")
|
@Excel(name = "领用数量")
|
||||||
private Integer receiveNum;
|
private Integer receiveNum;
|
||||||
|
/**
|
||||||
|
* "1:在用 2:在库"
|
||||||
|
*/
|
||||||
|
private Integer type;
|
||||||
|
/**
|
||||||
|
* 班组id
|
||||||
|
*/
|
||||||
|
private Integer teamGroupId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bonus.sgzb.material.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2024/12/30 - 15:19
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TeamGroup {
|
||||||
|
private Integer id;
|
||||||
|
//班组名称
|
||||||
|
private String name;
|
||||||
|
//所属上级(往来单位)
|
||||||
|
private Integer unitId;
|
||||||
|
//所属上级名称
|
||||||
|
private String unitName;
|
||||||
|
//创建者
|
||||||
|
private String creater;
|
||||||
|
//创建时间
|
||||||
|
private String createTime;
|
||||||
|
//修改者
|
||||||
|
private String updater;
|
||||||
|
//修改时间
|
||||||
|
private String updateTime;
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author c liu
|
* @author c liu
|
||||||
|
|
@ -31,10 +32,16 @@ public class TeamLeaseInfo {
|
||||||
*机具id
|
*机具id
|
||||||
*/
|
*/
|
||||||
private String maId;
|
private String maId;
|
||||||
|
private String maIds;
|
||||||
|
private List<TeamLeaseInfo> teamLeaseInfos;
|
||||||
/**
|
/**
|
||||||
*领料人
|
*领料人
|
||||||
*/
|
*/
|
||||||
private String pickName;
|
private String pickName;
|
||||||
|
// 二级库名称
|
||||||
|
private String secondName;
|
||||||
|
// 班组名称
|
||||||
|
private String groupName;
|
||||||
/**
|
/**
|
||||||
*出库人
|
*出库人
|
||||||
*/
|
*/
|
||||||
|
|
@ -111,9 +118,9 @@ public class TeamLeaseInfo {
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1出库2退库
|
* 1出库2退库3归还
|
||||||
*/
|
*/
|
||||||
private String type;
|
private Integer type;
|
||||||
private String keyword;
|
private String keyword;
|
||||||
/**
|
/**
|
||||||
* 1 2 3 4
|
* 1 2 3 4
|
||||||
|
|
@ -121,8 +128,11 @@ public class TeamLeaseInfo {
|
||||||
private String queryType;
|
private String queryType;
|
||||||
|
|
||||||
private int outNum;
|
private int outNum;
|
||||||
|
private Integer teamGroupId;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
private Date outTime;
|
private Date outTime;
|
||||||
|
|
||||||
|
private Integer parentId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
package com.bonus.sgzb.material.mapper;
|
package com.bonus.sgzb.material.mapper;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
import com.bonus.sgzb.material.domain.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -37,7 +38,7 @@ public interface SecondaryWarehouseMapper {
|
||||||
|
|
||||||
// List<TeamLeaseInfo> getNewRecordsFive(TeamLeaseInfo bean);
|
// List<TeamLeaseInfo> getNewRecordsFive(TeamLeaseInfo bean);
|
||||||
|
|
||||||
int addNewOperate(TeamLeaseInfo bean);
|
Integer addNewOperate(TeamLeaseInfo bean);
|
||||||
|
|
||||||
Integer selectStockNum(SecondaryWarehouse secondaryWarehouse);
|
Integer selectStockNum(SecondaryWarehouse secondaryWarehouse);
|
||||||
|
|
||||||
|
|
@ -46,4 +47,34 @@ public interface SecondaryWarehouseMapper {
|
||||||
List<SecondaryWarehouseVo> getList2(SecondaryWarehouseVo bean1);
|
List<SecondaryWarehouseVo> getList2(SecondaryWarehouseVo bean1);
|
||||||
|
|
||||||
Integer selectStockNum1(SecondaryWarehouseVo secondaryWarehouse);
|
Integer selectStockNum1(SecondaryWarehouseVo secondaryWarehouse);
|
||||||
|
|
||||||
|
Integer addConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
SecondLotConfig selectConfigByLotId(SecondLotConfig bean);
|
||||||
|
|
||||||
|
Integer updateConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
Integer delConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
List<SecondLotConfig> listConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
List<TeamGroup> listTeamGroup(TeamGroup bean);
|
||||||
|
|
||||||
|
Integer addTeamGroup(TeamGroup bean);
|
||||||
|
|
||||||
|
Integer updateMachine(@Param("maId") String maId, @Param("maStatus")Integer maStatus);
|
||||||
|
|
||||||
|
MaMachine getMaStatusByMaId(@Param("maId") String maId);
|
||||||
|
|
||||||
|
List<MaMachine> getUseMaStatusByMaId(/*@Param("maId") String maId,*/@Param("teamGroupId") Integer teamGroupId,@Param("unitId") Long unitId);
|
||||||
|
|
||||||
|
Integer getDevCount(SecondaryWarehouse bean);
|
||||||
|
|
||||||
|
Integer addNum(TeamLeaseInfo teamLeaseInfo);
|
||||||
|
|
||||||
|
Integer updateOutNum(TeamLeaseInfo teamLeaseInfo);
|
||||||
|
|
||||||
|
Integer deleteOutNum(TeamLeaseInfo teamLeaseInfo);
|
||||||
|
|
||||||
|
Integer selectParentId(TeamLeaseInfo teamLeaseInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package com.bonus.sgzb.material.service;
|
package com.bonus.sgzb.material.service;
|
||||||
|
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
import com.bonus.sgzb.material.domain.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -24,4 +24,20 @@ public interface SecondaryWarehouseService {
|
||||||
int addNewOperate(TeamLeaseInfo bean);
|
int addNewOperate(TeamLeaseInfo bean);
|
||||||
|
|
||||||
List<SecondaryWarehouseVo> getList1(SecondaryWarehouseVo bean1);
|
List<SecondaryWarehouseVo> getList1(SecondaryWarehouseVo bean1);
|
||||||
|
|
||||||
|
AjaxResult addConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
AjaxResult updateConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
AjaxResult delConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
List<SecondLotConfig> listConfig(SecondLotConfig bean);
|
||||||
|
|
||||||
|
List<TeamGroup> listTeamGroup(TeamGroup bean);
|
||||||
|
|
||||||
|
AjaxResult addTeamGroup(TeamGroup bean);
|
||||||
|
|
||||||
|
List<MaMachine> getMaStatusByMaId(SecondaryWarehouse bean);
|
||||||
|
|
||||||
|
Integer getDevCount(SecondaryWarehouse bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
package com.bonus.sgzb.material.service.impl;
|
package com.bonus.sgzb.material.service.impl;
|
||||||
|
|
||||||
|
import com.bonus.sgzb.base.api.domain.MaMachine;
|
||||||
|
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
import com.bonus.sgzb.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouse;
|
import com.bonus.sgzb.material.domain.*;
|
||||||
import com.bonus.sgzb.material.domain.SecondaryWarehouseVo;
|
|
||||||
import com.bonus.sgzb.material.domain.TeamLeaseInfo;
|
|
||||||
import com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper;
|
import com.bonus.sgzb.material.mapper.SecondaryWarehouseMapper;
|
||||||
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
import com.bonus.sgzb.material.service.SecondaryWarehouseService;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author c liu
|
* @author c liu
|
||||||
|
|
@ -40,11 +43,114 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult addConfig(SecondLotConfig bean) {
|
||||||
|
// 先查询该往来单位有没有绑定过二级库
|
||||||
|
SecondLotConfig config = mapper.selectConfigByLotId(bean);
|
||||||
|
if (config != null) {
|
||||||
|
return AjaxResult.warn("该往来单位已绑定二级库");
|
||||||
|
} else {
|
||||||
|
bean.setCreater(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||||
|
Integer i = mapper.addConfig(bean);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.success("新增成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("新增失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult updateConfig(SecondLotConfig bean) {
|
||||||
|
SecondLotConfig existingConfig = mapper.selectConfigByLotId(bean);
|
||||||
|
if (existingConfig != null) {
|
||||||
|
// 如果找到匹配的记录,检查除lotId外的其他属性是否有所不同,比如name
|
||||||
|
if (!bean.getName().equals(existingConfig.getName())) {
|
||||||
|
// 更新其它属性,比如name
|
||||||
|
bean.setUpdater(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||||
|
mapper.updateConfig(bean);
|
||||||
|
return AjaxResult.success("修改成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.warn("未检测到需要更新的信息");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 如果没有找到匹配的记录,则直接插入或返回错误取决于业务逻辑
|
||||||
|
bean.setUpdater(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||||
|
mapper.updateConfig(bean);
|
||||||
|
return AjaxResult.success("修改成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult delConfig(SecondLotConfig bean) {
|
||||||
|
Integer i = mapper.delConfig(bean);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.success("删除成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("删除失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SecondLotConfig> listConfig(SecondLotConfig bean) {
|
||||||
|
return mapper.listConfig(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TeamGroup> listTeamGroup(TeamGroup bean) {
|
||||||
|
return mapper.listTeamGroup(bean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult addTeamGroup(TeamGroup bean) {
|
||||||
|
bean.setCreater(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||||
|
Integer i = mapper.addTeamGroup(bean);
|
||||||
|
if (i > 0) {
|
||||||
|
return AjaxResult.success("新增成功");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("新增失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MaMachine> getMaStatusByMaId(SecondaryWarehouse bean) {
|
||||||
|
List<MaMachine> list = new ArrayList<>();
|
||||||
|
if (bean.getType() == 1) {
|
||||||
|
for (String maId : bean.getMaIds().split(",")) {
|
||||||
|
MaMachine maMachine = mapper.getMaStatusByMaId(maId);
|
||||||
|
if (maMachine != null) {
|
||||||
|
list.add(maMachine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bean.getType() == 2) {
|
||||||
|
// for (String maId : bean.getMaIds().split(",")) {
|
||||||
|
List<MaMachine> maMachine = mapper.getUseMaStatusByMaId(/*maId,*/ bean.getTeamGroupId(), bean.getUnitId());
|
||||||
|
if (maMachine != null) {
|
||||||
|
list.addAll(maMachine);
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(bean.getMaCode())) {
|
||||||
|
List<MaMachine> filteredItems = list.stream()
|
||||||
|
.filter(item -> item.getMaCode().contains(bean.getMaCode()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return filteredItems;
|
||||||
|
} else {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getDevCount(SecondaryWarehouse bean) {
|
||||||
|
return mapper.getDevCount(bean);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SecondaryWarehouse> getList(SecondaryWarehouse bean) {
|
public List<SecondaryWarehouse> getList(SecondaryWarehouse bean) {
|
||||||
List<SecondaryWarehouse> list = new ArrayList<>();
|
bean.setLeaseType(1);
|
||||||
if (bean.getLeaseType().equals(1)){
|
List<SecondaryWarehouse> list = mapper.getList(bean);
|
||||||
list = mapper.getList(bean);
|
|
||||||
for (SecondaryWarehouse secondaryWarehouse : list) {
|
for (SecondaryWarehouse secondaryWarehouse : list) {
|
||||||
Integer warehouse = mapper.selectStockNum(secondaryWarehouse);
|
Integer warehouse = mapper.selectStockNum(secondaryWarehouse);
|
||||||
if (warehouse == null) {
|
if (warehouse == null) {
|
||||||
|
|
@ -53,9 +159,6 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
secondaryWarehouse.setReceiveNum(warehouse);
|
secondaryWarehouse.setReceiveNum(warehouse);
|
||||||
secondaryWarehouse.setStockNum(secondaryWarehouse.getNum() - secondaryWarehouse.getReceiveNum());
|
secondaryWarehouse.setStockNum(secondaryWarehouse.getNum() - secondaryWarehouse.getReceiveNum());
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
list = mapper.getList1(bean);
|
|
||||||
}
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -73,18 +176,69 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TeamLeaseInfo> getRecords(TeamLeaseInfo bean) {
|
public List<TeamLeaseInfo> getRecords(TeamLeaseInfo bean) {
|
||||||
// System.out.println(bean.getLeaseMan());
|
|
||||||
return mapper.getNewRecords(bean);
|
return mapper.getNewRecords(bean);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int addNewOperate(TeamLeaseInfo bean) {
|
public int addNewOperate(TeamLeaseInfo teamLeaseInfo) {
|
||||||
Long userid = SecurityUtils.getLoginUser().getUserid();
|
teamLeaseInfo.setCreateBy(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
|
||||||
bean.setCreateBy(String.valueOf(userid));
|
Integer num = null;
|
||||||
return mapper.addNewOperate(bean);
|
if (teamLeaseInfo.getTeamLeaseInfos().size() > 0) {
|
||||||
|
num = 0;
|
||||||
|
for (TeamLeaseInfo bean : teamLeaseInfo.getTeamLeaseInfos()) {
|
||||||
|
// 编码设备
|
||||||
|
if (StringUtils.isNotBlank(bean.getMaIds())) {
|
||||||
|
for (String maId : bean.getMaIds().split(",")) {
|
||||||
|
if (teamLeaseInfo.getType() == 1) {
|
||||||
|
// 出库
|
||||||
|
teamLeaseInfo.setMaId(maId);
|
||||||
|
teamLeaseInfo.setTypeId(bean.getTypeId());
|
||||||
|
teamLeaseInfo.setOutNum(1);
|
||||||
|
teamLeaseInfo.setId(bean.getId());
|
||||||
|
num = mapper.addNewOperate(teamLeaseInfo);
|
||||||
|
mapper.updateMachine(maId, 132);
|
||||||
|
} else if (teamLeaseInfo.getType() == 2) {
|
||||||
|
// 退库
|
||||||
|
teamLeaseInfo.setMaId(maId);
|
||||||
|
teamLeaseInfo.setTypeId(bean.getTypeId());
|
||||||
|
teamLeaseInfo.setOutNum(1);
|
||||||
|
teamLeaseInfo.setId(bean.getId());
|
||||||
|
num = mapper.addNewOperate(teamLeaseInfo);
|
||||||
|
mapper.updateMachine(maId, 16);
|
||||||
|
} else {
|
||||||
|
// 归还
|
||||||
|
teamLeaseInfo.setMaId(maId);
|
||||||
|
teamLeaseInfo.setTypeId(bean.getTypeId());
|
||||||
|
teamLeaseInfo.setOutNum(1);
|
||||||
|
teamLeaseInfo.setId(bean.getId());
|
||||||
|
num = mapper.addNewOperate(teamLeaseInfo);
|
||||||
|
mapper.updateMachine(maId, 15);
|
||||||
|
// 修改库存总量
|
||||||
|
Integer parentId = mapper.selectParentId(teamLeaseInfo);
|
||||||
|
if (parentId != null) {
|
||||||
|
teamLeaseInfo.setParentId(parentId);
|
||||||
|
}
|
||||||
|
mapper.deleteOutNum(teamLeaseInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 数量设备
|
||||||
|
teamLeaseInfo.setOutNum(bean.getOutNum());
|
||||||
|
teamLeaseInfo.setTypeId(bean.getTypeId());
|
||||||
|
teamLeaseInfo.setId(bean.getId());
|
||||||
|
teamLeaseInfo.setMaId(null);
|
||||||
|
num = mapper.addNewOperate(teamLeaseInfo);
|
||||||
|
if (teamLeaseInfo.getType() == 3) {
|
||||||
|
// 归还(增加库存)
|
||||||
|
mapper.addNum(teamLeaseInfo);
|
||||||
|
// 修改库存总量
|
||||||
|
mapper.updateOutNum(teamLeaseInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
|
|
||||||
|
|
@ -1100,6 +1100,7 @@
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
and lad.type_id = #{typeId}
|
and lad.type_id = #{typeId}
|
||||||
</if>
|
</if>
|
||||||
|
GROUP BY lad.type_id
|
||||||
</select>
|
</select>
|
||||||
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
|
<select id="getMaTypeDetails" resultType="com.bonus.sgzb.app.domain.TmTask">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -1215,5 +1216,6 @@
|
||||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
AND lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
AND lod.create_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
</if>
|
</if>
|
||||||
|
group by lod.type_id
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="bindTime" column="bind_time" />
|
<result property="bindTime" column="bind_time" />
|
||||||
<result property="userName" column="nick_name" />
|
<result property="userName" column="nick_name" />
|
||||||
|
<result property="assetsCode" column="assets_code" />
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
<select id="selectMaLabelBindList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult">
|
<select id="selectMaLabelBindList" parameterType="com.bonus.sgzb.base.vo.MaLabelBindVO" resultMap="MaLabelBindVOResult">
|
||||||
SELECT b.label_id,a.id,b.is_bind,b.label_code,a.bind_time,b.label_type,mt.type_id,mt.type_name,
|
SELECT b.label_id,a.id,b.is_bind,b.label_code,a.bind_time,b.label_type,mt.type_id,mt.type_name,
|
||||||
mt2.type_id as modelId , mt2.type_name as modelName,mt3.type_name as wpName,
|
mt2.type_id as modelId , mt2.type_name as modelName,mt3.type_name as wpName,
|
||||||
mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code,user.nick_name
|
mt4.type_name as kindName ,a.status,a.binder,dic.name,ma.ma_code,ma.assets_code,user.nick_name
|
||||||
FROM ma_machine_label b
|
FROM ma_machine_label b
|
||||||
left join ma_label_bind a on a.ma_id = b.ma_id
|
left join ma_label_bind a on a.ma_id = b.ma_id
|
||||||
LEFT JOIN ma_type mt ON a.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON a.type_id = mt.type_id
|
||||||
|
|
@ -219,7 +220,7 @@
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertMaLabel" useGeneratedKeys="true" keyProperty="maId">
|
<insert id="insertMaLabel" useGeneratedKeys="true" keyProperty="maId">
|
||||||
insert into ma_machine (type_id,ma_code,ma_status,qr_code,create_time)
|
insert into ma_machine (type_id,ma_code,ma_status,qr_code,assets_code,create_time)
|
||||||
values (#{typeId},#{maCode},'15',#{qrCode},now());
|
values (#{typeId},#{maCode},'15',#{qrCode},#{assetsCode},now());
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -55,4 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
ORDER BY su.user_id DESC
|
ORDER BY su.user_id DESC
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getUsers" resultType="java.lang.Integer">
|
||||||
|
select user_id from ma_type_keeper where type_id = #{typeId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -7,6 +7,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
insert into team_lease_info (agreement_id,type_id,team_name,lease_man,phone,num,create_by,create_time,type)
|
insert into team_lease_info (agreement_id,type_id,team_name,lease_man,phone,num,create_by,create_time,type)
|
||||||
values (#{agreementId},#{typeId},#{teamName},#{leaseMan},#{phone},#{num},#{createBy},now(),#{type});
|
values (#{agreementId},#{typeId},#{teamName},#{leaseMan},#{phone},#{num},#{createBy},now(),#{type});
|
||||||
</insert>
|
</insert>
|
||||||
|
<update id="updateConfig">
|
||||||
|
UPDATE second_lot_config
|
||||||
|
SET name = #{name},
|
||||||
|
unit_id = #{unitId},
|
||||||
|
updater = #{updater},
|
||||||
|
update_time = now()
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="updateMachine">
|
||||||
|
UPDATE ma_machine
|
||||||
|
SET
|
||||||
|
ma_status = #{maStatus}
|
||||||
|
WHERE
|
||||||
|
ma_id = #{maId}
|
||||||
|
</update>
|
||||||
|
<update id="updateOutNum">
|
||||||
|
UPDATE lease_out_details
|
||||||
|
SET
|
||||||
|
out_num = out_num - #{outNum}
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</update>
|
||||||
|
<delete id="delConfig">
|
||||||
|
DELETE FROM second_lot_config
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteOutNum">
|
||||||
|
DELETE FROM lease_out_details
|
||||||
|
WHERE parent_id = #{parentId}
|
||||||
|
AND ma_id = #{maId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
|
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -14,18 +47,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
lod.id as id,
|
lod.id as id,
|
||||||
tta.agreement_id AS agreementId,
|
tta.agreement_id AS agreementId,
|
||||||
bui.unit_name AS unitName,
|
bui.unit_name AS unitName,
|
||||||
bp.lot_name AS proName,
|
|
||||||
mt1.type_name AS typeName,
|
mt1.type_name AS typeName,
|
||||||
mt.type_name AS modelName,
|
mt.type_name AS modelName,
|
||||||
|
mt.manage_type as manageType,
|
||||||
mt.unit_name AS nuitName,
|
mt.unit_name AS nuitName,
|
||||||
lod.type_id AS typeId,
|
lod.type_id AS typeId,
|
||||||
|
group_concat(lod.ma_id) AS maIds,
|
||||||
IFNULL(SUM( lod.out_num ),0) AS Num
|
IFNULL(SUM( lod.out_num ),0) AS Num
|
||||||
|
|
||||||
from lease_out_details lod
|
from lease_out_details lod
|
||||||
left join lease_apply_info lai on lod.parent_id=lai.id
|
left join lease_apply_info lai on lod.parent_id=lai.id
|
||||||
left join tm_task_agreement tta on lai.task_id=tta.task_id
|
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_agreement_info bai ON tta.agreement_id = bai.agreement_id
|
||||||
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
|
|
||||||
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
|
||||||
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
|
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
|
||||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||||
|
|
@ -33,9 +65,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="unitId != null and unitId != ''">
|
<if test="unitId != null and unitId != ''">
|
||||||
and bui.unit_id = #{unitId}
|
and bui.unit_id = #{unitId}
|
||||||
</if>
|
</if>
|
||||||
<if test="proId != null and proId != ''">
|
|
||||||
and bp.lot_id = #{proId}
|
|
||||||
</if>
|
|
||||||
<if test="typeId != null and typeId != ''">
|
<if test="typeId != null and typeId != ''">
|
||||||
and mt1.type_id = #{typeId}
|
and mt1.type_id = #{typeId}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -47,7 +76,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
and (bui.unit_name like concat('%', #{keyword}, '%') or
|
and (bui.unit_name like concat('%', #{keyword}, '%') or
|
||||||
bp.lot_name like concat('%', #{keyword}, '%') or
|
|
||||||
mt1.type_name like concat('%', #{keyword}, '%') or
|
mt1.type_name like concat('%', #{keyword}, '%') or
|
||||||
mt.type_name like concat('%', #{keyword}, '%')
|
mt.type_name like concat('%', #{keyword}, '%')
|
||||||
)
|
)
|
||||||
|
|
@ -274,13 +302,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectStockNum" resultType="java.lang.Integer">
|
<select id="selectStockNum" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT(
|
||||||
(
|
SUM(IF( rd.type = 1, rd.out_num, 0 )) -
|
||||||
SUM(
|
SUM(IF( rd.type = 2, rd.out_num, 0 ))) AS receiveNum
|
||||||
IF
|
|
||||||
( rd.type = 1, rd.out_num, 0 )) - SUM(
|
|
||||||
IF
|
|
||||||
( rd.type = 2, rd.out_num, 0 ))) AS receiveNum
|
|
||||||
FROM
|
FROM
|
||||||
receive_detail rd
|
receive_detail rd
|
||||||
WHERE
|
WHERE
|
||||||
|
|
@ -289,20 +313,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="getNewRecords" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
<select id="getNewRecords" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
||||||
select mt.type_name modelName,
|
select mt.type_name modelName,
|
||||||
mt2.type_name typeName,
|
mt2.type_name typeName,
|
||||||
su.nick_name nickName,
|
mt.unit_name unitName,
|
||||||
rd.out_num outNum,
|
rd.out_num outNum,
|
||||||
rd.pick_name pickName,
|
rd.pick_name pickName,
|
||||||
rd.out_time outTime
|
rd.out_time outTime,
|
||||||
|
slc.name secondName,
|
||||||
|
tg.name groupName
|
||||||
from receive_detail rd
|
from receive_detail rd
|
||||||
|
left join second_lot_config slc on rd.unit_id = slc.unit_id
|
||||||
|
LEFT JOIN team_group tg on tg.id = rd.team_group_id
|
||||||
left join ma_type mt on rd.type_id = mt.type_id
|
left join ma_type mt on rd.type_id = mt.type_id
|
||||||
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
left join ma_type mt2 on mt.parent_id = mt2.type_id
|
||||||
left join sys_user su on rd.out_name = su.user_id
|
where rd.type = #{type}
|
||||||
where rd.type = 1
|
<if test="teamGroupId != null">
|
||||||
<if test="typeId != null and typeId != ''">
|
and rd.team_group_id = #{teamGroupId}
|
||||||
and mt2.type_id = #{typeId}
|
|
||||||
</if>
|
</if>
|
||||||
<if test="modelId != null and modelId != ''">
|
<if test="pickName != null and pickName != ''">
|
||||||
and mt.type_id = #{modelId}
|
and rd.pick_name = #{pickName}
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != '' ">
|
||||||
|
AND rd.out_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
and rd.unit_id = #{unitId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectStockNum1" resultType="java.lang.Integer">
|
<select id="selectStockNum1" resultType="java.lang.Integer">
|
||||||
|
|
@ -318,10 +351,185 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE
|
WHERE
|
||||||
parent_id = #{id}
|
parent_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectConfigByLotId" resultType="com.bonus.sgzb.material.domain.SecondLotConfig">
|
||||||
|
select * from second_lot_config where unit_id = #{unitId} limit 1
|
||||||
|
</select>
|
||||||
|
<select id="listConfig" resultType="com.bonus.sgzb.material.domain.SecondLotConfig">
|
||||||
|
select slc.*, bui.unit_name from second_lot_config slc
|
||||||
|
left join bm_unit_info bui on slc.unit_id = bui.unit_id
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and slc.name like concat('%',#{name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
and slc.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="listTeamGroup" resultType="com.bonus.sgzb.material.domain.TeamGroup">
|
||||||
|
select tg.*, bui.unit_name from team_group tg
|
||||||
|
left join bm_unit_info bui on tg.unit_id = bui.unit_id
|
||||||
|
<where>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and tg.name like concat('%',#{name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="unitId != null">
|
||||||
|
and tg.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="getMaStatusByMaId" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||||
|
select mm.*,
|
||||||
|
mt.type_name modelName,
|
||||||
|
mt2.type_name typeName
|
||||||
|
from ma_machine mm
|
||||||
|
left join ma_type mt on mm.type_id = mt.type_id
|
||||||
|
left join ma_type mt2 on mt2.type_id = mt.parent_id
|
||||||
|
where ma_id = #{maId}
|
||||||
|
</select>
|
||||||
|
<select id="getUseMaStatusByMaId" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||||
|
SELECT DISTINCT
|
||||||
|
mt.type_name modelName,
|
||||||
|
mt.manage_type manageType,
|
||||||
|
mt2.type_name typeName,
|
||||||
|
rd.type_id typeId,
|
||||||
|
rd.parent_id as id,
|
||||||
|
mt.unit_name AS nuitName,
|
||||||
|
SUM( rd.out_num ) receiveNum,
|
||||||
|
GROUP_CONCAT( rd.ma_id ) maIds
|
||||||
|
FROM
|
||||||
|
receive_detail rd
|
||||||
|
LEFT JOIN ma_machine mm ON rd.ma_id = mm.ma_id
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE
|
||||||
|
rd.type IN ( '1', '2' )
|
||||||
|
AND mm.ma_status = 132
|
||||||
|
AND rd.team_group_id = #{teamGroupId}
|
||||||
|
AND rd.unit_id = #{unitId}
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd2
|
||||||
|
WHERE
|
||||||
|
rd2.ma_id = rd.ma_id
|
||||||
|
AND ((
|
||||||
|
rd2.type = '1'
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd3
|
||||||
|
WHERE
|
||||||
|
rd3.ma_id = rd.ma_id
|
||||||
|
AND rd3.type = '2'
|
||||||
|
AND rd3.type_id = rd2.type_id
|
||||||
|
AND rd3.team_group_id = rd2.team_group_id
|
||||||
|
AND rd3.unit_id = rd2.unit_id
|
||||||
|
))
|
||||||
|
OR (
|
||||||
|
rd2.type = '2'
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd4
|
||||||
|
WHERE
|
||||||
|
rd4.ma_id = rd.ma_id
|
||||||
|
AND rd4.type = '1'
|
||||||
|
AND rd4.type_id = rd2.type_id
|
||||||
|
AND rd4.team_group_id = rd2.team_group_id
|
||||||
|
AND rd4.unit_id = rd2.unit_id
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
GROUP BY
|
||||||
|
rd.type_id UNION
|
||||||
|
SELECT DISTINCT
|
||||||
|
mt.type_name modelName,
|
||||||
|
mt.manage_type manageType,
|
||||||
|
mt2.type_name typeName,
|
||||||
|
rd.type_id typeId,
|
||||||
|
rd.parent_id as id,
|
||||||
|
mt.unit_name AS nuitName,
|
||||||
|
(SUM(CASE WHEN rd.type = '1' THEN rd.out_num ELSE 0 END)
|
||||||
|
- SUM(CASE WHEN rd.type = '2' THEN rd.out_num ELSE 0 END)) AS receiveNum,
|
||||||
|
GROUP_CONCAT( rd.ma_id ) maIds
|
||||||
|
FROM
|
||||||
|
receive_detail rd
|
||||||
|
LEFT JOIN ma_type mt ON mt.type_id = rd.type_id
|
||||||
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
|
WHERE
|
||||||
|
rd.type IN ( '1', '2' )
|
||||||
|
AND rd.team_group_id = #{teamGroupId}
|
||||||
|
AND rd.ma_id IS NULL
|
||||||
|
AND rd.unit_id = #{unitId}
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd2
|
||||||
|
WHERE
|
||||||
|
rd2.ma_id = rd.ma_id
|
||||||
|
AND ((
|
||||||
|
rd2.type = '1'
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd3
|
||||||
|
WHERE
|
||||||
|
rd3.ma_id = rd.ma_id
|
||||||
|
AND rd3.type = '2'
|
||||||
|
AND rd3.type_id = rd2.type_id
|
||||||
|
AND rd3.team_group_id = rd2.team_group_id
|
||||||
|
AND rd3.unit_id = rd2.unit_id
|
||||||
|
))
|
||||||
|
OR (
|
||||||
|
rd2.type = '2'
|
||||||
|
AND EXISTS (
|
||||||
|
SELECT
|
||||||
|
1
|
||||||
|
FROM
|
||||||
|
receive_detail rd4
|
||||||
|
WHERE
|
||||||
|
rd4.ma_id = rd.ma_id
|
||||||
|
AND rd4.type = '1'
|
||||||
|
AND rd4.type_id = rd2.type_id
|
||||||
|
AND rd4.team_group_id = rd2.team_group_id
|
||||||
|
AND rd4.unit_id = rd2.unit_id
|
||||||
|
)))
|
||||||
|
)
|
||||||
|
GROUP BY
|
||||||
|
rd.type_id
|
||||||
|
</select>
|
||||||
|
<select id="getDevCount" resultType="java.lang.Integer">
|
||||||
|
SELECT
|
||||||
|
(SUM(CASE WHEN type = 1 THEN rd.out_num ELSE 0 END) -
|
||||||
|
SUM(CASE WHEN type = 2 THEN rd.out_num ELSE 0 END)) AS count
|
||||||
|
FROM receive_detail rd
|
||||||
|
WHERE type_id = #{typeId}
|
||||||
|
GROUP BY unit_id, team_group_id
|
||||||
|
</select>
|
||||||
|
<select id="selectParentId" resultType="java.lang.Integer">
|
||||||
|
SELECT parent_id
|
||||||
|
FROM lease_out_details
|
||||||
|
WHERE id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="addConfig">
|
||||||
|
insert into second_lot_config (name,unit_id,creater,create_time)
|
||||||
|
values (#{name},#{unitId},#{creater},now());
|
||||||
|
</insert>
|
||||||
|
<insert id="addTeamGroup">
|
||||||
|
insert into team_group (name, unit_id, creater, create_time)
|
||||||
|
values (#{name}, #{unitId}, #{creater}, now());
|
||||||
|
</insert>
|
||||||
<insert id="addNewOperate">
|
<insert id="addNewOperate">
|
||||||
insert into receive_detail (parent_id,type_id,out_num,out_time,type,out_name,pick_name)
|
insert into receive_detail (parent_id,type_id,ma_id,out_num,out_time,type,cteater,pick_name,unit_id,team_group_id,phone)
|
||||||
values (#{id},#{typeId},#{outNum},now(),#{type},#{createBy},#{leaseMan});
|
values (#{id},#{typeId},#{maId},#{outNum},now(),#{type},#{createBy},#{leaseMan},#{unitId},#{teamGroupId},#{phone});
|
||||||
|
</insert>
|
||||||
|
<insert id="addNum">
|
||||||
|
update ma_type set num = num + #{outNum} where type_id = #{typeId}
|
||||||
</insert>
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue