parent
a033aa2b5e
commit
c1e82f45ed
|
|
@ -657,10 +657,19 @@ public class NormalPGIController extends BaseController {
|
||||||
@ApiMark(moduleName = "送货单管理", apiName = "一键收货查询")
|
@ApiMark(moduleName = "送货单管理", apiName = "一键收货查询")
|
||||||
public ApiResult<List<BarcodeLessReceivingVO>> getDeliveryByNoScan(@Valid @RequestBody BarcodeLessReceivingSearchQO request) {
|
public ApiResult<List<BarcodeLessReceivingVO>> getDeliveryByNoScan(@Valid @RequestBody BarcodeLessReceivingSearchQO request) {
|
||||||
List<BarcodeLessReceivingVO> list = new ArrayList<>();
|
List<BarcodeLessReceivingVO> list = new ArrayList<>();
|
||||||
List<WmsSrmOrder> orders = wmsSrmOrderService.lambdaQuery()
|
List<WmsSrmOrder> orders = null;
|
||||||
.in(WmsSrmOrder::getId, request.getId())
|
if (Objects.isNull(request.getId()) && request.getId() > 0) {
|
||||||
.eq(WmsSrmOrder::getIsCompleted, false)
|
orders = wmsSrmOrderService.lambdaQuery()
|
||||||
.list();
|
.eq(WmsSrmOrder::getId, request.getId())
|
||||||
|
.eq(WmsSrmOrder::getIsCompleted, false)
|
||||||
|
.list();
|
||||||
|
} else {
|
||||||
|
orders = wmsSrmOrderService.lambdaQuery()
|
||||||
|
.eq(WmsSrmOrder::getNoteNum, request.getOrderNo())
|
||||||
|
.eq(WmsSrmOrder::getIsCompleted, false)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("不存在未完成收货的物料!");
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(orders)).throwMessage("不存在未完成收货的物料!");
|
||||||
// 查找订单信息
|
// 查找订单信息
|
||||||
List<WmsSrmOrderItem> items = wmsSrmOrderItemService.lambdaQuery()
|
List<WmsSrmOrderItem> items = wmsSrmOrderItemService.lambdaQuery()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.nflg.wms.admin.controller;
|
package com.nflg.wms.admin.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.nflg.wms.admin.service.UserControllerService;
|
import com.nflg.wms.admin.service.UserControllerService;
|
||||||
import com.nflg.wms.common.pojo.ApiResult;
|
import com.nflg.wms.common.pojo.ApiResult;
|
||||||
import com.nflg.wms.common.pojo.PageData;
|
import com.nflg.wms.common.pojo.PageData;
|
||||||
|
|
@ -7,12 +9,14 @@ import com.nflg.wms.common.pojo.qo.*;
|
||||||
import com.nflg.wms.common.pojo.vo.RoleSimpleVO;
|
import com.nflg.wms.common.pojo.vo.RoleSimpleVO;
|
||||||
import com.nflg.wms.common.pojo.vo.UserSupplierItemVO;
|
import com.nflg.wms.common.pojo.vo.UserSupplierItemVO;
|
||||||
import com.nflg.wms.common.pojo.vo.UserSupplierVO;
|
import com.nflg.wms.common.pojo.vo.UserSupplierVO;
|
||||||
|
import com.nflg.wms.common.util.VUtil;
|
||||||
import com.nflg.wms.repository.entity.DictionaryItem;
|
import com.nflg.wms.repository.entity.DictionaryItem;
|
||||||
import com.nflg.wms.starter.BaseController;
|
import com.nflg.wms.starter.BaseController;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import org.postgresql.core.Utils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@ -155,4 +159,16 @@ public class SupplierController extends BaseController {
|
||||||
public void exportSelect(HttpServletResponse response, @RequestBody(required = false) List<Long> ids) throws Exception {
|
public void exportSelect(HttpServletResponse response, @RequestBody(required = false) List<Long> ids) throws Exception {
|
||||||
userControllerService.exportSupplier(response, ids);
|
userControllerService.exportSupplier(response, ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出供应商
|
||||||
|
* @param request 搜索参数
|
||||||
|
*/
|
||||||
|
@PostMapping("exportall")
|
||||||
|
public void exportALL(HttpServletResponse response, @Valid @RequestBody UserSupplierSearchQO request) throws Exception {
|
||||||
|
request.setPageSize(Integer.MAX_VALUE);
|
||||||
|
IPage<UserSupplierVO> data = userControllerService.searchSupplier(request);
|
||||||
|
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(data.getRecords())).throwMessage("数据不存在");
|
||||||
|
userControllerService.exportSupplierByFilter(response, data.getRecords());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ public class UserControllerService {
|
||||||
VUtil.trueThrowBusinessError(Objects.isNull(userSupplier) || StrUtil.isBlank(userSupplier.getSupplierCode()))
|
VUtil.trueThrowBusinessError(Objects.isNull(userSupplier) || StrUtil.isBlank(userSupplier.getSupplierCode()))
|
||||||
.throwMessage("供应商不存在");
|
.throwMessage("供应商不存在");
|
||||||
if (userSupplier.getIsOpenAccount()) {
|
if (userSupplier.getIsOpenAccount()) {
|
||||||
enableUser(userSupplier.getUserId(),request.getEnable()?1:2);
|
enableUser(userSupplier.getUserId(), request.getEnable() ? 1 : 2);
|
||||||
}
|
}
|
||||||
userSupplierService.lambdaUpdate().set(UserSupplier::getState, request.getEnable() ? 1 : 2)
|
userSupplierService.lambdaUpdate().set(UserSupplier::getState, request.getEnable() ? 1 : 2)
|
||||||
.set(UserSupplier::getUpdateBy, UserUtil.getUserName())
|
.set(UserSupplier::getUpdateBy, UserUtil.getUserName())
|
||||||
|
|
@ -523,7 +523,7 @@ public class UserControllerService {
|
||||||
new Workbook()
|
new Workbook()
|
||||||
.addSheet(new ListSheet<>(data))
|
.addSheet(new ListSheet<>(data))
|
||||||
.writeTo(osOut);
|
.writeTo(osOut);
|
||||||
try(ByteArrayInputStream isIn = new ByteArrayInputStream(osOut.toByteArray())) {
|
try (ByteArrayInputStream isIn = new ByteArrayInputStream(osOut.toByteArray())) {
|
||||||
return ApiResult.error(STATE.DataNoCheckPass, "导入文件失败", fileUploadService.upload("temp/" + DateTimeUtil.format(LocalDate.now(), "yyyyMMdd") + "/" + IdUtil.fastUUID() + ".xlsx", isIn, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
|
return ApiResult.error(STATE.DataNoCheckPass, "导入文件失败", fileUploadService.upload("temp/" + DateTimeUtil.format(LocalDate.now(), "yyyyMMdd") + "/" + IdUtil.fastUUID() + ".xlsx", isIn, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -542,19 +542,16 @@ public class UserControllerService {
|
||||||
List<DictionaryItem> suppliersCategory = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_SUPPLIERS_CATEGORY);
|
List<DictionaryItem> suppliersCategory = dictionaryItemService.getListByDictionaryCode(Constant.DICTIONARY_SUPPLIERS_CATEGORY);
|
||||||
List<UserSupplier> userSuppliers = new ArrayList<>();
|
List<UserSupplier> userSuppliers = new ArrayList<>();
|
||||||
for (SupplierExcelDTO dto : data) {
|
for (SupplierExcelDTO dto : data) {
|
||||||
UserSupplier userSupplier = new UserSupplier();
|
Long typeId = 0L;
|
||||||
|
UserSupplier userSupplier = null;// new UserSupplier();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (Objects.isNull(dto.getSupplierCode())) {
|
if (Objects.isNull(dto.getSupplierCode())) {
|
||||||
sb.append("供应商编号不能为空;");
|
sb.append("供应商编号不能为空;");
|
||||||
} else if (data.stream().filter(item -> StrUtil.equals(item.getSupplierCode(), dto.getSupplierCode())).count() > 1) {
|
} else if (data.stream().filter(item -> StrUtil.equals(item.getSupplierCode(), dto.getSupplierCode())).count() > 1) {
|
||||||
sb.append("供应商编号重复;");
|
sb.append("供应商编号重复;");
|
||||||
} else {
|
|
||||||
userSupplier = userSupplierService.lambdaQuery().eq(UserSupplier::getSupplierCode, dto.getSupplierCode()).one();
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(dto.getSupplierName())) {
|
if (StrUtil.isBlank(dto.getSupplierName())) {
|
||||||
sb.append("供应商名称不能为空;");
|
sb.append("供应商名称不能为空;");
|
||||||
} else {
|
|
||||||
userSupplier.setSupplierName(dto.getSupplierName());
|
|
||||||
}
|
}
|
||||||
if (StrUtil.isBlank(dto.getTypeName())) {
|
if (StrUtil.isBlank(dto.getTypeName())) {
|
||||||
sb.append("供应商类别不能为空;");
|
sb.append("供应商类别不能为空;");
|
||||||
|
|
@ -563,24 +560,38 @@ public class UserControllerService {
|
||||||
if (Objects.isNull(type)) {
|
if (Objects.isNull(type)) {
|
||||||
sb.append("供应商类别无效;");
|
sb.append("供应商类别无效;");
|
||||||
} else {
|
} else {
|
||||||
userSupplier.setTypeId(type.getId());
|
typeId = type.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userSupplier.setUserId(0L);
|
if (sb.length() > 0) {
|
||||||
|
dto.setResult(sb.toString());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// if (data.stream().noneMatch(it -> StrUtil.isBlank(it.getResult()))) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
userSupplier = userSupplierService.lambdaQuery().eq(UserSupplier::getSupplierCode, dto.getSupplierCode()).one();
|
||||||
|
if (Objects.isNull(userSupplier)) {
|
||||||
|
userSupplier = new UserSupplier();
|
||||||
|
userSupplier.setUserId(0L);
|
||||||
|
userSupplier.setDefaultLanguage("");
|
||||||
|
userSupplier.setAvatar("");
|
||||||
|
userSupplier.setState(1);
|
||||||
|
userSupplier.setIsOpenAccount(false);
|
||||||
|
userSupplier.setCreateBy(UserUtil.getUserName());
|
||||||
|
userSupplier.setCreateTime(LocalDateTime.now());
|
||||||
|
userSupplier.setUpdateBy(UserUtil.getUserName());
|
||||||
|
userSupplier.setUpdateTime(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
userSupplier.setSupplierName(dto.getSupplierName());
|
||||||
|
userSupplier.setTypeId(typeId);
|
||||||
|
userSupplier.setSupplierCode(dto.getSupplierCode());
|
||||||
|
userSupplier.setPciName(dto.getUserName());
|
||||||
|
userSupplier.setPciPhone(dto.getPhone());
|
||||||
userSupplier.setAbbreviation(dto.getAbbreviation());
|
userSupplier.setAbbreviation(dto.getAbbreviation());
|
||||||
userSupplier.setAbbreviation1(StringUtil.toPinYin(dto.getAbbreviation()));
|
userSupplier.setAbbreviation1(StringUtil.toPinYin(dto.getAbbreviation()));
|
||||||
userSupplier.setAbbreviation2(StringUtil.getPinYinFirstLetter(dto.getAbbreviation()));
|
userSupplier.setAbbreviation2(StringUtil.getPinYinFirstLetter(dto.getAbbreviation()));
|
||||||
userSupplier.setPciName(dto.getUserName());
|
|
||||||
userSupplier.setPciPhone(dto.getPhone());
|
|
||||||
userSupplier.setDefaultLanguage("");
|
|
||||||
userSupplier.setAvatar("");
|
|
||||||
userSupplier.setState(1);
|
|
||||||
userSupplier.setIsOpenAccount(false);
|
|
||||||
userSupplier.setRemark(dto.getRemark());
|
userSupplier.setRemark(dto.getRemark());
|
||||||
userSupplier.setCreateBy(UserUtil.getUserName());
|
|
||||||
userSupplier.setCreateTime(LocalDateTime.now());
|
|
||||||
userSupplier.setUpdateBy(UserUtil.getUserName());
|
|
||||||
userSupplier.setUpdateTime(LocalDateTime.now());
|
|
||||||
dto.setResult(sb.toString());
|
dto.setResult(sb.toString());
|
||||||
userSuppliers.add(userSupplier);
|
userSuppliers.add(userSupplier);
|
||||||
}
|
}
|
||||||
|
|
@ -604,7 +615,7 @@ public class UserControllerService {
|
||||||
DictionaryItem type = suppliersCategory.stream().filter(it -> Objects.equals(it.getId(), vu.getTypeId())).findFirst().get();
|
DictionaryItem type = suppliersCategory.stream().filter(it -> Objects.equals(it.getId(), vu.getTypeId())).findFirst().get();
|
||||||
dto.setTypeName(type.getName());
|
dto.setTypeName(type.getName());
|
||||||
dto.setRemark(vu.getRemark());
|
dto.setRemark(vu.getRemark());
|
||||||
dto.setUserCode(vu.getUserCode());
|
// dto.setUserCode(vu.getUserCode());
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
|
@ -615,7 +626,7 @@ public class UserControllerService {
|
||||||
.setSupplierName("供应商名称")
|
.setSupplierName("供应商名称")
|
||||||
.setTypeName("供应商类别")
|
.setTypeName("供应商类别")
|
||||||
.setUserName("负责人姓名")
|
.setUserName("负责人姓名")
|
||||||
.setUserCode("登录账号,不填则不开通账号")
|
// .setUserCode("登录账号,不填则不开通账号")
|
||||||
.setPhone("负责人电话")
|
.setPhone("负责人电话")
|
||||||
.setAbbreviation("供应商简称")
|
.setAbbreviation("供应商简称")
|
||||||
.setRemark("备注信息,此行为提示信息,导入时请删除"));
|
.setRemark("备注信息,此行为提示信息,导入时请删除"));
|
||||||
|
|
@ -717,4 +728,35 @@ public class UserControllerService {
|
||||||
}
|
}
|
||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exportSupplierByFilter(HttpServletResponse response, List<UserSupplierVO> records) throws IOException {
|
||||||
|
List<SupplierExcelExportDTO> datas = records.stream().map(vu -> {
|
||||||
|
SupplierExcelExportDTO dto = new SupplierExcelExportDTO();
|
||||||
|
dto.setSupplierCode(vu.getSupplierCode());
|
||||||
|
dto.setSupplierName(vu.getSupplierName());
|
||||||
|
dto.setAbbreviation(vu.getAbbreviation());
|
||||||
|
dto.setUserName(vu.getPciName());
|
||||||
|
dto.setPhone(vu.getPciPhone());
|
||||||
|
//DictionaryItem type = suppliersCategory.stream().filter(it -> Objects.equals(it.getId(), vu.getTypeId())).findFirst().get();
|
||||||
|
dto.setTypeName(vu.getTypeName());
|
||||||
|
dto.setRemark(vu.getRemark());
|
||||||
|
// dto.setUserCode(vu.getSupplierCode());
|
||||||
|
return dto;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||||
|
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("供应商导出.xlsx", StandardCharsets.UTF_8));
|
||||||
|
if (CollectionUtil.isEmpty(datas)) {
|
||||||
|
datas.add(new SupplierExcelExportDTO()
|
||||||
|
.setSupplierCode("供应商编号")
|
||||||
|
.setSupplierName("供应商名称")
|
||||||
|
.setTypeName("供应商类别")
|
||||||
|
.setUserName("负责人姓名")
|
||||||
|
.setPhone("负责人电话")
|
||||||
|
.setAbbreviation("供应商简称")
|
||||||
|
.setRemark("备注信息,此行为提示信息,导入时请删除"));
|
||||||
|
}
|
||||||
|
new Workbook()
|
||||||
|
.addSheet(new ListSheet<>(datas))
|
||||||
|
.writeTo(response.getOutputStream());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ public class SupplierExcelExportDTO {
|
||||||
/**
|
/**
|
||||||
* 登录账号
|
* 登录账号
|
||||||
*/
|
*/
|
||||||
@ExcelColumn("登录账号")
|
// @ExcelColumn("登录账号")
|
||||||
private String userCode;
|
// private String userCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
|
|
|
||||||
|
|
@ -10,4 +10,9 @@ public class BarcodeLessReceivingSearchQO {
|
||||||
* 送货单Id
|
* 送货单Id
|
||||||
*/
|
*/
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号 ,和送货单号二选一
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.nflg.wms.common.pojo.qo.UserSupplierSearchQO;
|
||||||
import com.nflg.wms.common.pojo.vo.UserSupplierVO;
|
import com.nflg.wms.common.pojo.vo.UserSupplierVO;
|
||||||
import com.nflg.wms.repository.entity.UserSupplier;
|
import com.nflg.wms.repository.entity.UserSupplier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Mapper 接口
|
* Mapper 接口
|
||||||
|
|
@ -18,4 +20,5 @@ import com.nflg.wms.repository.entity.UserSupplier;
|
||||||
public interface UserSupplierMapper extends BaseMapper<UserSupplier> {
|
public interface UserSupplierMapper extends BaseMapper<UserSupplier> {
|
||||||
|
|
||||||
IPage<UserSupplierVO> search(UserSupplierSearchQO request, Page<Object> objectPage);
|
IPage<UserSupplierVO> search(UserSupplierSearchQO request, Page<Object> objectPage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import com.nflg.wms.repository.entity.UserSupplier;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
|
|
@ -27,4 +29,5 @@ public interface IUserSupplierService extends IService<UserSupplier> {
|
||||||
UserSupplier getByUserId(Long id);
|
UserSupplier getByUserId(Long id);
|
||||||
|
|
||||||
UserSupplier getByCode(@NotBlank String supplierNo);
|
UserSupplier getByCode(@NotBlank String supplierNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务实现类
|
* 服务实现类
|
||||||
|
|
@ -65,4 +67,5 @@ public class UserSupplierServiceImpl extends ServiceImpl<UserSupplierMapper, Use
|
||||||
public UserSupplier getByCode(String supplierNo) {
|
public UserSupplier getByCode(String supplierNo) {
|
||||||
return lambdaQuery().eq(UserSupplier::getSupplierCode, supplierNo).one();
|
return lambdaQuery().eq(UserSupplier::getSupplierCode, supplierNo).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue