package com.ld.igds.inout.manager;
|
|
import com.bstek.bdf2.core.business.IUser;
|
import com.ld.igds.check.CheckStandardManager;
|
import com.ld.igds.check.dto.CheckItemData;
|
import com.ld.igds.common.CoreCommonService;
|
import com.ld.igds.constant.RespCodeEnum;
|
import com.ld.igds.constant.TransType;
|
import com.ld.igds.data.Page;
|
import com.ld.igds.data.PageResponse;
|
import com.ld.igds.file.CoreFileService;
|
import com.ld.igds.file.dto.FileData;
|
import com.ld.igds.inout.InoutConstant;
|
import com.ld.igds.inout.dto.InoutData;
|
import com.ld.igds.inout.dto.InoutParam;
|
import com.ld.igds.inout.dto.InoutRecordItemData;
|
import com.ld.igds.inout.dto.InoutRecordItemParam;
|
import com.ld.igds.inout.mapper.InoutRecordMapper;
|
import com.ld.igds.inout.service.InoutRecordItemService;
|
import com.ld.igds.inout.service.InoutService;
|
import com.ld.igds.m.dto.NoticeParam;
|
import com.ld.igds.m.service.HInoutCarConfService;
|
import com.ld.igds.m.service.InoutCommonService;
|
import com.ld.igds.models.Depot;
|
import com.ld.igds.models.InoutCarConf;
|
import com.ld.igds.models.InoutNoticeIn;
|
import com.ld.igds.models.InoutNoticeOut;
|
import com.ld.igds.util.ContextUtil;
|
import com.ld.igds.util.DateUtil;
|
import lombok.extern.slf4j.Slf4j;
|
import org.apache.commons.lang3.StringUtils;
|
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.io.File;
|
import java.util.*;
|
|
/**
|
* 出入库相关业务2
|
*
|
* @author
|
*/
|
@Slf4j
|
@Component
|
public class InoutManager2 {
|
|
@Resource
|
private CoreFileService fileService;
|
@Resource
|
private InoutService inoutService;
|
@Autowired
|
private CoreCommonService coreCommonService;
|
@Resource
|
private InoutRecordItemService inoutRecordItemService;
|
@Resource
|
private CheckStandardManager checkStandardManager;
|
@Resource
|
private InoutCommonService inoutManagerService;
|
@Resource
|
private HInoutCarConfService carConfService;
|
@Autowired
|
private InoutRecordMapper inoutMapper;
|
|
/**
|
* 出入库流程中的实时数据,直接从缓存中获取
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<Map<String, List<InoutData>>> listProgress(InoutParam param) {
|
Map<String, List<InoutData>> result = new HashMap<>();
|
|
//当前流程中
|
List<InoutData> listProgress = inoutService.getListInoutCache(param.getDeptId());
|
|
|
//当前已经完成
|
List<InoutData> listComplete = inoutService.getCompleteListInoutCache(param.getDeptId());
|
|
|
if (null == listProgress) listProgress = new ArrayList<>();
|
if (null == listComplete) listComplete = new ArrayList<>();
|
|
result.put("listProgress", listProgress);
|
result.put("listComplete", listComplete);
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行完成", result);
|
}
|
|
public PageResponse<List<InoutData>> listOnlyProgress(InoutParam param) {
|
|
String type = param.getType();
|
//当前流程中
|
List<InoutData> listProgress = inoutService.getListInoutCache(param.getDeptId());
|
List<InoutData> result = new ArrayList<>();
|
if (null == listProgress || listProgress.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行完成", result);
|
}
|
|
if (null == type) {
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行完成", result);
|
}
|
|
for (InoutData data : listProgress) {
|
if (data.getType().equals(type)) result.add(data);
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行完成", result);
|
}
|
|
/**
|
* 出入库简易操作-分页获取流程未完成的数据
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<Page<InoutData>> pageInoutData(InoutParam param) {
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
if (StringUtils.isEmpty(param.getDeptId())) {
|
param.setDeptId(ContextUtil.subDeptId(null));
|
}
|
|
log.debug("分页信息--page={},limit={},cuur={}", param.getPage(),
|
param.getLimit(), param.getCurr());
|
Page<InoutData> result = inoutService.pageUnCompleteData(param);
|
|
if (null == result.getRecords() || result.getRecords().isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
|
"获取到数据信息为空");
|
}
|
|
return new PageResponse<Page<InoutData>>(RespCodeEnum.CODE_0000, result);
|
}
|
|
/**
|
* 入库的往来单位下拉框
|
*
|
* @param param
|
* @return public PageResponse<List<InoutCustomer>> listCustomerIn(InoutParam param) {
|
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
param.setDeptId(ContextUtil.subDeptId(null));
|
|
List<InoutCustomer> list;
|
// 获取出入库系统配置信息
|
InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(param.getCompanyId(), param.getDeptId());
|
|
// 判断入库通知单是否启用
|
if (Constant.YN_Y.equals(inoutSysConf.getNoticeTagIn())) {
|
// 从入库通知单查询客户列表
|
list = inoutManagerService.listCustomerByNoticeIn(param);
|
} else {
|
// 从往来单位表中查询,设置供应商标记
|
param.setType(InoutConstant.TYPE_IN);
|
list = inoutManagerService.listCustomer(param);
|
}
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"查询结果为空!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
*/
|
|
/**
|
* 出库的往来单位下拉框
|
*
|
* @param param
|
* @return public PageResponse<List<InoutCustomer>> listCustomerOut(InoutParam param) {
|
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
param.setDeptId(ContextUtil.subDeptId(null));
|
|
List<InoutCustomer> list;
|
// 获取出入库系统配置信息
|
InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(param.getCompanyId(), param.getDeptId());
|
// 判断出库通知单是否启用
|
if (Constant.YN_Y.equals(inoutSysConf.getNoticeTagOut())) {
|
// 从出库通知单查询客户列表
|
list = inoutManagerService.listCustomerByNoticeOut(param);
|
} else {
|
// 从往来单位表中查询,设置供应商标记
|
param.setType(InoutConstant.TYPE_OUT);
|
list = inoutManagerService.listCustomer(param);
|
}
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"查询结果为空!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
*/
|
|
/**
|
* 船运登记提交
|
*
|
* @param data
|
* @return
|
* @throws Exception
|
*/
|
@Transactional(rollbackFor = Exception.class)
|
public PageResponse<InoutData> inoutShipRegister(InoutData data) throws Exception {
|
|
String msg;
|
IUser user = ContextUtil.getLoginUser();
|
List<FileData> files = data.getFiles();
|
List<CheckItemData> checkItems = data.getCheckItems();
|
if (null == data.getCompanyId()) {
|
data.setCompanyId(user.getCompanyId());
|
}
|
if (null == data.getDeptId()) {
|
data.setDeptId(ContextUtil.subDeptId(user));
|
}
|
// 如果当前节点是注册,则需要验证下,是否有为完成的流程在执行中
|
if (InoutConstant.PROGRESS_REGISTER.equals(data.getProgress())) {
|
if (StringUtils.isEmpty(data.getIntelCard())) {
|
data.setIntelCard(data.getUserId());
|
}
|
|
InoutParam param = new InoutParam();
|
param.setCompanyId(data.getCompanyId());
|
param.setPlateNum(data.getPlateNum());
|
param.setIntelCard(data.getIntelCard());
|
param.setType(data.getType());
|
InoutData progressData = inoutService.inoutProgressQuery(param);
|
if (null != progressData) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"当前卡片/车牌号有流程未结束。", progressData);
|
}
|
}
|
//设置流程为称重
|
data.setProgress(InoutConstant.PROGRESS_WEIGHT_TAG);
|
data.setRegisterUser(ContextUtil.getLoginUserCName());
|
if (InoutConstant.TYPE_IN.equals(data.getType())) {
|
data.setCheckUser(ContextUtil.getLoginUserCName());
|
}
|
|
// 调用保存方法执行
|
if (null == data.getIntelCard()) {
|
data.setIntelCard(data.getUserId());
|
}
|
if (null == data.getRegisterTime()) {
|
data.setRegisterTime(new Date());
|
}
|
msg = inoutService.insertData(data);
|
|
//执行附件信息
|
if (null != files) {
|
fileService.saveInoutFiles(files, data.getCompanyId(), data.getId(), data.getProgress());
|
}
|
|
//执行化验信息
|
if (null != checkItems) {
|
//更新检验项数据
|
checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), checkItems);
|
}
|
|
if (null != msg) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(),
|
"执行成功", data);
|
}
|
|
/**
|
* 获取流程未结束的船运流水信息
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<List<InoutRecordItemData>> listInoutItem(InoutRecordItemParam param) {
|
|
//默认查询当天
|
param.setStart(DateUtil.getCurZero(new Date()));
|
param.setEnd(DateUtil.getNextZero(new Date()));
|
|
List<InoutRecordItemData> result = inoutRecordItemService.listInoutItem(param);
|
|
if (null == result || result.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
|
"获取到数据信息为空");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, result);
|
}
|
|
|
/**
|
* 获取流程未结束的船运流水信息
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<InoutRecordItemData> getInoutItemByCarNum(InoutRecordItemParam param) {
|
|
InoutRecordItemData result = inoutRecordItemService.getInoutItemByCarNum(param);
|
|
if (null == result) {
|
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
|
"获取到数据信息为空");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, result);
|
}
|
|
/**
|
* 获取流程未结束的船运流水信息
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<InoutRecordItemData> checkCarNum(InoutRecordItemParam param) {
|
|
InoutRecordItemData result = inoutRecordItemService.getInoutItemByCarNum(param);
|
|
if (null != result) {
|
return new PageResponse<>(RespCodeEnum.CODE_2000.getCode(),
|
"当前车辆流程未完成,无法绑定!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, null);
|
}
|
|
/**
|
* 车辆登记及称重提交
|
*
|
* @param data
|
* @return
|
* @throws Exception
|
*/
|
@Transactional(rollbackFor = Exception.class)
|
public PageResponse<String> inoutItemNextStep(InoutRecordItemData data) throws Exception {
|
String msg;
|
if (StringUtils.isEmpty(data.getRecordId()) || StringUtils.isEmpty(data.getPlateNum())) {
|
msg = "";
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
|
}
|
|
List<FileData> files = data.getFiles();
|
// 执行附件信息
|
if (null != files) {
|
fileService.saveInoutFiles(files, data.getCompanyId(), data.getRecordId(), data.getProgress());
|
}
|
if (InoutConstant.TYPE_IN.equals(data.getType())) {
|
if (StringUtils.isEmpty(data.getId())) {
|
data.setId(ContextUtil.getTimeId());
|
data.setProgress(InoutConstant.PROGRESS_WEIGHT_FULL);
|
data.setCreateTime(new Date());
|
msg = inoutRecordItemService.insertInoutItem(data);
|
} else {
|
if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(data.getProgress())) {
|
data.setProgress(InoutConstant.PROGRESS_WEIGHT_EMPTY);
|
data.setFullWeightTime(new Date());
|
data.setFullWeightUser(ContextUtil.getLoginUserCName());
|
} else if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(data.getProgress())) {
|
data.setProgress(InoutConstant.PROGRESS_RECORD);
|
data.setEmptyWeightTime(new Date());
|
data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
|
}
|
msg = inoutRecordItemService.updateInoutItem(data);
|
}
|
} else {
|
if (StringUtils.isEmpty(data.getId())) {
|
data.setId(ContextUtil.getTimeId());
|
data.setProgress(InoutConstant.PROGRESS_WEIGHT_FULL);
|
data.setCreateTime(new Date());
|
msg = inoutRecordItemService.insertInoutItem(data);
|
} else {
|
if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(data.getProgress())) {
|
data.setProgress(InoutConstant.PROGRESS_WEIGHT_EMPTY);
|
data.setFullWeightTime(new Date());
|
data.setFullWeightUser(ContextUtil.getLoginUserCName());
|
} else if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(data.getProgress())) {
|
data.setProgress(InoutConstant.PROGRESS_RECORD);
|
data.setEmptyWeightTime(new Date());
|
data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
|
}
|
msg = inoutRecordItemService.updateInoutItem(data);
|
}
|
}
|
|
if (null != msg) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg);
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功");
|
}
|
|
/**
|
* 获取流程未结束的船运流水信息
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<List<InoutRecordItemData>> unShipInoutRecord(InoutRecordItemParam param) {
|
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
if (StringUtils.isEmpty(param.getDeptId())) {
|
param.setDeptId(ContextUtil.subDeptId(null));
|
}
|
//设置运输方式为轮船
|
param.setTransType(TransType.TYPE_3.getCode());
|
//设置流程为称重
|
param.setProgress(InoutConstant.PROGRESS_WEIGHT_TAG);
|
if (StringUtils.isNotEmpty(param.getKey())) {
|
param.setKey("%" + param.getKey() + "%");
|
}
|
List<InoutRecordItemData> list = inoutRecordItemService.shipInoutRecord(param);
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"查询结果为空!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
|
/**
|
* 获取船运车辆配置信息
|
*
|
* @param companyId
|
* @param deptId
|
* @return
|
*/
|
public PageResponse<List<InoutCarConf>> listShipCar(String companyId, String deptId) {
|
|
if (StringUtils.isEmpty(companyId)) {
|
companyId = ContextUtil.getCompanyId();
|
}
|
if (StringUtils.isEmpty(deptId)) {
|
deptId = ContextUtil.subDeptId(null);
|
}
|
|
List<InoutCarConf> list = carConfService.listCarConf(companyId, deptId);
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"查询结果为空!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
|
/**
|
* 获取一个月的船运流水信息
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<List<InoutRecordItemData>> getShipInoutRecord(InoutRecordItemParam param) {
|
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
if (StringUtils.isEmpty(param.getDeptId())) {
|
param.setDeptId(ContextUtil.subDeptId(null));
|
}
|
//设置运输方式为轮船
|
param.setTransType(TransType.TYPE_3.getCode());
|
//设置时间 -- 默认取一个月以内的船运信息
|
param.setEnd(DateUtil.getNextZero(new Date()));
|
param.setStart(DateUtil.getNewByDay(new Date(), -30));
|
|
List<InoutRecordItemData> list = inoutRecordItemService.shipInoutRecord(param);
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
|
"查询结果为空!");
|
}
|
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
|
/**
|
* 结束船运信息流程,统计相关重量信息
|
*
|
* @param data
|
* @return
|
* @throws Exception
|
*/
|
public PageResponse<InoutRecordItemData> shipComplete(InoutRecordItemData data) throws Exception {
|
if (StringUtils.isEmpty(data.getRecordId())) {
|
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
|
"没有获取到流水数据信息。", data);
|
}
|
|
if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
|
//说明流程已结束,重新统计数量
|
inoutRecordItemService.updateNumByInoutItem(data.getRecordId());
|
InoutParam param = new InoutParam();
|
param.setId(data.getRecordId());
|
param.setType(data.getType());
|
param.setCompanyId(data.getCompanyId());
|
InoutData completeData = inoutMapper.inoutQueryById(param);
|
inoutService.updateInoutCache(completeData);
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
|
|
} else {
|
//流程未结束,统计数量
|
return reSumUnInoutRecord(data);
|
}
|
}
|
|
/**
|
* 结束船运信息流程,统计相关重量信息
|
*
|
* @param data
|
* @return
|
* @throws Exception
|
*/
|
public PageResponse<String> delShipItem(InoutRecordItemData data) throws Exception {
|
if (StringUtils.isEmpty(data.getId())) {
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(), "没有获取到流水数据信息。");
|
}
|
|
inoutRecordItemService.delShipItem(data.getId(), InoutConstant.RECORD_STATUS_DEL);
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null);
|
}
|
|
/**
|
* 结束船运信息流程,统计相关重量信息
|
*
|
* @param data
|
* @return
|
* @throws Exception
|
*/
|
public PageResponse<InoutRecordItemData> reSumUnInoutRecord(InoutRecordItemData data) throws Exception {
|
|
InoutRecordItemParam param = new InoutRecordItemParam();
|
param.setRecordId(data.getRecordId());
|
List<InoutRecordItemData> list = inoutRecordItemService.sumInoutItem(param);
|
|
if (list == null || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
|
"没有获取到该船运相关统计信息", data);
|
}
|
|
InoutParam inoutParam = new InoutParam();
|
inoutParam.setId(data.getRecordId());
|
//查询流水信息
|
InoutData inoutData = inoutService.inoutQueryById(inoutParam);
|
|
Map<String, InoutParam> map = new HashMap<>();
|
int temp = 1;
|
for (InoutRecordItemData item : list) {
|
if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(item.getProgress())
|
|| InoutConstant.PROGRESS_WEIGHT_FULL.equals(item.getProgress())) {
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
|
"该船运信息尚有未完成称重的车辆信息", data);
|
}
|
if (StringUtils.isEmpty(item.getDepotId())) {
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
|
"该船运信息中有车辆未设置装卸仓库", data);
|
}
|
inoutParam = new InoutParam();
|
if (StringUtils.isEmpty(data.getDepotId())) {
|
data.setDepotId(item.getDepotId());
|
}
|
if (data.getDepotId().equals(item.getDepotId())) {
|
inoutParam.setId(data.getRecordId());
|
} else {
|
String newId = data.getRecordId() + temp;
|
temp++;
|
//新增一条流水
|
inoutData.setId(newId);
|
inoutData.setDepotId(item.getDepotId());
|
inoutService.insertData(inoutData);
|
//更新流水子表中的recordId
|
inoutRecordItemService.updateInoutItemRecordId(newId, item.getRecordId(), item.getDepotId());
|
inoutParam.setId(inoutData.getId());
|
}
|
inoutParam.setDepotId(item.getDepotId());
|
inoutParam.setCompanyId(inoutData.getCompanyId());
|
inoutParam.setType(inoutData.getType());
|
inoutParam.setDeptId(inoutData.getDeptId());
|
inoutParam.setIntelCard(inoutData.getIntelCard());
|
inoutParam.setPlateNum(inoutData.getPlateNum());
|
inoutParam.setProgress(InoutConstant.PROGRESS_RECORD);
|
inoutParam.setFullWeight(item.getFullWeight());
|
inoutParam.setFullWeightTime(item.getFullWeightTime());
|
inoutParam.setFullWeightUser(ContextUtil.getLoginUserCName());
|
inoutParam.setEmptyWeight(item.getEmptyWeight());
|
inoutParam.setEmptyWeightTime(item.getEmptyWeightTime());
|
inoutParam.setEmptyWeightUser(ContextUtil.getLoginUserCName());
|
inoutParam.setDe(item.getDe());
|
inoutParam.setNetWeight(item.getNetWeight());
|
inoutParam.setSettleWeight(item.getSettleWeight());
|
inoutParam.setRecordWeight(item.getRecordWeight());
|
inoutParam.setCompleteTime(new Date());
|
map.put(inoutParam.getId(), inoutParam);
|
}
|
InoutParam par;
|
InoutData dat;
|
for (String key : map.keySet()) {
|
par = map.get(key);
|
if (par != null) {
|
dat = new InoutData();
|
//更新流水数据(包含重量信息以及流程进度信息)
|
inoutService.toComplete(par);
|
BeanUtils.copyProperties(par, dat);
|
inoutService.updateData(dat);
|
|
// //更新仓库库存
|
// if (InoutConstant.TYPE_IN.equals(par.getType())) {
|
// commonService.addStorage(par.getCompanyId(), par.getDepotId(),
|
// par.getSettleWeight());
|
// }
|
//
|
// if (InoutConstant.TYPE_OUT.equals(par.getType())) {
|
// commonService.reduceStorage(par.getCompanyId(), par.getDepotId(),
|
// par.getSettleWeight());
|
// }
|
}
|
}
|
InoutData completeData = inoutMapper.inoutQueryById(inoutParam);
|
inoutService.updateInoutCache(completeData);
|
return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), null, data);
|
}
|
|
/**
|
* 根据参数获取出入库的图片,文件流展示
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<List<FileData>> cutImgList(InoutParam param) {
|
|
if (null == param.getId())
|
return null;
|
if (null == param.getCompanyId()) {
|
param.setCompanyId(ContextUtil.getCompanyId());
|
}
|
List<FileData> files = fileService.listFile(param.getCompanyId(), param.getId());
|
|
if (null == files) {
|
return new PageResponse<>(RespCodeEnum.CODE_1007.getCode(),
|
"当前出入库信息下没有获取到可视化信息!!");
|
}
|
|
String bathPath;
|
File imgFile;
|
for (FileData file : files) {
|
|
//设置文件路径,通过文件流来展示图片
|
bathPath = fileService.getInoutFilePath(file.getCreateTime());
|
imgFile = new File(bathPath + file.getFileName());
|
if (imgFile.exists()) {
|
file.setFilePath(bathPath + file.getFileName());
|
}
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000, files);
|
}
|
|
|
public PageResponse<List<InoutNoticeIn>> listNoticeIn(NoticeParam param) {
|
|
IUser user = ContextUtil.getLoginUser();
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(user.getCompanyId());
|
}
|
param.setDeptId(ContextUtil.subDeptId(user));
|
param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE);
|
|
List<InoutNoticeIn> list = inoutManagerService.listNoticeIn(param);
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "查询结果为空!");
|
}
|
for (InoutNoticeIn inoutNoticeIn : list) {
|
Depot cacheDepot = coreCommonService.getCacheDepot(inoutNoticeIn.getCompanyId(), inoutNoticeIn.getDepotId());
|
if (null == cacheDepot) {
|
continue;
|
}
|
inoutNoticeIn.setDepotName(cacheDepot.getName());
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
|
/**
|
* 获取出库通知单列表
|
*
|
* @param param
|
* @return
|
*/
|
public PageResponse<List<InoutNoticeOut>> listNoticeOut(NoticeParam param) {
|
IUser user = ContextUtil.getLoginUser();
|
if (StringUtils.isEmpty(param.getCompanyId())) {
|
param.setCompanyId(user.getCompanyId());
|
}
|
param.setDeptId(ContextUtil.subDeptId(user));
|
|
param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE);
|
|
List<InoutNoticeOut> list = inoutManagerService.listNoticeOut(param);
|
|
if (null == list || list.isEmpty()) {
|
return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), "查询结果为空!");
|
}
|
|
//获取仓库信息
|
List<Depot> depotList = coreCommonService.getCacheDepotList(param.getCompanyId(), param.getDeptId());
|
Map<String, String> map = new HashMap<>();
|
if (depotList != null && depotList.size() > 0) {
|
for (Depot depot : depotList) {
|
map.put(depot.getId(), depot.getName());
|
}
|
}
|
|
//赋值仓库名称
|
for (InoutNoticeOut inoutNoticeOut : list) {
|
if (map.get(inoutNoticeOut.getDepotId()) != null) {
|
inoutNoticeOut.setDepotName(map.get(inoutNoticeOut.getDepotId()));
|
}
|
}
|
return new PageResponse<>(RespCodeEnum.CODE_0000, list);
|
}
|
}
|