|
|
@ -1,19 +1,23 @@ |
|
|
|
package com.win.module.wms.service.itembasic; |
|
|
|
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.*; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.ItembasicCreateReqVO; |
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.ItembasicExportReqVO; |
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.ItembasicPageReqVO; |
|
|
|
import com.win.module.wms.controller.admin.itembasic.vo.ItembasicUpdateReqVO; |
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.dal.mysql.itembasic.ItembasicMapper; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
import static com.win.module.wms.enums.itembasic.ErrorCodeConstants.ITEMBASIC_NOT_EXISTS; |
|
|
|
import static com.win.module.wms.enums.itembasic.ErrorCodeConstants.ITEMBASIC_NOT_RIGHT; |
|
|
|
|
|
|
|
/** |
|
|
|
* 物品基本信息 Service 实现类 |
|
|
@ -40,6 +44,19 @@ public class ItembasicServiceImpl implements ItembasicService { |
|
|
|
public void updateItembasic(ItembasicUpdateReqVO updateReqVO) { |
|
|
|
// 校验存在
|
|
|
|
validateItembasicExists(updateReqVO.getId()); |
|
|
|
codeExists(updateReqVO.getCode()); |
|
|
|
statusExists(updateReqVO.getStatus()); |
|
|
|
uomExists(updateReqVO.getUom()); |
|
|
|
isStdPackExists(updateReqVO.getIsStdPack()); |
|
|
|
enableBuyExists(updateReqVO.getEnableBuy()); |
|
|
|
enableMakeExists(updateReqVO.getEnableMake()); |
|
|
|
enableOutsouringExists(updateReqVO.getEnableOutsourcing()); |
|
|
|
isRecycledExists(updateReqVO.getIsRecycled()); |
|
|
|
isPhantomExists(updateReqVO.getIsPhantom()); |
|
|
|
abcClassExists(updateReqVO.getAbcClass()); |
|
|
|
typeExists(updateReqVO.getType()); |
|
|
|
validityDaysExists(updateReqVO.getValidityDays()); |
|
|
|
availableExists(updateReqVO.getAvailable()); |
|
|
|
// 更新
|
|
|
|
ItembasicDO updateObj = ItembasicConvert.INSTANCE.convert(updateReqVO); |
|
|
|
itembasicMapper.updateById(updateObj); |
|
|
@ -59,6 +76,84 @@ public class ItembasicServiceImpl implements ItembasicService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void codeExists(String code) { |
|
|
|
if (code.isEmpty()) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void statusExists(String status) { |
|
|
|
if (status.isEmpty()) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void uomExists(String uom) { |
|
|
|
if (uom.isEmpty()) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void isStdPackExists(Integer stdPack) { |
|
|
|
if (stdPack == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void enableBuyExists(Integer enableBuy) { |
|
|
|
if (enableBuy == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void enableMakeExists(Integer enableMark) { |
|
|
|
if (enableMark == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void enableOutsouringExists(Integer enblOutsouring) { |
|
|
|
if (enblOutsouring == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void isRecycledExists(Integer isRecycled) { |
|
|
|
if (isRecycled == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void isPhantomExists(Integer isPhantom) { |
|
|
|
if (isPhantom == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void abcClassExists(String abcClass) { |
|
|
|
if (abcClass.isEmpty()) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void typeExists(String type) { |
|
|
|
if (type.isEmpty()) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void validityDaysExists(Integer validityDays) { |
|
|
|
if (validityDays == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void availableExists(Integer available) { |
|
|
|
if (available == null) { |
|
|
|
throw exception(ITEMBASIC_NOT_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ItembasicDO getItembasic(Long id) { |
|
|
|
return itembasicMapper.selectById(id); |
|
|
|