Merge remote-tracking branch 'origin/master' into aps_0918

This commit is contained in:
zhangzhiqiang
2023-09-19 14:58:29 +08:00
92 changed files with 1631 additions and 95 deletions

View File

@@ -76,6 +76,11 @@ public class AutoCreateLubricate {
if (num <= 3) {
this.createMain(param);
}
// 周期为周 :当前日期-保养计划日期 <= 1 天时,新增保养单
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num <= 1) {
this.createMain(param);
}
}
}
} else {
@@ -114,6 +119,11 @@ public class AutoCreateLubricate {
if (num >= 3) {
this.createMain(param);
}
// 周期为日 :当前日期-保养实际结束 <= 1 天时,新增保养单
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num >= 1) {
this.createMain(param);
}
}
}
}

View File

@@ -81,6 +81,11 @@ public class AutoCreateRepair {
if (num <= 3) {
this.createRepair(param);
}
// 周期为日 维修计划日期 - 当前日期 <= 1 天时,新增维修单
} else if (StrUtil.equals(maintenancecycle,"05")) {
if (num <= 1) {
this.createRepair(param);
}
}
}
} else {
@@ -122,6 +127,11 @@ public class AutoCreateRepair {
if (num >= 3) {
this.createRepair(param);
}
// 周期为日 :当前日期-维修实际结束 <= 1 天时,新增维修单
} else if (StrUtil.equals(maintenancecycle,"05")) {
if (num >= 1) {
this.createRepair(param);
}
}
}
}

View File

@@ -76,6 +76,10 @@ public class AutoCreateSportCheck {
if (num <= 3) {
this.createMain(param);
}
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num <= 1) {
this.createMain(param);
}
}
}
} else {
@@ -114,6 +118,10 @@ public class AutoCreateSportCheck {
if (num >= 3) {
this.createMain(param);
}
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num >= 1) {
this.createMain(param);
}
}
}
}

View File

@@ -76,6 +76,10 @@ public class AutoCreateUpkeep {
if (num <= 3) {
this.createMain(param);
}
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num <= 1) {
this.createMain(param);
}
}
}
} else {
@@ -114,6 +118,10 @@ public class AutoCreateUpkeep {
if (num >= 3) {
this.createMain(param);
}
} else if (StrUtil.equals(maintenancecycle,"04")) {
if (num >= 1) {
this.createMain(param);
}
}
}
}

View File

@@ -100,7 +100,11 @@ public class DevicelubricateplanmstServiceImpl implements Devicelubricateplanmst
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
}else{
}else if (maintenancecycle2.equals("04")) { // 日
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
} else{
jo.put("next_end_date","");
ja2.add(jo);
}

View File

@@ -99,7 +99,11 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
}else{
}else if (maintenancecycle2.equals("05")) { // 日
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
} else{
jo.put("next_end_date","");
ja2.add(jo);
}

View File

@@ -100,6 +100,10 @@ public class DevicesportcheckplanmstServiceImpl implements Devicesportcheckplanm
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
}else if (maintenancecycle2.equals("04")) { // 日
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
}else{
jo.put("next_end_date","");
ja2.add(jo);

View File

@@ -100,7 +100,11 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
Date next_end_date = DateUtil.offsetWeek(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
}else{
} else if (maintenancecycle2.equals("04")) { // 日
Date next_end_date = DateUtil.offsetDay(real_end_date2,1);
jo.put("next_end_date", DateUtil.formatDate(next_end_date));
ja2.add(jo);
} else{
jo.put("next_end_date","");
ja2.add(jo);
}

View File

@@ -0,0 +1,113 @@
package org.nl.wms.masterdata_manage.controller.em;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.jsonwebtoken.lang.Assert;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
import org.nl.wms.masterdata_manage.service.em.EmBiRepairDeviceService;
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author Liu xy
* @date 2022-05-26
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "维修人与设备档案维护")
@RequestMapping("/api/embirepairdevice")
@Slf4j
public class EmBiRepairDeviceController {
@Autowired
private EmBiRepairDeviceService emBiRepairDeviceService;
@GetMapping
@Log("查询人员设备维护")
public ResponseEntity<Object> query(DeviceUserQuery query, PageQuery page){
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
List<Map> list = emBiRepairDeviceService.queryAll(query);
TableDataInfo build = TableDataInfo.build(list);
build.setTotalElements(result.getTotal());
return new ResponseEntity<>(build,HttpStatus.OK);
}
@GetMapping("/device")
@Log("查询设备")
//("查询设备")
public ResponseEntity<Object> device(DeviceUserQuery query, PageQuery page){
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
List<Map> list = emBiRepairDeviceService.queryAllDevice(query);
TableDataInfo build = TableDataInfo.build(list);
build.setTotalElements(result.getTotal());
return new ResponseEntity<>(build,HttpStatus.OK);
}
@PostMapping
@Log("新增人员设备维护")
public ResponseEntity<Object> create(@RequestBody JSONObject entity){
Assert.notNull(entity,"请求参数不能为空");
EmBiRepairDevice one = emBiRepairDeviceService.getOne(
new QueryWrapper<EmBiRepairDevice>().lambda()
.eq(EmBiRepairDevice::getUser_id, entity.getString("user_id"))
.eq(EmBiRepairDevice::getDevice_code, entity.getString("device_code"))
);
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("设备重复");
EmBiRepairDevice emBiRepairDevice = entity.toJavaObject(EmBiRepairDevice.class);
emBiRepairDevice.setPerson_id(IdUtil.getStringId());
emBiRepairDeviceService.save(emBiRepairDevice);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改人员设备维护")
public ResponseEntity<Object> update(@RequestBody JSONObject entity){
EmBiRepairDevice one = emBiRepairDeviceService.getOne(
new QueryWrapper<EmBiRepairDevice>().lambda()
.eq(EmBiRepairDevice::getUser_id, entity.getString("user_id"))
.eq(EmBiRepairDevice::getDevice_code, entity.getString("device_code"))
);
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("设备重复");
EmBiRepairDevice emBiRepairDevice = emBiRepairDeviceService.getById(entity.getString("person_id"));
emBiRepairDevice.setDevice_code(entity.getString("device_code"));
emBiRepairDeviceService.updateById(emBiRepairDevice);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@Log("删除人员设备维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
if (ids != null && ids.length>0){
emBiRepairDeviceService.removeByIds(Arrays.asList(ids));
}
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -9,8 +9,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.utils.MapOf;
import org.nl.wms.masterdata_manage.service.master.IMdPbMeasureunitService;
import org.nl.wms.masterdata_manage.service.master.dao.MdPbMeasureunit;
import org.nl.wms.masterdata_manage.service.master.dto.UnitQuery;
@@ -22,7 +24,9 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author loujf
@@ -45,6 +49,17 @@ public class MdPbMeasureunitController {
return new ResponseEntity<>(measureunitService.pageQuery(query, page), HttpStatus.OK);
}
@GetMapping("/select")
@Log("查询单位下拉列表设备")
public ResponseEntity<Object> selectAll(){
List<MdPbMeasureunit> list = measureunitService.list();
List<Map> result = new ArrayList<>();
for (MdPbMeasureunit item : list) {
result.add(MapOf.of("label",item.getUnit_name(),"value",item.getMeasure_unit_id()));
}
return new ResponseEntity<>(TableDataInfo.build(result),HttpStatus.OK);
}
@PostMapping("/add")
@Log("新增计量单位")
//("新增计量单位")

View File

@@ -0,0 +1,28 @@
package org.nl.wms.masterdata_manage.service.em;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
import java.util.List;
import java.util.Map;
/**
* <p>
* 人员设备关系表 服务类
* </p>
*
* @author generator
* @since 2023-06-06
*/
public interface EmBiRepairDeviceService extends IService<EmBiRepairDevice> {
/**
* 查询数据分页
* @param whereJson 条件
* @return Map<String,Object>
*/
List<Map> queryAll(DeviceUserQuery whereJson);
List<Map> queryAllDevice(DeviceUserQuery whereJson);
}

View File

@@ -0,0 +1,38 @@
package org.nl.wms.masterdata_manage.service.em.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* <p>
* 人员设备关系表
* </p>
*
* @author generator
* @since 2023-06-06
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("em_bi_repairpersondevice")
public class EmBiRepairDevice implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
private String person_id;
/**
* 用户id
*/
private String user_id;
/**
* 设备编码
*/
private String device_code;
}

View File

@@ -0,0 +1,24 @@
package org.nl.wms.masterdata_manage.service.em.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
import java.util.List;
import java.util.Map;
/**
* <p>
* 人员设备关系表 Mapper 接口
* </p>
*
* @author generator
* @since 2023-06-06
*/
public interface EmBiRepairDeviceMapper extends BaseMapper<EmBiRepairDevice> {
List<Map> queryAll(@Param("query") DeviceUserQuery query);
List<Map> queryAllDevice(@Param("query") DeviceUserQuery query);
}

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.masterdata_manage.service.em.dao.mapper.EmBiRepairDeviceMapper">
<select id="queryAll" resultType="java.util.Map">
SELECT
*
FROM
sys_user
<where>
is_used = '1'
<if test="query.username != null and query.username != ''">
and username = #{query.username}
</if>
</where>
</select>
<select id="queryAllDevice" resultType="java.util.Map">
SELECT
device.device_code,
device.device_name,
use1.person_name,
mps.person_id
FROM
em_bi_repairpersondevice mps
LEFT JOIN em_bi_equipmentfile device ON device.device_code = mps.device_code
LEFT JOIN sys_user use1 ON use1.user_id = mps.user_id
<where>
mps.user_id = #{query.user_id}
</where>
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
package org.nl.wms.masterdata_manage.service.em.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.device_manage.service.userdevice.dto.DeviceUserQuery;
import org.nl.wms.masterdata_manage.service.em.EmBiRepairDeviceService;
import org.nl.wms.masterdata_manage.service.em.dao.EmBiRepairDevice;
import org.nl.wms.masterdata_manage.service.em.dao.mapper.EmBiRepairDeviceMapper;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 人员设备关系表 服务实现类
* </p>
*
* @author generator
* @since 2023-06-06
*/
@Service
public class EmBiRepairDeviceServiceImpl extends ServiceImpl<EmBiRepairDeviceMapper, EmBiRepairDevice> implements EmBiRepairDeviceService {
@Override
public List<Map> queryAll(DeviceUserQuery query) {
return this.baseMapper.queryAll(query);
}
@Override
public List<Map> queryAllDevice(DeviceUserQuery query) {
return this.baseMapper.queryAllDevice(query);
}
}

View File

@@ -0,0 +1,51 @@
package org.nl.wms.masterdata_manage.storage.controller.dailyStructivt;
import cn.dev33.satoken.annotation.SaIgnore;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.nl.common.TableDataInfo;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.IStIvtStructivtDailyService;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dto.DailyStructivtQuery;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtSectattr;
import org.nl.wms.masterdata_manage.storage.service.storage.dto.SectattrQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 日库存统计表 前端控制器
* </p>
*
* @author generator
* @since 2023-09-18
*/
@RestController
@RequestMapping("api/structivtDaily")
@SaIgnore
public class StIvtStructivtDailyController {
@Autowired
private IStIvtStructivtDailyService stIvtStructivtDailyService;
@GetMapping
@Log("查询日库区")
@SaIgnore
public ResponseEntity<Object> query(DailyStructivtQuery query, PageQuery page){
return new ResponseEntity<>(TableDataInfo.build(stIvtStructivtDailyService.page(page.build(),query.build())),HttpStatus.OK);
}
@GetMapping("/sync")
@Log("同步日库区")
@SaIgnore
public ResponseEntity<Object> sync(String[] structivts){
stIvtStructivtDailyService.dailyStructivt(structivts);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,21 @@
package org.nl.wms.masterdata_manage.storage.service.dailyStructivt;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
/**
* <p>
* 日库存统计表 服务类
* </p>
*
* @author generator
* @since 2023-09-18
*/
public interface IStIvtStructivtDailyService extends IService<StIvtStructivtDaily> {
/**
* 统计日常数据
*/
void dailyStructivt(String...structivts);
}

View File

@@ -0,0 +1,116 @@
package org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 日库存统计表
* </p>
*
* @author generator
* @since 2023-09-18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("st_ivt_structivt_daily")
public class StIvtStructivtDaily implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 库存记录标识
*/
@TableId
private String id;
/**
* 仓库标识
*/
private String stor_id;
/**
* 仓库名称
*/
private String stor_name;
/**
* 库区标识
*/
private String sect_id;
/**
* 库区名称
*/
private String sect_name;
/**
* 仓库表
*/
private String table_name;
/**
* 车间标识
*/
private String product_area;
/**
* 货位集合
*/
private String struct_code;
/**
* 计量单位标识
*/
private String qty_unit_id;
/**
* 创建时间
*/
private String create_time;
/**
* 物料标识
*/
private String material_id;
/**
* 物料标识
*/
private String material_code;
/**
* 物料标识
*/
private String material_spec;
/**
* 可用数
*/
private BigDecimal canuse_qty;
/**
* 冻结数
*/
private BigDecimal frozen_qty;
/**
* 库存数
*/
private BigDecimal ivt_qty;
/**
* 待入数
*/
private BigDecimal warehousing_qty;
}

View File

@@ -0,0 +1,24 @@
package org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
import java.util.List;
import java.util.Map;
/**
* <p>
* 日库存统计表 Mapper 接口
* </p>
*
* @author generator
* @since 2023-09-18
*/
public interface StIvtStructivtDailyMapper extends BaseMapper<StIvtStructivtDaily> {
@Select("SELECT #{table} AS table_name,GROUP_CONCAT(a.struct_code) struct_code, 'A1' AS product_area, st_ivt_structattr.stor_id,st_ivt_structattr.stor_name , st_ivt_structattr.sect_id,st_ivt_structattr.sect_name , UUID_SHORT( ) id,a.material_id,md_me_materialbase.material_code,md_me_materialbase.material_spec, sum( canuse_qty ) canuse_qty, sum( frozen_qty ) frozen_qty, sum( ivt_qty ) ivt_qty, sum( warehousing_qty ) warehousing_qty, qty_unit_id, CURDATE( ) create_time FROM ${table} as a left join st_ivt_structattr on a.struct_code = st_ivt_structattr.struct_code left join md_me_materialbase on a.material_id = md_me_materialbase.material_id GROUP BY material_id")
List<Map> selectStructivt(@Param("table") String table);
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.mapper.StIvtStructivtDailyMapper">
</mapper>

View File

@@ -0,0 +1,26 @@
package org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
/*
* @author ZZQ
* @Date 2023/5/14 17:13
*/
@Data
public class DailyStructivtQuery extends BaseQuery<StIvtStructivtDaily> {
private String stor_id;
private String sect_id;
private String struct_code;
private String blurry;
@Override
public void paramMapping() {
super.doP.put("blurry", QParam.builder().k(new String[]{"material_code","material_spec"}).type(QueryTEnum.ORLK).build());
}
}

View File

@@ -0,0 +1,64 @@
package org.nl.wms.masterdata_manage.storage.service.dailyStructivt.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.IStIvtStructivtDailyService;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.mapper.StIvtStructivtDailyMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
* <p>
* 日库存统计表 服务实现类
* </p>
*
* @author generator
* @since 2023-09-18
*/
@Service
public class StIvtStructivtDailyServiceImpl extends ServiceImpl<StIvtStructivtDailyMapper, StIvtStructivtDaily> implements IStIvtStructivtDailyService {
@Override
@Transactional
public void dailyStructivt(String... structivts) {
if (structivts.length == 0){
return;
}
ArrayList<StIvtStructivtDaily> list = new ArrayList<>();
for (String structivt : structivts) {
List<Map> maps = this.baseMapper.selectStructivt(structivt);
if (!CollectionUtils.isEmpty(maps)){
List<StIvtStructivtDaily> dailyList = JSONArray.parseArray(JSON.toJSONString(maps), StIvtStructivtDaily.class);
list.addAll(dailyList);
}
}
if (!CollectionUtils.isEmpty(list)){
List<StIvtStructivtDaily> errorData = list.stream().filter(stIvtStructivtDaily -> StringUtils.isEmpty(stIvtStructivtDaily.getStor_id()) || StringUtils.isEmpty(stIvtStructivtDaily.getMaterial_id())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(errorData)){
throw new BadRequestException("表存在异常数据没有仓库跟物料信息:"+errorData
.stream()
.map(stIvtStructivtDaily-> stIvtStructivtDaily.getTable_name()+".仓位:"+stIvtStructivtDaily.getStruct_code()+".物料"+stIvtStructivtDaily.getMaterial_id())
.distinct().collect(Collectors.joining(",")));
}
Set<String> collect = list.stream().map(StIvtStructivtDaily::getStor_id).collect(Collectors.toSet());
this.remove(new QueryWrapper<StIvtStructivtDaily>().in("stor_id",collect).eq("create_time", DateUtil.now()));
this.saveBatch(list);
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.masterdata_manage.storage.service.storage.dao.mapper.StIvtStructivtDailyMapper">
</mapper>

View File

@@ -134,8 +134,8 @@ public class QlTestInspectionsheetmstServiceImpl extends ServiceImpl<QlTestInspe
ylmst.put("total_qty",mst.getQty());
ylmst.put("detail_count",1);
ylmst.put("stor_id",IOSEnum.STOR_CODE.code("原材料仓"));
ylmst.put("bill_type",IOSEnum.BILL_TYPE.code("手工入库"));
ylmst.put("buss_type",IOSEnum.BILL_TYPE.code("手工入库"));
ylmst.put("bill_type",IOSEnum.BILL_TYPE.code("采购入库"));
ylmst.put("buss_type",IOSEnum.BILL_TYPE.code("采购入库"));
ylmst.put("biz_date",DateUtil.today());
ylmst.put("tableData",tableData);
iostorinvYlService.create(ylmst);

View File

@@ -37,9 +37,11 @@ public enum IOSEnum {
//锁定类型
LOCK_TYPE(MapOf.of("未锁定", "0", "入库锁", "1", "出库锁", "2","盘点锁", "3","损溢锁", "4","拼盘锁","5","移库锁","10","其他锁","99")),
// 海柔半成品出入库类型
BILL_TYPE_HR(MapOf.of("生产出库", "1001", "盘点出库", "1002", "手工出库", "1009","生产入库","0001")),
BILL_TYPE_HR(MapOf.of("生产出库", "1001", "盘点出库", "1002", "手工出库", "1009","生产入库","0001","手工入库", "0009")),
// 半成品出入类型
BILL_TYPE_BCP(MapOf.of("清洗入库", "0001", "手工入库", "0009","生产出库","1001","手工出库","1009")),
ST_INV_CP_TYPE(MapOf.of("生产出库", "1001", "盘点出库", "1002", "移库出库", "1003","手工出库", "1009","生产入库","0001","移库入库","0003","手工入库", "0009")),
;
private Map<String, String> code;

View File

@@ -284,7 +284,8 @@ public class StIvtMoveinvCpServiceImpl extends ServiceImpl<StIvtMoveinvCpMapper,
ivtOutParam.put("sale_id", dtl.getSale_id());
ivtOutParam.put("bill_code",mst.getBill_code());
ivtOutParam.put("inv_id",mst.getMoveinv_id());
ivtOutParam.put("bill_type_scode",mst.getBill_type());
ivtOutParam.put("bill_type_scode",IOSEnum.ST_INV_CP_TYPE.code("移库出库"));
ivtOutParam.put("stor_id",mst.getStor_id());
iStIvtStructivtCpService.UpdateIvt(ivtOutParam);
//加入库
JSONObject ivtInParam = new JSONObject();
@@ -298,7 +299,8 @@ public class StIvtMoveinvCpServiceImpl extends ServiceImpl<StIvtMoveinvCpMapper,
ivtInParam.put("sale_id", dtl.getSale_id());
ivtInParam.put("bill_code",mst.getBill_code());
ivtInParam.put("inv_id",mst.getMoveinv_id());
ivtInParam.put("bill_type_scode",mst.getBill_type());
ivtInParam.put("bill_type_scode",IOSEnum.ST_INV_CP_TYPE.code("移库入库"));
ivtInParam.put("product_area",mst.getProduct_area());
iStIvtStructivtCpService.UpdateIvt(ivtInParam);
}
}

View File

@@ -1,19 +1,26 @@
package org.nl.wms.storage_manage.rawmanage.controller.structIvt;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.device_manage.ios.service.structIvt.dto.StructIvtEmQuery;
import org.nl.wms.storage_manage.productmanage.util.ChangeIvtUtil;
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvOutYlService;
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
@@ -29,31 +36,29 @@ public class StIvtStructivtYlController {
@Autowired
private IStIvtStructivtYlService structivtYlService;
@Autowired
private IStIvtIostorinvOutYlService iostorinvOutYlService;
@GetMapping("/getRawIvt")
@Log("查询可用的原料库存")
//("查询可用的原料库存")
public ResponseEntity<Object> getRawIvt(StructIvtYLQuery query, PageQuery page) {
return new ResponseEntity<>(structivtYlService.getRawIvt(query, page), HttpStatus.OK);
}
@GetMapping("/getProductIvt")
@Log("查询可用的成品库存")
//("查询可用的成品库存")
public ResponseEntity<Object> getProductIvt(StructIvtYLQuery query, PageQuery page) {
return new ResponseEntity<>(structivtYlService.getProductIvt(query,page), HttpStatus.OK);
}
@PostMapping("/getStructIvt")
@Log("查询库存")
//("查询库存")
public ResponseEntity<Object> getStructIvt(StructIvtYLQuery query) {
return new ResponseEntity<>(structivtYlService.getStructIvt(query), HttpStatus.OK);
}
@PostMapping("/getSemiProductIvt")
@Log("查询可用的半成品库存")
//("查询可用的半成品库存")
public ResponseEntity<Object> getSemiProductIvt(StructIvtYLQuery query) {
return new ResponseEntity<>(structivtYlService.getSemiProductIvt(query), HttpStatus.OK);
}
@@ -61,16 +66,22 @@ public class StIvtStructivtYlController {
@GetMapping("/getSemiProductIvt2")
@Log("查询可用的半成品库存")
//("查询可用的半成品库存")
public ResponseEntity<Object> getSemiProductIvt2(StructIvtYLQuery query, PageQuery page) {
return new ResponseEntity<>(structivtYlService.getSemiProductIvt(query,page), HttpStatus.OK);
}
@GetMapping("/getAllRawIvt")
@Log("查询原料库存")
//("查询原料库存")
public ResponseEntity<Object> getAllRawIvt(StructIvtYLQuery query, PageQuery page) {
return new ResponseEntity<>(structivtYlService.getAllRawIvt(query, page), HttpStatus.OK);
}
@PostMapping("/update")
@Log("更新原料库存")
public ResponseEntity<Object> update(@RequestBody JSONObject form) {
iostorinvOutYlService.updateIvt(form);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -63,4 +63,10 @@ public interface IStIvtIostorinvOutYlService extends IService<StIvtIostorinvYl>
*/
void confirm(JSONObject form);
/**
* 手动修改库存
* @param form
*/
void updateIvt(JSONObject form);
}

View File

@@ -299,4 +299,35 @@ public class StIvtIostorinvOutYlServiceImpl extends ServiceImpl<StIvtIostorinvOu
return stIvtIostorinvYl;
}
//aps_sale_type"I"canuse_qty660class_name"紫铜管件S"frozen_qty0instorage_time"2023-09-13 17:29:55"is_activetrueivt_level"1"ivt_qty660material_code"24010638S"material_id"1684134849134333952"material_name"三通\\T7/8墨西哥\\MSNA0201002"pcsn"2023-09-13"qty_unit_id"1"qty_unit_name"KG"quality_scode"01"sect_code"RCK001"sect_id"1528631043903590400"sect_name"原材料区"stockrecord_id"1701890944963579904"stor_id"1528627964823080960"stor_name"紫铜原材料仓库"struct_code"YCL001"struct_id"1528636861080276992"struct_name"原材料仓位"warehousing_qty0
@Override
@Transactional
public void updateIvt(JSONObject form) {
StIvtStructivtYl ivt = structivtYlService.getOne(new QueryWrapper<StIvtStructivtYl>()
.eq("material_id", form.getString("material_id"))
.eq("stor_id", form.getString("stor_id"))
.eq("canuse_qty", form.getBigDecimal("old_qty"))
);
if (ivt==null){
throw new BadRequestException("当前物料库存已变更,请重新操作");
}
double change_qty = NumberUtil.sub(form.getBigDecimal("ivt_qty"),form.getBigDecimal("old_qty")).doubleValue();
if (change_qty==0){
return;
}
ivt.setCanuse_qty(form.getBigDecimal("ivt_qty"));
ivt.setIvt_qty(ivt.getCanuse_qty());
structivtYlService.updateById(ivt);
// 插入库存变动记
JSONObject param = JSONObject.parseObject(JSON.toJSONString(ivt));
param.put("change_type", change_qty>0?ChangeIvtUtil.SUBWAREHOUSING_ADDIVT_QTY:ChangeIvtUtil.SUBFROZEN_SUBIVT_QTY);
param.put("change_qty",Math.abs(change_qty));
param.put("result_qty", form.getBigDecimal("ivt_qty"));
param.put("bill_code","");
param.put("inv_id","");
param.put("bill_type_scode","");
iStIvtStructivtflowYlService.insetIvtChange(param);
}
}

View File

@@ -161,6 +161,7 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
if (ObjectUtil.isNotEmpty(structivtYl)) {
structivtYl.setCanuse_qty(NumberUtil.add(structivtYl.getCanuse_qty(), dis.getPlan_qty()));
structivtYl.setIvt_qty(structivtYl.getCanuse_qty());
structivtYl.setInstorage_time(DateUtil.now());
structivtYlService.updateById(structivtYl);
// 插入库存变动记录

View File

@@ -68,6 +68,7 @@
and sa.stor_id = #{query.stor_id}
</if>
</where>
order by instorage_time desc
</select>
<select id="getProductIvt" resultType="java.util.Map">

View File

@@ -324,7 +324,7 @@ public class StIvtIostorinvBcpOutServiceImpl extends ServiceImpl<StIvtIostorinvB
mst.setPcsn(StringUtils.isNotEmpty(form.getString("pcsn")) ? form.getString("pcsn") : DateUtil.today());
mst.setPlan_qty(stIvtStructivtBcp.getCanuse_qty());
mst.setQuality_scode(stIvtStructivtBcp.getQuality_scode());
mst.setQty_unit_id(stIvtStructivtBcp.getQty_unit_id());
mst.setQty_unit_id("2");
mst.setBase_bill_code("");
mst.setQty_unit_name(" ");
mst.setUnit_weight(material.getNet_weight());

View File

@@ -219,7 +219,7 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
.pcsn(DateUtil.today())
.ivt_level(IVTEnum.IVT_LEVEL.code("一级"))
.is_active(true)
.qty_unit_id(mdMeMaterialbase.getBase_unit_id())
.qty_unit_id("2")
.instorage_time(DateUtil.now())
.stor_id(form.getString("stor_id"))
.canuse_qty(form.getBigDecimal("qty"))
@@ -273,7 +273,7 @@ public class StIvtIostorinvBcpServiceImpl extends ServiceImpl<StIvtIostorinvBcpM
.pcsn(mst.getPcsn())
.ivt_level(mst.getIvt_level())
.is_active(mst.getIs_active())
.qty_unit_id(mst.getQty_unit_id())
.qty_unit_id("2")
.instorage_time(DateUtil.now())
.stor_id(mst.getStor_id())
.canuse_qty(mst.getPlan_qty())

View File

@@ -288,7 +288,7 @@ public class StIvtMoveinvBcpServiceImpl extends ServiceImpl<StIvtMoveinvBcpMappe
.pcsn(dtl.getPcsn())
.ivt_level(dtl.getIvt_level())
.is_active(dtl.getIs_active())
.qty_unit_id(dtl.getQty_unit_id())
.qty_unit_id("2")
.instorage_time(DateUtil.now())
.stor_id(mst.getStor_id())
.canuse_qty(dtl.getQty())

View File

@@ -235,7 +235,7 @@ public class StIvtMoreorlessmstBcpServiceImpl extends ServiceImpl<StIvtMoreorles
.ivt_level(dtl.getIvt_level())
.is_active(dtl.getIs_active())
.canuse_qty(mol_qty)
.qty_unit_id(dtl.getQty_unit_id())
.qty_unit_id("2")
.instorage_time(DateUtil.now())
.stor_id(mst.getStor_id())
.workshop_id(mst.getProduct_area())

View File

@@ -72,9 +72,21 @@ public class StIvtStructivtBcp implements Serializable {
* 库存数
*/
private BigDecimal canuse_qty;
/**
* 库存数
*/
private BigDecimal frozen_qty;
/**
* 库存数
*/
private BigDecimal ivt_qty;
/**
* 库存数
*/
private BigDecimal warehousing_qty;
/**
* 计量单位标识
* 计量单位标识:2/g
*/
private String qty_unit_id;

View File

@@ -297,7 +297,7 @@ public class StIvtIostorinvHrBcpOutServiceImpl extends ServiceImpl<StIvtIostorin
new QueryWrapper<MdPbStoragevehicleext>().lambda()
.eq(MdPbStoragevehicleext::getStoragevehicle_code,form.getString("storagevehicle_code"))
);
}
}
@@ -335,7 +335,7 @@ public class StIvtIostorinvHrBcpOutServiceImpl extends ServiceImpl<StIvtIostorin
mst.setPcsn(StringUtils.isNotEmpty(form.getString("pcsn")) ? form.getString("pcsn") : DateUtil.today());
mst.setPlan_qty(stIvtStructivtBcp.getCanuse_qty());
mst.setQuality_scode(stIvtStructivtBcp.getQuality_scode());
mst.setQty_unit_id(stIvtStructivtBcp.getQty_unit_id());
mst.setQty_unit_id("2");
mst.setBase_bill_code("");
mst.setQty_unit_name(" ");
mst.setUnit_weight(material.getNet_weight());

View File

@@ -0,0 +1,24 @@
CREATE TABLE `st_ivt_structivt_daily` (
`id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '库存记录标识',
`stor_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '仓库标识',
`struct_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '仓位标识',
`struct_code` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '仓位编码',
`struct_name` varchar(500) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '仓位名称',
`material_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '物料标识',
`canuse_qty` decimal(18,6) NOT NULL DEFAULT '0.000000' COMMENT '可用数',
`frozen_qty` decimal(18,6) DEFAULT '0.000000' COMMENT '冻结数',
`ivt_qty` decimal(18,6) NOT NULL DEFAULT '0.000000' COMMENT '库存数',
`warehousing_qty` decimal(18,6) DEFAULT '0.000000' COMMENT '待入数',
`qty_unit_id` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '计量单位标识',
`create_time` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin NOT NULL COMMENT '创建时间',
`product_area` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '车间标识',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin COMMENT='日库存统计表';
ALTER TABLE st_ivt_structivt_bcp
ADD COLUMN `frozen_qty` decimal(18,3) DEFAULT '0.000' COMMENT '冻结数',
ADD COLUMN `ivt_qty` decimal(18,3) NOT NULL DEFAULT '0.000' COMMENT '库存数',
ADD COLUMN `warehousing_qty` decimal(18,3) DEFAULT '0.000' COMMENT '待入数';
-- CP移库类型
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1703954832731279360', 'ST_INV_CP_IN_TYPE', '成品入库单据类型', '移库入库', '0003', 3, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-19 10:11:04', '1694303357524643840', '管理员', '2023-09-19 10:11:04');
INSERT INTO `hl_one_mes`.`sys_dict`(`dict_id`, `code`, `name`, `label`, `value`, `dict_sort`, `dict_type`, `para1`, `para2`, `para3`, `create_id`, `create_name`, `create_time`, `update_id`, `update_name`, `update_time`) VALUES ('1703955348920078336', 'ST_INV_CP_OUT_TYPE', '成品出库单据类型', '移库出库', '1003', 3, NULL, NULL, NULL, NULL, '1694303357524643840', '管理员', '2023-09-19 10:13:07', '1694303357524643840', '管理员', '2023-09-19 10:13:16');