|
|
@@ -49,6 +49,9 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
//库存
|
|
|
@Autowired
|
|
|
private DictionaryMapper dictionaryMapper;
|
|
|
+ //质检单
|
|
|
+ @Autowired
|
|
|
+ private ReceiveGoodsMapper receiveGoodsMapper;
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere) {
|
|
|
@@ -153,23 +156,13 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Map<String, Object> warehousing(String uniqueCode, String type) {
|
|
|
+ public Map<String, Object> warehousing(String uniqueCode, String type, String warehouseTransferId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
try{
|
|
|
//入库信息
|
|
|
List<WarehousingVirtual> list = new LinkedList<>();
|
|
|
//查询入库所需要的信息
|
|
|
- for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtual(uniqueCode, type, null)){
|
|
|
- //查询采购单信息
|
|
|
- List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual);
|
|
|
- if(receiveGoods.size() != 0) {
|
|
|
- //所属账套
|
|
|
- warehousingVirtual.setAccountSleeve(receiveGoods.get(0).getCompanyNumber());
|
|
|
- //WBS
|
|
|
- warehousingVirtual.setWbs(receiveGoods.get(0).getWbs());
|
|
|
- //流水编号
|
|
|
- warehousingVirtual.setStorageCode(receiveGoods.get(0).getOrderCode());
|
|
|
- }
|
|
|
+ for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtual(uniqueCode, type, warehouseTransferId)){
|
|
|
//查询部门编号
|
|
|
List<User> listUser = userMapper.getAllUser(new User().setId(warehousingVirtual.getUserId()));
|
|
|
warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
|
|
|
@@ -185,48 +178,46 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
//返回采购单id
|
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
|
//入质检入库数量
|
|
|
- for(WarehousingVirtual warehousingVirtual1 : warehousingMapper.getVirtual(uniqueCode, type, null)) {
|
|
|
+ for(WarehousingVirtual warehousingVirtual1 : warehousingMapper.getVirtual(uniqueCode, type, warehouseTransferId)) {
|
|
|
//查询采购单信息
|
|
|
- List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual1);
|
|
|
- for(ReceiveGoods receiveGoods1 : receiveGoods) {
|
|
|
- if(Integer.parseInt(warehousingVirtual1.getNum()) <= 0){
|
|
|
- break;
|
|
|
- }
|
|
|
- //采购单剩余入库数量
|
|
|
- int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
|
|
|
- //剩余入库数量
|
|
|
- int numInto = Integer.parseInt(warehousingVirtual1.getNum()) - surplusNum;
|
|
|
- if(numInto < 0) {
|
|
|
- receiveGoods1.setWarehousingNum(warehousingVirtual1.getNum());
|
|
|
- warehousingMapper.updateReceiveGood(receiveGoods1);
|
|
|
- } else {
|
|
|
- receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
|
|
|
- warehousingMapper.updateReceiveGood(receiveGoods1);
|
|
|
- //存入给gs的返回数据
|
|
|
- String code = codeGenerateRk();
|
|
|
- warehousingVirtual1.setStorageCode(code);
|
|
|
- ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
- .setWarehousingNum(receiveGoods1.getWarehousingNum())
|
|
|
- .setGsCk(warehousingVirtual1.getGsCk())
|
|
|
- .setSourceType(receiveGoods1.getSourceType())
|
|
|
- .setMoveType(receiveGoods1.getMoveType())
|
|
|
- .setEntryNumber(receiveGoods1.getEntryNumber())
|
|
|
- .setWbs(receiveGoods1.getWbs())
|
|
|
- .setId(receiveGoods1.getId())
|
|
|
- .setMaterialId(receiveGoods1.getMaterialId())
|
|
|
- .setStorageCode(code)
|
|
|
- .setOrderNumber(receiveGoods1.getOrderNumber())
|
|
|
- .setUserName(warehousingVirtual1.getUserName())
|
|
|
- .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
|
|
|
- warehousingMapper.addReturnWarehousing(returnWarehousing);
|
|
|
- warehousingMapper.updateStorage(warehousingVirtual1);//增加入库编号
|
|
|
- //判断是否有已存在的采购单号
|
|
|
- if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
|
|
|
- stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
|
|
|
- }
|
|
|
+ ReceiveGoods receiveGoods1 = receiveGoodsMapper.getReceiveGoodsCode(warehousingVirtual1.getReceiveGoodsId());
|
|
|
+ if(Integer.parseInt(warehousingVirtual1.getNum()) <= 0){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ //采购单剩余入库数量
|
|
|
+ int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
|
|
|
+ //剩余入库数量
|
|
|
+ int numInto = Integer.parseInt(warehousingVirtual1.getNum()) - surplusNum;
|
|
|
+ if(numInto < 0) {
|
|
|
+ receiveGoods1.setWarehousingNum(warehousingVirtual1.getNum());
|
|
|
+ warehousingMapper.updateReceiveGood(receiveGoods1);
|
|
|
+ } else {
|
|
|
+ receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
|
|
|
+ warehousingMapper.updateReceiveGood(receiveGoods1);
|
|
|
+ //存入给gs的返回数据
|
|
|
+ String code = codeGenerateRk();
|
|
|
+ warehousingVirtual1.setStorageCode(code);
|
|
|
+ ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
+ .setWarehousingNum(receiveGoods1.getWarehousingNum())
|
|
|
+ .setGsCk(warehousingVirtual1.getGsCk())
|
|
|
+ .setSourceType(receiveGoods1.getSourceType())
|
|
|
+ .setMoveType(receiveGoods1.getMoveType())
|
|
|
+ .setEntryNumber(receiveGoods1.getEntryNumber())
|
|
|
+ .setWbs(receiveGoods1.getWbs())
|
|
|
+ .setId(receiveGoods1.getId())
|
|
|
+ .setMaterialId(receiveGoods1.getMaterialId())
|
|
|
+ .setStorageCode(code)
|
|
|
+ .setOrderNumber(receiveGoods1.getOrderNumber())
|
|
|
+ .setUserName(warehousingVirtual1.getUserName())
|
|
|
+ .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
|
|
|
+ warehousingMapper.addReturnWarehousing(returnWarehousing);
|
|
|
+ warehousingMapper.updateStorage(warehousingVirtual1);//增加入库编号
|
|
|
+ //判断是否有已存在的采购单号
|
|
|
+ if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
|
|
|
+ stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
|
|
|
}
|
|
|
- warehousingVirtual1.setNum(String.valueOf(numInto));
|
|
|
}
|
|
|
+ warehousingVirtual1.setNum(String.valueOf(numInto));
|
|
|
}
|
|
|
warehousingMapper.delVirtual(uniqueCode);//删除临时表数据
|
|
|
map.put("data", stringBuilder.toString());
|
|
|
@@ -367,7 +358,7 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
PageInfo<Notice> list = new PageInfo<>(warehousingMapper.getNotice(notice));
|
|
|
for(Notice notice1 : list.getList()){
|
|
|
int sumScanNumVal = warehousingMapper.getSumScanNumVal(notice1);
|
|
|
- sumScanNum.put(notice1.getNoticeId(), sumScanNumVal);
|
|
|
+ sumScanNum.put(notice1.getNoticeId() + "-" + notice1.getMaterialId(), sumScanNumVal);
|
|
|
}
|
|
|
map.put("data", list);
|
|
|
map.put("msg", "200");
|
|
|
@@ -411,7 +402,8 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
.setProducDate(notice1.getNoticeTime())
|
|
|
.setNum(notice.getWarehousingNum())
|
|
|
.setStorageCode(storageCode)
|
|
|
- .setWbs(notice.getWbs());
|
|
|
+ .setWbs(notice.getWbs())
|
|
|
+ .setOrderCode(notice1.getProductionCode());
|
|
|
warehousingMapper.addProduct(warehousingVirtual);//入库流水 半成品
|
|
|
|
|
|
ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
@@ -579,9 +571,13 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
StorageLocation storageLocation = new StorageLocation().setIsProduct("1");
|
|
|
String[] symbol = {"<", "="};
|
|
|
for(int i = 0; i < symbol.length; i++){
|
|
|
- String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i]); //查询昨天没满的库位
|
|
|
+ String producBatch = null;
|
|
|
+ if(symbol[i].equals("=")){
|
|
|
+ producBatch = notice.getProducBatch();
|
|
|
+ }
|
|
|
+ String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i], producBatch); //查询昨天没满的库位
|
|
|
if(!storageLocationCode.equals("0")) {
|
|
|
- int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i]);
|
|
|
+ int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i], producBatch);
|
|
|
int num = 0;
|
|
|
if(notice.getType().equals("0")){
|
|
|
num = warehousingMapper.getNumUtil("产成品库位托盘定义");
|
|
|
@@ -599,9 +595,9 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
}
|
|
|
//查询产成品库位
|
|
|
List<StorageLocation> storageLocations = storageLocationMapper.getStorage(storageLocation);
|
|
|
- for(StorageLocation storageLocation1 : storageLocations){
|
|
|
+ for(StorageLocation storageLocation1 : storageLocations) {
|
|
|
Inventory inventory = warehousingMapper.getInventoryInfo(storageLocation1);//查询库存信息
|
|
|
- if(inventory == null){
|
|
|
+ if(inventory == null) {
|
|
|
stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
|
|
|
break;
|
|
|
}
|
|
|
@@ -610,41 +606,43 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
map.put("data", list);
|
|
|
map.put("msg", "210");
|
|
|
} else {
|
|
|
- if(warehousingMapper.getInventoryNotice(notice) != 0){
|
|
|
- warehousingMapper.updateInventoryNotice(notice);
|
|
|
- } else {
|
|
|
- warehousingMapper.addInventoryNotice(notice);
|
|
|
- }
|
|
|
- warehousingMapper.updateNotice(notice);//修改报工单数量
|
|
|
- String storageCode = codeGenerateRk();
|
|
|
- //入库流水
|
|
|
- WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
|
|
|
- .setWllbCode(material.getWllbCode())
|
|
|
- .setUserId(notice.getUserId())
|
|
|
- .setStorageLocationCode(notice.getStorageLocationCode())
|
|
|
- .setProducDate(notice.getProducBatch())
|
|
|
- .setNum(notice.getWarehousingNum())
|
|
|
- .setSerial(notice.getSerial())
|
|
|
- .setSeq(notice.getSeq())
|
|
|
- .setAttribute(notice.getAttribute())
|
|
|
- .setStorageCode(storageCode)
|
|
|
- .setWbs(notice.getWbs());
|
|
|
- warehousingMapper.addHalf(warehousingVirtual);//入库流水 产成品
|
|
|
- //存入给gs的返回数据
|
|
|
- Notice notice1 = warehousingMapper.getNoticeId(notice);
|
|
|
- ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
- .setStorageCode(storageCode)//入库编号
|
|
|
- .setSourceType(notice1.getSourceType())//来源类型
|
|
|
- .setMoveType(notice1.getMoveType())//移动类型
|
|
|
- .setOrderNumber(notice1.getNoticeId())//通知单id
|
|
|
- .setWbs(notice1.getWbs())//wbs
|
|
|
- .setEntryNumber(notice1.getEntryNumber())//gs分录号
|
|
|
- .setMaterialId(notice1.getMaterialId())//物料id
|
|
|
- .setId(notice1.getId())//分录单id
|
|
|
- .setWarehousingNum(notice.getWarehousingNum());//入库数量
|
|
|
- warehousingMapper.addReturnWarehousing(returnWarehousing);
|
|
|
- map.put("msg", "200");
|
|
|
- map.put("data", notice1.getNoticeId() + ",");
|
|
|
+ map.put("msg", "220");
|
|
|
+// if(warehousingMapper.getInventoryNotice(notice) != 0){
|
|
|
+// warehousingMapper.updateInventoryNotice(notice);
|
|
|
+// } else {
|
|
|
+// warehousingMapper.addInventoryNotice(notice);
|
|
|
+// }
|
|
|
+// warehousingMapper.updateNotice(notice);//修改报工单数量
|
|
|
+// String storageCode = codeGenerateRk();
|
|
|
+// //入库流水
|
|
|
+// Notice notice1 = warehousingMapper.getNoticeId(notice);
|
|
|
+// WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
|
|
|
+// .setWllbCode(material.getWllbCode())
|
|
|
+// .setUserId(notice.getUserId())
|
|
|
+// .setStorageLocationCode(notice.getStorageLocationCode())
|
|
|
+// .setProducDate(notice.getProducBatch())
|
|
|
+// .setNum(notice.getWarehousingNum())
|
|
|
+// .setSerial(notice.getSerial())
|
|
|
+// .setSeq(notice.getSeq())
|
|
|
+// .setAttribute(notice.getAttribute())
|
|
|
+// .setStorageCode(storageCode)
|
|
|
+// .setWbs(notice.getWbs())
|
|
|
+// .setProductionCode(notice1.getProductionCode());
|
|
|
+// warehousingMapper.addHalf(warehousingVirtual);//入库流水 产成品
|
|
|
+// //存入给gs的返回数据
|
|
|
+// ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
+// .setStorageCode(storageCode)//入库编号
|
|
|
+// .setSourceType(notice1.getSourceType())//来源类型
|
|
|
+// .setMoveType(notice1.getMoveType())//移动类型
|
|
|
+// .setOrderNumber(notice1.getNoticeId())//通知单id
|
|
|
+// .setWbs(notice1.getWbs())//wbs
|
|
|
+// .setEntryNumber(notice1.getEntryNumber())//gs分录号
|
|
|
+// .setMaterialId(notice1.getMaterialId())//物料id
|
|
|
+// .setId(notice1.getId())//分录单id
|
|
|
+// .setWarehousingNum(notice.getWarehousingNum());//入库数量
|
|
|
+// warehousingMapper.addReturnWarehousing(returnWarehousing);
|
|
|
+// map.put("msg", "200");
|
|
|
+// map.put("data", notice1.getNoticeId() + ",");
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
@@ -695,7 +693,8 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
.setSeq(warehousingVirtual.getSeq())
|
|
|
.setAttribute(warehousingVirtual.getAttribute())
|
|
|
.setStorageCode(storageCode)
|
|
|
- .setWbs(notice1.getWbs());
|
|
|
+ .setWbs(notice1.getWbs())
|
|
|
+ .setProductionCode(notice1.getProductionCode());;
|
|
|
warehousingMapper.addHalf(warehousingVirtual1);//入库流水 产成品
|
|
|
//存入给gs的返回数据
|
|
|
ReturnWarehousing returnWarehousing = new ReturnWarehousing()
|
|
|
@@ -825,11 +824,11 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
//判断物料是否录入
|
|
|
MaterialClass materialClass = warehousingMapper.getMateriaIsExist(inventory.getWllbCode());
|
|
|
String userId = request.getHeader("userId");
|
|
|
- inventory.setWllbClass(materialClass.getWllbClass()).setMaterialId(inventory.getMaterialId()).setUserId(userId);
|
|
|
+ inventory.setWllbClass(materialClass.getWllbClass()).setMaterialId(materialClass.getTldId()).setUserId(userId);
|
|
|
if(inventory.getId() != null){
|
|
|
- warehousingMapper.addInventoryOther(inventory);
|
|
|
- } else {
|
|
|
warehousingMapper.updateInventoryOther(inventory);
|
|
|
+ } else {
|
|
|
+ warehousingMapper.addInventoryOther(inventory);
|
|
|
}
|
|
|
List<WarehousingVirtual> list = new LinkedList<>();
|
|
|
String storageCode = codeGenerateRk();//入库单
|
|
|
@@ -846,7 +845,8 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
.setStorageLocationCode(inventory.getStorageLocationCode())
|
|
|
.setWbs(inventory.getWbs())
|
|
|
.setAccountSleeve(inventory.getAccountSleeve())
|
|
|
- .setMaterialId(materialClass.getTldId());
|
|
|
+ .setMaterialId(materialClass.getTldId())
|
|
|
+ .setNum(inventory.getAmount());
|
|
|
list.add(warehousingVirtual);
|
|
|
warehousingMapper.addStorage(list);//入库流水
|
|
|
warehousingMapper.addReturnWarehousingOther(warehousingVirtual);//其他入库返回信息
|
|
|
@@ -860,6 +860,50 @@ public class WarehousingServiceImpl implements WarehousingService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> getMing(String code) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ try {
|
|
|
+ //查询库存
|
|
|
+ String wllbCode = askGoodsMapper.getMing(code);
|
|
|
+ //判断物料是否录入
|
|
|
+ MaterialClass materialClass = warehousingMapper.getMateriaIsExist(wllbCode);
|
|
|
+ if(materialClass.getWllbClass().equals("圆柱终端")){
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "请扫描托码");
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ map.put("msg", "200");
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "服务器请求异常,请稍后再试");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> addWarehousingVirtualTwo(WarehousingVirtual warehousingVirtual) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ try{
|
|
|
+ Map<String, Object> mapVal = warehousingMapper.getSumWarehousingVirtual(warehousingVirtual);
|
|
|
+ Double num = Double.parseDouble(warehousingVirtual.getNum()) + Double.parseDouble(mapVal.get("scanNum").toString());
|
|
|
+ if(Double.parseDouble(mapVal.get("num").toString()) < num){
|
|
|
+ String surplus = String.valueOf(Double.parseDouble(mapVal.get("num").toString()) - Double.parseDouble(mapVal.get("scanNum").toString()));
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "扫描数量超过单据数量,剩余要扫数量" + surplus);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ warehousingMapper.addWarehousingVirtual(warehousingVirtual);
|
|
|
+ map.put("msg", "200");
|
|
|
+ } catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ map.put("msg", "500");
|
|
|
+ map.put("errMsg", "服务器请求异常,请稍后再试");
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 入库单生成
|