Commit 3fd65719 by 李小惠

调整库存管理接口

parent c6cfbf1f
...@@ -22,4 +22,5 @@ public class FinalTjOrgCountDto implements Serializable { ...@@ -22,4 +22,5 @@ public class FinalTjOrgCountDto implements Serializable {
* 装备总数 * 装备总数
*/ */
private Integer number; private Integer number;
private Integer brokenCount;
} }
\ No newline at end of file
...@@ -206,6 +206,9 @@ public class InventoryReq extends BaseRequest { ...@@ -206,6 +206,9 @@ public class InventoryReq extends BaseRequest {
private String bussinessType; private String bussinessType;
private String number; //导入装备时的装备总数
private Integer number;
private Integer epcType;
} }
...@@ -32,7 +32,7 @@ public class TjOrgCountReq extends BaseRequest { ...@@ -32,7 +32,7 @@ public class TjOrgCountReq extends BaseRequest {
//本级0,本级及下级1 //本级0,本级及下级1
@NotNull(message = "查询条件维度不能为空",groups = {edit.class}) @NotNull(message = "查询条件维度不能为空",groups = {edit.class})
private int levelType; private Integer levelType;
@NotNull(message = "查询条件组织机构信息不能为空",groups = {edit.class}) @NotNull(message = "查询条件组织机构信息不能为空",groups = {edit.class})
private String findCode; private String findCode;
......
...@@ -18,7 +18,7 @@ public enum InventoryExceptionEnum implements IExceptionEnum { ...@@ -18,7 +18,7 @@ public enum InventoryExceptionEnum implements IExceptionEnum {
ACCOUNT_ERROR(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"人工新增物资未编辑,请先编辑物资信息"), ACCOUNT_ERROR(CommonConstant.DEFAULT_BIZ_ERROR_CODE,"人工新增物资未编辑,请先编辑物资信息"),
INVERTORY_IS_NULL(CommonConstant.DEFAULT_USER_ERROR_CODE,"导入的装备为空"), INVERTORY_IS_NULL(CommonConstant.DEFAULT_USER_ERROR_CODE,"导入的装备为空"),
/** /**
* 装备不存 * 装备不存
*/ */
EQUIPMENT_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "{}") EQUIPMENT_NOT_EXIST(CommonConstant.DEFAULT_USER_ERROR_CODE + JYZBConstant.JYZB_EXCEPTION_STEP_CODE + 13, "{}")
; ;
......
...@@ -33,7 +33,7 @@ public class TemperatureRedisCache extends AbstractRedisCache<Object> { ...@@ -33,7 +33,7 @@ public class TemperatureRedisCache extends AbstractRedisCache<Object> {
// String key = warehouseId; // String key = warehouseId;
// Long size = getRedisTemplate().opsForZSet().size(key); // Long size = getRedisTemplate().opsForZSet().size(key);
getRedisTemplate().opsForZSet().add("WarehouseDev:"+warehouseId, data, timestamp); getRedisTemplate().opsForZSet().add("WarehouseDev:"+warehouseId, data, timestamp);
setValueWithExpiration("WarehouseDev:"+warehouseId, data,86400); setValueWithExpiration("WarehouseDev:"+warehouseId, data,259200);
put(warehouseId, data); put(warehouseId, data);
} }
public List<Object> getDataByTimestampRange(String warehouseId, long startTimestamp, long endTimestamp) { public List<Object> getDataByTimestampRange(String warehouseId, long startTimestamp, long endTimestamp) {
......
...@@ -181,6 +181,7 @@ public class Inventory implements Serializable { ...@@ -181,6 +181,7 @@ public class Inventory implements Serializable {
/** /**
* 备注 * 备注
*/ */
//装备导入 equipmentImport
private String note ; private String note ;
......
...@@ -68,7 +68,7 @@ public class WarehouseInventory implements Serializable { ...@@ -68,7 +68,7 @@ public class WarehouseInventory implements Serializable {
private String epc; private String epc;
/** /**
* 0,正常,1不做提醒 * 0,正常,1不做提醒, 2装备导入
*/ */
@TableField(value = "flag") @TableField(value = "flag")
private Integer flag; private Integer flag;
......
...@@ -297,7 +297,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*; ...@@ -297,7 +297,7 @@ import static com.junmp.junmpProcess.common.CommonConstants.*;
} }
else else
{ {
sendReq.setMsgTitle("您的审批已通过"); sendReq.setMsgTitle("您的申请已通过");
sendReq.setMsgContent("您提交的审批【"+mainProcess.getName()+"】已经通过"); sendReq.setMsgContent("您提交的审批【"+mainProcess.getName()+"】已经通过");
} }
sendReq.setPriority("0"); sendReq.setPriority("0");
......
...@@ -111,6 +111,8 @@ public interface InventoryMapper extends BaseMapper<Inventory> { ...@@ -111,6 +111,8 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
@Param("price")BigDecimal price, @Param("warrantyPeriod")Integer warrantyPeriod, @Param("price")BigDecimal price, @Param("warrantyPeriod")Integer warrantyPeriod,
@Param("startTime") Date startTime,@Param("endTime") Date endTime); @Param("startTime") Date startTime,@Param("endTime") Date endTime);
void updateEqsInfo(@Param("list") List<InventoryReq> addInvList,@Param("updateTime") Date time);
// IPage<InventoryDto> GetDetailByTerms(@Param("page") Page<Object> defaultPage, @Param("req") InventoryReq req); // IPage<InventoryDto> GetDetailByTerms(@Param("page") Page<Object> defaultPage, @Param("req") InventoryReq req);
......
...@@ -100,4 +100,6 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> { ...@@ -100,4 +100,6 @@ public interface InventorySummaryMapper extends BaseMapper<InventorySummary> {
void setDestoryGroupAction(); void setDestoryGroupAction();
void setWarrantyGroupAction(); void setWarrantyGroupAction();
void updateSummaryInsByOrder(@Param("orgId") Long orgId);
} }
\ No newline at end of file
package com.junmp.jyzb.mapper; package com.junmp.jyzb.mapper;
import com.junmp.jyzb.api.bean.query.InventoryReq;
import com.junmp.jyzb.entity.WarehouseInventory; import com.junmp.jyzb.entity.WarehouseInventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/** /**
* @author lxh专属坐骑 * @author lxh专属坐骑
...@@ -11,6 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,6 +16,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface WarehouseInventoryMapper extends BaseMapper<WarehouseInventory> { public interface WarehouseInventoryMapper extends BaseMapper<WarehouseInventory> {
void updateWareInfo(@Param("list") List<InventoryReq> eqsList,@Param("updateTime") Date currentDateTime);
} }
......
...@@ -23,7 +23,7 @@ public interface InventorySummaryService extends IService<InventorySummary> { ...@@ -23,7 +23,7 @@ public interface InventorySummaryService extends IService<InventorySummary> {
InventorySummary getOne(InventorySumReq req); InventorySummary getOne(InventorySumReq req);
//对summary表中数据进行重新计算装备信息汇总 //对summary表中数据进行重新计算装备信息汇总
Boolean updateSummaryInsByOrder(Long orgId); void updateSummaryInsByOrder(Long orgId);
//处理单警柜返回单据结果 //处理单警柜返回单据结果
Boolean cabinetInOutRecords(CabinetLogsRecordReq req); Boolean cabinetInOutRecords(CabinetLogsRecordReq req);
......
...@@ -26,6 +26,7 @@ import com.junmp.jyzb.entity.*; ...@@ -26,6 +26,7 @@ import com.junmp.jyzb.entity.*;
import com.junmp.jyzb.mapper.InventorySummaryMapper; import com.junmp.jyzb.mapper.InventorySummaryMapper;
import com.junmp.jyzb.mapper.LogSummaryMapper; import com.junmp.jyzb.mapper.LogSummaryMapper;
import com.junmp.jyzb.mapper.WarehouseInventoryMapper;
import com.junmp.jyzb.service.*; import com.junmp.jyzb.service.*;
import com.junmp.jyzb.utils.DateTimeUtil; import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.v2.common.exception.base.ServiceException; import com.junmp.v2.common.exception.base.ServiceException;
...@@ -57,6 +58,8 @@ import java.text.SimpleDateFormat; ...@@ -57,6 +58,8 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static org.springframework.amqp.core.QueueBuilder.MasterLocator.random;
@Service @Service
@Slf4j @Slf4j
...@@ -116,6 +119,11 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -116,6 +119,11 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
@Resource @Resource
private InventorySummaryMapper inventorySummaryMapper; private InventorySummaryMapper inventorySummaryMapper;
@Resource
private WarehouseInventoryService warehouseInventoryService;
@Resource
private WarehouseInventoryMapper warehouseInventoryMapper;
...@@ -681,44 +689,57 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory ...@@ -681,44 +689,57 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
//装备导入(判断导入的数据是否存在redis中,如果不存在,则判断数据库是否存在相同的epc,如果存在提示报错,并且讲该次导入的数据存储到redis中,为下一次进行作比较) //装备导入(判断导入的数据是否存在redis中,如果不存在,则判断数据库是否存在相同的epc,如果存在提示报错,并且讲该次导入的数据存储到redis中,为下一次进行作比较)
@Override @Override
@Transactional
public boolean EqsImport(InventoryReq req) { public boolean EqsImport(InventoryReq req) {
//将该组织机构下面已经导入的装备删除
remove(new LambdaQueryWrapper<Inventory>().eq(Inventory::getNote,"equipmentImport"));
warehouseInventoryService.remove(new LambdaQueryWrapper<WarehouseInventory>().eq(WarehouseInventory::getFlag,2));
List<InventoryReq> eqsList = req.getEqsList(); List<InventoryReq> eqsList = req.getEqsList();
PubOrg pubOrg = new PubOrg(); PubOrg pubOrg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>().eq(PubOrg::getDName, eqsList.get(0).getOrgName())
if (CollectionUtil.isNotEmpty(eqsList)){ .or()
pubOrg = pubOrgService.getOne(new LambdaQueryWrapper<PubOrg>() .eq(PubOrg::getOrgName, eqsList.get(0).getOrgName()));
.eq(PubOrg::getOrgName, eqsList.get(0).getOrgName()) //将summary表进行删除
.or() inventorySummaryService.remove(new LambdaQueryWrapper<InventorySummary>().eq(InventorySummary::getOrgId,pubOrg.getOrgId()));
.eq(PubOrg::getDName, eqsList.get(0).getOrgName())); List<Inventory> addInvList=new ArrayList<>();
}else { List<WarehouseInventory> addWareList=new ArrayList<>();
throw new ServiceException(InventoryExceptionEnum.INVERTORY_IS_NULL);
}
//创建4个对应的map去数据库进行查询
Map<String,String> locationMap=new HashMap<>();
Map<String,String> typeMap=new HashMap<>();
Map<String,String> sizeMap=new HashMap<>();
Map<String,String> supplierMap=new HashMap<>();
for (InventoryReq inv:eqsList) { for (InventoryReq inv:eqsList) {
locationMap.putIfAbsent(inv.getLocationName(),inv.getLocationName()); for (int i = 0; i < inv.getNumber(); i++) {
typeMap.putIfAbsent(inv.getTypeName(),inv.getTypeName()); //每次遍历inv,获取inv中的数量,对应创建对象并且进行添加至list从而最终插入数据库
sizeMap.putIfAbsent(inv.getSizeName(),inv.getSizeName()+"-"+inv.getTypeName()); Random random = new Random();
supplierMap.putIfAbsent(inv.getSupplierName(),inv.getSupplierName()); String epc="000000"+DateTimeUtil.getCurrentDateTime().getTime()+(random.nextInt(999999 - 100000 + 1) + 100000);
Inventory inventory = new Inventory();
BeanPlusUtil.copyProperties(inv,inventory);
inventory.setOrgId(pubOrg.getOrgId());
inventory.setNote("equipmentImport");
inventory.setCreateTime(DateTimeUtil.getCurrentDateTime());
inventory.setEpc(epc);
addInvList.add(inventory);
WarehouseInventory warehouseInventory = new WarehouseInventory();
BeanPlusUtil.copyProperties(inv,warehouseInventory);
warehouseInventory.setOrgId(pubOrg.getOrgId());
//2表示装备导入
warehouseInventory.setFlag(2);
warehouseInventory.setEpc(epc);
warehouseInventory.setOrgName(inv.getOrgName());
addWareList.add(warehouseInventory);
}
} }
List<String> locationList = new ArrayList<>(locationMap.values()); if (CollectionUtil.isNotEmpty(addInvList)){
List<EquipmentSize> sizeList = new ArrayList<>(); saveBatch(addInvList);
for (String item:typeMap.values()) {
String[] parts = item.split("-");
String sizeName = parts[0].trim();
String typeName = parts[1].trim();
EquipmentSize equipmentSize = new EquipmentSize();
equipmentSize.setName(sizeName);
equipmentSize.setTypeName(typeName);
sizeList.add(equipmentSize);
} }
List<String> typeList = new ArrayList<>(sizeMap.values()); if (CollectionUtil.isNotEmpty(addWareList)){
List<String> supplierList = new ArrayList<>(supplierMap.values()); warehouseInventoryService.saveBatch(addWareList);
List<EquipmentSize> equipmentSizeList = equipmentSizeService.distinctByName(sizeList); }
//直接查询五张数据表并且更新
return false; inventoryMapper.updateEqsInfo(eqsList,DateTimeUtil.getCurrentDateTime());
warehouseInventoryMapper.updateWareInfo(eqsList,DateTimeUtil.getCurrentDateTime());
//重新计算summary表中的数据
inventorySummaryService.updateSummaryInsByOrder(pubOrg.getOrgId());
//是否需要创建报表(不创建,由定时任务进行。)但是在撤回时,需要将报表进行删除
return true;
} }
@Override @Override
......
...@@ -218,23 +218,8 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa ...@@ -218,23 +218,8 @@ public class InventorySummaryServiceImpl extends ServiceImpl<InventorySummaryMa
//对summary表中数据进行重新计算装备信息汇总 //对summary表中数据进行重新计算装备信息汇总
public Boolean updateSummaryInsByOrder(Long orgId){ public void updateSummaryInsByOrder(Long orgId){
//查询字典表中的临近报废天数 inventorySummaryMapper.updateSummaryInsByOrder(orgId);
SysDictItem sysDictItem = sysDictItemService.getOne(new LambdaQueryWrapper<SysDictItem>()
.eq(SysDictItem::getItemText, "brokenNumber"));
//如果配置找不到,那就默认设置为15天为临近报废(如果装备的质保期小于15天了,就是为临近报废)
Integer brokenNumberDays;
if (ObjectUtil.isNotNull(sysDictItem)){
brokenNumberDays=15;
}else {
brokenNumberDays=Integer.parseInt(sysDictItem.getItemValue());
}
//查询出组织机构下的所有仓库信息,并且将表中的仓库信息数据进行删除
List<WarehouseDto> allWarehouse = warehouseService.getAllWarehouse(orgId,-1);
boolean a = inventorySummaryMapper.deleteByWarehouse(allWarehouse);
//根据仓库id重新计算汇总信息
boolean sumByWarehouse = inventorySummaryMapper.getSumByWarehouse(allWarehouse, brokenNumberDays);
return (a && sumByWarehouse);
} }
//单警柜返回数据 //单警柜返回数据
......
...@@ -1160,6 +1160,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain ...@@ -1160,6 +1160,9 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
if (CollectionUtil.isNotEmpty(updateInvList)){ if (CollectionUtil.isNotEmpty(updateInvList)){
//更新数据库中实体类的状态 //更新数据库中实体类的状态
LambdaUpdateWrapper<Inventory> wp1 = Wrappers.<Inventory>lambdaUpdate(); LambdaUpdateWrapper<Inventory> wp1 = Wrappers.<Inventory>lambdaUpdate();
if (orderMain.getBussinessType().equals("destruction")){
req.setBussinessType("destory");
}
wp1.set(Inventory::getState, req.getBussinessType()) wp1.set(Inventory::getState, req.getBussinessType())
.set(Inventory::getLocationState, req.getOrderType()); .set(Inventory::getLocationState, req.getOrderType());
LambdaUpdateWrapper<WarehouseInventory> wp2 = Wrappers.<WarehouseInventory>lambdaUpdate(); LambdaUpdateWrapper<WarehouseInventory> wp2 = Wrappers.<WarehouseInventory>lambdaUpdate();
......
...@@ -97,28 +97,25 @@ public class PublicServiceImpl implements PublicService { ...@@ -97,28 +97,25 @@ public class PublicServiceImpl implements PublicService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean updateMessage(MessageReq req) { public boolean updateMessage(MessageReq req) {
SysMessage message = sysMessageService.getById(req.getMsgIdList().get(0)); SysMessage message = sysMessageService.getById(req.getMsgIdList().get(0));
Long bizId = message.getBizId(); req.setBizId(message.getBizId());
messageApi.updateMsgReadFlag(req);
//将该条消息全设置为已读并且更新再推送一条消息 //将该条消息全设置为已读并且更新再推送一条消息
List<SysMessage> list = sysMessageService.list(new LambdaQueryWrapper<SysMessage>().eq(SysMessage::getBizId, bizId)); List<SysMessage> list = sysMessageService.list(new LambdaQueryWrapper<SysMessage>().eq(SysMessage::getBizId, message.getBizId()));
// messageApi.batchReadFlagByMessageIds(StrUtil.join(",", new Object[]{idList}), MsgReadStateEnum.READ);
sysMessageService.update(new LambdaUpdateWrapper<SysMessage>()
.set(SysMessage::getReadFlag, 1)
.eq(SysMessage::getBizId, bizId));
List<Long> userIdList = list.stream().map(SysMessage::getReceiveUserId).collect(Collectors.toList()); List<Long> userIdList = list.stream().map(SysMessage::getReceiveUserId).collect(Collectors.toList());
userIdList.forEach(userId ->{
if (userId!= LoginContext.getContext().getLoginUser().getUserId())//非本人审核单据 MessageSendReq sendReq = new MessageSendReq();
{ sendReq.setReceiveUserIds(userIdList.stream()
MessageSendReq sendReq = new MessageSendReq(); .map(Object::toString)
sendReq.setReceiveUserIds(String.valueOf(userId)); .collect(Collectors.joining(",")));
sendReq.setMsgTitle("refresh"); sendReq.setMsgTitle("refresh");
sendReq.setMsgContent("消息更新"); sendReq.setMsgContent("消息更新");
sendReq.setPriority("1"); sendReq.setPriority("1");
sendReq.setSendTime(DateTime.now()); sendReq.setSendTime(DateTime.now());
messageApi.sendMessageNoToken(sendReq); messageApi.sendMessageNoToken(sendReq);
}
});
return true; return true;
} }
......
package com.junmp.jyzb.service.impl; package com.junmp.jyzb.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.support.ExcelTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -23,6 +25,7 @@ import com.junmp.jyzb.mapper.*; ...@@ -23,6 +25,7 @@ import com.junmp.jyzb.mapper.*;
import com.junmp.jyzb.service.InventorySummaryService; import com.junmp.jyzb.service.InventorySummaryService;
import com.junmp.jyzb.service.PubOrgService; import com.junmp.jyzb.service.PubOrgService;
import com.junmp.jyzb.service.TjService; import com.junmp.jyzb.service.TjService;
import com.junmp.jyzb.utils.DateTimeUtil;
import com.junmp.v2.common.util.BeanPlusUtil; import com.junmp.v2.common.util.BeanPlusUtil;
import com.junmp.v2.common.util.HttpServletUtil; import com.junmp.v2.common.util.HttpServletUtil;
import com.junmp.v2.db.api.factory.PageFactory; import com.junmp.v2.db.api.factory.PageFactory;
...@@ -38,6 +41,7 @@ import javax.annotation.Resource; ...@@ -38,6 +41,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Year;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
...@@ -309,7 +313,7 @@ public class TjServiceImpl implements TjService { ...@@ -309,7 +313,7 @@ public class TjServiceImpl implements TjService {
req.setColumn(req.getColumn().equals("createTime") req.setColumn(req.getColumn().equals("createTime")
? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase()); ? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc")) req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc"))
? null : req.getOrder().toLowerCase()); ? req.getOrder().toLowerCase() : null);
} }
List<TjOrgEqsDto> allData=inventorySummaryMapper.getTotalDataDetail(String.valueOf(req.getOrgId()),req.getTypeIdsList(),req.getSizeNameList(),req.getLevelNum(),req.getLevel(),req.getColumn(),req.getOrder()); List<TjOrgEqsDto> allData=inventorySummaryMapper.getTotalDataDetail(String.valueOf(req.getOrgId()),req.getTypeIdsList(),req.getSizeNameList(),req.getLevelNum(),req.getLevel(),req.getColumn(),req.getOrder());
...@@ -415,7 +419,7 @@ public class TjServiceImpl implements TjService { ...@@ -415,7 +419,7 @@ public class TjServiceImpl implements TjService {
req.setColumn(req.getColumn().equals("createTime") req.setColumn(req.getColumn().equals("createTime")
? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase()); ? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc")) req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc"))
? req.getOrder().toLowerCase() :null ); ? req.getOrder().toLowerCase() : null);
List<InventorySumDto> returnList=inventorySummaryMapper.TjOrgEqsDetail(req.getOrgId(),req.getTypeIdsList(), List<InventorySumDto> returnList=inventorySummaryMapper.TjOrgEqsDetail(req.getOrgId(),req.getTypeIdsList(),
req.getSizeNameList(),req.getColumn(),req.getOrder()); req.getSizeNameList(),req.getColumn(),req.getOrder());
return returnList; return returnList;
...@@ -619,7 +623,7 @@ public class TjServiceImpl implements TjService { ...@@ -619,7 +623,7 @@ public class TjServiceImpl implements TjService {
req.setColumn(req.getColumn().equals("createTime") req.setColumn(req.getColumn().equals("createTime")
? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase()); ? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc")) req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc"))
? null : req.getOrder().toLowerCase()); ? req.getOrder().toLowerCase() : null);
} }
List<TjOrgPriceDto> returnList=priceSumSummaryMapper.TjOrgPriceDetail(req.getOrgId(),req.getYear(), List<TjOrgPriceDto> returnList=priceSumSummaryMapper.TjOrgPriceDetail(req.getOrgId(),req.getYear(),
req.getTypeIdsList(),req.getSizeNameList(), req.getColumn(), req.getOrder()); req.getTypeIdsList(),req.getSizeNameList(), req.getColumn(), req.getOrder());
...@@ -934,7 +938,7 @@ public class TjServiceImpl implements TjService { ...@@ -934,7 +938,7 @@ public class TjServiceImpl implements TjService {
req.setColumn(req.getColumn().equals("createTime") req.setColumn(req.getColumn().equals("createTime")
? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase()); ? null : req.getColumn().replaceAll("[A-Z]", "_$0").toLowerCase());
req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc")) req.setOrder((req.getOrder().equals("desc")||req.getOrder().equals("asc"))
? null : req.getOrder().toLowerCase()); ? req.getOrder().toLowerCase() : null);
} }
List<TjOrgCountDto> returnList=equipmentCountSummaryMapper.TjOrgCountDetail(req.getOrgId(), List<TjOrgCountDto> returnList=equipmentCountSummaryMapper.TjOrgCountDetail(req.getOrgId(),
req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(), req.getTypeIdsList(),req.getSizeNameList(),req.getYear(),req.getTypeParentId(),
...@@ -1060,7 +1064,16 @@ public class TjServiceImpl implements TjService { ...@@ -1060,7 +1064,16 @@ public class TjServiceImpl implements TjService {
public List<InventorySummary> GetCount(TjOrgCountReq req) { public List<InventorySummary> GetCount(TjOrgCountReq req) {
int length = req.getFindCode().length(); int length = req.getFindCode().length();
List<InventorySummary> tjOutAndInDtos = equipmentCountSummaryMapper.GetCount(req, length); List<InventorySummary> tjOutAndInDtos = equipmentCountSummaryMapper.GetCount(req, length);
InventorySummary inventorySummary = tjOutAndInDtos.get(0);
req.setOrgId(inventorySummary.getOrgId());
Year now = Year.now();
int year = now.getValue();
req.setStartTime(year+"-01");
req.setEndTime(year+"-12");
FinalTjOrgCountDto finalTjOrgCountDto = TjOrgCountSum(req);
inventorySummary.setUseCount(finalTjOrgCountDto.getUseCount());
inventorySummary.setBrokenCount(finalTjOrgCountDto.getBrokenCount());
inventorySummary.setFixCount(finalTjOrgCountDto.getFixCount());
return tjOutAndInDtos; return tjOutAndInDtos;
} }
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
vecs.`month`, vecs.`month`,
SUM(vecs.use_count) AS use_count, SUM(vecs.use_count) AS use_count,
SUM(vecs.fix_count) AS fix_count, SUM(vecs.fix_count) AS fix_count,
SUM(vecs.broken_count) AS broken_count,
sum(vecs.number) as number sum(vecs.number) as number
FROM vie_equipment_count_summary vecs FROM vie_equipment_count_summary vecs
left join pub_org po on vecs.org_id_int=po.org_id left join pub_org po on vecs.org_id_int=po.org_id
...@@ -199,6 +200,7 @@ ...@@ -199,6 +200,7 @@
MAX(t.`year`) AS `year`, MAX(t.`year`) AS `year`,
SUM(t.use_count) AS use_count, SUM(t.use_count) AS use_count,
SUM(t.fix_count) AS fix_count, SUM(t.fix_count) AS fix_count,
SUM(t.broken_count) AS broken_count,
sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number, sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number,
(SELECT `org_id` FROM `pub_org` WHERE `org_id` = 1369509498032811869 OR `org_parent_ids` LIKE CONCAT('%', 1369509498032811869, '%') ORDER BY `level_flag` LIMIT 1) AS org_id, (SELECT `org_id` FROM `pub_org` WHERE `org_id` = 1369509498032811869 OR `org_parent_ids` LIKE CONCAT('%', 1369509498032811869, '%') ORDER BY `level_flag` LIMIT 1) AS org_id,
(SELECT `org_code` FROM `pub_org` WHERE `org_id` = 1369509498032811869 OR `org_parent_ids` LIKE CONCAT('%', 1369509498032811869, '%') ORDER BY `level_flag` LIMIT 1) AS org_code, (SELECT `org_code` FROM `pub_org` WHERE `org_id` = 1369509498032811869 OR `org_parent_ids` LIKE CONCAT('%', 1369509498032811869, '%') ORDER BY `level_flag` LIMIT 1) AS org_code,
...@@ -210,6 +212,7 @@ ...@@ -210,6 +212,7 @@
vecs.`month`, vecs.`month`,
SUM(vecs.use_count) AS use_count, SUM(vecs.use_count) AS use_count,
SUM(vecs.fix_count) AS fix_count, SUM(vecs.fix_count) AS fix_count,
SUM(vecs.broken_count) AS broken_count,
sum(vecs.number) as number sum(vecs.number) as number
FROM vie_equipment_count_summary vecs FROM vie_equipment_count_summary vecs
left join pub_org po on vecs.org_id_int=po.org_id left join pub_org po on vecs.org_id_int=po.org_id
...@@ -253,6 +256,7 @@ ...@@ -253,6 +256,7 @@
MAX(t.`year`) AS `year`, MAX(t.`year`) AS `year`,
SUM(t.use_count) AS use_count, SUM(t.use_count) AS use_count,
SUM(t.fix_count) AS fix_count, SUM(t.fix_count) AS fix_count,
SUM(t.broken_count) AS broken_count,
sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number, sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number,
(SELECT `org_id` FROM `pub_org` WHERE `org_id` = #{orgId} ) AS org_id, (SELECT `org_id` FROM `pub_org` WHERE `org_id` = #{orgId} ) AS org_id,
(SELECT `org_code` FROM `pub_org` WHERE `org_id` = #{orgId} ) AS org_code, (SELECT `org_code` FROM `pub_org` WHERE `org_id` = #{orgId} ) AS org_code,
...@@ -264,6 +268,7 @@ ...@@ -264,6 +268,7 @@
vecs.`month`, vecs.`month`,
SUM(vecs.use_count) AS use_count, SUM(vecs.use_count) AS use_count,
SUM(vecs.fix_count) AS fix_count, SUM(vecs.fix_count) AS fix_count,
SUM(vecs.broken_count) AS broken_count,
sum(vecs.number) as number sum(vecs.number) as number
FROM vie_equipment_count_summary vecs FROM vie_equipment_count_summary vecs
where vecs.`year`= #{year} and vecs.org_id_int = #{orgId} where vecs.`year`= #{year} and vecs.org_id_int = #{orgId}
...@@ -305,6 +310,7 @@ ...@@ -305,6 +310,7 @@
vecs.`month`, vecs.`month`,
SUM( vecs.use_count ) AS use_count, SUM( vecs.use_count ) AS use_count,
SUM( vecs.fix_count ) AS fix_count, SUM( vecs.fix_count ) AS fix_count,
SUM( vecs.broken_count ) AS broken_count,
vecs.size_id, vecs.size_id,
vecs.size_name, vecs.size_name,
vecs.type_id, vecs.type_id,
...@@ -384,6 +390,7 @@ ...@@ -384,6 +390,7 @@
MAX(t.`year`) AS `year`, MAX(t.`year`) AS `year`,
SUM(t.use_count) AS use_count, SUM(t.use_count) AS use_count,
SUM(t.fix_count) AS fix_count, SUM(t.fix_count) AS fix_count,
SUM(t.broken_count) AS broken_count,
sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number sum(CASE WHEN t.month = MONTH(CURRENT_DATE()) THEN t.number ELSE 0 END) AS number
FROM ( FROM (
SELECT SELECT
...@@ -392,6 +399,7 @@ ...@@ -392,6 +399,7 @@
vecs.`month`, vecs.`month`,
SUM(vecs.use_count) AS use_count, SUM(vecs.use_count) AS use_count,
SUM(vecs.fix_count) AS fix_count, SUM(vecs.fix_count) AS fix_count,
SUM(vecs.broken_count) AS broken_count,
sum(vecs.number) as number sum(vecs.number) as number
FROM vie_equipment_count_summary vecs FROM vie_equipment_count_summary vecs
left join pub_org po on vecs.org_id_int=po.org_id left join pub_org po on vecs.org_id_int=po.org_id
...@@ -442,6 +450,36 @@ ...@@ -442,6 +450,36 @@
) AS t GROUP BY t.org_id_int ) AS t GROUP BY t.org_id_int
)as t2 where t1.org_id=t2.org_id_int )as t2 where t1.org_id=t2.org_id_int
</select> </select>
<select id="GetCount" resultType="com.junmp.jyzb.entity.InventorySummary">
select sum(case when location_type=0 then stock_number else 0 end)+
sum(case when location_type=0 then outbound_number else 0 end)+
sum(case when location_type=1 then stock_number else 0 end)+
sum(case when location_type=1 then outbound_number else 0 end) as number,
sum(price)as price,sum(case when location_type=0 then stock_number else 0 end)as stockNumber,
sum(case when location_type=0 then outbound_number else 0 end)as outboundNumber,
sum(case when location_type=1 then stock_number else 0 end)as djgstockNumber,
sum(case when location_type=1 then outbound_number else 0 end)as djgoutboundNumber,
sum(destruction_number)as destructionNumber,
sum(expire_number)as expireNumber,
sum(broken_number)as brokenNumber,
sum(fix_number)as fixNumber,
sum(use_number)as useNumber,
<if test=" length !=12">
(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1) as orgId
</if>
<if test="length == 12">
(select org_id FROM pub_org where org_code=#{req.findCode} ) as orgId
</if>
FROM base_inventory_summary where SUBSTRING( org_code, 1, #{length} ) = #{req.findCode}
<if test="length != 12">
<if test="req.levelType == 0">
and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 )
</if>
</if>
<if test="length == 12">
and org_id_int =(select org_id FROM pub_org where org_code=#{req.findCode} )
</if>
</select>
<select id="GetTop5" resultType="com.junmp.jyzb.api.bean.dto.LargeScreenDto.Top5Dto"> <select id="GetTop5" resultType="com.junmp.jyzb.api.bean.dto.LargeScreenDto.Top5Dto">
SELECT SELECT
sum( use_count ) AS item_num, sum( use_count ) AS item_num,
...@@ -483,30 +521,6 @@ ...@@ -483,30 +521,6 @@
) as t ) as t
join base_equipment_type on base_equipment_type.id= t.type_parent_id join base_equipment_type on base_equipment_type.id= t.type_parent_id
</select> </select>
<select id="GetCount" resultType="com.junmp.jyzb.entity.InventorySummary">
select sum(case when location_type=0 then stock_number else 0 end)+
sum(case when location_type=0 then outbound_number else 0 end)+
sum(case when location_type=1 then stock_number else 0 end)+
sum(case when location_type=1 then outbound_number else 0 end) as number,
sum(price)as price,sum(case when location_type=0 then stock_number else 0 end)as stockNumber,
sum(case when location_type=0 then outbound_number else 0 end)as outboundNumber,
sum(case when location_type=1 then stock_number else 0 end)as djgstockNumber,
sum(case when location_type=1 then outbound_number else 0 end)as djgoutboundNumber,
sum(destruction_number)as destructionNumber,
sum(expire_number)as expireNumber,
sum(broken_number)as brokenNumber,
sum(fix_number)as fixNumber,
sum(use_number)as useNumber
FROM base_inventory_summary where SUBSTRING( org_code, 1, #{length} ) = #{req.findCode}
<if test="length != 12">
<if test="req.levelType == 0">
and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 )
</if>
</if>
<if test="length == 12">
and org_id_int =(select org_id FROM pub_org where org_code=#{req.findCode} )
</if>
</select>
<select id="getTypeParentName" resultType="java.lang.String"> <select id="getTypeParentName" resultType="java.lang.String">
select name FROM base_equipment_type where parent_id="00000000-0000-0000-0000-000000000000" select name FROM base_equipment_type where parent_id="00000000-0000-0000-0000-000000000000"
and id !="00000000-0000-0000-0000-000000000000" order by id and id !="00000000-0000-0000-0000-000000000000" order by id
...@@ -590,59 +604,72 @@ ...@@ -590,59 +604,72 @@
</select> </select>
<select id="GetSyWxBf" resultType="java.lang.Integer"> <select id="GetSyWxBf" resultType="java.lang.Integer">
<if test="num==0"> <if test="num==0">
select coalesce(t.item_num,0)as item_num FROM SELECT COALESCE(t.item_num, 0) AS item_num
(select id FROM base_equipment_type where parent_id="00000000-0000-0000-0000-000000000000"
and id !="00000000-0000-0000-0000-000000000000") as a left join (
SELECT
sum( use_count ) AS item_num,
type_parent_id
FROM FROM
`vie_equipment_count_summary` (SELECT id
FROM base_equipment_type
WHERE parent_id = '00000000-0000-0000-0000-000000000000'
AND id != '00000000-0000-0000-0000-000000000000'
) AS a
LEFT JOIN
(SELECT
SUM(use_count) AS item_num,
type_parent_id
FROM vie_equipment_count_summary
WHERE WHERE
SUBSTRING( org_code, 1, #{length} ) = #{req.findCode} and year=YEAR(NOW()) and month=MONTH(NOW()) SUBSTRING( org_code, 1, #{length} ) = #{req.findCode}
<if test="req.levelType == 0"> <if test="req.levelType!=null and req.levelType == 0">
and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 ) and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 )
</if> </if>
GROUP BY GROUP BY type_parent_id
type_parent_id ) AS t
)as t on t.type_parent_id=a.id ON t.type_parent_id = a.id;
</if> </if>
<if test="num==1"> <if test="num==1">
select coalesce(t.item_num,0)as item_num FROM SELECT COALESCE(t.item_num, 0) AS item_num
(select id FROM base_equipment_type where parent_id="00000000-0000-0000-0000-000000000000"
and id !="00000000-0000-0000-0000-000000000000") as a left join (
SELECT
sum( fix_count ) AS item_num,
type_parent_id
FROM FROM
`vie_equipment_count_summary` (SELECT id
FROM base_equipment_type
WHERE parent_id = '00000000-0000-0000-0000-000000000000'
AND id != '00000000-0000-0000-0000-000000000000'
) AS a
LEFT JOIN
(SELECT
SUM(fix_count) AS item_num,
type_parent_id
FROM vie_equipment_count_summary
WHERE WHERE
SUBSTRING( org_code, 1, #{length} ) = #{req.findCode} and year=YEAR(NOW()) and month=MONTH(NOW()) SUBSTRING( org_code, 1, #{length} ) = #{req.findCode}
<if test="req.levelType == 0"> <if test="req.levelType!=null and req.levelType == 0">
and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 ) and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 )
</if> </if>
GROUP BY GROUP BY type_parent_id
type_parent_id ) AS t
)as t on t.type_parent_id=a.id ON t.type_parent_id = a.id;
</if> </if>
<if test="num==2"> <if test="num==2">
select coalesce(t.item_num,0)as item_num FROM SELECT COALESCE(t.item_num, 0) AS item_num
(select id FROM base_equipment_type where parent_id="00000000-0000-0000-0000-000000000000"
and id !="00000000-0000-0000-0000-000000000000") as a left join (
SELECT
sum( broken_count ) AS item_num,
type_parent_id
FROM FROM
`vie_equipment_count_summary` (SELECT id
FROM base_equipment_type
WHERE parent_id = '00000000-0000-0000-0000-000000000000'
AND id != '00000000-0000-0000-0000-000000000000'
) AS a
LEFT JOIN
(SELECT
SUM(broken_count) AS item_num,
type_parent_id
FROM vie_equipment_count_summary
WHERE WHERE
SUBSTRING( org_code, 1, #{length} ) = #{req.findCode} and year=YEAR(NOW()) and month=MONTH(NOW()) SUBSTRING( org_code, 1, #{length} ) = #{req.findCode}
<if test="req.levelType == 0"> <if test="req.levelType!=null and req.levelType == 0">
and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 ) and org_id_int =(select org_id FROM pub_org where find_code=#{req.findCode} ORDER BY level_flag asc limit 0,1 )
</if> </if>
GROUP BY GROUP BY type_parent_id
type_parent_id ) AS t
)as t on t.type_parent_id=a.id ON t.type_parent_id = a.id;
</if> </if>
</select> </select>
<select id="GetPageOrgTj" resultType="com.junmp.jyzb.api.bean.dto.LargeScreenDto.TjOrgDto"> <select id="GetPageOrgTj" resultType="com.junmp.jyzb.api.bean.dto.LargeScreenDto.TjOrgDto">
......
...@@ -36,6 +36,21 @@ ...@@ -36,6 +36,21 @@
production_date, warranty_period, maintenance_period, fix_count, price, create_time, production_date, warranty_period, maintenance_period, fix_count, price, create_time,
update_time, note,area_id update_time, note,area_id
</sql> </sql>
<update id="updateEqsInfo">
<foreach collection="list" item="item" separator=";">
update
base_inventory
<set>
size_id=(select DISTINCT id FROM base_equipment_size where name=#{item.sizeName} and
type_id =(select DISTINCT id FROM base_equipment_type where name=#{item.typeName} limit 1) limit 1),
type_id=(select DISTINCT id FROM base_equipment_type where name=#{item.typeName} limit 1),
location_id=(select DISTINCT id FROM base_warehouse where name=#{item.locationId} limit 1),
state="normal",bussiness_type="normal",update_time=#{updateTime},property=0,epc_type=1,location_state="in",
location_type=0
</set>
where note ="equipmentImport"
</foreach>
</update>
<select id="GetViewCountByepcs" resultType="com.junmp.jyzb.api.bean.dto.EpcListDto"> <select id="GetViewCountByepcs" resultType="com.junmp.jyzb.api.bean.dto.EpcListDto">
...@@ -701,6 +716,48 @@ ...@@ -701,6 +716,48 @@
left JOIN base_supplier bs ON bs.id = t2.supplier_id left JOIN base_supplier bs ON bs.id = t2.supplier_id
</select> </select>
<select id="GetByPeriodAndDate" resultType="com.junmp.jyzb.api.bean.PeriodAndDateDto">
select count(*) as zkCount,location_id,max(location_name) as location_name,warranty_period,production_date,price as unit_price,org_id FROM(
SELECT a.*,b.warranty_period,b.production_date,b.price FROM
(SELECT org_id,size_id,type_id,location_id,epc,location_name FROM `base_warehouse_inventory` wi
where org_id=#{req.orgId} and type_id=#{req.typeId}
and size_id=#{req.sizeId}
and location_state="in" and location_type=0
<if test="req.epcType ==1">
and epc_type=1
</if>
<if test="req.locationName != null and req.locationName != ''">
and location_name like CONCAT('%', req.locationName, '%')
</if>
)as a
left join (
select epc,warranty_period,production_date,price
FROM base_inventory bi where org_id_int=#{req.orgId}
and type_id=#{req.typeId} and size_id=#{req.sizeId}
and location_state="in" and location_type=0
<if test="req.epcType ==1">
and epc_type=1
</if>
)as b on a.epc=b.epc
) as t group by location_id,price,warranty_period,production_date
having 1=1
<if test="req.price != null and req.price!= ''">
and price =#{req.price}
</if>
<if test="req.zkCount != null and req.zkCount !=''">
and zkCount =#{req.zkCount}
</if>
<if test="req.warrantyPeriod != null and req.warrantyPeriod !=''">
and warranty_period =#{req.warrantyPeriod}
</if>
<if test="req.startTime!= null and req.startTime !=''">
and production_date > #{req.startTime}
</if>
<if test="req.endTime!= null and req.endTime !=''">
and production_date &lt; #{req.endTime}
</if>
</select>
<select id="EqsByStateSum" resultType="java.lang.Integer"> <select id="EqsByStateSum" resultType="java.lang.Integer">
select count(*) from ( select count(*) from (
...@@ -747,41 +804,6 @@ ...@@ -747,41 +804,6 @@
</if> </if>
</select> </select>
<select id="GetByPeriodAndDate" resultType="com.junmp.jyzb.api.bean.PeriodAndDateDto">
select count(*) as zkCount,location_id,max(location_name) as location_name,warranty_period,production_date,price as unit_price,org_id FROM(
SELECT a.*,b.warranty_period,b.production_date,b.price FROM
(SELECT org_id,size_id,type_id,location_id,epc,location_name FROM `base_warehouse_inventory` wi
where org_id=#{req.orgId} and type_id=#{req.typeId}
and size_id=#{req.sizeId}
and location_state="in" and location_type=0
<if test="req.locationName != null and req.locationName != ''">
and location_name like CONCAT('%', req.locationName, '%')
</if>
)as a
left join (
select epc,warranty_period,production_date,price
FROM base_inventory bi where org_id_int=#{req.orgId}
and type_id=#{req.typeId} and size_id=#{req.sizeId}
and location_state="in" and location_type=0)as b on a.epc=b.epc
) as t group by location_id,price,warranty_period,production_date
having 1=1
<if test="req.price != null and req.price!= ''">
and price =#{req.price}
</if>
<if test="req.zkCount != null and req.zkCount !=''">
and zkCount =#{req.zkCount}
</if>
<if test="req.warrantyPeriod != null and req.warrantyPeriod !=''">
and warranty_period =#{req.warrantyPeriod}
</if>
<if test="req.startTime!= null and req.startTime !=''">
and production_date > #{req.startTime}
</if>
<if test="req.endTime!= null and req.endTime !=''">
and production_date &lt; #{req.endTime}
</if>
</select>
<select id="getEqsInfo" resultType="com.junmp.jyzb.entity.Inventory"> <select id="getEqsInfo" resultType="com.junmp.jyzb.entity.Inventory">
SELECT wi.id as inventoryId,wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state, SELECT wi.id as inventoryId,wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,
wi.type_name,wi.org_name,wi.size_name,wi.location_name, wi.type_name,wi.org_name,wi.size_name,wi.location_name,
......
...@@ -87,6 +87,12 @@ ...@@ -87,6 +87,12 @@
END END
WHERE add_price IS NULL OR add_num IS NULL; WHERE add_price IS NULL OR add_num IS NULL;
</update> </update>
<insert id="updateSummaryInsByOrder" statementType="CALLABLE">
{CALL UpdateInventorySummaryByOrgId(#{orgId, mode=IN})}
</insert>
<insert id="setWarrantyInventoryAction" statementType="CALLABLE"> <insert id="setWarrantyInventoryAction" statementType="CALLABLE">
{CALL Insert_into_base_warranty_inventory()} {CALL Insert_into_base_warranty_inventory()}
...@@ -602,7 +608,7 @@ ...@@ -602,7 +608,7 @@
<if test="column != null and column != '' and order != null and order != '' "> <if test="column != null and column != '' and order != null and order != '' ">
order by ${column} ${order} order by ${column} ${order}
</if> </if>
<if test="column == null and order == null"> <if test="column == null">
ORDER BY type_id ORDER BY type_id
</if> </if>
...@@ -762,12 +768,13 @@ ...@@ -762,12 +768,13 @@
select count(*) from ( select count(*) from (
SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,wi.location_name,wi.type_name,wi.size_name,wi.org_name, SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,wi.location_name,wi.type_name,wi.size_name,wi.org_name,
wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state, wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state,
i.production_date,i.warranty_period,i.maintenance_period, i.term_state,i.property, i.production_date,i.warranty_period,i.maintenance_period, i.property,
i.area_id, i.area_id,
bs.name as supplier_name, bs.name as supplier_name,
(select instructions FROM base_equipment_type where id=#{req.typeId}) as instructions, (select instructions FROM base_equipment_type where id=#{req.typeId}) as instructions,
(select photo FROM base_equipment_type where id=#{req.typeId}) as type_photo, (select photo FROM base_equipment_type where id=#{req.typeId}) as type_photo,
es.photo as size_photo es.photo as size_photo,
(case when DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) > NOW() or i.warranty_period = 0 then 0 else 1 end)as term_state
FROM base_warehouse_inventory wi FROM base_warehouse_inventory wi
LEFT JOIN base_inventory i ON i.epc = wi.epc LEFT JOIN base_inventory i ON i.epc = wi.epc
LEFT JOIN base_equipment_size es ON wi.size_id = es.id LEFT JOIN base_equipment_size es ON wi.size_id = es.id
...@@ -779,8 +786,11 @@ ...@@ -779,8 +786,11 @@
<if test="req.locationId != null and req.locationId != ''"> <if test="req.locationId != null and req.locationId != ''">
and wi.location_id =#{req.locationId} and wi.location_id =#{req.locationId}
</if> </if>
<if test="req.termState!= -1"> <if test="req.termState== 1">
and i.term_state=#{req.termState} and DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) &lt; NOW() and i.warranty_period != 0
</if>
<if test="req.termState== 0">
and (DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) > NOW() or i.warranty_period = 0)
</if> </if>
<if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''"> <if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''">
and i.location_state=#{req.locationState} and i.location_state=#{req.locationState}
...@@ -804,26 +814,29 @@ ...@@ -804,26 +814,29 @@
SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,wi.location_name,wi.type_name,wi.size_name,wi.org_name, SELECT wi.type_id,wi.size_id,wi.shelf_id,wi.shelf_location, wi.epc,wi.org_id,wi.location_state,wi.location_name,wi.type_name,wi.size_name,wi.org_name,
wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state, wi.location_type,wi.location_id,i.id,i.supplier_id,i.price,i.state,i.bussiness_state,
i.production_date,i.warranty_period,i.maintenance_period, i.term_state,i.property, i.production_date,i.warranty_period,i.maintenance_period,i.property,
i.area_id, i.area_id,
bs.name as supplier_name, bs.name as supplier_name,
es.instructions as instructions, es.instructions as instructions,
(select photo FROM base_equipment_type where id=#{req.typeId}) as type_photo, (select photo FROM base_equipment_type where id=#{req.typeId}) as type_photo,
es.photo as size_photo es.photo as size_photo,
(case when DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) > NOW() or i.warranty_period = 0 then 0 else 1 end)as term_state
FROM base_warehouse_inventory wi FROM base_warehouse_inventory wi
LEFT JOIN base_inventory i ON i.epc = wi.epc LEFT JOIN base_inventory i ON i.epc = wi.epc
LEFT JOIN base_equipment_size es ON wi.size_id = es.id LEFT JOIN base_equipment_size es ON wi.size_id = es.id
LEFT JOIN base_supplier bs ON bs.id = i.supplier_id LEFT JOIN base_supplier bs ON bs.id = i.supplier_id
WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} and i.state !="destory" WHERE wi.org_id=#{req.orgId} and wi.type_id=#{req.typeId} and i.state !="destory"
<if test="req.locationType !='all' and req.locationType != null"> <if test="req.locationType !='all' and req.locationType != null">
and wi.location_type=#{req.locationType} and wi.location_type=#{req.locationType}
</if> </if>
<if test="req.locationId != null and req.locationId != ''"> <if test="req.locationId != null and req.locationId != ''">
and wi.location_id =#{req.locationId} and wi.location_id =#{req.locationId}
</if> </if>
<if test="req.termState!= -1"> <if test="req.termState== 1">
and i.term_state=#{req.termState} and DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) &lt; NOW() and i.warranty_period != 0
</if>
<if test="req.termState== 0">
and (DATE_ADD(i.production_date, INTERVAL i.warranty_period MONTH) > NOW() or i.warranty_period = 0)
</if> </if>
<if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''"> <if test="req.locationState!='all' and req.locationState !=null and req.locationState!=''">
and i.location_state=#{req.locationState} and i.location_state=#{req.locationState}
...@@ -840,6 +853,9 @@ ...@@ -840,6 +853,9 @@
<if test="req.maintenancePeriod != null and req.maintenancePeriod != ''"> <if test="req.maintenancePeriod != null and req.maintenancePeriod != ''">
and i.maintenance_period=#{req.maintenancePeriod} and i.maintenance_period=#{req.maintenancePeriod}
</if> </if>
<if test="req.state !='all' and req.state !=''">
and i.state=#{req.state}
</if>
ORDER BY wi.type_id,i.size_id ORDER BY wi.type_id,i.size_id
<if test="req.pageNo != null and req.pageSize != null"> <if test="req.pageNo != null and req.pageSize != null">
limit #{req.pageNo},#{req.pageSize} limit #{req.pageNo},#{req.pageSize}
......
...@@ -29,4 +29,18 @@ ...@@ -29,4 +29,18 @@
update_time,update_user,create_user, update_time,update_user,create_user,
location_state,shelf_location,shelf_id location_state,shelf_location,shelf_id
</sql> </sql>
<update id="updateWareInfo">
<foreach collection="list" item="item" separator=";">
update
base_warehouse_inventory
<set>
size_id=(select DISTINCT id FROM base_equipment_size where name=#{item.sizeName} and
type_id =(select DISTINCT id FROM base_equipment_type where name=#{item.typeName} limit 1) limit 1),
type_id=(select DISTINCT id FROM base_equipment_type where name=#{item.typeName} limit 1),
location_id=(select DISTINCT id FROM base_warehouse where name=#{item.locationId} limit 1),
update_time=#{updateTime},epc_type=1,location_state="in",location_type=0
</set>
where flag =2
</foreach>
</update>
</mapper> </mapper>
...@@ -4,8 +4,8 @@ scanner: ...@@ -4,8 +4,8 @@ scanner:
easy-es: easy-es:
enable: true enable: true
address: 192.168.3.121:9200 address: 192.168.3.121:9200
username: username: elastic
password: password: junmp123
thing: thing:
server: server:
websocket: websocket:
...@@ -42,7 +42,7 @@ spring: ...@@ -42,7 +42,7 @@ spring:
redis: redis:
#host: 192.168.3.188 #host: 192.168.3.188
host: 192.168.3.121 host: 192.168.3.188
port: 6379 port: 6379
database: 1 database: 1
password: password:
......
...@@ -4,8 +4,8 @@ scanner: ...@@ -4,8 +4,8 @@ scanner:
easy-es: easy-es:
enable: true enable: true
address: 192.168.3.121:9200 address: 192.168.3.121:9200
username: username: elastic
password: password: junmp123
thing: thing:
server: server:
websocket: websocket:
...@@ -36,7 +36,7 @@ knife4j: ...@@ -36,7 +36,7 @@ knife4j:
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.1.128:3306/db_jyzb_test?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true url: jdbc:mysql://192.168.1.128:3306/db_jyzb?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT&nullCatalogMeansCurrent=true
username: root username: root
password: 123456 password: 123456
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
easy-es: easy-es:
enable: true enable: true
address: 192.168.3.121:9200 address: 192.168.3.121:9200
username: username: elastic
password: password: junmp123
server: server:
tomcat: tomcat:
uri-encoding: UTF-8 #tomcat编码 uri-encoding: UTF-8 #tomcat编码
......
...@@ -301,7 +301,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask ...@@ -301,7 +301,7 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
String bussinessType= MapUtil.getStr(processInstance.getProcessVariables(),BUSSINESS_TYPE); String bussinessType= MapUtil.getStr(processInstance.getProcessVariables(),BUSSINESS_TYPE);
sendReq.setReceiveUserIds(String.valueOf(user.getUserId())); sendReq.setReceiveUserIds(String.valueOf(user.getUserId()));
// sendReq.setBizId(Long.valueOf(processInstance.getProcessInstanceId())); // sendReq.setBizId(Long.valueOf(processInstance.getProcessInstanceId()));
sendReq.setMsgTitle("您的审批被驳回"); sendReq.setMsgTitle("您的申请被驳回");
sendReq.setBizType("refuse/"+Types); sendReq.setBizType("refuse/"+Types);
sendReq.setBizId(Long.valueOf(task.getProcessInstanceId())); sendReq.setBizId(Long.valueOf(task.getProcessInstanceId()));
sendReq.setMsgContent("您提交的审批【"+mainProcess.getName()+"】被驳回,原因:"+comments); sendReq.setMsgContent("您提交的审批【"+mainProcess.getName()+"】被驳回,原因:"+comments);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论