|
|
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @author Dreamchaser |
|
|
* @author Dreamchaser |
|
|
@ -62,6 +63,30 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于在盘点时获取到盘点位置的所有库存 |
|
|
|
|
|
* |
|
|
|
|
|
* @param map |
|
|
|
|
|
* @param request |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@GetMapping("/findInventoryForStockTaking") |
|
|
|
|
|
public RestResponse findInventoryForStockTaking(@RequestParam Map<String, Object> map, HttpServletRequest request) { |
|
|
|
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); |
|
|
|
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
|
|
|
if (Integer.compare(depositoryId, -1) == 0) { |
|
|
|
|
|
return new RestResponse(null); |
|
|
|
|
|
} else { |
|
|
|
|
|
map.put("userTokenId",userToken.getId()); |
|
|
|
|
|
List<MaterialAndPlaceForView> inventoryForStockTaking = materialService.findInventoryForStockTaking(map); |
|
|
|
|
|
return new RestResponse(inventoryForStockTaking,placeService.findPlaceAndMaterialCountByCondition(map),200); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 用于查询当前组合中物料的数量 |
|
|
* 用于查询当前组合中物料的数量 |
|
|
* |
|
|
* |
|
|
@ -118,7 +143,7 @@ public class MaterialController { |
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
UserByPort userToken = (UserByPort) request.getAttribute("userToken"); |
|
|
List<InventoryP> list = new ArrayList<>(); |
|
|
List<InventoryP> list = new ArrayList<>(); |
|
|
Integer total = 0; |
|
|
Integer total = 0; |
|
|
if(Integer.compare(userToken.getMaindeparment(),361) != 0){ |
|
|
if (Integer.compare(userToken.getMaindeparment(), 361) != 0) { |
|
|
// 查询当前用户管理的仓库
|
|
|
// 查询当前用户管理的仓库
|
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId()); |
|
|
List<RoleAndDepository> depositoryAndRole = roleService.findDepositoryAndRole(userToken.getId()); |
|
|
// 查询当前用户部门拥有的仓库
|
|
|
// 查询当前用户部门拥有的仓库
|
|
|
@ -204,8 +229,7 @@ public class MaterialController { |
|
|
) { |
|
|
) { |
|
|
inventoryP.setSplitInfoList(splitUnitService.findSplitInfoByMid(inventoryP.getMid())); |
|
|
inventoryP.setSplitInfoList(splitUnitService.findSplitInfoByMid(inventoryP.getMid())); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else{ |
|
|
|
|
|
list = materialService.findInventory(map); |
|
|
list = materialService.findInventory(map); |
|
|
total = materialService.findInventoryCount(map); |
|
|
total = materialService.findInventoryCount(map); |
|
|
} |
|
|
} |
|
|
@ -430,7 +454,7 @@ public class MaterialController { |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
for (Integer depositoryId :depositoryIdList |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
) { |
|
|
) { |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(param); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(param); |
|
|
@ -458,8 +482,7 @@ public class MaterialController { |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(ip.getMid()); |
|
|
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(ip.getMid()); |
|
|
ip.setSplitInfoList(splitInfoByMid); |
|
|
ip.setSplitInfoList(splitInfoByMid); |
|
|
return new RestResponse(ip, 1, 200); |
|
|
return new RestResponse(ip, 1, 200); |
|
|
} |
|
|
} else if ("in".equals(type)) { |
|
|
else if ("in".equals(type)) { |
|
|
|
|
|
param.put("code", code); |
|
|
param.put("code", code); |
|
|
materialPByCondition = materialService.findMaterialPByCondition(param); |
|
|
materialPByCondition = materialService.findMaterialPByCondition(param); |
|
|
if (materialPByCondition.size() > 0) { |
|
|
if (materialPByCondition.size() > 0) { |
|
|
@ -513,7 +536,7 @@ public class MaterialController { |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
depositoryIdList.add(rad.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
for (Integer depositoryId :depositoryIdList |
|
|
for (Integer depositoryId : depositoryIdList |
|
|
) { |
|
|
) { |
|
|
map.put("depositoryId", depositoryId); |
|
|
map.put("depositoryId", depositoryId); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(map); |
|
|
List<InventoryP> inventoryPS = materialService.findInventory(map); |
|
|
@ -566,7 +589,7 @@ public class MaterialController { |
|
|
} |
|
|
} |
|
|
try { |
|
|
try { |
|
|
// 二维码保存信息
|
|
|
// 二维码保存信息
|
|
|
return RestResponse.CreateBarCode(qrCode,material.getMname()); |
|
|
return RestResponse.CreateBarCode(qrCode, material.getMname()); |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
return new RestResponse("err: " + e.getMessage(), 678, new StatusInfo("失败", "请联系开发人员")); |
|
|
return new RestResponse("err: " + e.getMessage(), 678, new StatusInfo("失败", "请联系开发人员")); |
|
|
} |
|
|
} |
|
|
@ -897,12 +920,12 @@ public class MaterialController { |
|
|
depositoryIdList.add(depository.getId()); |
|
|
depositoryIdList.add(depository.getId()); |
|
|
} |
|
|
} |
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
if(!depositoryIdList.contains(depository.getDepositoryId())){ |
|
|
if (!depositoryIdList.contains(depository.getDepositoryId())) { |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for (Integer depositoryId:depositoryIdList){ |
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
param.put("mcode", mcode); |
|
|
param.put("mcode", mcode); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
// 获取当前仓库下是否有当前物料的库存
|
|
|
// 获取当前仓库下是否有当前物料的库存
|
|
|
@ -1214,13 +1237,13 @@ public class MaterialController { |
|
|
depositoryIdList.add(depository.getId()); |
|
|
depositoryIdList.add(depository.getId()); |
|
|
} |
|
|
} |
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
for (RoleAndDepository depository : depositoryAndRole) { |
|
|
if(!depositoryIdList.contains(depository.getDepositoryId())){ |
|
|
if (!depositoryIdList.contains(depository.getDepositoryId())) { |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
depositoryIdList.add(depository.getDepositoryId()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
List<PlaceP> placePList = new ArrayList<>(); |
|
|
for (Integer depositoryId:depositoryIdList) { |
|
|
for (Integer depositoryId : depositoryIdList) { |
|
|
Boolean isExist = false; |
|
|
Boolean isExist = false; |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
Map<String, Object> param = new HashMap<>(); |
|
|
param.put("depositoryId", depositoryId); |
|
|
param.put("depositoryId", depositoryId); |
|
|
@ -1310,8 +1333,8 @@ public class MaterialController { |
|
|
if (isExist) { |
|
|
if (isExist) { |
|
|
materialList.add(mp); |
|
|
materialList.add(mp); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
|
|
|
// 如果当前条形码不存对应物料
|
|
|
// 如果当前条形码不存对应物料
|
|
|
|
|
|
} else { |
|
|
barCodeListByNoMaterial.add(barCode); |
|
|
barCodeListByNoMaterial.add(barCode); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -1516,7 +1539,7 @@ public class MaterialController { |
|
|
// 获取当前物料
|
|
|
// 获取当前物料
|
|
|
InventoryP materialP = inventory.get(0); |
|
|
InventoryP materialP = inventory.get(0); |
|
|
MaterialAndPlace pm = placeService.findPlaceAndMaterialByMidAndPid(0, materialP.getId()); |
|
|
MaterialAndPlace pm = placeService.findPlaceAndMaterialByMidAndPid(0, materialP.getId()); |
|
|
if(pm!=null) { |
|
|
if (pm != null) { |
|
|
Map<String, Object> paramForCode = new HashMap<>(); |
|
|
Map<String, Object> paramForCode = new HashMap<>(); |
|
|
paramForCode.put("mcode", materialP.getCode()); |
|
|
paramForCode.put("mcode", materialP.getCode()); |
|
|
paramForCode.put("codeFlag", 1); |
|
|
paramForCode.put("codeFlag", 1); |
|
|
@ -1526,7 +1549,7 @@ public class MaterialController { |
|
|
materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
materialP.setMaterialAndBarCodeList(materialByBarCodeByCondition); |
|
|
materialP.setBaseUnitQuantity(pm.getQuantity()); |
|
|
materialP.setBaseUnitQuantity(pm.getQuantity()); |
|
|
return new RestResponse(materialP, 1, 200); |
|
|
return new RestResponse(materialP, 1, 200); |
|
|
}else { |
|
|
} else { |
|
|
return new RestResponse("", 0, 200); |
|
|
return new RestResponse("", 0, 200); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|