rev:安全库存、库区维护
This commit is contained in:
@@ -2,25 +2,19 @@
|
||||
package org.nl.wms.masterdata_manage.storage.controller.material;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.masterdata_manage.备份st.service.MaterialsafeivtService;
|
||||
import org.nl.wms.masterdata_manage.备份st.service.dto.MaterialsafeivtDto;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.IStIvtMaterialsafeivtService;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.dto.SafeIvtQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @date 2021-12-10
|
||||
@@ -39,13 +33,15 @@ public class MaterialsafeivtController {
|
||||
@ApiOperation("查询安全库存")
|
||||
//@PreAuthorize("@el.check('materialsafeivt:list')")
|
||||
public ResponseEntity<Object> query(SafeIvtQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(materialsafeivtService.queryAll(query,page),HttpStatus.OK);
|
||||
return new ResponseEntity<>(materialsafeivtService.pageQuery(query,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询拼盘单")
|
||||
@ApiOperation("查询拼盘单")
|
||||
public ResponseEntity<Object> query(ShutQuery query, PageQuery page) {
|
||||
return new ResponseEntity<>(shutframeinvBcpService.pageQuery(query, page), HttpStatus.OK);
|
||||
@PostMapping("/save")
|
||||
@Log("保存安全库存")
|
||||
@ApiOperation("保存安全库存")
|
||||
//@PreAuthorize("@el.check('materialsafeivt:list')")
|
||||
public ResponseEntity<Object> save(@RequestBody JSONObject form){
|
||||
materialsafeivtService.save(form);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.basedata.service.material;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.dao.StIvtMaterialsafeivt;
|
||||
@@ -22,4 +23,5 @@ public interface IStIvtMaterialsafeivtService extends IService<StIvtMaterialsafe
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object pageQuery(SafeIvtQuery query, PageQuery page);
|
||||
void save(JSONObject form);
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ public class StIvtMaterialsafeivt implements Serializable {
|
||||
/**
|
||||
* 仓库标识
|
||||
*/
|
||||
private Long stor_id;
|
||||
private String stor_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private Long material_id;
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 安全库存下限
|
||||
@@ -45,7 +45,7 @@ public class StIvtMaterialsafeivt implements Serializable {
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private Long qty_unit_id;
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量计量单位名称
|
||||
@@ -55,7 +55,7 @@ public class StIvtMaterialsafeivt implements Serializable {
|
||||
/**
|
||||
* 设置人
|
||||
*/
|
||||
private Long set_id;
|
||||
private String set_id;
|
||||
|
||||
/**
|
||||
* 设置人姓名
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON stor.stor_id = safe.stor_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mb.base_unit_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
WHERE
|
||||
1 = 1
|
||||
<where>
|
||||
<if test="query.material_type_id != null and query.material_type_id != ''">
|
||||
mb.material_type_id = #{query.material_type_id}
|
||||
AND mb.material_type_id = #{query.material_type_id}
|
||||
</if>
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
stor.stor_id = #{stor_id}
|
||||
AND stor.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
<if test="query.material_search != null and query.material_search != ''">
|
||||
(mb.material_code = #{query.material_search} OR mb.material_name = #{query.material_search})
|
||||
AND (mb.material_code like '%${query.material_search}%' OR mb.material_name like '%${query.material_search}%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -20,4 +20,8 @@ public class SafeIvtQuery extends BaseQuery<StIvtShutframeinvBcp> {
|
||||
|
||||
private String material_search;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("material_search", QParam.builder().k(new String[]{"material_search"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package org.nl.wms.storage_manage.basedata.service.material.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.mvel2.ast.Safe;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.IStIvtMaterialsafeivtService;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.dao.StIvtMaterialsafeivt;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.dao.mapper.StIvtMaterialsafeivtMapper;
|
||||
import org.nl.wms.storage_manage.basedata.service.material.dto.SafeIvtQuery;
|
||||
import org.nl.wms.storage_manage.semimanage.service.shutFrame.dto.ShutQuery;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -36,4 +39,28 @@ public class StIvtMaterialsafeivtServiceImpl extends ServiceImpl<StIvtMaterialsa
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(JSONObject form) {
|
||||
String stor_id = form.getString("stor_id");
|
||||
JSONArray rows = form.getJSONArray("rows");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String material_id = row.getString("material_id");
|
||||
this.remove(new QueryWrapper<StIvtMaterialsafeivt>().eq("material_id", material_id).eq("stor_id", stor_id));
|
||||
|
||||
StIvtMaterialsafeivt safe = new StIvtMaterialsafeivt();
|
||||
if (row.getDouble("safe_ivt_down") > 0) {
|
||||
safe.setMaterial_id(material_id);
|
||||
safe.setStor_id(stor_id);
|
||||
safe.setSafe_ivt_up(row.getBigDecimal("safe_ivt_down"));
|
||||
safe.setSafe_ivt_down(row.getBigDecimal("safe_ivt_down"));
|
||||
safe.setQty_unit_id(row.getString("qty_unit_id"));
|
||||
safe.setQty_unit_name(row.getString("qty_unit_name"));
|
||||
safe.setSet_id(SecurityUtils.getCurrentUserId());
|
||||
safe.setSet_name(SecurityUtils.getCurrentNickName());
|
||||
safe.setSet_time(DateUtil.now());
|
||||
this.save(safe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user