Commit 6a3dc070 sunke

更新数量导致字段数据丢失问题

1 个父辈 37974856
...@@ -53,26 +53,33 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao { ...@@ -53,26 +53,33 @@ public class OutItemDaoImpl extends AbstractMongoDao implements IOutItemDao {
@Override @Override
public void updateQty(String outItemId, int outQty, int sendQty){ public void updateQty(String outItemId, int outQty, int sendQty){
Update update = new Update();
if(outQty > 0){ if(outQty > 0){
Update update = new Update();
update.set("outQty",outQty); update.set("outQty",outQty);
update(outItemId, update);
} }
if(sendQty > 0){ if(sendQty > 0){
Update update = new Update();
update.set("sendQty",sendQty); update.set("sendQty",sendQty);
update(outItemId, update);
} }
update(outItemId, update);
} }
@Override @Override
public void updateLockQty(String outItemId, int preLockQty, int realLockQty){ public void updateLockQty(String outItemId, int preLockQty, int realLockQty){
Update update = new Update();
if(preLockQty > 0){ if(preLockQty > 0){
Update update = new Update();
update.set("lockQty",preLockQty); update.set("lockQty",preLockQty);
update(outItemId, update);
} }
if(realLockQty > 0){ if(realLockQty > 0){
Update update = new Update();
update.set("realLockQty",realLockQty); update.set("realLockQty",realLockQty);
update(outItemId, update);
} }
update(outItemId, update);
} }
@Override @Override
......
...@@ -357,7 +357,7 @@ public class OutInfoCache { ...@@ -357,7 +357,7 @@ public class OutInfoCache {
} }
} }
private OutInfo getOutInfoFromCache(String hSerial){ public OutInfo getOutInfoFromCache(String hSerial){
OutInfo outInfo = outInfoMap.get(hSerial); OutInfo outInfo = outInfoMap.get(hSerial);
if(outInfo == null){ if(outInfo == null){
log.info("未找到需求单["+hSerial+"]的缓存信息,从数据库中加载"); log.info("未找到需求单["+hSerial+"]的缓存信息,从数据库中加载");
...@@ -795,10 +795,13 @@ public class OutInfoCache { ...@@ -795,10 +795,13 @@ public class OutInfoCache {
List<StoragePos> bindPosList = storagePosDao.findBindList(outItem.getSoseq(), outItem.getSlotlocation()); List<StoragePos> bindPosList = storagePosDao.findBindList(outItem.getSoseq(), outItem.getSlotlocation());
StoragePos maxQtyReelPos = null; StoragePos maxQtyReelPos = null;
OutItem totalOutInfo = soseqCache.getCutOutItem(outItem.getSoseq(), outItem.getSlotlocation()); OutItem totalOutInfo = soseqCache.getCutOutItem(outItem.getSoseq(), outItem.getSlotlocation());
if(totalOutInfo.getOutQty() == 0){ if(totalOutInfo != null){
//首盘未出,需要预留一盘最大的给首盘 if(totalOutInfo.getOutQty() == 0){
maxQtyReelPos = storagePosDao.findMaxQtyBindReel(outItem.getSoseq(), outItem.getSlotlocation()); //首盘未出,需要预留一盘最大的给首盘
maxQtyReelPos = storagePosDao.findMaxQtyBindReel(outItem.getSoseq(), outItem.getSlotlocation());
}
} }
//没有顺序 //没有顺序
int sendQty = outItem.getSendQty(); int sendQty = outItem.getSendQty();
int fixQty = outItem.getFixedQty(); int fixQty = outItem.getFixedQty();
......
...@@ -62,7 +62,7 @@ public class SoseqCache { ...@@ -62,7 +62,7 @@ public class SoseqCache {
boolean allItemsBindOk = true; boolean allItemsBindOk = true;
for (OutItem outItem : outInfo.getOutItems()) { for (OutItem outItem : outInfo.getOutItems()) {
if(outItem.getRealLockQty() > 0 && !outItem.isCutMaterial()){ if(outItem.getRealLockQty() > 0 && outItem.isCutMaterial()){
hasBindItem = true; hasBindItem = true;
} }
...@@ -91,22 +91,20 @@ public class SoseqCache { ...@@ -91,22 +91,20 @@ public class SoseqCache {
if(outInfo != null){ if(outInfo != null){
OutItem cutOutItem = getCutOutItem(outItem.getSoseq(), outItem.getSlotlocation()); OutItem cutOutItem = getCutOutItem(outItem.getSoseq(), outItem.getSlotlocation());
if(cutOutItem != null){ if(cutOutItem != null){
if(cutOutItem != null){ int totalSendQty = cutOutItem.getSendQty();
int totalSendQty = cutOutItem.getSendQty(); totalSendQty = totalSendQty + sendQty;
totalSendQty = totalSendQty + sendQty; int outQty = 0;
int outQty = 0; if(outItem.isFirstReelAction()){
if(outItem.isFirstReelAction()){ //首盘
//首盘 outQty = sendQty;
outQty = sendQty;
}
cutOutItem.setOutQty(sendQty);
cutOutItem.setSendQty(totalSendQty);
outItemDao.updateQty(cutOutItem.getId(), outQty, totalSendQty);
outInfo.updateItem(cutOutItem);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
}else{
log.error("更新总发料数量时,未找到分盘的 soseq="+outItem.getSoseq() +" slotSeq=" + outItem.getSlotlocation());
} }
cutOutItem.setOutQty(sendQty);
cutOutItem.setSendQty(totalSendQty);
outItemDao.updateQty(cutOutItem.getId(), outQty, totalSendQty);
outInfo.updateItem(cutOutItem);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
}else{
log.error("更新总发料数量时,未找到分盘的 soseq="+outItem.getSoseq() +" slotSeq=" + outItem.getSlotlocation());
} }
} }
} }
...@@ -142,6 +140,7 @@ public class SoseqCache { ...@@ -142,6 +140,7 @@ public class SoseqCache {
if(totalRealLockQty > 0){ if(totalRealLockQty > 0){
cutOutItem.setRealLockQty(totalRealLockQty); cutOutItem.setRealLockQty(totalRealLockQty);
} }
outItemDao.updateLockQty(cutOutItem.getId(), totalPreLockQty, totalRealLockQty); outItemDao.updateLockQty(cutOutItem.getId(), totalPreLockQty, totalRealLockQty);
outInfo.updateItem(cutOutItem); outInfo.updateItem(cutOutItem);
soSeqCacheMap.put(outInfo.getSoseq(), outInfo); soSeqCacheMap.put(outInfo.getSoseq(), outInfo);
......
...@@ -56,6 +56,8 @@ public class MainTimer { ...@@ -56,6 +56,8 @@ public class MainTimer {
InquiryShelfBean.initShelfMap(); InquiryShelfBean.initShelfMap();
outInfoCache.loadUnEndOutInfos(); outInfoCache.loadUnEndOutInfos();
log.info("主定时器开启,60秒后开始执行, 每10s执行一次"); log.info("主定时器开启,60秒后开始执行, 每10s执行一次");
//1 分钟之后执行,每秒钟执行一次 //1 分钟之后执行,每秒钟执行一次
......
...@@ -49,9 +49,6 @@ public class QisdaApiController extends BaseController { ...@@ -49,9 +49,6 @@ public class QisdaApiController extends BaseController {
private IOutInfoDao outInfoDao; private IOutInfoDao outInfoDao;
@Autowired @Autowired
private DataCache dataCache;
@Autowired
private OutInfoCache outInfoCache; private OutInfoCache outInfoCache;
...@@ -114,6 +111,8 @@ public class QisdaApiController extends BaseController { ...@@ -114,6 +111,8 @@ public class QisdaApiController extends BaseController {
@ResponseBody @ResponseBody
public String executeOut(HttpServletRequest request){ public String executeOut(HttpServletRequest request){
String hSerial = request.getParameter("hSerial"); String hSerial = request.getParameter("hSerial");
OutInfo outInfo = outInfoCache.getOutInfoFromCache(hSerial);
qisdaBindService.realBindOutInfo(outInfo);
ResultBean resultBean = outInfoCache.checkOutOutItems(hSerial); ResultBean resultBean = outInfoCache.checkOutOutItems(hSerial);
return resultBean.getMsg(); return resultBean.getMsg();
} }
......
...@@ -44,7 +44,7 @@ public class QisdaBindService { ...@@ -44,7 +44,7 @@ public class QisdaBindService {
*/ */
public void realBindOutInfo(OutInfo outInfo){ public void realBindOutInfo(OutInfo outInfo){
//只对分盘需求单进行绑定(分盘料,未关闭,未绑定OK,未发料完成) //只对分盘需求单进行绑定(分盘料,未关闭,未绑定OK,未发料完成)
if(outInfo.isReelCutAction() && !outInfo.isClosed() && !outInfo.isRealBindOk() && !outInfo.isSendEnd()){ if(!outInfo.isClosed() && !outInfo.isRealBindOk() && !outInfo.isSendEnd()){
log.info("需求单["+outInfo+"]开始进行真实绑定"); log.info("需求单["+outInfo+"]开始进行真实绑定");
for (OutItem outItem : outInfo.getOutItems()) { for (OutItem outItem : outInfo.getOutItems()) {
firstBindCutReel(outItem); firstBindCutReel(outItem);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!