二级库功能修改+审计漏洞修复
This commit is contained in:
parent
39a952ae4c
commit
6b034e61d8
|
|
@ -128,6 +128,7 @@ public class TmTaskController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "删除任务", businessType = BusinessType.DELETE)
|
@Log(title = "删除任务", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{taskId}")
|
@DeleteMapping("/{taskId}")
|
||||||
|
@RequiresPermissions("picking:apply:del")
|
||||||
public AjaxResult deleteTaskInfoByTaskId(@PathVariable String taskId) {
|
public AjaxResult deleteTaskInfoByTaskId(@PathVariable String taskId) {
|
||||||
if (StringUtils.isEmpty(taskId)) {
|
if (StringUtils.isEmpty(taskId)) {
|
||||||
return AjaxResult.error("参数错误,删除失败!");
|
return AjaxResult.error("参数错误,删除失败!");
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ import java.util.stream.Collectors;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/base/bmUnitInfo")
|
@RequestMapping("/base/bmUnitInfo")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class BmUnitInfoController extends BaseController{
|
public class BmUnitInfoController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BmUnitInfoService bmUnitInfoService;
|
private BmUnitInfoService bmUnitInfoService;
|
||||||
|
|
@ -46,31 +46,30 @@ public class BmUnitInfoController extends BaseController{
|
||||||
@ApiOperation(value = "获取往来单位列表")
|
@ApiOperation(value = "获取往来单位列表")
|
||||||
@GetMapping("/unitInfoAll")
|
@GetMapping("/unitInfoAll")
|
||||||
@RequiresPermissions("comeAndGo:list")
|
@RequiresPermissions("comeAndGo:list")
|
||||||
public TableDataInfo getUnitInfoAll(BmUnitInfo bmUnitInfo)
|
public TableDataInfo getUnitInfoAll(BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单位类型配置表bm_unit_type(同数据字典合并)列表
|
* 查询单位类型配置表bm_unit_type(同数据字典合并)列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询单位类型")
|
@ApiOperation("查询单位类型")
|
||||||
@GetMapping("/typeList")
|
@GetMapping("/typeList")
|
||||||
public TableDataInfo typeList(BmUnitInfo bmUnitInfo)
|
public TableDataInfo typeList(BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<BmUnitInfo> list = bmUnitInfoService.selectTypeList(bmUnitInfo);
|
List<BmUnitInfo> list = bmUnitInfoService.selectTypeList(bmUnitInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询单位类型配置表bm_unit_type(同数据字典合并)列表
|
* 查询单位类型配置表bm_unit_type(同数据字典合并)列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询单位类型")
|
@ApiOperation("查询单位类型")
|
||||||
@GetMapping("/userList")
|
@GetMapping("/userList")
|
||||||
public TableDataInfo UserAll(SysUser sysUser)
|
public TableDataInfo UserAll(SysUser sysUser) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<SysUser> list = bmUnitInfoService.getUserAll(sysUser);
|
List<SysUser> list = bmUnitInfoService.getUserAll(sysUser);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
|
|
@ -81,8 +80,7 @@ public class BmUnitInfoController extends BaseController{
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "获取往来单位下拉选")
|
@ApiOperation(value = "获取往来单位下拉选")
|
||||||
@GetMapping("/getUnitInfoSelect")
|
@GetMapping("/getUnitInfoSelect")
|
||||||
public AjaxResult getUnitInfoSelect(BmUnitInfo bmUnitInfo)
|
public AjaxResult getUnitInfoSelect(BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
|
|
||||||
|
|
@ -93,13 +91,13 @@ public class BmUnitInfoController extends BaseController{
|
||||||
* 根据条件进行查询往来单位
|
* 根据条件进行查询往来单位
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "根据条件进行查询往来单位")
|
@ApiOperation(value = "根据条件进行查询往来单位")
|
||||||
@PostMapping ("/getUnitInfo")
|
@PostMapping("/getUnitInfo")
|
||||||
public TableDataInfo getUnitInfo(@Validated @RequestBody BmUnitInfo bmUnitInfo)
|
public TableDataInfo getUnitInfo(@Validated @RequestBody BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfo(bmUnitInfo);
|
List<BmUnitInfo> list = bmUnitInfoService.getUnitInfo(bmUnitInfo);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增往来单位
|
* 新增往来单位
|
||||||
*/
|
*/
|
||||||
|
|
@ -107,8 +105,7 @@ public class BmUnitInfoController extends BaseController{
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@RequiresPermissions("comeAndGo:list:add")
|
@RequiresPermissions("comeAndGo:list:add")
|
||||||
public AjaxResult unitInfoAdd(@Validated @RequestBody BmUnitInfo bmUnitInfo)
|
public AjaxResult unitInfoAdd(@Validated @RequestBody BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
log.info("新增往来单位参数:{}", bmUnitInfo);
|
log.info("新增往来单位参数:{}", bmUnitInfo);
|
||||||
return bmUnitInfoService.unitInfoAdd(bmUnitInfo);
|
return bmUnitInfoService.unitInfoAdd(bmUnitInfo);
|
||||||
}
|
}
|
||||||
|
|
@ -125,14 +122,18 @@ public class BmUnitInfoController extends BaseController{
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除往来单位
|
* 批量删除往来单位
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "批量删除往来单位")
|
@ApiOperation(value = "批量删除往来单位")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping ("/{unitId}")
|
@DeleteMapping("/{unitId}")
|
||||||
public AjaxResult deleteUnitInfoById(@PathVariable Long unitId)
|
public AjaxResult deleteUnitInfoById(@PathVariable Long unitId) {
|
||||||
{
|
// 首先判断是否已经绑定了二级库
|
||||||
|
if (bmUnitInfoService.selectUnitBind(unitId) > 0) {
|
||||||
|
return AjaxResult.error("该往来单位已绑定二级库,无法删除");
|
||||||
|
}
|
||||||
bmUnitInfoService.deleteUnitInfoById(unitId);
|
bmUnitInfoService.deleteUnitInfoById(unitId);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
@ -143,17 +144,16 @@ public class BmUnitInfoController extends BaseController{
|
||||||
@ApiOperation(value = "修改往来单位")
|
@ApiOperation(value = "修改往来单位")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody BmUnitInfo bmUnitInfo)
|
public AjaxResult edit(@Validated @RequestBody BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
|
|
||||||
return bmUnitInfoService.updateBmUnitInfo(bmUnitInfo);
|
return bmUnitInfoService.updateBmUnitInfo(bmUnitInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "往来单位导出")
|
@ApiOperation(value = "往来单位导出")
|
||||||
@Log(title = "往来单位导出", businessType = BusinessType.EXPORT)
|
@Log(title = "往来单位导出", businessType = BusinessType.EXPORT)
|
||||||
@RequiresPermissions("system:user:export")
|
@RequiresPermissions("system:user:export")
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, BmUnitInfo bmUnitInfo)
|
public void export(HttpServletResponse response, BmUnitInfo bmUnitInfo) {
|
||||||
{
|
|
||||||
List<BmUnitInfo> list;
|
List<BmUnitInfo> list;
|
||||||
list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
list = bmUnitInfoService.getUnitInfoAll(bmUnitInfo);
|
||||||
//根据前端列表选中选择性列表导出
|
//根据前端列表选中选择性列表导出
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.bonus.sgzb.common.core.constant.Constants;
|
||||||
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;
|
||||||
|
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 org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
@ -149,11 +150,12 @@ public class MaPartTypeController extends BaseController {
|
||||||
* @param paId
|
* @param paId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{paId}")
|
/* @GetMapping("/{paId}")
|
||||||
|
@RequiresPermissions("base:maPartType:paId")
|
||||||
public AjaxResult getById (@PathVariable("paId") Long paId){
|
public AjaxResult getById (@PathVariable("paId") Long paId){
|
||||||
MaPartType bean = maPartTypeService.getById(paId);
|
MaPartType bean = maPartTypeService.getById(paId);
|
||||||
return AjaxResult.success(bean);
|
return AjaxResult.success(bean);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id修改数据
|
* 根据id修改数据
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.bonus.sgzb.base.service.MaTypeHisPriceService;
|
||||||
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;
|
||||||
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
|
||||||
|
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -45,21 +46,23 @@ public class MaTypeHisPriceController extends BaseController {
|
||||||
/**
|
/**
|
||||||
* 删除机具历史租赁价格
|
* 删除机具历史租赁价格
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{typeIds}")
|
/*@DeleteMapping("/{typeIds}")
|
||||||
|
@RequiresPermissions("base:typeHisPrice:remove")
|
||||||
public AjaxResult remove(@PathVariable Long[] typeIds)
|
public AjaxResult remove(@PathVariable Long[] typeIds)
|
||||||
{
|
{
|
||||||
maTypeHisPriceService.remove(typeIds);
|
maTypeHisPriceService.remove(typeIds);
|
||||||
return success();
|
return success();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改机机具历史租赁价格
|
* 修改机机具历史租赁价格
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
/* @PutMapping
|
||||||
|
@RequiresPermissions("base:typeHisPrice:updateTypeHisPrice")
|
||||||
public AjaxResult updateTypeHisPrice(@Validated @RequestBody MaTypeHisPrice maTypeHisPrice)
|
public AjaxResult updateTypeHisPrice(@Validated @RequestBody MaTypeHisPrice maTypeHisPrice)
|
||||||
{
|
{
|
||||||
|
|
||||||
return toAjax(maTypeHisPriceService.updateTypeHisPrice(maTypeHisPrice));
|
return toAjax(maTypeHisPriceService.updateTypeHisPrice(maTypeHisPrice));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,4 +21,6 @@ public interface BmUnitPersonMapper {
|
||||||
public void remove(Long[] unitIds);
|
public void remove(Long[] unitIds);
|
||||||
|
|
||||||
public int updateBmUnitPerson(BmUnitPerson bmUnitPerson);
|
public int updateBmUnitPerson(BmUnitPerson bmUnitPerson);
|
||||||
|
|
||||||
|
Integer selectUnitBind(Long unitId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,4 +37,6 @@ public interface BmUnitInfoService {
|
||||||
public int deleteUnitInfoById(Long unitId);
|
public int deleteUnitInfoById(Long unitId);
|
||||||
|
|
||||||
String importUser(List<BmUnitInfo> bmUnitInfoList, boolean updateSupport, Long userId);
|
String importUser(List<BmUnitInfo> bmUnitInfoList, boolean updateSupport, Long userId);
|
||||||
|
|
||||||
|
Integer selectUnitBind(Long unitId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,4 +92,9 @@ public class BmUnitInfoServiceImpl implements BmUnitInfoService {
|
||||||
}
|
}
|
||||||
return "导入成功";
|
return "导入成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer selectUnitBind(Long unitId) {
|
||||||
|
return bmUnitPersonMapper.selectUnitBind(unitId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -96,6 +97,9 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
@ApiOperation(value = "班组库存台账")
|
@ApiOperation(value = "班组库存台账")
|
||||||
@GetMapping("/getDevStockCount")
|
@GetMapping("/getDevStockCount")
|
||||||
public TableDataInfo getDevStockCount(SecondaryWarehouse bean) {
|
public TableDataInfo getDevStockCount(SecondaryWarehouse bean) {
|
||||||
|
if (bean.getUnitId() == null) {
|
||||||
|
return getDataTable(new ArrayList<>());
|
||||||
|
}
|
||||||
startPage();
|
startPage();
|
||||||
return getDataTable(service.getDevStockCount(bean));
|
return getDataTable(service.getDevStockCount(bean));
|
||||||
}
|
}
|
||||||
|
|
@ -148,14 +152,14 @@ public class SecondaryWarehouseController extends BaseController {
|
||||||
|
|
||||||
@ApiOperation(value = "二级库报废申请")
|
@ApiOperation(value = "二级库报废申请")
|
||||||
@PostMapping("/seconfScrap")
|
@PostMapping("/seconfScrap")
|
||||||
public AjaxResult seconfScrap(SecondCcrapApplyDetails bean) {
|
public AjaxResult seconfScrap(@RequestBody SecondCcrapApplyDetails bean) {
|
||||||
Integer i = service.seconfScrap(bean);
|
Integer i = service.seconfScrap(bean);
|
||||||
return toAjax(i);
|
return toAjax(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "二级库报废审核(通过/驳回)")
|
@ApiOperation(value = "二级库报废审核(通过/驳回)")
|
||||||
@PostMapping("/auditSeconfScrap")
|
@PostMapping("/auditSeconfScrap")
|
||||||
public AjaxResult auditSeconfScrap(SecondCcrapApplyDetails bean) {
|
public AjaxResult auditSeconfScrap(@RequestBody SecondCcrapApplyDetails bean) {
|
||||||
Integer i = service.auditSeconfScrap(bean);
|
Integer i = service.auditSeconfScrap(bean);
|
||||||
return toAjax(i);
|
return toAjax(i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ public class TeamLeaseInfo {
|
||||||
*/
|
*/
|
||||||
private String startTime;
|
private String startTime;
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
private String auditRemark;
|
||||||
private String companyId;
|
private String companyId;
|
||||||
/**
|
/**
|
||||||
* 协议id
|
* 协议id
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,9 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
if (bean.getType() == 2) {
|
if (bean.getType() == 2) {
|
||||||
// for (String maId : bean.getMaIds().split(",")) {
|
// for (String maId : bean.getMaIds().split(",")) {
|
||||||
List<MaMachine> maMachine = mapper.getUseMaStatusByMaId(/*maId,*/ bean.getTeamGroupId(), bean.getUnitId());
|
List<MaMachine> maMachine = mapper.getUseMaStatusByMaId(/*maId,*/ bean.getTeamGroupId(), bean.getUnitId());
|
||||||
if (maMachine != null) {
|
List<MaMachine> maList = maMachine.stream().filter(t -> t.getReceiveNum() != 0).collect(Collectors.toList());
|
||||||
list.addAll(maMachine);
|
if (maList != null) {
|
||||||
|
list.addAll(maList);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
@ -174,6 +175,7 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
teamLeaseInfo.setScrapNum(1);
|
teamLeaseInfo.setScrapNum(1);
|
||||||
teamLeaseInfo.setCode(code);
|
teamLeaseInfo.setCode(code);
|
||||||
teamLeaseInfo.setStatus(0);
|
teamLeaseInfo.setStatus(0);
|
||||||
|
teamLeaseInfo.setAuditRemark(bean.getAuditRemark());
|
||||||
num = mapper.secondScrapApplyDetails(teamLeaseInfo);
|
num = mapper.secondScrapApplyDetails(teamLeaseInfo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -183,6 +185,7 @@ public class SecondaryWarehouseServiceImpl implements SecondaryWarehouseService
|
||||||
teamLeaseInfo.setMaId(null);
|
teamLeaseInfo.setMaId(null);
|
||||||
teamLeaseInfo.setCode(code);
|
teamLeaseInfo.setCode(code);
|
||||||
teamLeaseInfo.setStatus(0);
|
teamLeaseInfo.setStatus(0);
|
||||||
|
teamLeaseInfo.setAuditRemark(bean.getAuditRemark());
|
||||||
num = mapper.secondScrapApplyDetails(teamLeaseInfo);
|
num = mapper.secondScrapApplyDetails(teamLeaseInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<include refid="bmUnitPerson"/>
|
<include refid="bmUnitPerson"/>
|
||||||
where unit_id = #{unitId}
|
where unit_id = #{unitId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectUnitBind" resultType="java.lang.Integer">
|
||||||
|
select count(1) from second_lot_config where unit_id = #{unitId}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="unitPersonAdd" parameterType="com.bonus.sgzb.base.domain.BmUnitPerson">
|
<insert id="unitPersonAdd" parameterType="com.bonus.sgzb.base.domain.BmUnitPerson">
|
||||||
insert into bm_unit_person (
|
insert into bm_unit_person (
|
||||||
|
|
|
||||||
|
|
@ -360,6 +360,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="unitId != null">
|
<if test="unitId != null">
|
||||||
and rd.unit_id = #{unitId}
|
and rd.unit_id = #{unitId}
|
||||||
</if>
|
</if>
|
||||||
|
order by rd.out_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="selectStockNum1" resultType="java.lang.Integer">
|
<select id="selectStockNum1" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -511,57 +512,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE id = #{id}
|
WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="getDevStockCount" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
<select id="getDevStockCount" resultType="com.bonus.sgzb.base.api.domain.MaMachine">
|
||||||
|
|
||||||
SELECT DISTINCT
|
SELECT DISTINCT
|
||||||
mt.type_name modelName,
|
mt.type_name modelName,
|
||||||
mt.manage_type manageType,
|
mt.manage_type manageType,
|
||||||
mt2.type_name typeName,
|
mt2.type_name typeName,
|
||||||
rd.type_id typeId,
|
rd.type_id typeId,
|
||||||
tg.NAME groupName,
|
tg.NAME groupName,
|
||||||
rd.parent_id AS id,
|
|
||||||
slc.name as name,
|
slc.name as name,
|
||||||
mt.unit_name AS unitName,
|
mt.unit_name AS nuitName,
|
||||||
SUM(rd.out_num) receiveNum,
|
SUM(rd.out_num) receiveNum,
|
||||||
GROUP_CONCAT(rd.ma_id) maIds
|
GROUP_CONCAT(rd.ma_id) maIds
|
||||||
FROM (
|
FROM (
|
||||||
SELECT rd.*,
|
SELECT
|
||||||
(SELECT type1_count FROM (SELECT tc.ma_id, tc.type1_count FROM (SELECT rd.ma_id,
|
rd.*,
|
||||||
SUM(CASE WHEN rd.type = '1' THEN 1 ELSE 0 END) AS type1_count,
|
tc.type1_count,
|
||||||
SUM(CASE WHEN rd.type = '2' THEN 1 ELSE 0 END) AS type2_count
|
tc.type2_count,
|
||||||
FROM receive_detail rd
|
|
||||||
WHERE rd.type IN ('1', '2')
|
|
||||||
<if test="unitId != null">
|
|
||||||
AND rd.unit_id = #{unitId}
|
|
||||||
</if>
|
|
||||||
GROUP BY rd.ma_id) tc WHERE tc.ma_id = rd.ma_id) ttc) AS type1_count,
|
|
||||||
(SELECT type2_count FROM (SELECT tc.ma_id, tc.type2_count FROM (SELECT rd.ma_id,
|
|
||||||
SUM(CASE WHEN rd.type = '1' THEN 1 ELSE 0 END) AS type1_count,
|
|
||||||
SUM(CASE WHEN rd.type = '2' THEN 1 ELSE 0 END) AS type2_count
|
|
||||||
FROM receive_detail rd
|
|
||||||
WHERE rd.type IN ('1', '2')
|
|
||||||
<if test="unitId != null">
|
|
||||||
AND rd.unit_id = #{unitId}
|
|
||||||
</if>
|
|
||||||
GROUP BY rd.ma_id) tc WHERE tc.ma_id = rd.ma_id) ttc) AS type2_count,
|
|
||||||
@rn := IF(@prev_ma_id = rd.ma_id AND @prev_type = rd.type, @rn + 1, 1) AS rn,
|
@rn := IF(@prev_ma_id = rd.ma_id AND @prev_type = rd.type, @rn + 1, 1) AS rn,
|
||||||
@prev_ma_id := rd.ma_id,
|
@prev_ma_id := rd.ma_id,
|
||||||
@prev_type := rd.type
|
@prev_type := rd.type
|
||||||
FROM receive_detail rd,
|
FROM receive_detail rd,
|
||||||
|
(SELECT
|
||||||
|
rd.ma_id,
|
||||||
|
SUM(CASE WHEN rd.type = '1' THEN 1 ELSE 0 END) as type1_count,
|
||||||
|
SUM(CASE WHEN rd.type = '2' THEN 1 ELSE 0 END) as type2_count
|
||||||
|
FROM receive_detail rd
|
||||||
|
WHERE rd.type IN ('1', '2')
|
||||||
|
|
||||||
|
<if test="unitId != null">
|
||||||
|
AND rd.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
GROUP BY rd.ma_id) tc,
|
||||||
(SELECT @prev_ma_id := NULL, @prev_type := NULL, @rn := 0) vars
|
(SELECT @prev_ma_id := NULL, @prev_type := NULL, @rn := 0) vars
|
||||||
WHERE rd.type IN ('1', '2')
|
WHERE rd.type IN ('1', '2')
|
||||||
<if test="unitId != null">
|
<if test="unitId != null">
|
||||||
AND rd.unit_id = #{unitId}
|
AND rd.unit_id = #{unitId}
|
||||||
</if>
|
</if>
|
||||||
|
AND rd.ma_id = tc.ma_id
|
||||||
ORDER BY rd.ma_id, rd.type, rd.out_num DESC
|
ORDER BY rd.ma_id, rd.type, rd.out_num DESC
|
||||||
) rd
|
) rd
|
||||||
|
LEFT JOIN ma_machine mm ON rd.ma_id = mm.ma_id
|
||||||
LEFT JOIN team_group tg ON rd.team_group_id = tg.id
|
LEFT JOIN team_group tg ON rd.team_group_id = tg.id
|
||||||
LEFT JOIN second_lot_config slc ON rd.unit_id = slc.unit_id
|
LEFT JOIN second_lot_config slc ON rd.unit_id = slc.unit_id
|
||||||
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 mt ON mt.type_id = mm.type_id
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
WHERE mm.ma_status = 132
|
WHERE mm.ma_status = 132
|
||||||
<if test="keyword != null and keyword != ''">
|
<if test="keyword != null and keyword != ''">
|
||||||
AND tg.NAME LIKE CONCAT('%', #{keyword}, '%')
|
AND tg.NAME like concat('%', #{keyword}, '%')
|
||||||
</if>
|
</if>
|
||||||
AND ((rd.type = '1' AND rd.rn <= GREATEST(0, rd.type1_count - rd.type2_count))
|
AND ((rd.type = '1' AND rd.rn <= GREATEST(0, rd.type1_count - rd.type2_count))
|
||||||
OR (rd.type = '2' AND rd.rn <= GREATEST(0, rd.type2_count - rd.type1_count)))
|
OR (rd.type = '2' AND rd.rn <= GREATEST(0, rd.type2_count - rd.type1_count)))
|
||||||
|
|
@ -575,7 +571,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt2.type_name typeName,
|
mt2.type_name typeName,
|
||||||
rd.type_id typeId,
|
rd.type_id typeId,
|
||||||
tg.NAME groupName,
|
tg.NAME groupName,
|
||||||
rd.parent_id as id,
|
|
||||||
slc.name as name,
|
slc.name as name,
|
||||||
mt.unit_name AS nuitName,
|
mt.unit_name AS nuitName,
|
||||||
(SUM(CASE WHEN rd.type = '1' THEN rd.out_num ELSE 0 END)
|
(SUM(CASE WHEN rd.type = '1' THEN rd.out_num ELSE 0 END)
|
||||||
|
|
@ -588,18 +583,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
WHERE rd.type IN ('1', '2')
|
WHERE rd.type IN ('1', '2')
|
||||||
AND rd.ma_id IS NULL
|
AND rd.ma_id IS NULL
|
||||||
<if test="keyword != null and keyword != ''">
|
|
||||||
AND tg.NAME LIKE CONCAT('%', #{keyword}, '%')
|
|
||||||
</if>
|
|
||||||
<if test="unitId != null">
|
<if test="unitId != null">
|
||||||
AND rd.unit_id = #{unitId}
|
AND rd.unit_id = #{unitId}
|
||||||
|
</if>
|
||||||
|
<if test="keyword != null and keyword != ''">
|
||||||
|
AND tg.NAME like concat('%', #{keyword}, '%')
|
||||||
</if>
|
</if>
|
||||||
AND NOT EXISTS (
|
AND NOT EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM receive_detail rd2
|
FROM receive_detail rd2
|
||||||
WHERE rd2.ma_id = rd.ma_id
|
WHERE rd2.ma_id = rd.ma_id
|
||||||
AND ((
|
AND ((rd2.type = '1'
|
||||||
rd2.type = '1'
|
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM receive_detail rd3
|
FROM receive_detail rd3
|
||||||
|
|
@ -607,10 +601,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND rd3.type = '2'
|
AND rd3.type = '2'
|
||||||
AND rd3.type_id = rd2.type_id
|
AND rd3.type_id = rd2.type_id
|
||||||
AND rd3.team_group_id = rd2.team_group_id
|
AND rd3.team_group_id = rd2.team_group_id
|
||||||
AND rd3.unit_id = rd2.unit_id
|
AND rd3.unit_id = rd2.unit_id))
|
||||||
))
|
OR (rd2.type = '2'
|
||||||
OR (
|
|
||||||
rd2.type = '2'
|
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
FROM receive_detail rd4
|
FROM receive_detail rd4
|
||||||
|
|
@ -618,8 +610,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
AND rd4.type = '1'
|
AND rd4.type = '1'
|
||||||
AND rd4.type_id = rd2.type_id
|
AND rd4.type_id = rd2.type_id
|
||||||
AND rd4.team_group_id = rd2.team_group_id
|
AND rd4.team_group_id = rd2.team_group_id
|
||||||
AND rd4.unit_id = rd2.unit_id
|
AND rd4.unit_id = rd2.unit_id)))
|
||||||
)))
|
|
||||||
)
|
)
|
||||||
GROUP BY rd.type_id, rd.parent_id
|
GROUP BY rd.type_id, rd.parent_id
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue