Browse Source

mybatis bug

master
常熟吴彦祖 11 months ago
parent
commit
5f8aba311f
  1. 22
      src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java
  2. 8
      src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java
  3. 3
      src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java
  4. 4
      src/main/java/com/gaotao/modules/warehouse/service/PalletService.java
  5. 3
      src/main/resources/mapper/warehouse/PalletMapper.xml

22
src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java

@ -21,6 +21,7 @@ import com.gaotao.modules.handlingunit.entity.HandlingUnit;
import com.gaotao.modules.handlingunit.service.HandlingUnitService;
import com.gaotao.modules.trans.entity.*;
import com.gaotao.modules.trans.service.*;
import com.gaotao.modules.warehouse.dao.PalletMapper;
import com.gaotao.modules.warehouse.entity.InventoryStock;
import com.gaotao.modules.warehouse.entity.Pallet;
import com.gaotao.modules.warehouse.service.InventoryStockService;
@ -65,6 +66,8 @@ public class WmsMessageServiceImpl implements WmsMessageService {
@Autowired
private PalletService palletService;
@Autowired
private PalletMapper palletMapper;
@Autowired
private WcsIntegrationService wcsIntegrationService;
@ -379,8 +382,22 @@ public class WmsMessageServiceImpl implements WmsMessageService {
throw new RuntimeException("托盘不存在:" + inData.getPalletId());
}
// 更新托盘位置和调用标志 - rqrq
log.info("取货通知-更新托盘信息前 - rqrq,托盘ID: {}, 主键ID: {}, 当前位置: {}, 当前调用标志: {}, 目标位置: {}",
pallet.getPalletId(), pallet.getId(), pallet.getLocationCode(), pallet.getCallingFlag(), inData.getToBarcode());
pallet.setLocationCode(inData.getToBarcode());
palletService.updateById(pallet);
pallet.setCallingFlag("N");
// boolean updateResult = palletService.updateById(pallet);
palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),null);
// log.info("取货通知-更新托盘信息完成 - rqrq,托盘ID: {}, 主键ID: {}, 更新结果: {}, 新位置: {}, 新调用标志: N",
// pallet.getPalletId(), pallet.getId(), updateResult ? "成功" : "失败", inData.getToBarcode());
//
// if (!updateResult) {
// throw new RuntimeException("更新托盘信息失败,托盘ID: " + inData.getPalletId());
// }
// 4. 保存WCS回调数据到新表作为记录 后续根据order表去取货就行
WcsCallbackTask callbackTask = new WcsCallbackTask();
callbackTask.setSite(inData.getSite());
@ -498,7 +515,8 @@ public class WmsMessageServiceImpl implements WmsMessageService {
}
pallet.setLocationCode(request.getToStation());
pallet.setWcsLocation(request.getToStation());
palletService.updateById(pallet);
palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),pallet.getWcsLocation());
//如果更新wcs库位
//这里插入逻辑

8
src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java

@ -19,6 +19,7 @@ import com.gaotao.modules.automatedWarehouse.mapper.AgvTaskMapper;
import com.gaotao.modules.automatedWarehouse.mapper.WcsIntegrationMapper;
import com.gaotao.modules.automatedWarehouse.service.AgvTaskService;
import com.gaotao.modules.base.entity.PalletType;
import com.gaotao.modules.warehouse.dao.PalletMapper;
import com.gaotao.modules.warehouse.entity.Pallet;
import com.gaotao.modules.warehouse.service.PalletService;
import lombok.extern.slf4j.Slf4j;
@ -37,7 +38,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
@Autowired
private AgvTaskMapper agvTaskMapper;
@Autowired
private PalletMapper palletMapper;
@Autowired
private AgvClientUtil agvClientUtil;
@Autowired
@ -402,8 +404,8 @@ public class AgvTaskServiceImpl implements AgvTaskService {
// 更新栈板位置信息复用doWareHouseForPallet中的逻辑
pallet.setLocationCode(transportTask.getToLocation());
palletService.updateById(pallet);
// palletService.updateById(pallet);
palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),pallet.getWcsLocation());
log.info("栈板{}位置已更新到目标站点{}", transportTask.getPalletId(), transportTask.getToLocation());
} catch (Exception e) {

3
src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java

@ -33,4 +33,7 @@ public interface PalletMapper extends BaseMapper<Pallet> {
* @date 2025/10/14
*/
PalletData selectPalletByPalletId(@Param("palletId") String palletId);
void updateLocationWithPalletId(@Param("site") String site,@Param("palletId") String palletId,@Param("locationCode") String locationCode,@Param("wcsLocation") String wcsLocation);
}

4
src/main/java/com/gaotao/modules/warehouse/service/PalletService.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.gaotao.common.utils.PageUtils;
import com.gaotao.modules.warehouse.entity.Pallet;
import com.gaotao.modules.warehouse.entity.PalletData;
import org.apache.ibatis.annotations.Param;
/**
* @Description 托盘服务接口 - rqrq
@ -75,4 +76,5 @@ public interface PalletService extends IService<Pallet> {
* @date 2025/10/14
*/
boolean checkPalletIdExists(String palletId, Long excludeId);
}
}

3
src/main/resources/mapper/warehouse/PalletMapper.xml

@ -103,4 +103,7 @@
WHERE p.pallet_id = #{palletId}
</select>
<update id="updateLocationWithPalletId">
update pallet set location_code=#{locationCode} ,wcs_location=#{wcsLocation} where site=#{site} and pallet_id=#{palletId}
</update>
</mapper>
Loading…
Cancel
Save