更新内容
parent
9a5513acfc
commit
5e55f21584
|
|
@ -130,9 +130,10 @@ public class ImportPointServiceImpl implements ImportPointService {
|
||||||
"品番",
|
"品番",
|
||||||
"库存下限",
|
"库存下限",
|
||||||
"纳所",
|
"纳所",
|
||||||
"标签类型",
|
"标签类型"
|
||||||
"总分类型",
|
// ,
|
||||||
"关联总库位"
|
// "总分类型",
|
||||||
|
// "关联总库位"
|
||||||
);
|
);
|
||||||
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
List<String> headers = FastExcelUtil.readHeadContent(file, 0, 0);
|
||||||
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
if (!SmartStringUtil.containsAllIgnoreCase(requiredColumns, headers)) {
|
||||||
|
|
|
||||||
|
|
@ -111,10 +111,11 @@ public class InventoryController {
|
||||||
@ApiOperation("查询inventory")
|
@ApiOperation("查询inventory")
|
||||||
@AnonymousAccess
|
@AnonymousAccess
|
||||||
public ResponseEntity<Object> queryInventory(InventoryQueryCriteria criteria, Pageable pageable) {
|
public ResponseEntity<Object> queryInventory(InventoryQueryCriteria criteria, Pageable pageable) {
|
||||||
if (criteria.getItemCodeOne() != null && criteria.getItemCode() != null) {
|
// if (criteria.getItemCodeOne() != null && criteria.getItemCode() != null) {
|
||||||
criteria.setItemCodeOne(null);
|
// criteria.setItemCodeOne(null);
|
||||||
}
|
// }
|
||||||
return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK);
|
return new ResponseEntity<>(inventoryService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
|
// return new ResponseEntity<>(inventoryService.queryInvAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/queryInventoryZz")
|
@GetMapping(value = "/queryInventoryZz")
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,7 @@ public class PickDetailController {
|
||||||
inventoryService.update(inventory);
|
inventoryService.update(inventory);
|
||||||
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.ZZKW_RK, BizStatus.ADD, "制造入库APP", point.getArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, cxjldto.getOrder_qty() + 0d, null, null,
|
InventoryLog inventoryLog = inventoryLogService.storeInventoryLog(BizStatus.ZZKW_RK, BizStatus.ADD, "制造入库APP", point.getArea(), itemKey, inventory.getPoint(), inventory.getPoint(), null, null, srcQty, cxjldto.getOrder_qty() + 0d, null, null,
|
||||||
BizStatus.ZZKW_TL, null, inventory.getId(), "制造入库APP");
|
BizStatus.ZZKW_TL, null, inventory.getId(), "制造入库APP");
|
||||||
inventoryLog.setZzkw(point);
|
// inventoryLog.setZzkw(point);
|
||||||
inventoryLogService.update(inventoryLog);
|
inventoryLogService.update(inventoryLog);
|
||||||
}else {
|
}else {
|
||||||
throw new BadRequestException("扫描错误");
|
throw new BadRequestException("扫描错误");
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ public interface InventoryService {
|
||||||
List<InventoryDto> queryAll(InventoryQueryCriteria criteria);
|
List<InventoryDto> queryAll(InventoryQueryCriteria criteria);
|
||||||
|
|
||||||
List<InventoryDto> queryAll(InvQueryCriteria criteria);
|
List<InventoryDto> queryAll(InvQueryCriteria criteria);
|
||||||
|
Map<String,Object> queryInvAll(InventoryQueryCriteria criteria, Pageable pageable);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询
|
* 根据ID查询
|
||||||
|
|
@ -121,7 +122,6 @@ public interface InventoryService {
|
||||||
* 满足线边耗用库存
|
* 满足线边耗用库存
|
||||||
* @param item
|
* @param item
|
||||||
* @param area
|
* @param area
|
||||||
* @param gw
|
|
||||||
* @param zzkw
|
* @param zzkw
|
||||||
* @param type
|
* @param type
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2019-2020 Zheng Jie
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.youchain.businessdata.service.dto;
|
||||||
|
|
||||||
|
import com.youchain.modules.system.domain.Dept;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author huojin
|
||||||
|
* @website https://eladmin.vip
|
||||||
|
* @description /
|
||||||
|
* @date 2023-08-16
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class InventoryQueryDto implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
private String area_name;
|
||||||
|
private String point_code;
|
||||||
|
private String item_code;
|
||||||
|
private String item_name;
|
||||||
|
private String quantity;
|
||||||
|
private String queued_qty;
|
||||||
|
private String prop_c2;
|
||||||
|
private String inv_min;
|
||||||
|
}
|
||||||
|
|
@ -48,8 +48,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.math.BigInteger;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
@ -57,8 +57,6 @@ import javax.persistence.criteria.Join;
|
||||||
import javax.persistence.criteria.JoinType;
|
import javax.persistence.criteria.JoinType;
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author huojin
|
* @author huojin
|
||||||
|
|
@ -184,6 +182,71 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
return inventoryList;
|
return inventoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String,Object> queryInvAll(InventoryQueryCriteria criteria, Pageable pageable) {
|
||||||
|
//库存查询
|
||||||
|
int pageNum=pageable.getPageNumber();//当前页
|
||||||
|
int pageSize=pageable.getPageSize();//条数
|
||||||
|
Query queryTotal = getQuery(criteria,BizStatus.QUERY_TOTAL);
|
||||||
|
List l=queryTotal.getResultList();
|
||||||
|
int pageCount=((BigInteger)l.get(0)).intValue();
|
||||||
|
Query queryPage = getQuery(criteria,BizStatus.QUERY_PAGE);
|
||||||
|
queryPage.setFirstResult((pageNum)*pageSize);
|
||||||
|
queryPage.setMaxResults((pageNum+1)*pageSize);
|
||||||
|
long st=System.currentTimeMillis();
|
||||||
|
List<InventoryQueryDto> queryResultList = queryPage.unwrap(SQLQuery.class)
|
||||||
|
.setResultTransformer(
|
||||||
|
AliasToEntityMapResultTransformer.INSTANCE
|
||||||
|
)
|
||||||
|
.list();
|
||||||
|
log.error("查询制造库存用时:"+(System.currentTimeMillis()-st));
|
||||||
|
Map<String,Object> map=new HashMap<>();
|
||||||
|
map.put("content",queryResultList);
|
||||||
|
map.put("totalElements",pageCount);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Query getQuery(InventoryQueryCriteria criteria,String type){
|
||||||
|
String midSql="SELECT inv.id,area.name area_name,p.code point_code,it.code item_code,it.name item_name," +
|
||||||
|
" inv.quantity ,inv.queued_qty,ik.prop_c2 ,p.inv_min " ;
|
||||||
|
if(type.equals(BizStatus.QUERY_TOTAL)){
|
||||||
|
midSql="SELECT count(inv.id) ";
|
||||||
|
}
|
||||||
|
String sql =midSql+" " +
|
||||||
|
" from data_inventory inv\n" +
|
||||||
|
"left join base_point p on p.id=inv.point_id\n" +
|
||||||
|
"left join base_area area on area.id=inv.area_id\n" +
|
||||||
|
"left join data_item_key ik on ik.id=inv.item_key_id\n" +
|
||||||
|
"left join base_item it on it.id=ik.item_id" +
|
||||||
|
" where 1=1 " ;
|
||||||
|
if(criteria!=null) {
|
||||||
|
String item_code=criteria.getItemCodeOne();
|
||||||
|
String item_name=criteria.getItemName();
|
||||||
|
String point_code=criteria.getPointCode();
|
||||||
|
String prop_c2=criteria.getBonded();
|
||||||
|
String point_type=criteria.getPointType();
|
||||||
|
Boolean kcbz=true;
|
||||||
|
if (item_code!=null &&item_code.equals("") ) {
|
||||||
|
sql += " and it.code like '%" + item_code + "%'";
|
||||||
|
}
|
||||||
|
if (item_name!=null &&item_name.equals("") ) {
|
||||||
|
sql += " and it.name like '%" + item_code + "%'";
|
||||||
|
}
|
||||||
|
if (point_code!=null &&point_code.equals("") ) {
|
||||||
|
sql += " and p.code like '%" + point_code + "%'";
|
||||||
|
}
|
||||||
|
if (point_type!=null &&point_type.equals("") ) {
|
||||||
|
sql += " and p.type='" + point_type + "'";
|
||||||
|
}
|
||||||
|
if (prop_c2!=null &&prop_c2.equals("") ) {
|
||||||
|
sql += " and it.name like '%" + item_code + "%'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql+=" order by it.code ";
|
||||||
|
Query query = entityManager.createNativeQuery(sql);
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
public Double getInvQty(long itemId, long areaId,Long zzkwId) {
|
public Double getInvQty(long itemId, long areaId,Long zzkwId) {
|
||||||
String hql = "select sum(inv.quantity-inv.queuedQty) from Inventory inv where 1=1 " +
|
String hql = "select sum(inv.quantity-inv.queuedQty) from Inventory inv where 1=1 " +
|
||||||
" and inv.itemKey.item.id=" + itemId + " " +
|
" and inv.itemKey.item.id=" + itemId + " " +
|
||||||
|
|
@ -214,18 +277,18 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
public Inventory getInventory(ItemKey itemKey, Area area, Point point, Point zzkw,Dept dept, String type,String stockCode) {
|
public Inventory getInventory(ItemKey itemKey, Area area, Point point, Point zzkw,Dept dept, String type,String stockCode) {
|
||||||
//生成Inventory
|
//生成Inventory
|
||||||
String hql = " from Inventory inv where 1=1 ";
|
String hql = " from Inventory inv where 1=1 ";
|
||||||
if(type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.ZZKW_TL)||type.equals(BizStatus.YK_JS)){
|
// if(type.equals(BizStatus.SL_ALL)||type.equals(BizStatus.ZZKW_TL)||type.equals(BizStatus.YK_JS)){
|
||||||
if(zzkw==null){
|
// if(zzkw==null){
|
||||||
throw new BadRequestException(HttpStatus.NOT_FOUND, "制造库位必填");
|
// throw new BadRequestException(HttpStatus.NOT_FOUND, "制造库位必填");
|
||||||
}
|
// }
|
||||||
if(!area.getBexb()){
|
// if(!area.getBexb()){
|
||||||
throw new BadRequestException(HttpStatus.NOT_FOUND, area.getCode()+"接收库区必须为线边仓");
|
// throw new BadRequestException(HttpStatus.NOT_FOUND, area.getCode()+"接收库区必须为线边仓");
|
||||||
}
|
// }
|
||||||
// if(area.getPoint()==null){
|
// if(area.getPoint()==null){
|
||||||
// if(area.getPointId()==null){
|
// if(area.getPointId()==null){
|
||||||
// throw new BadRequestException(HttpStatus.NOT_FOUND, "接收库区线边库位必填");
|
// throw new BadRequestException(HttpStatus.NOT_FOUND, "接收库区线边库位必填");
|
||||||
// }
|
// }
|
||||||
}
|
// }
|
||||||
if(type.equals(BizStatus.SL_ALL)){
|
if(type.equals(BizStatus.SL_ALL)){
|
||||||
//取库区默认
|
//取库区默认
|
||||||
hql += " and inv.point.id=" + area.getPointId() + " ";
|
hql += " and inv.point.id=" + area.getPointId() + " ";
|
||||||
|
|
@ -266,11 +329,11 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
inventory.setItemKey(itemKey);
|
inventory.setItemKey(itemKey);
|
||||||
inventory.setPoint(point);
|
inventory.setPoint(point);
|
||||||
inventory.setPointCode(point.getCode());
|
inventory.setPointCode(point.getCode());
|
||||||
if(zzkw==null){
|
// if(zzkw==null){
|
||||||
zzkw=pointService.getPoint("ZZKW",null,null,null);
|
// zzkw=pointService.getPoint("ZZKW",null,null,null);
|
||||||
}
|
// }
|
||||||
inventory.setStockCode(stockCode);
|
inventory.setStockCode(stockCode);
|
||||||
inventory.setZzkw(zzkw);
|
// inventory.setZzkw(zzkw);
|
||||||
// inventory.setStock(stock);
|
// inventory.setStock(stock);
|
||||||
// inventory.setStockCode(stock.getCode());
|
// inventory.setStockCode(stock.getCode());
|
||||||
inventory.setDept(dept);
|
inventory.setDept(dept);
|
||||||
|
|
@ -353,7 +416,7 @@ public class InventoryServiceImpl implements InventoryService {
|
||||||
//位移所需要的数据
|
//位移所需要的数据
|
||||||
InventoryYW inventoryYW = inventoryButton.getInventoryYW();
|
InventoryYW inventoryYW = inventoryButton.getInventoryYW();
|
||||||
//原数据
|
//原数据
|
||||||
Inventory inventoryOld = inventoryYW.getInventory();
|
Inventory inventoryOld = inventoryRepository.getById(inventoryYW.getInventory().getId());
|
||||||
// 位移数量
|
// 位移数量
|
||||||
double rmNumber = inventoryYW.getRmNumber();
|
double rmNumber = inventoryYW.getRmNumber();
|
||||||
//判断 库存-要移动的数量
|
//判断 库存-要移动的数量
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue