销售订单提交
This commit is contained in:
parent
c9ad6c5741
commit
502ea2ec13
@ -154,6 +154,8 @@ springdoc:
|
||||
# password: 123456
|
||||
|
||||
config:
|
||||
kkFileUrl: http://222.75.128.58:93/FileServer/ #kkfile文件预览服务地址
|
||||
|
||||
# ===================== 是否开启测试环境 =====================
|
||||
TestVersion: false
|
||||
# ===================== ApacheShardingSphere 配置开关 =====================
|
||||
@ -167,7 +169,7 @@ config:
|
||||
enable-storage: true #启用存储
|
||||
enable-access: true #启用访问(线上请使用 Nginx 配置,效率更高)
|
||||
domain: "" # 访问域名,例如:“http://127.0.0.1:8030/”,注意后面要和 path-patterns 保持一致,“/”结尾,本地存储建议使用相对路径,方便后期更换域名
|
||||
base-path: C:/project/jnpf-resources/ # 基础路径
|
||||
base-path: D:/project/jnpf-resources/ # 基础路径
|
||||
path-patterns: /** # 访问路径
|
||||
storage-path: # 存储路径
|
||||
aliyun-oss: # 阿里云 OSS ,不使用的情况下可以不写
|
||||
|
||||
@ -43,9 +43,9 @@ config:
|
||||
AllowUploadFileType: jpg,gif,png,bmp,jpeg,doc,docx,ppt,pptx,xls,xlsx,pdf,txt,rar,zip,csv,mp3 #允许上传文件类型
|
||||
AllowPreviewFileType: doc,docx,xls,xlsx,ppt,pptx,pdf,jpg,gif,png,bmp,jpeg #允许预览文件类型
|
||||
PreviewType: kkfile #文件预览方式 (1.yozo 2.kkfile)默认使用kkfile
|
||||
kkFileUrl: http://183.129.248.194:90/FileServer/ #kkfile文件预览服务地址
|
||||
ApiDomain: http://127.0.0.1:5558 #后端域名(文档预览中使用)
|
||||
FrontDomain: http://127.0.0.1:5558 #前端域名(文档预览中使用)
|
||||
kkFileUrl: http://222.75.128.58:93/FileServer/ #kkfile文件预览服务地址
|
||||
ApiDomain: http://127.0.0.1:5559 #后端域名(文档预览中使用)
|
||||
FrontDomain: http://127.0.0.1:5559 #前端域名(文档预览中使用)
|
||||
AppDomain: http://127.0.0.1:8080 #app/h5端域名配置(文档预览中使用)
|
||||
|
||||
CodeAreasName: example #代码生成器模块命名
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package jnpf.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jnpf.base.entity.DictionaryDataEntity;
|
||||
import jnpf.entity.ExampleOrderEntity;
|
||||
import jnpf.model.order.OrderForm;
|
||||
import jnpf.model.order.OrderPagination;
|
||||
import jnpf.model.order.ExampleOrderForm;
|
||||
import jnpf.model.order.ExampleOrderPagination;
|
||||
import jnpf.permission.entity.UserEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 示例业务订单 Service
|
||||
@ -18,7 +21,7 @@ import java.util.List;
|
||||
public interface ExampleOrderService extends IService<ExampleOrderEntity> {
|
||||
|
||||
|
||||
List<ExampleOrderEntity> getList(OrderPagination orderPagination);
|
||||
List<ExampleOrderEntity> getList(ExampleOrderPagination exampleOrderPagination);
|
||||
ExampleOrderEntity getInfo(String id);
|
||||
|
||||
void delete(ExampleOrderEntity entity);
|
||||
@ -26,7 +29,10 @@ public interface ExampleOrderService extends IService<ExampleOrderEntity> {
|
||||
void create(ExampleOrderEntity entity);
|
||||
|
||||
boolean update(String id, ExampleOrderEntity entity);
|
||||
String checkForm(OrderForm form, int i);
|
||||
void saveOrUpdate(OrderForm orderForm,String id, boolean isSave) throws Exception;
|
||||
String checkForm(ExampleOrderForm form, int i);
|
||||
void saveOrUpdate(ExampleOrderForm orderForm, String id, boolean isSave) throws Exception;
|
||||
|
||||
List<UserEntity> getByDeptId(String id);
|
||||
List<Map<String, Object>> convertAttFileToAttachment(String attFile);
|
||||
void convertFields(Map<String, Object> map,List<DictionaryDataEntity> dictionaryDataEntities);
|
||||
}
|
||||
|
||||
@ -30,6 +30,6 @@ public interface OrderDetailService extends IService<OrderDetailEntity> {
|
||||
* @param saleOrdId 销售订单ID
|
||||
* @return 订单明细列表
|
||||
*/
|
||||
List<OrderDetailEntity> getListByOrderId(String saleOrdId);
|
||||
List<OrderDetailEntity> getListByOrderId(Long saleOrdId);
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,20 @@
|
||||
package jnpf.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.entity.DictionaryDataEntity;
|
||||
import jnpf.entity.OrderDetailEntity;
|
||||
import jnpf.entity.ExampleOrderEntity;
|
||||
import jnpf.mapper.ExampleOrderMapper;
|
||||
import jnpf.model.order.OrderForm;
|
||||
import jnpf.model.order.OrderPagination;
|
||||
import jnpf.model.order.ExampleOrderForm;
|
||||
import jnpf.model.order.ExampleOrderPagination;
|
||||
import jnpf.permission.entity.UserEntity;
|
||||
import jnpf.permission.service.UserService;
|
||||
import jnpf.service.ExampleOrderService;
|
||||
@ -21,8 +24,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -45,29 +51,29 @@ public class ExampleOrderServiceImpl extends ServiceImpl<ExampleOrderMapper, Exa
|
||||
@Resource
|
||||
private OrderDetailService orderDetailService;
|
||||
@Override
|
||||
public List<ExampleOrderEntity> getList(OrderPagination orderPagination) {
|
||||
public List<ExampleOrderEntity> getList(ExampleOrderPagination exampleOrderPagination) {
|
||||
LambdaQueryWrapper<ExampleOrderEntity> OrderWrapper=new LambdaQueryWrapper<>();
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getOrdDate())){
|
||||
List inParkTimeList = JsonUtil.getJsonToList(orderPagination.getOrdDate(),String.class);
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getOrdDate())){
|
||||
List inParkTimeList = JsonUtil.getJsonToList(exampleOrderPagination.getOrdDate(),String.class);
|
||||
Long fir = Long.valueOf(String.valueOf(inParkTimeList.get(0)));
|
||||
Long sec = Long.valueOf(String.valueOf(inParkTimeList.get(1)));
|
||||
OrderWrapper.ge(ExampleOrderEntity::getOrdDate, new Date(fir))
|
||||
.le(ExampleOrderEntity::getOrdDate, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getSaleOrdNo())){
|
||||
OrderWrapper.like(ExampleOrderEntity::getSaleOrdNo,orderPagination.getSaleOrdNo());
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getSaleOrdNo())){
|
||||
OrderWrapper.like(ExampleOrderEntity::getSaleOrdNo, exampleOrderPagination.getSaleOrdNo());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getProjectName())){
|
||||
OrderWrapper.like(ExampleOrderEntity::getProjectName,orderPagination.getProjectName());
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getOrdType())){
|
||||
OrderWrapper.eq(ExampleOrderEntity::getOrdType, exampleOrderPagination.getOrdType());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getIsUrgent())){
|
||||
OrderWrapper.eq(ExampleOrderEntity::getIsUrgent,orderPagination.getIsUrgent());
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getIsUrgent())){
|
||||
OrderWrapper.eq(ExampleOrderEntity::getIsUrgent, exampleOrderPagination.getIsUrgent());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getOrdStatus())){
|
||||
OrderWrapper.eq(ExampleOrderEntity::getOrdStatus,orderPagination.getOrdStatus());
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getOrdStatus())){
|
||||
OrderWrapper.eq(ExampleOrderEntity::getOrdStatus, exampleOrderPagination.getOrdStatus());
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(orderPagination.getSaleManName())){
|
||||
List<UserEntity> userList = userService.getUserByName(orderPagination.getSaleManName());
|
||||
if(ObjectUtil.isNotEmpty(exampleOrderPagination.getSaleManName())){
|
||||
List<UserEntity> userList = userService.getUserByName(exampleOrderPagination.getSaleManName());
|
||||
List<String> ids = userList.stream().map(UserEntity::getId).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(ids)){
|
||||
OrderWrapper.in(ExampleOrderEntity::getSaleMan,ids);
|
||||
@ -75,10 +81,10 @@ public class ExampleOrderServiceImpl extends ServiceImpl<ExampleOrderMapper, Exa
|
||||
}
|
||||
OrderWrapper.isNull(ExampleOrderEntity::getDeleteMark);
|
||||
OrderWrapper.orderByDesc(ExampleOrderEntity::getCreatorTime);
|
||||
if("0".equals(orderPagination.getDataType())){
|
||||
Page<ExampleOrderEntity> page=new Page<>(orderPagination.getCurrentPage(), orderPagination.getPageSize());
|
||||
if("0".equals(exampleOrderPagination.getDataType())){
|
||||
Page<ExampleOrderEntity> page=new Page<>(exampleOrderPagination.getCurrentPage(), exampleOrderPagination.getPageSize());
|
||||
IPage<ExampleOrderEntity> userIPage=this.page(page, OrderWrapper);
|
||||
return orderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
|
||||
return exampleOrderPagination.setData(userIPage.getRecords(),userIPage.getTotal());
|
||||
}else {
|
||||
return this.list(OrderWrapper);
|
||||
}
|
||||
@ -105,7 +111,7 @@ public class ExampleOrderServiceImpl extends ServiceImpl<ExampleOrderMapper, Exa
|
||||
}
|
||||
/** 验证表单唯一字段,正则,非空 i-0新增-1修改*/
|
||||
@Override
|
||||
public String checkForm(OrderForm form, int i) {
|
||||
public String checkForm(ExampleOrderForm form, int i) {
|
||||
boolean isUp =StringUtil.isNotEmpty(form.getId()) && !form.getId().equals("0");
|
||||
String id="";
|
||||
String countRecover = "";
|
||||
@ -124,34 +130,212 @@ public class ExampleOrderServiceImpl extends ServiceImpl<ExampleOrderMapper, Exa
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveOrUpdate(OrderForm OrderForm, String id, boolean isSave) throws Exception{
|
||||
UserInfo userInfo=userProvider.get();
|
||||
UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
public void saveOrUpdate(ExampleOrderForm OrderForm, String id, boolean isSave) throws Exception{
|
||||
// UserInfo userInfo=userProvider.get();
|
||||
// UserEntity userEntity = generaterSwapUtil.getUser(userInfo.getUserId());
|
||||
ExampleOrderEntity entity = JsonUtil.getJsonToBean(OrderForm, ExampleOrderEntity.class);
|
||||
|
||||
if(isSave){
|
||||
String mainId = RandomUtil.uuId() ;
|
||||
entity.setId(mainId);
|
||||
entity.setSaleOrdNo(generaterSwapUtil.getBillNumber("order", false));
|
||||
|
||||
// String mainId = RandomUtil.uuId() ;
|
||||
// entity.setId(mainId);
|
||||
String saleOrdNo = generateSaleOrdNo(entity.getOrdType());
|
||||
entity.setSaleOrdNo(saleOrdNo);
|
||||
}
|
||||
this.saveOrUpdate(entity);
|
||||
if(!isSave){
|
||||
QueryWrapper<OrderDetailEntity> orderDetailEntityWrapper = new QueryWrapper<>();
|
||||
orderDetailEntityWrapper.lambda().eq(OrderDetailEntity::getSaleOrdId, entity.getId());
|
||||
orderDetailService.remove(orderDetailEntityWrapper);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(OrderForm.getOrderDetailList())){
|
||||
List<OrderDetailEntity> orderDetailEntityList = JsonUtil.getJsonToList(OrderForm.getOrderDetailList(),OrderDetailEntity.class);
|
||||
for(OrderDetailEntity entitys : orderDetailEntityList){
|
||||
entitys.setId(RandomUtil.uuId());
|
||||
entitys.setSaleOrdId(entity.getId());
|
||||
if(isSave){
|
||||
}else{
|
||||
}
|
||||
orderDetailService.saveOrUpdate(entitys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserEntity> getByDeptId(String id) {
|
||||
QueryWrapper<UserEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(UserEntity::getOrganizeId, id);
|
||||
queryWrapper.lambda().ne(UserEntity::getIsAdministrator, 1);
|
||||
return userService.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单编号
|
||||
* @param ordType 订单类型:1-备库订单,2-销售订单
|
||||
* @return 订单编号
|
||||
*/
|
||||
private String generateSaleOrdNo(String ordType) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
|
||||
String ym = sdf.format(new Date());
|
||||
|
||||
String prefix;
|
||||
if ("1".equals(ordType)) {
|
||||
prefix = "BK";
|
||||
} else if ("2".equals(ordType)) {
|
||||
prefix = "SO";
|
||||
} else {
|
||||
prefix = "SO";
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<ExampleOrderEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ExampleOrderEntity::getOrdType, ordType);
|
||||
queryWrapper.eq(ExampleOrderEntity::getDeleteMark, null);
|
||||
queryWrapper.likeRight(ExampleOrderEntity::getSaleOrdNo, prefix + ym);
|
||||
queryWrapper.orderByDesc(ExampleOrderEntity::getSaleOrdNo);
|
||||
queryWrapper.last("LIMIT 1");
|
||||
|
||||
ExampleOrderEntity lastOrder = this.getOne(queryWrapper);
|
||||
|
||||
if (lastOrder == null || lastOrder.getSaleOrdNo() == null) {
|
||||
return prefix + ym + "001";
|
||||
}
|
||||
|
||||
String lastSaleOrdNo = lastOrder.getSaleOrdNo();
|
||||
if (lastSaleOrdNo.length() < 9) {
|
||||
return prefix + ym + "001";
|
||||
}
|
||||
|
||||
String lastYm = lastSaleOrdNo.substring(2, 8);
|
||||
if (!ym.equals(lastYm)) {
|
||||
return prefix + ym + "001";
|
||||
}
|
||||
|
||||
String lastSeq = lastSaleOrdNo.substring(8);
|
||||
try {
|
||||
int seq = Integer.parseInt(lastSeq);
|
||||
seq++;
|
||||
String newSeq = String.format("%03d", seq);
|
||||
return prefix + ym + newSeq;
|
||||
} catch (NumberFormatException e) {
|
||||
return prefix + ym + "001";
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 转换 attFile 为 attachment
|
||||
* @param attFile attFile 字符串
|
||||
* @return attachment 数组
|
||||
*/
|
||||
public List<Map<String, Object>> convertAttFileToAttachment(String attFile) {
|
||||
if (attFile == null || attFile.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
try {
|
||||
JSONArray jsonArray = JSON.parseArray(attFile);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||
result.add(jsonObject);
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换订单字段
|
||||
* @param map 订单数据Map
|
||||
*/
|
||||
@Override
|
||||
public void convertFields(Map<String, Object> map,List<DictionaryDataEntity> dictionaryDataEntities) {
|
||||
if (map == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
//格式化业务人员
|
||||
Object saleMan = map.get("saleMan");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(saleMan)){
|
||||
UserEntity byId = userService.getById(Long.parseLong(saleMan.toString()));
|
||||
if (ObjectUtil.isNotEmpty(byId)){
|
||||
map.put("saleManName", byId.getRealName());
|
||||
}
|
||||
}
|
||||
Object ordStatus = map.get("ordStatus");
|
||||
if (ObjectUtil.isNotEmpty(ordStatus)){
|
||||
DictionaryDataEntity entity = dictionaryDataEntities.stream().filter(t -> t.getEnCode().equals(ordStatus.toString())).findFirst().orElse(null);
|
||||
if (ObjectUtil.isNotEmpty( entity)) {
|
||||
map.put("ordStatus", entity.getFullName());
|
||||
}
|
||||
}
|
||||
// 格式化下单日期
|
||||
Object ordDate = map.get("ordDate");
|
||||
if (ordDate != null) {
|
||||
if (ordDate instanceof Date) {
|
||||
map.put("ordDate", dateFormat.format((Date) ordDate));
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化要求交货日期
|
||||
Object reqDeliveryDate = map.get("reqDeliveryDate");
|
||||
if (reqDeliveryDate != null) {
|
||||
if (reqDeliveryDate instanceof Date) {
|
||||
map.put("reqDeliveryDate", dateFormat.format((Date) reqDeliveryDate));
|
||||
}
|
||||
}
|
||||
|
||||
// 转换订单类型
|
||||
Object ordType = map.get("ordType");
|
||||
if (ordType != null) {
|
||||
String typeStr = String.valueOf(ordType);
|
||||
if ("1".equals(typeStr)) {
|
||||
map.put("ordType", "备库订单");
|
||||
} else if ("2".equals(typeStr)) {
|
||||
map.put("ordType", "销售订单");
|
||||
}
|
||||
}
|
||||
|
||||
// 转换是否急单
|
||||
Object isUrgent = map.get("isUrgent");
|
||||
if (isUrgent != null) {
|
||||
String urgentStr = String.valueOf(isUrgent);
|
||||
if ("0".equals(urgentStr)) {
|
||||
map.put("isUrgent", "是");
|
||||
} else if ("1".equals(urgentStr)) {
|
||||
map.put("isUrgent", "否");
|
||||
}
|
||||
}
|
||||
|
||||
// 转换是否变更
|
||||
Object isChange = map.get("isChange");
|
||||
if (isChange != null) {
|
||||
String changeStr = String.valueOf(isChange);
|
||||
if ("0".equals(changeStr)) {
|
||||
map.put("isChange", "是");
|
||||
} else if ("1".equals(changeStr)) {
|
||||
map.put("isChange", "否");
|
||||
}
|
||||
}
|
||||
|
||||
// 转换生产状态
|
||||
Object proStatus = map.get("proStatus");
|
||||
if (proStatus != null) {
|
||||
String statusStr = String.valueOf(proStatus);
|
||||
if ("0".equals(statusStr)) {
|
||||
map.put("proStatus", "正常");
|
||||
} else if ("1".equals(statusStr)) {
|
||||
map.put("proStatus", "部分转生产");
|
||||
} else if ("2".equals(statusStr)) {
|
||||
map.put("proStatus", "全部转生产");
|
||||
}
|
||||
}
|
||||
|
||||
// 转换发货状态
|
||||
Object deliveryStatus = map.get("deliveryStatus");
|
||||
if (deliveryStatus != null) {
|
||||
String statusStr = String.valueOf(deliveryStatus);
|
||||
if ("0".equals(statusStr) || "".equals(statusStr)) {
|
||||
map.put("deliveryStatus", "未发货");
|
||||
} else if ("1".equals(statusStr)) {
|
||||
map.put("deliveryStatus", "部分发货");
|
||||
} else if ("2".equals(statusStr)) {
|
||||
map.put("deliveryStatus", "全部发货");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderDetailEntity> getListByOrderId(String saleOrdId) {
|
||||
public List<OrderDetailEntity> getListByOrderId(Long saleOrdId) {
|
||||
QueryWrapper<OrderDetailEntity> query = new QueryWrapper<>();
|
||||
query.lambda().eq(OrderDetailEntity::getSaleOrdId, saleOrdId);
|
||||
query.lambda().orderByDesc(OrderDetailEntity::getCreatorTime);
|
||||
|
||||
@ -1,42 +1,59 @@
|
||||
package jnpf.controller;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.xuyanwu.spring.file.storage.FileInfo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jnpf.base.ActionResult;
|
||||
|
||||
import jnpf.base.UserInfo;
|
||||
import jnpf.base.entity.DictionaryDataEntity;
|
||||
import jnpf.base.model.ColumnDataModel;
|
||||
import jnpf.base.service.DictionaryDataService;
|
||||
import jnpf.base.util.VisualUtils;
|
||||
import jnpf.base.vo.DownloadVO;
|
||||
import jnpf.base.vo.PageListVO;
|
||||
import jnpf.base.vo.PaginationVO;
|
||||
|
||||
import jnpf.config.ConfigValueUtil;
|
||||
import jnpf.entity.ExampleOrderEntity;
|
||||
import jnpf.entity.OrderDetailEntity;
|
||||
import jnpf.model.order.OrderForm;
|
||||
import jnpf.model.order.OrderPagination;
|
||||
import jnpf.model.order.ExampleOrderForm;
|
||||
import jnpf.model.order.ExampleOrderPagination;
|
||||
|
||||
import jnpf.model.visualJson.config.HeaderModel;
|
||||
import jnpf.permission.entity.UserEntity;
|
||||
import jnpf.permission.service.UserService;
|
||||
import jnpf.service.ExampleOrderService;
|
||||
import jnpf.service.OrderDetailService;
|
||||
import jnpf.util.JsonUtil;
|
||||
import jnpf.util.StringUtil;
|
||||
import jnpf.util.*;
|
||||
import lombok.Cleanup;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 业务订单 控制类
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Tag(name = "业务订单", description = "exampleOrder")
|
||||
@RestController
|
||||
@RequestMapping("/api/example/exampleOrder")
|
||||
@ -49,15 +66,24 @@ public class ExampleOrderController {
|
||||
|
||||
@Resource
|
||||
private OrderDetailService orderDetailService;
|
||||
|
||||
@Resource
|
||||
private ConfigValueUtil configValueUtil;
|
||||
|
||||
@Resource
|
||||
private UserProvider userProvider;
|
||||
@Resource
|
||||
private DictionaryDataService dictionaryDataService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param orderPagination 分页查询对象
|
||||
* @param exampleOrderPagination 分页查询对象
|
||||
* @return 列表结果集
|
||||
*/
|
||||
@Operation(summary = "获取订单列表")
|
||||
@PostMapping("/getList")
|
||||
public ActionResult getList(@RequestBody OrderPagination orderPagination) {
|
||||
List<ExampleOrderEntity> list= orderService.getList(orderPagination);
|
||||
public ActionResult getList(@RequestBody ExampleOrderPagination exampleOrderPagination) {
|
||||
List<ExampleOrderEntity> list= orderService.getList(exampleOrderPagination);
|
||||
List<Map<String, Object>> realList =new ArrayList<>();
|
||||
for (ExampleOrderEntity entity : list) {
|
||||
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
|
||||
@ -70,16 +96,39 @@ public class ExampleOrderController {
|
||||
ExampleOrderMap.put("saleManName", byId.getRealName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
realList.add(ExampleOrderMap);
|
||||
}
|
||||
//返回对象
|
||||
PageListVO vo = new PageListVO();
|
||||
vo.setList(realList);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(orderPagination, PaginationVO.class);
|
||||
PaginationVO page = JsonUtil.getJsonToBean(exampleOrderPagination, PaginationVO.class);
|
||||
vo.setPagination(page);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param orderForm
|
||||
* @return
|
||||
*/
|
||||
@PostMapping()
|
||||
@Operation(summary = "创建")
|
||||
public ActionResult create(@RequestBody @Valid ExampleOrderForm orderForm) {
|
||||
String b = orderService.checkForm(orderForm,0);
|
||||
if (StringUtil.isNotEmpty(b)){
|
||||
return ActionResult.fail(b );
|
||||
}
|
||||
try{
|
||||
orderService.saveOrUpdate(orderForm, null ,true);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail("新增数据失败");
|
||||
}
|
||||
return ActionResult.success("创建成功");
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
* @param id
|
||||
@ -88,7 +137,7 @@ public class ExampleOrderController {
|
||||
*/
|
||||
@PutMapping("/{id}")
|
||||
@Operation(summary = "更新")
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid OrderForm orderForm,
|
||||
public ActionResult update(@PathVariable("id") String id,@RequestBody @Valid ExampleOrderForm orderForm,
|
||||
@RequestParam(value = "isImport", required = false) boolean isImport){
|
||||
orderForm.setId(id);
|
||||
if (!isImport) {
|
||||
@ -102,6 +151,7 @@ public class ExampleOrderController {
|
||||
try{
|
||||
orderService.saveOrUpdate(orderForm,id,false);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
return ActionResult.fail("修改数据失败");
|
||||
}
|
||||
return ActionResult.success("更新成功");
|
||||
@ -114,17 +164,17 @@ public class ExampleOrderController {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除")
|
||||
@Operation(summary = "作废")
|
||||
@DeleteMapping("/{id}")
|
||||
@Transactional
|
||||
public ActionResult delete(@PathVariable("id") String id){
|
||||
ExampleOrderEntity entity = orderService.getInfo(id);
|
||||
if (entity != null) {
|
||||
//假删除
|
||||
entity.setDeleteMark(1);
|
||||
entity.setOrdStatus("9");
|
||||
orderService.update(id, entity);
|
||||
}
|
||||
return ActionResult.success("删除成功");
|
||||
return ActionResult.success("作废成功");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +193,19 @@ public class ExampleOrderController {
|
||||
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
|
||||
ExampleOrderMap.put("id", ExampleOrderMap.get("id"));
|
||||
List<OrderDetailEntity> orderDetailList = orderDetailService.getListByOrderId(entity.getId());
|
||||
for (OrderDetailEntity orderDetailEntity : orderDetailList) {
|
||||
orderDetailEntity.setUnitName("1".equals(orderDetailEntity.getUnit())?"kg":"T");
|
||||
}
|
||||
ExampleOrderMap.put("orderDetailList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(orderDetailList)));
|
||||
ExampleOrderMap.put("saleMan",String.valueOf(entity.getSaleMan()));
|
||||
ExampleOrderMap.put("saleDeptId",String.valueOf(entity.getSaleDeptId()));
|
||||
ExampleOrderMap.put("custId",Integer.valueOf(entity.getCustId()));
|
||||
if (entity.getAttFile() != null && !entity.getAttFile().isEmpty()) {
|
||||
List<Map<String, Object>> attFile = orderService.convertAttFileToAttachment(entity.getAttFile());
|
||||
ExampleOrderMap.put("attFile", attFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//副表数据
|
||||
//子表数据
|
||||
@ -165,10 +227,174 @@ public class ExampleOrderController {
|
||||
Map<String, Object> ExampleOrderMap=JsonUtil.entityToMap(entity);
|
||||
ExampleOrderMap.put("id", ExampleOrderMap.get("id"));
|
||||
List<OrderDetailEntity> orderDetailList = orderDetailService.getListByOrderId(entity.getId());
|
||||
for (OrderDetailEntity orderDetailEntity : orderDetailList) {
|
||||
orderDetailEntity.setUnitName("1".equals(orderDetailEntity.getUnit())?"kg":"T");
|
||||
}
|
||||
ExampleOrderMap.put("orderDetailList",JsonUtil.getJsonToList(JsonUtil.getListToJsonArray(orderDetailList)));
|
||||
ExampleOrderMap.put("saleMan",String.valueOf(entity.getSaleMan()));
|
||||
ExampleOrderMap.put("saleDeptId",String.valueOf(entity.getSaleDeptId()));
|
||||
ExampleOrderMap.put("custId",Integer.valueOf(entity.getCustId()));
|
||||
|
||||
if (entity.getAttFile() != null && !entity.getAttFile().isEmpty()) {
|
||||
List<Map<String, Object>> attFile = orderService.convertAttFileToAttachment(entity.getAttFile());
|
||||
ExampleOrderMap.put("attFile", attFile);
|
||||
}
|
||||
|
||||
//副表数据
|
||||
//子表数据
|
||||
return ActionResult.success(ExampleOrderMap);
|
||||
}
|
||||
/**
|
||||
* 获取详情(编辑页)
|
||||
* 编辑页面使用-不转换数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "信息")
|
||||
@GetMapping("/getByDeptId/{id}")
|
||||
public ActionResult getByDeptId(@PathVariable("id") String id){
|
||||
List<UserEntity> userEntities=orderService.getByDeptId( id);
|
||||
//子表数据
|
||||
return ActionResult.success(userEntities);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出Excel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "导出Excel")
|
||||
@PostMapping("/Actions/Export")
|
||||
public ActionResult Export(@RequestBody ExampleOrderPagination exampleOrderPagination) throws IOException {
|
||||
if (StringUtil.isEmpty(exampleOrderPagination.getSelectKey())){
|
||||
return ActionResult.fail("请选择导出字段");
|
||||
}
|
||||
List<DictionaryDataEntity> dictionaryDataEntities= dictionaryDataService.getList("811520443046428805", false);
|
||||
|
||||
List<ExampleOrderEntity> list= orderService.getList(exampleOrderPagination);
|
||||
List<Map<String, Object>> realList=new ArrayList<>();
|
||||
for (ExampleOrderEntity entity : list) {
|
||||
Map<String, Object> exampleOrderMap=JsonUtil.entityToMap(entity);
|
||||
exampleOrderMap.put("id", exampleOrderMap.get("id"));
|
||||
|
||||
orderService.convertFields(exampleOrderMap,dictionaryDataEntities);
|
||||
//子表数据
|
||||
realList.add(exampleOrderMap);
|
||||
}
|
||||
//数据转换
|
||||
String[]keys=!StringUtil.isEmpty(exampleOrderPagination.getSelectKey())?exampleOrderPagination.getSelectKey():new String[0];
|
||||
UserInfo userInfo=userProvider.get();
|
||||
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
|
||||
return ActionResult.success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出表格方法
|
||||
*/
|
||||
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
|
||||
DownloadVO vo=DownloadVO.builder().build();
|
||||
List<ExcelExportEntity> entitys=new ArrayList<>();
|
||||
if(keys.length>0){
|
||||
for(String key:keys){
|
||||
switch(key){
|
||||
case "saleOrdNo" :
|
||||
entitys.add(new ExcelExportEntity("订单编码" ,"saleOrdNo"));
|
||||
break;
|
||||
case "ordDate" :
|
||||
entitys.add(new ExcelExportEntity("下单日期" ,"ordDate"));
|
||||
break;
|
||||
case "custName" :
|
||||
entitys.add(new ExcelExportEntity("客户名称" ,"custName"));
|
||||
break;
|
||||
case "ordType" :
|
||||
entitys.add(new ExcelExportEntity("订单类型" ,"ordType"));
|
||||
break;
|
||||
case "reqDeliveryDate" :
|
||||
entitys.add(new ExcelExportEntity("要求交货日期" ,"reqDeliveryDate"));
|
||||
break;
|
||||
case "isUrgent" :
|
||||
entitys.add(new ExcelExportEntity("是否急单" ,"isUrgent"));
|
||||
break;
|
||||
case "contractNo" :
|
||||
entitys.add(new ExcelExportEntity("合同编号" ,"contractNo"));
|
||||
break;
|
||||
case "saleManName" :
|
||||
entitys.add(new ExcelExportEntity("业务人员" ,"saleManName"));
|
||||
break;
|
||||
case "isChange" :
|
||||
entitys.add(new ExcelExportEntity("是否变更" ,"isChange"));
|
||||
break;
|
||||
case "proStatus" :
|
||||
entitys.add(new ExcelExportEntity("生产状态" ,"proStatus"));
|
||||
break;
|
||||
case "qualityReq" :
|
||||
entitys.add(new ExcelExportEntity("质量要求" ,"qualityReq"));
|
||||
break;
|
||||
case "packReq" :
|
||||
entitys.add(new ExcelExportEntity("包装要求" ,"packReq"));
|
||||
break;
|
||||
case "ordStatus" :
|
||||
entitys.add(new ExcelExportEntity("订单状态" ,"ordStatus"));
|
||||
break;
|
||||
case "deliveryStatus" :
|
||||
entitys.add(new ExcelExportEntity("发货状态" ,"deliveryStatus"));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ExportParams exportParams = new ExportParams(null, "表单信息");
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
try{
|
||||
@Cleanup Workbook workbook = new HSSFWorkbook();
|
||||
if (entitys.size()>0){
|
||||
if (list.size()==0){
|
||||
list.add(new HashMap<>());
|
||||
}
|
||||
//去除空数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (Map<String, Object> map : list) {
|
||||
int i = 0;
|
||||
for (String key : keys) {
|
||||
//子表
|
||||
if (key.toLowerCase().startsWith("tablefield")) {
|
||||
String tableField = key.substring(0, key.indexOf("-" ));
|
||||
String field = key.substring(key.indexOf("-" ) + 1);
|
||||
Object o = map.get(tableField);
|
||||
if (o != null) {
|
||||
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
|
||||
for (Map<String, Object> childMap : childList) {
|
||||
if (childMap.get(field) != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Object o = map.get(key);
|
||||
if (o != null) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
dataList.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
|
||||
}
|
||||
String fileName = "销售订单信息_" + DateUtil.dateNow("yyyyMMddHHmmss") + ".xlsx";
|
||||
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
|
||||
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
|
||||
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
|
||||
vo.setName(fileInfo.getFilename());
|
||||
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
|
||||
} catch (Exception e) {
|
||||
log.error("信息导出Excel错误:{}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package jnpf.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@ -31,7 +32,7 @@ import java.util.List;
|
||||
*/
|
||||
@Tag(name = "业务订单明细", description = "example")
|
||||
@RestController
|
||||
@RequestMapping("/api/example/OrderDetail")
|
||||
@RequestMapping("/api/example/orderDetail")
|
||||
public class OrderDetailController {
|
||||
|
||||
@Autowired
|
||||
@ -60,7 +61,7 @@ public class OrderDetailController {
|
||||
@Operation(summary = "根据订单ID获取明细列表")
|
||||
@Parameter(name = "saleOrdId", description = "销售订单ID", required = true)
|
||||
@GetMapping("/byOrder/{saleOrdId}")
|
||||
public ActionResult<ListVO<OrderDetailVO>> getListByOrderId(@PathVariable String saleOrdId) {
|
||||
public ActionResult<ListVO<OrderDetailVO>> getListByOrderId(@PathVariable Long saleOrdId) {
|
||||
List<OrderDetailEntity> entityList = orderDetailService.getListByOrderId(saleOrdId);
|
||||
List<OrderDetailVO> voList = JsonUtil.getJsonToList(entityList, OrderDetailVO.class);
|
||||
return ActionResult.success(new ListVO<>(voList));
|
||||
@ -124,19 +125,18 @@ public class OrderDetailController {
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "删除订单明细")
|
||||
@SaCheckPermission("example.orderDetail")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "主键", required = true)
|
||||
})
|
||||
@DeleteMapping("/{id}")
|
||||
public ActionResult<OrderDetailForm> delete(@PathVariable Integer id) {
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ActionResult<OrderDetailForm> delete(@PathVariable("id")Integer id) {
|
||||
OrderDetailEntity byId = orderDetailService.getById(id);
|
||||
// 对象存在判断
|
||||
if (orderDetailService.getById(id) != null) {
|
||||
if (ObjectUtil.isNotEmpty(byId )) {
|
||||
if (!"1".equals(byId.getOrdItemStatus())) return ActionResult.fail("该产品已转生产订单不允许删除,请确认!");
|
||||
orderDetailService.removeById(id);
|
||||
return ActionResult.success(MsgCode.SU003.get());
|
||||
} else {
|
||||
return ActionResult.fail(MsgCode.FA003.get());
|
||||
return ActionResult.success("删除成功");
|
||||
}
|
||||
return ActionResult.success("该产品数据不存在,请刷新界面!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ import java.util.Date;
|
||||
@TableName("tso_order")
|
||||
public class ExampleOrderEntity {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private String id;
|
||||
private Long id;
|
||||
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||
private String creatorUserId;
|
||||
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||
@ -41,8 +41,8 @@ public class ExampleOrderEntity {
|
||||
private String custId;
|
||||
@TableField("cust_name")
|
||||
private String custName;
|
||||
@TableField("project_name")
|
||||
private String projectName;
|
||||
// @TableField("project_name")
|
||||
// private String projectName;
|
||||
@TableField("contact")
|
||||
private String contact;
|
||||
@TableField("con_phone")
|
||||
@ -79,7 +79,11 @@ public class ExampleOrderEntity {
|
||||
private String auditId;
|
||||
@TableField("audit_time")
|
||||
private Date auditTime;
|
||||
@TableField(value = "att_file", updateStrategy = FieldStrategy.IGNORED)
|
||||
@TableField("att_file")
|
||||
private String attFile;
|
||||
@TableField("pro_status")
|
||||
private String proStatus;
|
||||
@TableField("delivery_status")
|
||||
private String deliveryStatus;
|
||||
|
||||
}
|
||||
|
||||
@ -15,10 +15,10 @@ import java.util.Date;
|
||||
* @日期: 2024-02-04
|
||||
*/
|
||||
@Data
|
||||
@TableName("tso_order_detail")
|
||||
@TableName("tso_order_item")
|
||||
public class OrderDetailEntity {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private String id;
|
||||
private Long id;
|
||||
@TableField(value = "f_creator_user_id", fill = FieldFill.INSERT)
|
||||
private String creatorUserId;
|
||||
@TableField(value = "f_creator_time", fill = FieldFill.INSERT)
|
||||
@ -38,7 +38,7 @@ public class OrderDetailEntity {
|
||||
@TableField(value = "f_flow_task_id")
|
||||
private String flowTaskId;
|
||||
@TableField(value = "sale_ord_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String saleOrdId;
|
||||
private Long saleOrdId;
|
||||
@TableField(value = "material_id", updateStrategy = FieldStrategy.IGNORED)
|
||||
private Integer materialId;
|
||||
@TableField("material_code")
|
||||
@ -55,9 +55,14 @@ public class OrderDetailEntity {
|
||||
private BigDecimal priceTax;
|
||||
@TableField("material_use")
|
||||
private String materialUse;
|
||||
@TableField("delivered_qty")
|
||||
private BigDecimal deliveredQty;
|
||||
@TableField("deliveried_qty")
|
||||
private BigDecimal deliveriedQty;
|
||||
@TableField(value = "remark", updateStrategy = FieldStrategy.IGNORED)
|
||||
private String remark;
|
||||
|
||||
@TableField("produce_qty")
|
||||
private BigDecimal produceQty;
|
||||
@TableField("ord_item_status")
|
||||
private String ordItemStatus;
|
||||
@TableField(exist = false)
|
||||
private String unitName;
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jnpf.entity.OrderDetailEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -19,7 +18,7 @@ import java.util.List;
|
||||
* @日期: 2024-02-04
|
||||
*/
|
||||
@Data
|
||||
public class OrderForm {
|
||||
public class ExampleOrderForm {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
@ -94,7 +93,7 @@ public class OrderForm {
|
||||
private Date auditTime;
|
||||
|
||||
@Schema(description = "附件信息")
|
||||
private String attFile;
|
||||
private Object attFile;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private Date creatorTime;
|
||||
@ -125,4 +124,10 @@ public class OrderForm {
|
||||
@JsonProperty("orderDetailList")
|
||||
private List<OrderDetailEntity> orderDetailList;
|
||||
|
||||
|
||||
|
||||
@Schema(description = "发货状态")
|
||||
@JsonProperty("deliveryStatus")
|
||||
private String deliveryStatus;
|
||||
|
||||
}
|
||||
@ -4,8 +4,6 @@ import jnpf.base.Pagination;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 业务订单分页查询
|
||||
*
|
||||
@ -15,7 +13,7 @@ import java.util.Date;
|
||||
* @日期: 2024-02-04
|
||||
*/
|
||||
@Data
|
||||
public class OrderPagination extends Pagination {
|
||||
public class ExampleOrderPagination extends Pagination {
|
||||
/** 查询key */
|
||||
private String[] selectKey;
|
||||
/** json */
|
||||
@ -45,4 +43,6 @@ public class OrderPagination extends Pagination {
|
||||
private String saleManName;
|
||||
@Schema(description = "下单日期")
|
||||
private Object ordDate;
|
||||
@Schema(description = "订单类型")
|
||||
private String ordType;
|
||||
}
|
||||
@ -20,7 +20,7 @@ import java.util.Date;
|
||||
public class OrderDetailForm implements Serializable {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "销售订单主表ID")
|
||||
private Integer saleOrdId;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -15,18 +15,14 @@
|
||||
<el-input v-model="query.saleOrdNo" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
<el-form-item label="项目名称">
|
||||
<el-input v-model="query.projectName" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否急单">
|
||||
<JnpfSelect v-model="query.isUrgent" placeholder="请选择" clearable :options="isUrgentOptions"
|
||||
:props="isUrgentProps">
|
||||
<el-form-item label="订单类型">
|
||||
<JnpfSelect v-model="query.ordType" placeholder="请选择" clearable :options="ordTypeOptions"
|
||||
:props="ordTypeProps">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="订单状态">
|
||||
<JnpfSelect v-model="query.ordStatus" placeholder="请选择" clearable :options="ordStatusOptions"
|
||||
@ -34,9 +30,11 @@
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" >
|
||||
<el-form-item label="业务员">
|
||||
<el-input v-model="query.saleManName" placeholder="请输入" clearable> </el-input>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="是否急单">
|
||||
<JnpfSelect v-model="query.isUrgent" placeholder="请选择" clearable :options="isUrgentOptions"
|
||||
:props="isUrgentProps">
|
||||
</JnpfSelect>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6" >
|
||||
@ -50,57 +48,63 @@
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle()">新建
|
||||
<el-button type="primary" icon="icon-ym icon-ym-btn-add" @click="addOrUpdateHandle(null,'create')">新建
|
||||
</el-button>
|
||||
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()"
|
||||
v-has="'btn_download'">导出
|
||||
>导出
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="JNPF-common-head-right">
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list"
|
||||
:span-method="arraySpanMethod">
|
||||
<el-table-column prop="saleOrdNo" label="订单编码" align="center"/>
|
||||
<el-table-column prop="ordDate" label="下单日期" align="center" :formatter="jnpf.tableDateFormat1"/>
|
||||
<el-table-column prop="custName" label="客户名称" align="center"/>
|
||||
<el-table-column prop="projectName" label="项目名称" align="center"/>
|
||||
<el-table-column prop="ordType" label="订单类型" align="left">
|
||||
:span-method="arraySpanMethod" @selection-change="handleSelectionChange" :hasNOFixed="true" border>
|
||||
<el-table-column type="selection" width="50" align="center" fixed="left"/>
|
||||
<el-table-column prop="saleOrdNo" label="订单编码" align="center" fixed="left" width="100"/>
|
||||
<el-table-column prop="ordDate" label="下单日期" align="center" :formatter="jnpf.tableDateFormat1" fixed="left" width="90"/>
|
||||
<el-table-column prop="custName" label="客户名称" align="center" />
|
||||
<el-table-column prop="ordType" label="订单类型" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.ordType == 1 ? '常规' : scope.row.ordType == 2 ? '定制' : scope.row.ordType }}
|
||||
{{ scope.row.ordType == 1 ? '备库订单' : scope.row.ordType == 2 ? '销售订单' : scope.row.ordType }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="reqDeliveryDate" label="要求交货日期" align="center" :formatter="jnpf.tableDateFormat1"/>
|
||||
<el-table-column prop="isUrgent" label="是否急单" align="left">
|
||||
<el-table-column prop="reqDeliveryDate" label="要求交货日期" align="center" :formatter="jnpf.tableDateFormat1" width="100"/>
|
||||
<el-table-column prop="isUrgent" label="是否急单" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.isUrgent == 0 ? '是' : scope.row.isUrgent == 1 ? '否' : scope.row.isUrgent }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="contractNo" label="合同编号" align="center"/>
|
||||
<el-table-column prop="saleManName" label="业务人员" align="center"/>
|
||||
<el-table-column prop="isChange" label="是否变更" align="left">
|
||||
<el-table-column prop="isChange" label="是否变更" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.isChange == 0 ? '是' : scope.row.isChange == 1 ? '否' : scope.row.isChange }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="proStatus" label="生产状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.proStatus == 0 ? '正常' : scope.row.proStatus == 1 ? '部分转生产' : scope.row.proStatus == 2 ? "全部转生产":scope.row.proStatus}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="qualityReq" label="质量要求" align="center"/>
|
||||
<el-table-column prop="packReq" label="包装要求" align="center"/>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="170">
|
||||
<el-table-column prop="ordStatus" label="订单状态" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row)">编辑</el-button>
|
||||
<el-dropdown class="dropdown" placement="bottom">
|
||||
<el-button style="width:70px">
|
||||
更 多<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item @click.native="handleOrderChange(scope.row)">
|
||||
订单变更
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item @click.native="handleDetail(scope.row)">
|
||||
详情
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
{{ (ordStatusOptions.find(item => item.enCode == scope.row.ordStatus) || {}).fullName || scope.row.ordStatus }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="deliveryStatus" label="发货状态" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.deliveryStatus ==1 ? '未发货' : scope.row.deliveryStatus == 1 ? '部分发货' : scope.row.deliveryStatus == 2 ? "全部发货":scope.row.deliveryStatus}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="160" >
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row,'update')" v-if='scope.row.ordStatus=="1"||scope.row.ordStatus=="5"' >编辑</el-button>
|
||||
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)" v-if='scope.row.ordStatus=="1"||scope.row.ordStatus=="5"'>作废</el-button>
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row,'change')" v-if='scope.row.ordStatus=="2"' >订单变更</el-button>
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row,'detail')" v-if='scope.row.ordStatus!="3"' >详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</JNPF-table>
|
||||
@ -114,7 +118,6 @@
|
||||
<ImportBox v-if="uploadBoxVisible" ref="UploadBox" @refresh="initData" />
|
||||
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible = false" />
|
||||
<ToFormDetail v-if="toFormDetailVisible" ref="toFormDetail" @close="toFormDetailVisible = false" />
|
||||
<SuperQuery v-if="superQueryVisible" ref="SuperQuery" :columnOptions="superQueryJson" @superQuery="superQuery" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@ -139,7 +142,7 @@ import jnpf from "@/utils/jnpf";
|
||||
|
||||
|
||||
export default {
|
||||
name: "zpzj_new",
|
||||
name: "order",
|
||||
components: {
|
||||
JNPFForm,
|
||||
Detail,
|
||||
@ -160,7 +163,11 @@ export default {
|
||||
mergeList: [],
|
||||
exportList: [],
|
||||
columnList,
|
||||
|
||||
ordTypeOptions: [
|
||||
{ fullName: "备库订单", id: "1" },
|
||||
{ fullName: "销售订单", id: "2" },
|
||||
],
|
||||
ordTypeProps: { label: "fullName", value: "id" },
|
||||
superQueryVisible: false,
|
||||
superQueryJson,
|
||||
uploadBoxVisible: false,
|
||||
@ -260,17 +267,12 @@ export default {
|
||||
|
||||
|
||||
|
||||
handleSelectionChange() { },
|
||||
|
||||
|
||||
treeRefresh() {
|
||||
this.keyword = "";
|
||||
this.treeActiveId = "";
|
||||
this.leftTreeActiveInfo = {};
|
||||
this.$refs.treeBox.setCurrentKey(null);
|
||||
this.getTreeView();
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
|
||||
|
||||
|
||||
toDetail(defaultValue, modelId) {
|
||||
if (!defaultValue) return;
|
||||
getConfigData(modelId).then((res) => {
|
||||
@ -464,12 +466,12 @@ export default {
|
||||
});
|
||||
},
|
||||
handleDel(id) {
|
||||
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
||||
this.$confirm("此操作将作废该数据, 是否继续?", "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
request({
|
||||
url: `/api/example/QaProMaterialCheck/${id}`,
|
||||
url: `/api/example/exampleOrder/${id}`,
|
||||
method: "DELETE",
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
@ -483,28 +485,7 @@ export default {
|
||||
})
|
||||
.catch(() => { });
|
||||
},
|
||||
handelUpload() {
|
||||
this.uploadBoxVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.UploadBox.init(
|
||||
"",
|
||||
"example/QaFinalCheckData",
|
||||
0,
|
||||
this.flowList
|
||||
);
|
||||
});
|
||||
},
|
||||
openSuperQuery() {
|
||||
this.superQueryVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.SuperQuery.init();
|
||||
});
|
||||
},
|
||||
superQuery(queryJson) {
|
||||
this.listQuery.superQueryJson = queryJson;
|
||||
this.listQuery.currentPage = 1;
|
||||
this.initData();
|
||||
},
|
||||
|
||||
addOrUpdateHandle(row, isDetail) {
|
||||
let id = row ? row.id : "";
|
||||
this.formVisible = true;
|
||||
@ -520,16 +501,23 @@ export default {
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
exportData() {
|
||||
let temp = [
|
||||
{ label: "产品名称", prop: "productName" },
|
||||
{ label: "产品货号", prop: "productNumber" },
|
||||
{ label: "生产批号", prop: "productLot" },
|
||||
{ label: "检验人员", prop: "checkUserName" },
|
||||
{ label: "检验日期", prop: "checkDate" },
|
||||
{ label: "抽检数量(件)", prop: "sampleQty" },
|
||||
{ label: "检验结果", prop: "checkResult" },
|
||||
{ label: "备注", prop: "remark" },
|
||||
{ label: "订单编码", prop: "saleOrdNo" },
|
||||
{ label: "下单日期", prop: "ordDate" },
|
||||
{ label: "客户名称", prop: "custName" },
|
||||
{ label: "订单类型", prop: "ordType" },
|
||||
{ label: "要求交货日期", prop: "reqDeliveryDate" },
|
||||
{ label: "是否急单", prop: "isUrgent" },
|
||||
{ label: "合同编号", prop: "contractNo" },
|
||||
{ label: "业务人员", prop: "saleManName" },
|
||||
{ label: "是否变更", prop: "isChange" },
|
||||
{ label: "生产状态", prop: "proStatus" },
|
||||
{ label: "质量要求", prop: "qualityReq" },
|
||||
{ label: "包装要求", prop: "packReq" },
|
||||
{ label: "订单状态", prop: "ordStatus" },
|
||||
{ label: "发货状态", prop: "deliveryStatus" },
|
||||
];
|
||||
this.exportBoxVisible = true;
|
||||
this.$nextTick(() => {
|
||||
@ -544,7 +532,7 @@ export default {
|
||||
menuId: this.menuId,
|
||||
};
|
||||
request({
|
||||
url: `/api/example/QaFinalCheckData/Actions/Export`,
|
||||
url: `/api/example/exampleOrder/Actions/Export`,
|
||||
method: "post",
|
||||
data: query,
|
||||
}).then((res) => {
|
||||
@ -568,73 +556,9 @@ export default {
|
||||
this.query = JSON.parse(JSON.stringify(this.queryData));
|
||||
this.search();
|
||||
},
|
||||
colseFlow(isrRefresh) {
|
||||
this.flowVisible = false;
|
||||
if (isrRefresh) this.reset();
|
||||
},
|
||||
|
||||
//以下排序相关方法
|
||||
|
||||
handleHeaderClass({ column }) {
|
||||
column.order = column.multiOrder;
|
||||
},
|
||||
handleTableSort({ column }) {
|
||||
if (column.sortable !== "custom") return;
|
||||
column.multiOrder =
|
||||
column.multiOrder === "descending"
|
||||
? "ascending"
|
||||
: column.multiOrder
|
||||
? ""
|
||||
: "descending";
|
||||
this.handleOrderChange(column.property, column.multiOrder);
|
||||
},
|
||||
handleOrderChange(orderColumn, orderState) {
|
||||
let index = this.ordersList.findIndex((e) => e.field === orderColumn);
|
||||
let sort =
|
||||
orderState === "ascending"
|
||||
? "asc"
|
||||
: orderState === "descending"
|
||||
? "desc"
|
||||
: "";
|
||||
if (index > -1) {
|
||||
this.ordersList[index].sort = orderState;
|
||||
} else {
|
||||
this.ordersList.push({ field: orderColumn, sort });
|
||||
}
|
||||
this.ordersList = this.ordersList.filter((e) => e.sort);
|
||||
this.ordersList.length
|
||||
? this.setDefaultQuery(this.ordersList)
|
||||
: this.setDefaultQuery(this.defaultSortConfig);
|
||||
this.initData();
|
||||
},
|
||||
handleJY(row) {
|
||||
this.$set(this, 'currentRow', row || {})
|
||||
this.currentRow && this.$refs.jyxm.open(row);
|
||||
},
|
||||
handleSH(row) {
|
||||
this.$set(this, 'currentRow', row || {})
|
||||
this.currentRow && this.$refs.sh.open(row);
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.handleDel(row.id);
|
||||
},
|
||||
handleOrderChange(row) {
|
||||
if (!row || !row.id) {
|
||||
this.$message.warning('请选择订单')
|
||||
return
|
||||
}
|
||||
this.$message.info('订单变更功能开发中')
|
||||
},
|
||||
handleDetail(row) {
|
||||
if (!row || !row.id) {
|
||||
this.$message.warning('请选择订单')
|
||||
return
|
||||
}
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(row.id)
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@ -47,7 +47,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list" @sort-change="sortChange" :span-method="arraySpanMethod" border>
|
||||
<el-table-column prop="classGroup" label="班组" align="center"> </el-table-column>
|
||||
<el-table-column prop="classRate" label="班次" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.classRate == '1'">白</el-tag>
|
||||
@ -55,7 +54,7 @@
|
||||
<el-tag v-else-if="scope.row.classRate == '3'">夜</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="classGroup" label="班组" align="center"/>
|
||||
<el-table-column prop="bgnDtime" label="开始时间" align="center" :formatter="jnpf.tableDateFormat"/>
|
||||
<el-table-column prop="endDtime" label="结束时间" align="center" :formatter="jnpf.tableDateFormat"/>
|
||||
<el-table-column prop="shiftHour" label="小时数" align="center"> </el-table-column>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user