feat(example): 生产订单生成功能优化
This commit is contained in:
parent
1e8d69ec53
commit
cf5b0c3ca2
@ -1,6 +1,7 @@
|
|||||||
package jnpf.service;
|
package jnpf.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jnpf.model.order.ExampleOrderForm;
|
||||||
import jnpf.model.order.ProOrderEntity;
|
import jnpf.model.order.ProOrderEntity;
|
||||||
import jnpf.model.order.ProOrderPagination;
|
import jnpf.model.order.ProOrderPagination;
|
||||||
import jnpf.model.order.ProOrderVO;
|
import jnpf.model.order.ProOrderVO;
|
||||||
@ -32,4 +33,6 @@ public interface ProOrderService extends IService<ProOrderEntity> {
|
|||||||
* @return 生产订单信息
|
* @return 生产订单信息
|
||||||
*/
|
*/
|
||||||
ProOrderVO getInfoById(Integer id);
|
ProOrderVO getInfoById(Integer id);
|
||||||
|
|
||||||
|
void generate(ExampleOrderForm proOrderForm);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,4 +29,5 @@ public interface ProcService extends IService<ProcEntity> {
|
|||||||
String checkForm(ProcForm form, int i);
|
String checkForm(ProcForm form, int i);
|
||||||
void saveOrUpdate(ProcForm procForm, String id, boolean isSave) throws Exception;
|
void saveOrUpdate(ProcForm procForm, String id, boolean isSave) throws Exception;
|
||||||
|
|
||||||
|
ProcEntity getByProcCd(String s);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,4 +25,6 @@ public interface TechProcService extends IService<TechProcEntity> {
|
|||||||
String checkForm(TechProcForm form, int type);
|
String checkForm(TechProcForm form, int type);
|
||||||
|
|
||||||
void saveOrUpdate(TechProcForm techProcForm, String id, boolean isSave) throws Exception;
|
void saveOrUpdate(TechProcForm techProcForm, String id, boolean isSave) throws Exception;
|
||||||
|
|
||||||
|
List<TechProcEntity> getSelectList(String selectKey);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,13 +143,13 @@ public class ProLineServiceImpl extends ServiceImpl<ProLineMapper, ProLineEntity
|
|||||||
@Override
|
@Override
|
||||||
public List<ProLineEntity> getSelectList(String keyWord) {
|
public List<ProLineEntity> getSelectList(String keyWord) {
|
||||||
LambdaQueryWrapper<ProLineEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<ProLineEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(ProLineEntity::getDeleteMark, 0);
|
wrapper.eq(ProLineEntity::getDeleteMark, "0");
|
||||||
wrapper.eq(ProLineEntity::getEnabledStatus, 1);
|
wrapper.eq(ProLineEntity::getEnabledStatus, 1);
|
||||||
if (ObjectUtil.isNotEmpty(keyWord)) {
|
if (ObjectUtil.isNotEmpty(keyWord)) {
|
||||||
wrapper.like(ProLineEntity::getProLineName, keyWord).or()
|
wrapper.and(w -> w.like(ProLineEntity::getProLineName, keyWord)
|
||||||
.like(ProLineEntity::getProLineCd, keyWord);
|
.or()
|
||||||
|
.like(ProLineEntity::getProLineCd, keyWord));
|
||||||
}
|
}
|
||||||
wrapper.select(ProLineEntity::getId, ProLineEntity::getProLineName);
|
|
||||||
wrapper.orderByAsc(ProLineEntity::getProLineName);
|
wrapper.orderByAsc(ProLineEntity::getProLineName);
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,17 @@ package jnpf.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jnpf.entity.ExampleOrderEntity;
|
||||||
|
import jnpf.entity.OrderDetailEntity;
|
||||||
import jnpf.mapper.ProOrderMapper;
|
import jnpf.mapper.ProOrderMapper;
|
||||||
import jnpf.model.order.ProOrderEntity;
|
import jnpf.model.order.*;
|
||||||
import jnpf.model.order.ProOrderPagination;
|
import jnpf.model.orderdetail.OrderDetailForm;
|
||||||
import jnpf.model.order.ProOrderVO;
|
import jnpf.service.*;
|
||||||
import jnpf.service.ProOrderService;
|
import jnpf.util.GeneraterSwapUtil;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -23,8 +27,21 @@ import java.util.List;
|
|||||||
* @日期: 2024-04-17
|
* @日期: 2024-04-17
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class ProOrderServiceImpl extends ServiceImpl<ProOrderMapper, ProOrderEntity> implements ProOrderService {
|
public class ProOrderServiceImpl extends ServiceImpl<ProOrderMapper, ProOrderEntity> implements ProOrderService {
|
||||||
|
|
||||||
|
|
||||||
|
private final ProSoRelationService proSoRelationService;
|
||||||
|
|
||||||
|
private final ProOrderLineService proOrderLineService;
|
||||||
|
|
||||||
|
private final OrderDetailService orderDetailService;
|
||||||
|
|
||||||
|
private final ExampleOrderService orderService;
|
||||||
|
|
||||||
|
private final GeneraterSwapUtil generaterSwapUtil;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProOrderVO> getList(ProOrderPagination proOrderPagination) {
|
public List<ProOrderVO> getList(ProOrderPagination proOrderPagination) {
|
||||||
QueryWrapper<ProOrderEntity> query = new QueryWrapper<>();
|
QueryWrapper<ProOrderEntity> query = new QueryWrapper<>();
|
||||||
@ -83,4 +100,65 @@ public class ProOrderServiceImpl extends ServiceImpl<ProOrderMapper, ProOrderEnt
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void generate(ExampleOrderForm orderForm) {
|
||||||
|
ProOrderEntity proOrder = JsonUtil.getJsonToBean(orderForm, ProOrderEntity.class);
|
||||||
|
|
||||||
|
String orderNo = generaterSwapUtil.getBillNumber("scdd", false);
|
||||||
|
proOrder.setProNo(orderNo);
|
||||||
|
proOrder.setProDate(orderForm.getOrdDate());
|
||||||
|
proOrder.setPlanBgDate(orderForm.getPlanBgDate());
|
||||||
|
proOrder.setPlanEndDate(orderForm.getPlanEndDate());
|
||||||
|
proOrder.setPlanQty(orderForm.getPlanQty());
|
||||||
|
proOrder.setMaterialCode(orderForm.getMaterialCode());
|
||||||
|
proOrder.setMaterialName(orderForm.getMaterialName());
|
||||||
|
// proOrder.setMaterialId(Integer.valueOf(orderForm.getMaterialId()));
|
||||||
|
proOrder.setSpec(orderForm.getSpec());
|
||||||
|
proOrder.setUnit(orderForm.getUnit());
|
||||||
|
proOrder.setProcessFlow(orderForm.getProcessFlow());
|
||||||
|
proOrder.setPlanStatus("0");
|
||||||
|
proOrder.setIsAllLine(orderForm.getIsAllLine());
|
||||||
|
|
||||||
|
|
||||||
|
this.save(proOrder);
|
||||||
|
List<OrderDetailForm> orderItems = orderForm.getOrderItems();
|
||||||
|
for (OrderDetailForm orderItem : orderItems) {
|
||||||
|
OrderDetailEntity detailEntity = orderDetailService.getById(orderItem.getItemId());
|
||||||
|
ExampleOrderEntity orderEntity = orderService.getById(detailEntity.getSaleOrdId());
|
||||||
|
if (detailEntity != null) {
|
||||||
|
ProSoRelationEntity proSoRelationEntity = new ProSoRelationEntity();
|
||||||
|
proSoRelationEntity.setProId(proOrder.getId());
|
||||||
|
proSoRelationEntity.setProNo(proOrder.getProNo());
|
||||||
|
proSoRelationEntity.setSaleOrdId(detailEntity.getSaleOrdId());
|
||||||
|
proSoRelationEntity.setSaleOrdNo(orderEntity.getSaleOrdNo());
|
||||||
|
proSoRelationEntity.setChangProQty(orderItem.getPlanQty());
|
||||||
|
proSoRelationEntity.setProNo(proOrder.getProNo());
|
||||||
|
proSoRelationEntity.setCustId(Long.valueOf(orderEntity.getCustId()));
|
||||||
|
proSoRelationEntity.setCustName(orderEntity.getCustName());
|
||||||
|
proSoRelationEntity.setMaterialName(detailEntity.getMaterialName());
|
||||||
|
proSoRelationEntity.setMaterialCode(detailEntity.getMaterialCode());
|
||||||
|
proSoRelationEntity.setSpec(detailEntity.getSpec());
|
||||||
|
proSoRelationEntity.setUnit(detailEntity.getUnit());
|
||||||
|
proSoRelationEntity.setMaterialId(detailEntity.getMaterialId());
|
||||||
|
proSoRelationService.save(proSoRelationEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<OrderLineForm> proLines = orderForm.getProLines();
|
||||||
|
for (OrderLineForm proLine : proLines) {
|
||||||
|
ProOrderLineEntity lineEntity = JsonUtil.getJsonToBean(proLine, ProOrderLineEntity.class);
|
||||||
|
lineEntity.setProId(proOrder.getId());
|
||||||
|
lineEntity.setProNo(proOrder.getProNo());
|
||||||
|
lineEntity.setRemark(proLine.getRemark());
|
||||||
|
lineEntity.setProBgDate(proLine.getPlanStartDate());
|
||||||
|
lineEntity.setProEndDate(proLine.getPlanEndDate());
|
||||||
|
// lineEntity.setLineId(Integer.valueOf(proLine.getLineId()));
|
||||||
|
lineEntity.setLineCd(proLine.getLineCode());
|
||||||
|
lineEntity.setLineName(proLine.getLineName());
|
||||||
|
lineEntity.setPlanQty(proLine.getAllocateQty());
|
||||||
|
proOrderLineService.save(lineEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,4 +139,10 @@ public class ProcServiceImpl extends ServiceImpl<ProcMapper, ProcEntity> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProcEntity getByProcCd(String s) {
|
||||||
|
LambdaQueryWrapper<ProcEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(ProcEntity::getProcCd, s);
|
||||||
|
return this.getOne(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,4 +136,16 @@ public class TechProcServiceImpl extends ServiceImpl<TechProcMapper, TechProcEnt
|
|||||||
// 通过注入的 self 调用,确保事务生效
|
// 通过注入的 self 调用,确保事务生效
|
||||||
self.saveOrUpdate(entity);
|
self.saveOrUpdate(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TechProcEntity> getSelectList(String selectKey) {
|
||||||
|
LambdaQueryWrapper<TechProcEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(TechProcEntity::getDeleteMark, 0);
|
||||||
|
wrapper.eq(TechProcEntity::getEnabledStatus, 1);
|
||||||
|
if (StringUtil.isNotEmpty(selectKey)) {
|
||||||
|
wrapper.and(w -> w.like(TechProcEntity::getTechProc, selectKey));
|
||||||
|
}
|
||||||
|
wrapper.orderByDesc(TechProcEntity::getId);
|
||||||
|
return this.list(wrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,10 +10,7 @@ import jnpf.base.ActionResult;
|
|||||||
import jnpf.base.vo.PageListVO;
|
import jnpf.base.vo.PageListVO;
|
||||||
import jnpf.base.vo.PaginationVO;
|
import jnpf.base.vo.PaginationVO;
|
||||||
import jnpf.constant.MsgCode;
|
import jnpf.constant.MsgCode;
|
||||||
import jnpf.model.order.ProOrderEntity;
|
import jnpf.model.order.*;
|
||||||
import jnpf.model.order.ProOrderForm;
|
|
||||||
import jnpf.model.order.ProOrderPagination;
|
|
||||||
import jnpf.model.order.ProOrderVO;
|
|
||||||
import jnpf.service.ProOrderService;
|
import jnpf.service.ProOrderService;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -74,13 +71,12 @@ public class ProOrderController {
|
|||||||
* @param proOrderForm 实体模型
|
* @param proOrderForm 实体模型
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "新建生产订单")
|
@Operation(summary = "生成生产订单")
|
||||||
@SaCheckPermission("example.proOrder")
|
@SaCheckPermission("example.proOrder")
|
||||||
@Parameter(name = "proOrderForm", description = "实体模型", required = true)
|
@Parameter(name = "proOrderForm", description = "实体模型", required = true)
|
||||||
@PostMapping()
|
@PostMapping("/generate")
|
||||||
public ActionResult<ProOrderForm> create(@RequestBody ProOrderForm proOrderForm) {
|
public ActionResult<ProOrderForm> generate(@RequestBody ExampleOrderForm proOrderForm) {
|
||||||
ProOrderEntity entity = JsonUtil.getJsonToBean(proOrderForm, ProOrderEntity.class);
|
proOrderService.generate(proOrderForm);
|
||||||
proOrderService.save(entity);
|
|
||||||
return ActionResult.success(MsgCode.SU001.get());
|
return ActionResult.success(MsgCode.SU001.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,11 +5,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import jnpf.base.ActionResult;
|
import jnpf.base.ActionResult;
|
||||||
import jnpf.base.vo.PageListVO;
|
import jnpf.base.vo.PageListVO;
|
||||||
import jnpf.base.vo.PaginationVO;
|
import jnpf.base.vo.PaginationVO;
|
||||||
|
import jnpf.model.proc.ProcEntity;
|
||||||
import jnpf.model.techproc.TechProcEntity;
|
import jnpf.model.techproc.TechProcEntity;
|
||||||
import jnpf.model.techproc.TechProcForm;
|
import jnpf.model.techproc.TechProcForm;
|
||||||
import jnpf.model.techproc.TechProcPagination;
|
import jnpf.model.techproc.TechProcPagination;
|
||||||
import jnpf.permission.entity.UserEntity;
|
import jnpf.permission.entity.UserEntity;
|
||||||
import jnpf.permission.service.UserService;
|
import jnpf.permission.service.UserService;
|
||||||
|
import jnpf.service.ProcService;
|
||||||
import jnpf.service.TechProcService;
|
import jnpf.service.TechProcService;
|
||||||
import jnpf.util.JsonUtil;
|
import jnpf.util.JsonUtil;
|
||||||
import jnpf.util.StringUtil;
|
import jnpf.util.StringUtil;
|
||||||
@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -35,8 +38,12 @@ public class TechProcController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProcService procService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
|
*
|
||||||
* @param techProcPagination 分页查询对象
|
* @param techProcPagination 分页查询对象
|
||||||
* @return 列表结果集
|
* @return 列表结果集
|
||||||
*/
|
*/
|
||||||
@ -65,6 +72,7 @@ public class TechProcController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 详情
|
||||||
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
* @return 详情结果集
|
* @return 详情结果集
|
||||||
*/
|
*/
|
||||||
@ -80,6 +88,7 @@ public class TechProcController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建
|
* 新建
|
||||||
|
*
|
||||||
* @param techProcForm 表单对象
|
* @param techProcForm 表单对象
|
||||||
* @return 新建结果
|
* @return 新建结果
|
||||||
*/
|
*/
|
||||||
@ -100,6 +109,7 @@ public class TechProcController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
* @param techProcForm 表单对象
|
* @param techProcForm 表单对象
|
||||||
* @return 编辑结果
|
* @return 编辑结果
|
||||||
@ -124,4 +134,37 @@ public class TechProcController {
|
|||||||
return ActionResult.fail("更新失败,数据不存在");
|
return ActionResult.fail("更新失败,数据不存在");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 工艺流程下拉框,支持查询
|
||||||
|
@Operation(summary = "获取工艺流程下拉框")
|
||||||
|
@GetMapping("/getSelect")
|
||||||
|
public ActionResult getSelect(@RequestParam(value = "selectKey", required = false) String selectKey) {
|
||||||
|
List<TechProcEntity> list = techProcService.getSelectList(selectKey);
|
||||||
|
for (TechProcEntity techProcEntity : list) {
|
||||||
|
String name = "";
|
||||||
|
String[] split = techProcEntity.getTechProc().split("-");
|
||||||
|
for (String s : split) {
|
||||||
|
ProcEntity procEntity = procService.getByProcCd(s);
|
||||||
|
if (procEntity != null) {
|
||||||
|
name += procEntity.getProcName() + "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtil.isNotEmpty(name)) {
|
||||||
|
techProcEntity.setTechProcName(name.substring(0, name.length() - 1));
|
||||||
|
} else {
|
||||||
|
techProcEntity.setTechProcName("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<Map<String, Object>> result = list.stream()
|
||||||
|
.map(entity -> {
|
||||||
|
Map<String, Object> map = new HashMap<>(3);
|
||||||
|
map.put("id", entity.getId());
|
||||||
|
map.put("code", entity.getTechProc());
|
||||||
|
map.put("name", entity.getTechProcName());
|
||||||
|
return map;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return ActionResult.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package jnpf.model.order;
|
|||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jnpf.entity.OrderDetailEntity;
|
import jnpf.entity.OrderDetailEntity;
|
||||||
|
import jnpf.model.orderdetail.OrderDetailForm;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -130,4 +131,30 @@ public class ExampleOrderForm {
|
|||||||
@JsonProperty("deliveryStatus")
|
@JsonProperty("deliveryStatus")
|
||||||
private String deliveryStatus;
|
private String deliveryStatus;
|
||||||
|
|
||||||
|
|
||||||
|
private Date planBgDate;
|
||||||
|
|
||||||
|
private Date planEndDate;
|
||||||
|
|
||||||
|
private BigDecimal planQty;
|
||||||
|
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
private String materialCode;
|
||||||
|
|
||||||
|
private String materialId;
|
||||||
|
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
private String processFlow;
|
||||||
|
|
||||||
|
private String isAllLine;
|
||||||
|
|
||||||
|
|
||||||
|
private List<OrderDetailForm> orderItems;
|
||||||
|
|
||||||
|
private List<OrderLineForm> proLines;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,47 @@
|
|||||||
|
package jnpf.model.order;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产订单产线信息 Form
|
||||||
|
*
|
||||||
|
* @版本: V3.5
|
||||||
|
* @版权: 引迈信息技术有限公司(https://www.jnpfsoft.com)
|
||||||
|
* @作者: JNPF开发平台组
|
||||||
|
* @日期: 2024-04-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "OrderLineForm对象", name = "生产订单产线信息表单对象")
|
||||||
|
public class OrderLineForm implements Serializable {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "产线编码")
|
||||||
|
private String lineCode;
|
||||||
|
|
||||||
|
@Schema(description = "产线名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
|
@Schema(description = "计划开始日期")
|
||||||
|
private Date planStartDate;
|
||||||
|
|
||||||
|
@Schema(description = "计划结束日期")
|
||||||
|
private Date planEndDate;
|
||||||
|
|
||||||
|
@Schema(description = "分配数量")
|
||||||
|
private BigDecimal allocateQty;
|
||||||
|
|
||||||
|
@Schema(description = "完成数量")
|
||||||
|
private BigDecimal completedQty;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private String lineId;
|
||||||
|
}
|
||||||
@ -58,7 +58,7 @@ public class ProSoRelationEntity {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@TableField("sale_ord_id")
|
@TableField("sale_ord_id")
|
||||||
private Integer saleOrdId;
|
private Long saleOrdId;
|
||||||
|
|
||||||
@TableField("sale_ord_no")
|
@TableField("sale_ord_no")
|
||||||
private String saleOrdNo;
|
private String saleOrdNo;
|
||||||
@ -67,7 +67,7 @@ public class ProSoRelationEntity {
|
|||||||
private BigDecimal changProQty;
|
private BigDecimal changProQty;
|
||||||
|
|
||||||
@TableField("cust_id")
|
@TableField("cust_id")
|
||||||
private Integer custId;
|
private Long custId;
|
||||||
|
|
||||||
@TableField("cust_name")
|
@TableField("cust_name")
|
||||||
private String custName;
|
private String custName;
|
||||||
|
|||||||
@ -82,4 +82,8 @@ public class OrderDetailForm implements Serializable {
|
|||||||
@Schema(description = "流程任务ID")
|
@Schema(description = "流程任务ID")
|
||||||
private String flowTaskId;
|
private String flowTaskId;
|
||||||
|
|
||||||
|
private String itemId;
|
||||||
|
|
||||||
|
private BigDecimal planQty;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import lombok.Data;
|
|||||||
public class TechProcPagination extends Pagination {
|
public class TechProcPagination extends Pagination {
|
||||||
|
|
||||||
@Schema(description = "selectKey")
|
@Schema(description = "selectKey")
|
||||||
private String[] selectKey;
|
private String selectKey;
|
||||||
|
|
||||||
@Schema(description = "json")
|
@Schema(description = "json")
|
||||||
private String json;
|
private String json;
|
||||||
|
|||||||
@ -84,7 +84,7 @@ export default {
|
|||||||
data: {
|
data: {
|
||||||
currentPage: this.page.currentPage,
|
currentPage: this.page.currentPage,
|
||||||
pageSize: this.page.pageSize,
|
pageSize: this.page.pageSize,
|
||||||
selectKey: this.search.selectKey,
|
// selectKey: this.search.selectKey,
|
||||||
dataType: 0,
|
dataType: 0,
|
||||||
enabledStatus: 1
|
enabledStatus: 1
|
||||||
}
|
}
|
||||||
@ -147,6 +147,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectedData = this.selectedLines.map(line => ({
|
const selectedData = this.selectedLines.map(line => ({
|
||||||
|
lineId: line.id || line.lineId || '',
|
||||||
lineCode: line.proLineCd,
|
lineCode: line.proLineCd,
|
||||||
lineName: line.proLineName,
|
lineName: line.proLineName,
|
||||||
remark: line.remark || ""
|
remark: line.remark || ""
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :title="!dataForm.id ? '新建供应商' : '编辑供应商'" :visible.sync="visible"
|
<el-dialog :title="!dataForm.id ? '新建供应商' : '编辑供应商'" :visible.sync="visible" @close="handleClose"
|
||||||
:close-on-click-modal="false" width="1200px" class="JNPF-dialog JNPF-dialog_center long-title"
|
:close-on-click-modal="false" width="1200px" class="JNPF-dialog JNPF-dialog_center long-title"
|
||||||
lock-scroll>
|
lock-scroll>
|
||||||
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
<el-form ref="formRef" :model="dataForm" :rules="dataRule" size="small" label-width="100px" label-position="right">
|
||||||
@ -199,6 +199,7 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
this.resetDataForm(); // 新增时重置表单
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -21,8 +21,8 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="订单日期" prop="orderDate">
|
<el-form-item label="订单日期" prop="proDate">
|
||||||
<el-date-picker v-model="baseForm.orderDate" type="date" placeholder="选择日期" />
|
<el-date-picker v-model="baseForm.proDate" type="date" placeholder="选择日期" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
@ -58,23 +58,52 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="开始日期" prop="startDate">
|
<el-form-item label="开始日期" prop="planBgDate">
|
||||||
<el-date-picker v-model="baseForm.startDate" type="date" placeholder="选择日期" />
|
<el-date-picker
|
||||||
|
v-model="baseForm.planBgDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
:picker-options="{ disabledDate: (time) => {
|
||||||
|
if (this.baseForm.planEndDate) {
|
||||||
|
return time.getTime() > new Date(this.baseForm.planEndDate).getTime();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}}"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="结束日期" prop="endDate">
|
<el-form-item label="结束日期" prop="planEndDate">
|
||||||
<el-date-picker v-model="baseForm.endDate" type="date" placeholder="选择日期" />
|
<el-date-picker
|
||||||
|
v-model="baseForm.planEndDate"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
:picker-options="{ disabledDate: (time) => {
|
||||||
|
if (this.baseForm.planBgDate) {
|
||||||
|
return time.getTime() < new Date(this.baseForm.planBgDate).getTime();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}}"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="工艺流程" prop="processFlow">
|
<el-form-item label="工艺流程" prop="processFlow">
|
||||||
<el-select v-model="baseForm.processFlow" placeholder="请选择">
|
<el-select
|
||||||
<el-option label="流程A" value="A" />
|
v-model="baseForm.processFlow"
|
||||||
<el-option label="流程B" value="B" />
|
filterable
|
||||||
<el-option label="流程C" value="C" />
|
:remote-method="searchProcessFlow"
|
||||||
|
:loading="processFlowLoading"
|
||||||
|
placeholder="请选择"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in processFlowList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -87,9 +116,8 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<label class="checkbox-label">
|
<el-checkbox v-model="baseForm.isAllLine" @change="handleisAllLineChange" />
|
||||||
<el-checkbox v-model="baseForm.allLines" /> 所有产线
|
<span style="margin-left: 5px;">所有产线</span>
|
||||||
</label>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@ -223,23 +251,24 @@ export default {
|
|||||||
lineModalVisible: false,
|
lineModalVisible: false,
|
||||||
baseForm: {
|
baseForm: {
|
||||||
orderNo: "",
|
orderNo: "",
|
||||||
orderDate: new Date(),
|
proDate: new Date(),
|
||||||
orderStatus: "0",
|
orderStatus: "0",
|
||||||
materialName: "",
|
materialName: "",
|
||||||
spec: "",
|
spec: "",
|
||||||
unit: "",
|
unit: "",
|
||||||
unitText: "",
|
|
||||||
planQty: null,
|
planQty: null,
|
||||||
startDate: "",
|
planEndDate: "",
|
||||||
endDate: "",
|
planBgDate: "",
|
||||||
processFlow: "",
|
processFlow: "",
|
||||||
remark: "",
|
remark: "",
|
||||||
allLines: false
|
isAllLine: false
|
||||||
},
|
},
|
||||||
orderList: [],
|
orderList: [],
|
||||||
lineList: [],
|
lineList: [],
|
||||||
orderLoading: false,
|
orderLoading: false,
|
||||||
selectedLineCodes: []
|
selectedLineCodes: [],
|
||||||
|
processFlowList: [],
|
||||||
|
processFlowLoading: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -249,8 +278,25 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initData();
|
this.initData();
|
||||||
|
this.loadProcessFlowList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
loadProcessFlowList() {
|
||||||
|
this.processFlowLoading = true;
|
||||||
|
request({
|
||||||
|
url: "/api/example/techproc/getSelect",
|
||||||
|
method: "get",
|
||||||
|
data: {}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.processFlowList = res.data || [];
|
||||||
|
this.allProcessFlowList = res.data || [];
|
||||||
|
}
|
||||||
|
this.processFlowLoading = false;
|
||||||
|
}).catch(() => {
|
||||||
|
this.processFlowLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
initData() {
|
initData() {
|
||||||
const dataStr = this.$route.query.data;
|
const dataStr = this.$route.query.data;
|
||||||
if (dataStr) {
|
if (dataStr) {
|
||||||
@ -277,7 +323,7 @@ export default {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.orderList = res.data.list || [];
|
this.orderList = res.data.list || [];
|
||||||
this.orderList.forEach((item, index) => {
|
this.orderList.forEach((item, index) => {
|
||||||
this.$set(this.orderList[index], 'planQty', null);
|
this.$set(this.orderList[index], 'planQty', item.remainingQty || 0);
|
||||||
});
|
});
|
||||||
this.calculateTotalQty();
|
this.calculateTotalQty();
|
||||||
if (this.orderList.length > 0) {
|
if (this.orderList.length > 0) {
|
||||||
@ -292,8 +338,18 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
searchProcessFlow(keyword) {
|
||||||
|
if (!keyword) {
|
||||||
|
this.processFlowList = this.allProcessFlowList;
|
||||||
|
} else {
|
||||||
|
this.processFlowList = this.allProcessFlowList.filter(item =>
|
||||||
|
item.name && item.name.toLowerCase().includes(keyword.toLowerCase())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
calculateTotalQty() {
|
calculateTotalQty() {
|
||||||
const total = this.orderList.reduce((sum, item) => (item.remainingQty || 0), 0);
|
const total = this.orderList.reduce((sum, item) => sum + (item.planQty || 0), 0);
|
||||||
this.baseForm.planQty = total;
|
this.baseForm.planQty = total;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -333,14 +389,20 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addLine() {
|
addLine() {
|
||||||
|
this.baseForm.isAllLine = "0";
|
||||||
this.lineModalVisible = true;
|
this.lineModalVisible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleisAllLineChange(val) {
|
||||||
|
this.baseForm.isAllLine = val ? "1" : "0";
|
||||||
|
},
|
||||||
|
|
||||||
handleProLineConfirm(selectedLines) {
|
handleProLineConfirm(selectedLines) {
|
||||||
selectedLines.forEach(line => {
|
selectedLines.forEach(line => {
|
||||||
const exists = this.lineList.some(item => item.lineCode === line.lineCode);
|
const exists = this.lineList.some(item => item.lineCode === line.lineCode);
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
this.lineList.push({
|
this.lineList.push({
|
||||||
|
id: line.id,
|
||||||
lineCode: line.lineCode,
|
lineCode: line.lineCode,
|
||||||
lineName: line.lineName,
|
lineName: line.lineName,
|
||||||
allocateQty: null,
|
allocateQty: null,
|
||||||
@ -366,10 +428,11 @@ export default {
|
|||||||
|
|
||||||
save() {
|
save() {
|
||||||
if (!this.validateProLine()) return;
|
if (!this.validateProLine()) return;
|
||||||
if (!this.validatePlanQty()) return;
|
if (!this.validateOrderPlanQty()) return;
|
||||||
const submitData = this.prepareSubmitData();
|
const submitData = this.prepareSubmitData();
|
||||||
|
submitData.orderStatus = "0";
|
||||||
request({
|
request({
|
||||||
url: "/api/example/tsoOrder/save",
|
url: "/api/example/proOrder/generate",
|
||||||
method: "post",
|
method: "post",
|
||||||
data: submitData
|
data: submitData
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@ -382,11 +445,12 @@ export default {
|
|||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
if (!this.validateProLine()) return;
|
if (!this.validateProLine()) return;
|
||||||
if (!this.validatePlanQty()) return;
|
if (!this.validateOrderPlanQty()) return;
|
||||||
|
if (!this.validateAllocateQty()) return;
|
||||||
const submitData = this.prepareSubmitData();
|
const submitData = this.prepareSubmitData();
|
||||||
submitData.orderStatus = "1";
|
submitData.orderStatus = "1";
|
||||||
request({
|
request({
|
||||||
url: "/api/example/tsoOrder/submit",
|
url: "/api/example/proOrder/generate",
|
||||||
method: "post",
|
method: "post",
|
||||||
data: submitData
|
data: submitData
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
@ -405,7 +469,7 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
validatePlanQty() {
|
validateOrderPlanQty() {
|
||||||
for (let item of this.orderList) {
|
for (let item of this.orderList) {
|
||||||
if (!item.planQty || item.planQty <= 0) {
|
if (!item.planQty || item.planQty <= 0) {
|
||||||
this.$message.error("转生成数量不能为空且必须大于0");
|
this.$message.error("转生成数量不能为空且必须大于0");
|
||||||
@ -416,7 +480,10 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
validateAllocateQty() {
|
||||||
const totalPlanQty = this.orderList.reduce((sum, item) => sum + Number(item.planQty || 0), 0);
|
const totalPlanQty = this.orderList.reduce((sum, item) => sum + Number(item.planQty || 0), 0);
|
||||||
const totalAllocateQty = this.lineList.reduce((sum, item) => sum + Number(item.allocateQty || 0), 0);
|
const totalAllocateQty = this.lineList.reduce((sum, item) => sum + Number(item.allocateQty || 0), 0);
|
||||||
|
|
||||||
@ -425,22 +492,46 @@ export default {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (let item of this.lineList) {
|
||||||
|
if (!item.allocateQty || item.allocateQty <= 0) {
|
||||||
|
this.$message.error("产线分配数量不能为空且必须大于0");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
prepareSubmitData() {
|
prepareSubmitData() {
|
||||||
const orderItems = this.orderList.map(item => ({
|
const orderItems = this.orderList.map(item => ({
|
||||||
itemId: item.itemId,
|
itemId: item.itemId,
|
||||||
saleOrdNo: item.saleOrdNo,
|
planQty: item.planQty
|
||||||
planQty: item.planQty,
|
}));
|
||||||
materialName: item.materialName,
|
|
||||||
spec: item.spec,
|
const firstItem = this.orderList[0] || {};
|
||||||
unit: item.unit
|
|
||||||
|
const proLines = this.lineList.map(item => ({
|
||||||
|
lineId: item.id || item.lineId || '',
|
||||||
|
lineCode: item.lineCode || '',
|
||||||
|
lineName: item.lineName || '',
|
||||||
|
allocateQty: item.allocateQty || 0,
|
||||||
|
planStartDate: item.planStartDate || '',
|
||||||
|
planEndDate: item.planEndDate || '',
|
||||||
|
remark: item.remark || ''
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...this.baseForm,
|
...this.baseForm,
|
||||||
orderItems: orderItems
|
planBgDate: this.baseForm.startDate,
|
||||||
|
planEndDate: this.baseForm.endDate,
|
||||||
|
processFlow: this.baseForm.processFlow,
|
||||||
|
materialName: firstItem.materialName || '',
|
||||||
|
materialCode: firstItem.materialCode || '',
|
||||||
|
spec: firstItem.spec || '',
|
||||||
|
unit: firstItem.unit || '',
|
||||||
|
materialId: firstItem.materialId || firstItem.id || '',
|
||||||
|
orderItems: orderItems,
|
||||||
|
proLines: proLines
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user