|
|
@ -2,25 +2,25 @@ package com.win.module.wms.service.expectout; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.module.wms.controller.expectout.vo.ExpectoutCreateReqVO; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
import com.win.framework.common.util.validation.ValidationUtils; |
|
|
|
import com.win.module.wms.controller.expectout.vo.ExpectoutExportReqVO; |
|
|
|
import com.win.module.wms.controller.expectout.vo.ExpectoutPageReqVO; |
|
|
|
import com.win.module.wms.controller.expectout.vo.ExpectoutUpdateReqVO; |
|
|
|
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO; |
|
|
|
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; |
|
|
|
import com.win.module.wms.service.rule.RuleService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import com.win.module.wms.dal.dataobject.expectout.ExpectoutDO; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
|
|
|
|
|
import com.win.module.wms.convert.expectout.ExpectoutConvert; |
|
|
|
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.validation.Validator; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
|
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
|
|
|
import static com.win.module.wms.enums.ErrorCodeConstants.EXPECTOUT_NOT_EXISTS; |
|
|
|
|
|
|
|
/** |
|
|
|
* 预计出库存 Service 实现类 |
|
|
@ -36,31 +36,40 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private RuleService ruleService; |
|
|
|
@Resource |
|
|
|
private Validator validator; |
|
|
|
|
|
|
|
@Override |
|
|
|
public String createExpectout(ExpectoutCreateReqVO createReqVO) { |
|
|
|
// 插入
|
|
|
|
ExpectoutDO expectout = ExpectoutConvert.INSTANCE.convert(createReqVO); |
|
|
|
expectoutMapper.insert(expectout); |
|
|
|
public Long createExpectout(String jobNumber, String businessType, String itemCode, String batch, String inventoryStatus, String uom, BigDecimal qty, String locationCode, String warehouseCode, String ownerCode) { |
|
|
|
ExpectoutDO expectoutDO = new ExpectoutDO(); |
|
|
|
expectoutDO.setJobNumber(jobNumber); |
|
|
|
expectoutDO.setItemCode(itemCode); |
|
|
|
expectoutDO.setBatch(batch); |
|
|
|
expectoutDO.setInventoryStatus(inventoryStatus); |
|
|
|
expectoutDO.setUom(uom); |
|
|
|
expectoutDO.setQty(qty); |
|
|
|
expectoutDO.setLocationCode(locationCode); |
|
|
|
expectoutDO.setWarehouseCode(warehouseCode); |
|
|
|
expectoutDO.setOwnerCode(ownerCode); |
|
|
|
ValidationUtils.validate(validator, expectoutDO); |
|
|
|
expectoutMapper.insert(expectoutDO); |
|
|
|
// 返回
|
|
|
|
return expectout.getId(); |
|
|
|
return expectoutDO.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void updateExpectout(ExpectoutUpdateReqVO updateReqVO) { |
|
|
|
public int deleteExpectout(Long id) { |
|
|
|
// 校验存在
|
|
|
|
validateExpectoutExists(updateReqVO.getId()); |
|
|
|
// 更新
|
|
|
|
ExpectoutDO updateObj = ExpectoutConvert.INSTANCE.convert(updateReqVO); |
|
|
|
expectoutMapper.updateById(updateObj); |
|
|
|
validateExpectoutExists(id); |
|
|
|
// 删除
|
|
|
|
return expectoutMapper.deleteById(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void deleteExpectout(Long id) { |
|
|
|
// 校验存在
|
|
|
|
validateExpectoutExists(id); |
|
|
|
// 删除
|
|
|
|
expectoutMapper.deleteById(id); |
|
|
|
public int deleteExpectoutByJobNumber(String jobNumber) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("job_number", jobNumber); |
|
|
|
return expectoutMapper.deleteByMap(map); |
|
|
|
} |
|
|
|
|
|
|
|
private void validateExpectoutExists(Long id) { |
|
|
@ -74,11 +83,6 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
return expectoutMapper.selectById(id); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> getExpectoutList(Collection<String> ids) { |
|
|
|
return expectoutMapper.selectBatchIds(ids); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<ExpectoutDO> getExpectoutPage(ExpectoutPageReqVO pageReqVO) { |
|
|
|
return expectoutMapper.selectPage(pageReqVO); |
|
|
@ -97,7 +101,7 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
//按数量查找 BY_BATCH
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> selectNumberNew(String itemcode, List<String> inventorystatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
queryWrapper.eq("inventory_status", inventorystatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
@ -112,7 +116,7 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
//按批次查询 BY_BATCH
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> selectBatchNew(String itemcode, String batch, List<String> inventorystatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
queryWrapper.eq("batch", batch); |
|
|
|
queryWrapper.eq("inventory_status", inventorystatus); |
|
|
@ -128,7 +132,7 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
//按包裝 BY_PACKAGING
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> selectPackingNew(String itemcode, String packingnumber, String batch, List<String> inventorystatus, String locationcode) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_code", itemcode); |
|
|
|
queryWrapper.eq("batch", batch); |
|
|
|
queryWrapper.eq("packing_number", packingnumber); |
|
|
@ -145,7 +149,7 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
//按唯一码查询 BY_UNIQUE_ID
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> selectUniqeIdNew(String packingnumber, String locationcode, List<String> inventorystatus) { |
|
|
|
QueryWrapper queryWrapper = new QueryWrapper(); |
|
|
|
QueryWrapper<ExpectoutDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("packing_number", packingnumber); |
|
|
|
queryWrapper.eq("inventory_status", inventorystatus); |
|
|
|
queryWrapper.eq("location_code", locationcode); |
|
|
@ -156,4 +160,10 @@ public class ExpectoutServiceImpl implements ExpectoutService { |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ExpectoutDO> getExpectoutList(CustomConditions conditions) { |
|
|
|
return expectoutMapper.selectSeniorList(conditions); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|