|
@@ -157,10 +157,28 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
sparePickForm = sparePickFormMapper.selectByPrimaryKey(model.getPickId());
|
|
sparePickForm = sparePickFormMapper.selectByPrimaryKey(model.getPickId());
|
|
}
|
|
}
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
|
|
+
|
|
|
|
+ // 判断备件是否在该仓库里面,出库单已经勾选了仓库。这个不允许了,pc和移动端都不允许
|
|
|
|
+ for(OutStoreDetailDTO detail:detailList) {
|
|
|
|
+ SpareStore spareStore = new SpareStore();
|
|
|
|
+ if(StringUtils.isNotBlank(model.getStoreId())){
|
|
|
|
+ spareStore.setStoreId(model.getStoreId());
|
|
|
|
+ }else{
|
|
|
|
+ spareStore.setStoreId(detail.getStoreId());
|
|
|
|
+ }
|
|
|
|
+ spareStore.setSpareId(detail.getSpareId());
|
|
|
|
+ List<SpareStore> spareStoreList = spareStoreMapper.select(spareStore);
|
|
|
|
+ if(spareStoreList == null || spareStoreList.size() == 0){
|
|
|
|
+ throw new BusinessException("该仓库中没有此备件,请检查");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// 插
|
|
// 插
|
|
for(OutStoreDetailDTO detail:detailList) {
|
|
for(OutStoreDetailDTO detail:detailList) {
|
|
detail.setUserInfo(userInfo);
|
|
detail.setUserInfo(userInfo);
|
|
detail.setOutId(outStoreForm.getId());
|
|
detail.setOutId(outStoreForm.getId());
|
|
|
|
+ if(StringUtils.isNotBlank(model.getStoreId())){
|
|
|
|
+ detail.setStoreId(model.getStoreId());
|
|
|
|
+ }
|
|
// detail.setStoreId(outStoreForm.getStoreId());
|
|
// detail.setStoreId(outStoreForm.getStoreId());
|
|
detail.setId(IdGeneratorUtils.getObjectId());
|
|
detail.setId(IdGeneratorUtils.getObjectId());
|
|
totalPrice = totalPrice.add(detail.getTotalPrice());
|
|
totalPrice = totalPrice.add(detail.getTotalPrice());
|
|
@@ -249,6 +267,7 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
sparePickForm = sparePickFormMapper.selectByPrimaryKey(model.getPickId());
|
|
sparePickForm = sparePickFormMapper.selectByPrimaryKey(model.getPickId());
|
|
}
|
|
}
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
BigDecimal totalPrice = new BigDecimal(0);
|
|
|
|
+
|
|
// 插
|
|
// 插
|
|
for(OutStoreDetailDTO detail:detailList) {
|
|
for(OutStoreDetailDTO detail:detailList) {
|
|
model.setCreatedUserId("1");
|
|
model.setCreatedUserId("1");
|
|
@@ -279,13 +298,28 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
// 出库单详情
|
|
// 出库单详情
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
List<OutStoreDetailDTO> detailList = model.getDetailList();
|
|
List<OutStoreDetailDTO> detailList = model.getDetailList();
|
|
|
|
+
|
|
|
|
+ // 判断备件是否在该仓库里面,出库单已经勾选了仓库。这个不允许了,pc和移动端都不允许
|
|
|
|
+ for(OutStoreDetailDTO detail:detailList) {
|
|
|
|
+ SpareStore spareStore = new SpareStore();
|
|
|
|
+ if(StringUtils.isNotBlank(model.getStoreId())){
|
|
|
|
+ spareStore.setStoreId(model.getStoreId());
|
|
|
|
+ }else{
|
|
|
|
+ spareStore.setStoreId(detail.getStoreId());
|
|
|
|
+ }
|
|
|
|
+ spareStore.setSpareId(detail.getSpareId());
|
|
|
|
+ List<SpareStore> spareStoreList = spareStoreMapper.select(spareStore);
|
|
|
|
+ if(spareStoreList == null || spareStoreList.size() == 0){
|
|
|
|
+ throw new BusinessException("该仓库中没有此备件,请检查");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
// 先删后插,前端删除的不存在与ids里面,说明被删掉了,需要删除,同时要更新对应的库存
|
|
// 先删后插,前端删除的不存在与ids里面,说明被删掉了,需要删除,同时要更新对应的库存
|
|
Weekend<OutStoreDetail> detailWeekend = new Weekend<>(OutStoreDetail.class);
|
|
Weekend<OutStoreDetail> detailWeekend = new Weekend<>(OutStoreDetail.class);
|
|
List<String> ids = detailList.stream().map(OutStoreDetailDTO::getId).collect(Collectors.toList());
|
|
List<String> ids = detailList.stream().map(OutStoreDetailDTO::getId).collect(Collectors.toList());
|
|
detailWeekend.weekendCriteria().andNotIn(OutStoreDetail::getId, ids).andEqualTo(OutStoreDetail::getOutId, model.getId());
|
|
detailWeekend.weekendCriteria().andNotIn(OutStoreDetail::getId, ids).andEqualTo(OutStoreDetail::getOutId, model.getId());
|
|
detailMapper.deleteByExample(detailWeekend);
|
|
detailMapper.deleteByExample(detailWeekend);
|
|
|
|
|
|
-
|
|
|
|
// 更新和新增
|
|
// 更新和新增
|
|
List<OutStoreDetail> updateDetailList = new ArrayList<OutStoreDetail>();
|
|
List<OutStoreDetail> updateDetailList = new ArrayList<OutStoreDetail>();
|
|
List<OutStoreDetail> addDetailList = new ArrayList<OutStoreDetail>();
|
|
List<OutStoreDetail> addDetailList = new ArrayList<OutStoreDetail>();
|
|
@@ -303,6 +337,9 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
|
|
if(ObjectUtil.isNull(realDetail)){
|
|
if(ObjectUtil.isNull(realDetail)){
|
|
detail.setUserInfo(userInfo);
|
|
detail.setUserInfo(userInfo);
|
|
detail.setOutId(model.getId());
|
|
detail.setOutId(model.getId());
|
|
|
|
+ if(StringUtils.isNotBlank(model.getStoreId())){
|
|
|
|
+ detail.setStoreId(model.getStoreId());
|
|
|
|
+ }
|
|
//detail.setStoreId(model.getStoreId());
|
|
//detail.setStoreId(model.getStoreId());
|
|
detail.setOutNo(model.getOutNo());
|
|
detail.setOutNo(model.getOutNo());
|
|
totalPrice = totalPrice.add(detail.getTotalPrice());
|
|
totalPrice = totalPrice.add(detail.getTotalPrice());
|