diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java index ceb520d..77a4eb0 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java @@ -124,9 +124,9 @@ public class ItemAccountsController { ItemDO itemDO = itemService.getByNumber(vo.getItemNumber()); vo.setItemName(itemDO.getName()); LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber()); - vo.setLocationName(locationDO.getName()); + vo.setLocationName(locationDO==null?"":locationDO.getName()); LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber()); - vo.setAreaName(locationAreaDO.getName()); + vo.setAreaName(locationAreaDO==null?"":locationAreaDO.getName()); Boolean b = itemAccountsService.qtyZore(vo.getItemNumber()); vo.setDisplay(b); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java index d513ce5..daf7bcb 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java @@ -222,7 +222,7 @@ public interface ItemAccountsMapper extends BaseMapperX { //库存事务 result = updateById(itemAccountsDO); TransactionDO transactionDO = new TransactionDO(); - transactionDO.setQty(itemAccountsDO.getQty()); + transactionDO.setQty(param.getQty()); transactionDO.setType(itemAccountsDO.getType()); list.add(transactionDO); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java index c6dd523..1ebe4ec 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java @@ -390,7 +390,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { errorList.add(convert); } ItemAccountsDO itemAccountsDO = validateItemAndTypeAndLocation(item.getItemNumber(), item.getType(), item.getLocationNumber());//查询重复数据 - if(mode != 2){// 如果存在,判断是否允许更新 + if(mode != 2 && itemAccountsDO!=null){// 如果存在,判断是否允许更新 ItemAccountsDO itemAccountsDO1 = ItemAccountsConvert.INSTANCE.convert1(item); itemAccountsDO1.setId(itemAccountsDO.getId()); //itemAccountsMapper.updateById(itemAccountsDO1); @@ -434,6 +434,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { transactionCreateReqVO.setOperator(null); transactionCreateReqVO.setCreator(getLoginUserId().toString()); transactionCreateReqVO.setAssociatedNumber(null); + transactionCreateReqVO.setType(item.getType()); if(itemAccountsDO1.getType().equals(ItemAccountStatusEnum.NEW.getCode())){//新到货 transactionCreateReqVO.setInventoryAction(TransactionEnum.NEW_IN.getCode()); transactionCreateReqVO.setDescribes("备件导入新到货入库");//描述 @@ -446,10 +447,10 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { transactionCreateReqVO.setInventoryAction(TransactionEnum.IN_IN.getCode()); transactionCreateReqVO.setDescribes("备件导入账外入库");//描述 } - transactionCreateReqVO.setType(itemAccountsDO1.getType()); + //transactionCreateReqVO.setType(itemAccountsDO1.getType()); list.add(transactionCreateReqVO); } - transactionService.create(list); + } catch (Exception e) { ItemAccountsErrorVO convert = ItemAccountsConvert.INSTANCE.convert(item); convert.setImportStatus("失败"); @@ -461,6 +462,7 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { if(!errorList.isEmpty() && !updatePart) { TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//不需要捕获异常 } + transactionService.create(list); return errorList; }