|
@ -1,5 +1,6 @@ |
|
|
package com.win.module.eam.service.iteminlocation; |
|
|
package com.win.module.eam.service.iteminlocation; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
import com.win.module.eam.controller.iteminlocation.vo.ItemInLocationCreateReqVO; |
|
|
import com.win.module.eam.controller.iteminlocation.vo.ItemInLocationCreateReqVO; |
|
@ -9,8 +10,10 @@ import com.win.module.eam.controller.iteminlocation.vo.ItemInLocationUpdateReqVO |
|
|
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; |
|
|
import com.win.module.eam.controller.transaction.vo.TransactionCreateReqVO; |
|
|
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert; |
|
|
import com.win.module.eam.convert.iteminlocation.ItemInLocationConvert; |
|
|
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO; |
|
|
import com.win.module.eam.dal.dataobject.iteminlocation.ItemInLocationDO; |
|
|
|
|
|
import com.win.module.eam.dal.dataobject.itemorder.ItemOrderDetailDO; |
|
|
import com.win.module.eam.dal.dataobject.location.LocationDO; |
|
|
import com.win.module.eam.dal.dataobject.location.LocationDO; |
|
|
import com.win.module.eam.dal.mysql.iteminlocation.ItemInLocationMapper; |
|
|
import com.win.module.eam.dal.mysql.iteminlocation.ItemInLocationMapper; |
|
|
|
|
|
import com.win.module.eam.dal.mysql.location.LocationMapper; |
|
|
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum; |
|
|
import com.win.module.eam.enums.itemAccount.ItemAccountStatusEnum; |
|
|
import com.win.module.eam.enums.transaction.TransactionEnum; |
|
|
import com.win.module.eam.enums.transaction.TransactionEnum; |
|
|
import com.win.module.eam.service.transaction.TransactionService; |
|
|
import com.win.module.eam.service.transaction.TransactionService; |
|
@ -19,9 +22,11 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.Collection; |
|
|
import java.util.Collection; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
|
|
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
|
@ -42,6 +47,9 @@ public class ItemInLocationServiceImpl implements ItemInLocationService { |
|
|
@Resource |
|
|
@Resource |
|
|
private TransactionService transactionService; |
|
|
private TransactionService transactionService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private LocationMapper locationMapper; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional |
|
|
@Transactional |
|
|
public Long createItemInLocation(ItemInLocationCreateReqVO createReqVO) { |
|
|
public Long createItemInLocation(ItemInLocationCreateReqVO createReqVO) { |
|
@ -69,6 +77,47 @@ public class ItemInLocationServiceImpl implements ItemInLocationService { |
|
|
return itemInLocation.getId(); |
|
|
return itemInLocation.getId(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
@Transactional |
|
|
|
|
|
public Long createPDA(ItemInLocationCreateReqVO createReqVO) { |
|
|
|
|
|
long i=0l; |
|
|
|
|
|
List<Map<String, Object>> itemList = createReqVO.getItemNumbers();//备件号集合
|
|
|
|
|
|
List<TransactionCreateReqVO> list = new ArrayList<>(); |
|
|
|
|
|
if(createReqVO.getItemNumbers()!=null&& !createReqVO.getItemNumbers().isEmpty()){ |
|
|
|
|
|
for (Map<String, Object> map : itemList) { |
|
|
|
|
|
String itemNumber = map.get("itemNumber").toString();//备件号
|
|
|
|
|
|
String qty = map.get("qty").toString();//入库数量
|
|
|
|
|
|
String locationNumber = map.get("locationNumber").toString();//库位
|
|
|
|
|
|
LocationDO byNumber = locationMapper.getByNumber(locationNumber); |
|
|
|
|
|
// 插入
|
|
|
|
|
|
createReqVO.setAreaNumber(byNumber.getAreaNumber()); |
|
|
|
|
|
createReqVO.setItemNumber(itemNumber); |
|
|
|
|
|
createReqVO.setLocationNumber(locationNumber); |
|
|
|
|
|
createReqVO.setQty(new BigDecimal(qty)); |
|
|
|
|
|
ItemInLocationDO itemInLocation = ItemInLocationConvert.INSTANCE.convert(createReqVO); |
|
|
|
|
|
itemInLocation.setType(TransactionEnum.RETURN_IN.getCode()); |
|
|
|
|
|
itemInLocationMapper.insert(itemInLocation); |
|
|
|
|
|
i = itemInLocation.getId(); |
|
|
|
|
|
//添加库存事务
|
|
|
|
|
|
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO(); |
|
|
|
|
|
transactionCreateReqVO.setItemNumber(createReqVO.getItemNumber()); |
|
|
|
|
|
transactionCreateReqVO.setLocationNumber(createReqVO.getLocationNumber()); |
|
|
|
|
|
transactionCreateReqVO.setAreaNumber(createReqVO.getAreaNumber()); |
|
|
|
|
|
transactionCreateReqVO.setTransactionType("IN"); |
|
|
|
|
|
transactionCreateReqVO.setQty(createReqVO.getQty()); |
|
|
|
|
|
transactionCreateReqVO.setDescribes("备件归还");//描述
|
|
|
|
|
|
transactionCreateReqVO.setOperator(createReqVO.getReturner()); |
|
|
|
|
|
transactionCreateReqVO.setCreator(getLoginUserId().toString()); |
|
|
|
|
|
transactionCreateReqVO.setAssociatedNumber(null); |
|
|
|
|
|
transactionCreateReqVO.setInventoryAction(TransactionEnum.RETURN_IN.getCode()); |
|
|
|
|
|
transactionCreateReqVO.setType(ItemAccountStatusEnum.OUT.getCode()); |
|
|
|
|
|
list.add(transactionCreateReqVO); |
|
|
|
|
|
} |
|
|
|
|
|
transactionService.create(list); |
|
|
|
|
|
} |
|
|
|
|
|
return i; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Integer updateItemInLocation(ItemInLocationUpdateReqVO updateReqVO) { |
|
|
public Integer updateItemInLocation(ItemInLocationUpdateReqVO updateReqVO) { |
|
|
// 校验存在
|
|
|
// 校验存在
|
|
|