Commit d8332d1b zshaohui

1.按隔口清理数据

1 个父辈 7369c809
package com.neotel.smfcore.custom.luxsan.factory_c.rawstor.controller.manual;
import com.neotel.smfcore.common.bean.ResultBean;
import com.neotel.smfcore.core.barcode.service.manager.IBarcodeManager;
import com.neotel.smfcore.core.barcode.service.po.Barcode;
import com.neotel.smfcore.core.device.util.DataCache;
import com.neotel.smfcore.core.storage.service.manager.IStoragePosManager;
import com.neotel.smfcore.core.storage.service.po.Storage;
import com.neotel.smfcore.core.storage.service.po.StoragePos;
import com.neotel.smfcore.security.annotation.AnonymousAccess;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/manualHandlBox")
public class ManualHandlBoxController {
@Autowired
private IBarcodeManager barcodeManager;
@Autowired
private IStoragePosManager storagePosManager;
@Autowired
private DataCache dataCache;
@ApiOperation("清理料箱隔口信息")
@RequestMapping("/clearBoxPar")
@AnonymousAccess
public synchronized ResultBean clearBoxPar(String boxPar) {
log.info("收到清理料箱隔口信息为:" + boxPar);
Barcode barcode = barcodeManager.findOne(new Query(
Criteria.where("subCodeList.posName").is(boxPar)));
if (barcode == null){
return ResultBean.newErrorResult(-1,"",boxPar+"对应的料箱信息不存在");
}
String posName = "";
StoragePos pos = storagePosManager.findOne(new Query(
Criteria.where("barcode.subCodeList.posName").is(boxPar)));
if (pos != null) {
barcode = pos.getBarcode();
posName = pos.getPosName();
}
log.info("收到清理料箱隔口信息为:" + boxPar + "库位为:" + posName + ",料箱号为:" + barcode.getBarcode());
//获取要清空的隔口号
List<Barcode> needRemoveBarcodeList = new ArrayList<>();
List<Barcode> subCodeList = barcode.getSubCodeList();
if (subCodeList != null && !subCodeList.isEmpty()) {
for (Barcode subCode : subCodeList) {
if (boxPar.equals(subCode.getPosName())) {
needRemoveBarcodeList.add(subCode);
}
}
}
if (needRemoveBarcodeList != null && !needRemoveBarcodeList.isEmpty()) {
for (Barcode needRemoveBarcode : needRemoveBarcodeList) {
barcode.removeFromSubCodes(needRemoveBarcode);
log.info("收到清理料箱隔口信息为:" + boxPar + "料盘信息为:" + needRemoveBarcode.getBarcode() + ",所在料格为:" + needRemoveBarcode.getPosName());
needRemoveBarcode.setPosName("");
needRemoveBarcode.setSelectMsg(null);
needRemoveBarcode.setOut(false);
barcodeManager.save(needRemoveBarcode);
}
barcode = barcodeManager.save(barcode);
if (pos != null) {
pos.setBarcode(barcode);
storagePosManager.save(pos);
}
return ResultBean.newOkResult("");
}
return ResultBean.newErrorResult(-1, "", boxPar + "未找到可以清理的数据");
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!