|
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.ruoyi.RuoYiApplication;
|
|
|
+import com.ruoyi.ams.inv.domain.InvLotAtt;
|
|
|
import com.ruoyi.ams.inv.domain.InvLotLocId;
|
|
|
import com.ruoyi.ams.inv.service.IInvLotAttService;
|
|
|
import com.ruoyi.ams.inv.service.IInvLotLocIdService;
|
|
@@ -15,9 +16,9 @@ import com.ruoyi.base.domain.BaseSku;
|
|
|
import com.ruoyi.base.service.IBaseLocationInfoService;
|
|
|
import com.ruoyi.base.service.IBaseSkuService;
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
-import io.netty.util.internal.SocketUtils;
|
|
|
import io.netty.util.internal.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.Test;
|
|
@@ -130,9 +131,8 @@ public class ProcessLocationTest {
|
|
|
|
|
|
//查出原先的库存情况,如果当前库存SKU不符合,则生成新的批次记录
|
|
|
List<InvLotLocId> invLotLocList = invLotLocIdService.getInvLotLocList(baseLocationInfo.getId());
|
|
|
- if(CollectionUtil.isEmpty(invLotLocList)) return;
|
|
|
//此时数据是错的都要重新生成库存
|
|
|
- List<String> skuList = invLotLocList.stream().map(item -> item.getSku()).collect(Collectors.toList());
|
|
|
+ List<String> skuList = CollectionUtil.isNotEmpty(invLotLocList) ? invLotLocList.stream().map(item -> item.getSku()).collect(Collectors.toList()) : Lists.newArrayList();
|
|
|
if(CollectionUtil.isEmpty(skuList) || skuList.size() > 1 || !StringUtils.equals(skuList.get(0), bindSku)){
|
|
|
//生成新的批次记录
|
|
|
String lotnum = invLotAttService.insertInvLotAtt(bindSku, palletNo);
|
|
@@ -143,13 +143,20 @@ public class ProcessLocationTest {
|
|
|
reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
|
|
|
return;
|
|
|
}
|
|
|
- if(CompareUtil.compare(invLotLocList.get(0).getQty(), quantity) != 0){
|
|
|
+ InvLotAtt invLotAtt = invLotAttService.selectInvLotAttByLotnum(invLotLocList.get(0).getLotnum());
|
|
|
+ if(CompareUtil.compare(invLotLocList.get(0).getQty(), quantity) != 0 || CompareUtil.compare(invLotAtt.getLotatt07(), palletNo) != 0){
|
|
|
//此时只有数量是错的,那么update一下数量就好
|
|
|
InvLotLocId invLotLocId = invLotLocList.get(0);
|
|
|
invLotLocId.setQty(quantity);
|
|
|
//TODO 其他关于数量的字段要改嘛
|
|
|
invLotLocId.setQtyEach(quantity);
|
|
|
+ invLotLocId.setUpdateTime(DateUtils.getNowDate());
|
|
|
invLotLocIdService.updateInvLotLocId(invLotLocId);
|
|
|
+ InvLotAtt iotLotAtt = new InvLotAtt();
|
|
|
+ iotLotAtt.setLotnum(invLotLocId.getLotnum());
|
|
|
+ iotLotAtt.setLotatt07(palletNo);
|
|
|
+ iotLotAtt.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ invLotAttService.updateInvLotAtt(iotLotAtt);
|
|
|
//重置库存数据
|
|
|
reSetLocationInfo(baseLocationInfo, bindSku, Constants.NO, skuTypeMapping);
|
|
|
}
|