|
|
@@ -8,6 +8,7 @@ import com.mysql.cj.xdevapi.JsonString;
|
|
|
import com.tld.excel.ExcelUtils;
|
|
|
import com.tld.mapper.*;
|
|
|
import com.tld.model.*;
|
|
|
+import com.tld.model.Dictionary;
|
|
|
import com.tld.model.Error;
|
|
|
import com.tld.service.WarehousingService;
|
|
|
import com.tld.util.DateUtil;
|
|
|
@@ -88,17 +89,17 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
Map<String, Object> listMap = new HashMap<>();
|
|
|
for(int i = 0; i < listMaterialClass.size(); i++) {
|
|
|
Map<String, Object> map1 = warehousingMapper.getScanNum(listMaterialClass.get(i).getStorageLocationCode(), num);
|
|
|
- if(Double.parseDouble(String.valueOf(map1.get("scanNum"))) <= Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity")))){
|
|
|
+ if(Double.parseDouble(String.valueOf(map1.get("scanNum"))) <= Double.parseDouble(String.valueOf(materialClass.getSize()))){
|
|
|
//查询库存是否同物料同批次存在
|
|
|
List<String> countProduc = warehousingMapper.getInventoryProduc(listMaterialClass.get(i).getWllbCode(), producDate, listMaterialClass.get(i).getStorageLocationCode());
|
|
|
if(countProduc.size() == 0){
|
|
|
stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
|
|
|
- int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
|
|
|
+ int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
|
|
|
listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
|
|
|
} else {
|
|
|
if(String.valueOf(countProduc.get(0)).equals(producDate)){
|
|
|
stringBuffer.append(listMaterialClass.get(i).getStorageLocationCode() + ",");
|
|
|
- int surplusNum = (int) (Double.parseDouble(String.valueOf(map1.get("storageLocationCapacity"))) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
|
|
|
+ int surplusNum = (int) (Double.parseDouble(String.valueOf(materialClass.getSize())) - Double.parseDouble(String.valueOf(map1.get("scanNum"))) + Double.parseDouble(num));
|
|
|
listMap.put(listMaterialClass.get(i).getStorageLocationCode(), surplusNum);
|
|
|
}
|
|
|
}
|
|
|
@@ -291,10 +292,10 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Object> getWarehousingVirtual(String uniqueCode) {
|
|
|
+ public Map<String, Object> getWarehousingVirtual(String uniqueCode, String type) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
try{
|
|
|
- List<WarehousingVirtual> list = warehousingMapper.getWarehousingVirtual(uniqueCode);
|
|
|
+ List<WarehousingVirtual> list = warehousingMapper.getWarehousingVirtual(uniqueCode, type);
|
|
|
map.put("data", list);
|
|
|
map.put("msg", "200");
|
|
|
} catch (Exception e){
|
|
|
@@ -336,10 +337,16 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
public Map<String, Object> getNotice(Notice notice) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
try{
|
|
|
+ Map<String, Object> sumScanNum = new HashMap<>();
|
|
|
PageHelper.startPage(notice.getPage(), notice.getLimit());
|
|
|
PageInfo<Notice> list = new PageInfo<>(warehousingMapper.getNotice(notice));
|
|
|
+ for(Notice notice1 : list.getList()){
|
|
|
+ int sumScanNumVal = warehousingMapper.getSumScanNumVal(notice1);
|
|
|
+ sumScanNum.put(notice1.getNoticeId(), sumScanNumVal);
|
|
|
+ }
|
|
|
map.put("data", list);
|
|
|
map.put("msg", "200");
|
|
|
+ map.put("sumScanNum", sumScanNum);
|
|
|
} catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
map.put("msg", "500");
|
|
|
@@ -453,11 +460,11 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
String removalCode = codeGenerateCk();
|
|
|
ReturRemoval returRemoval = new ReturRemoval()
|
|
|
.setMaterialId(notice.getMaterialId())
|
|
|
- .setAskGoodsId(notice.getAskGoodsId())
|
|
|
+ .setDocumentId(notice.getAskGoodsId())
|
|
|
.setWbs(askGoods.getWbs())
|
|
|
.setNum(notice.getWarehousingNum())
|
|
|
.setEntryNumber(askGoods.getEntryNumber())
|
|
|
- .setAskId(askGoods.getId())
|
|
|
+ .setDocumentPointsId(askGoods.getId())
|
|
|
.setStorageLocationCode(inventory.getStorageLocationCode())
|
|
|
.setRemovalCode(removalCode)
|
|
|
.setSourceType(askGoods.getSourceType())
|
|
|
@@ -529,6 +536,12 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
map.put("errMsg", "物料信息未录入,请联系管理员");
|
|
|
return map;
|
|
|
}
|
|
|
+ Map<String, Object> mapVal = warehousingMapper.getScanIsNotProduct(notice);
|
|
|
+ if(Integer.parseInt(mapVal.get("inventoryCount").toString()) != 0 || Integer.parseInt(mapVal.get("virtualCount").toString()) != 0){
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "已被扫描");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
notice.setWllbClass(material.getWllbClass());
|
|
|
StringBuffer stringBuffer = new StringBuffer();//库位编号
|
|
|
Map<String, Object> listMap = new HashMap<>();
|
|
|
@@ -540,15 +553,15 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
for(StorageLocation storageLocation1 : storageLocations){
|
|
|
Inventory inventory = warehousingMapper.getInventoryInfo(storageLocation1);//查询库存信息
|
|
|
if(inventory == null){
|
|
|
- stringBuffer.append(storageLocation1.getStorageLocationCode());
|
|
|
+ stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
|
|
|
continue;
|
|
|
}
|
|
|
//判断剩余容量大于入库数量
|
|
|
- int num = (int) (Double.parseDouble(storageLocation1.getStorageLocationCapacity()) - Double.parseDouble(inventory.getAmount()));
|
|
|
+ int num = (int) (Double.parseDouble(material.getSize()) - Double.parseDouble(inventory.getAmount()));
|
|
|
if(Integer.parseInt(notice.getWarehousingNum()) < num){
|
|
|
//同一属性 同一批次推荐
|
|
|
if(inventory.getAttribute().equals(notice.getAttribute()) && inventory.getProducBatch().equals(notice.getProducBatch())){
|
|
|
- stringBuffer.append(storageLocation1.getStorageLocationCode());
|
|
|
+ stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
|
|
|
listMap.put(storageLocation1.getStorageLocationCode(), num);
|
|
|
}
|
|
|
}
|
|
|
@@ -556,6 +569,7 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
List<StorageLocation> list = warehousingMapper.recommend(stringBuffer.toString());
|
|
|
map.put("data", list);
|
|
|
map.put("listString", listMap);//返回库位剩余数量
|
|
|
+ map.put("msg", "210");
|
|
|
} else {
|
|
|
notice.setStorageLocationCode("111111");
|
|
|
if(warehousingMapper.getInventoryNotice(notice) != 0){
|
|
|
@@ -563,6 +577,7 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
} else {
|
|
|
warehousingMapper.addInventoryNotice(notice);
|
|
|
}
|
|
|
+ warehousingMapper.updateNotice(notice);//修改报工单数量
|
|
|
//入库流水
|
|
|
WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
|
|
|
.setWllbCode(material.getWllbCode())
|
|
|
@@ -609,7 +624,7 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
//查询入库所需要的信息
|
|
|
for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtualNotice(uniqueCode, type, noticeId)) {
|
|
|
//查询物料信息
|
|
|
- Notice notice = new Notice().setWllbCode(warehousingVirtual.getWllbCode());
|
|
|
+ Notice notice = new Notice().setMaterialCode(warehousingVirtual.getWllbCode());
|
|
|
MaterialClass material = warehousingMapper.getMaterial(notice);
|
|
|
Notice notice1 = warehousingMapper.getNoticeId(new Notice().setNoticeId(noticeId).setMaterialId(material.getTldId()));
|
|
|
Notice notice2 = new Notice()
|
|
|
@@ -621,8 +636,13 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
.setProducBatch(warehousingVirtual.getProducDate())
|
|
|
.setWllbClass(material.getWllbClass())
|
|
|
.setWbs(notice1.getWbs())
|
|
|
+ .setCompanyNumber(notice1.getCompanyNumber())
|
|
|
+ .setSupplierId(warehousingVirtual.getSuppId())
|
|
|
+ .setSerial(warehousingVirtual.getSerial())
|
|
|
+ .setWllbCode(material.getWllbCode())
|
|
|
.setCompanyNumber(notice1.getCompanyNumber());
|
|
|
- warehousingMapper.addInventoryNotice(notice2);
|
|
|
+ warehousingMapper.addInventoryNotice(notice2);//入库存
|
|
|
+ warehousingMapper.updateNotice(notice2);//修改报工单数量
|
|
|
//入库流水
|
|
|
WarehousingVirtual warehousingVirtual1 = new WarehousingVirtual()
|
|
|
.setWllbCode(material.getWllbCode())
|