Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d4d14c987e
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import jnpf.entity.OrderDetailEntity;
|
import jnpf.entity.OrderDetailEntity;
|
||||||
import jnpf.model.order.OrderItemWithOrderPagination;
|
import jnpf.model.order.OrderItemWithOrderPagination;
|
||||||
import jnpf.model.order.OrderItemWithOrderVO;
|
import jnpf.model.order.OrderItemWithOrderVO;
|
||||||
|
import jnpf.model.orderdetail.OrderDetailForm;
|
||||||
import jnpf.model.orderdetail.OrderDetailPagination;
|
import jnpf.model.orderdetail.OrderDetailPagination;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -39,4 +40,6 @@ public interface OrderDetailService extends IService<OrderDetailEntity> {
|
|||||||
|
|
||||||
List<OrderItemWithOrderVO> getOrderItemWithOrderByIds(List<String> orderIds);
|
List<OrderItemWithOrderVO> getOrderItemWithOrderByIds(List<String> orderIds);
|
||||||
|
|
||||||
|
String close(OrderDetailForm proOrderForm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,4 +35,7 @@ public interface ProOrderService extends IService<ProOrderEntity> {
|
|||||||
ProOrderVO getInfoById(Integer id);
|
ProOrderVO getInfoById(Integer id);
|
||||||
|
|
||||||
void generate(ExampleOrderForm proOrderForm);
|
void generate(ExampleOrderForm proOrderForm);
|
||||||
|
|
||||||
|
String generateCheck(ExampleOrderForm proOrderForm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import jnpf.entity.OrderDetailEntity;
|
|||||||
import jnpf.mapper.OrderDetailMapper;
|
import jnpf.mapper.OrderDetailMapper;
|
||||||
import jnpf.model.order.OrderItemWithOrderPagination;
|
import jnpf.model.order.OrderItemWithOrderPagination;
|
||||||
import jnpf.model.order.OrderItemWithOrderVO;
|
import jnpf.model.order.OrderItemWithOrderVO;
|
||||||
|
import jnpf.model.orderdetail.OrderDetailForm;
|
||||||
import jnpf.model.orderdetail.OrderDetailPagination;
|
import jnpf.model.orderdetail.OrderDetailPagination;
|
||||||
import jnpf.service.OrderDetailService;
|
import jnpf.service.OrderDetailService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -49,4 +50,18 @@ public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, Order
|
|||||||
public List<OrderItemWithOrderVO> getOrderItemWithOrderByIds(List<String> orderIds) {
|
public List<OrderItemWithOrderVO> getOrderItemWithOrderByIds(List<String> orderIds) {
|
||||||
return this.baseMapper.getOrderItemWithOrderByIds(orderIds);
|
return this.baseMapper.getOrderItemWithOrderByIds(orderIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String close(OrderDetailForm proOrderForm) {
|
||||||
|
OrderDetailEntity detailEntity = this.getById(proOrderForm.getId());
|
||||||
|
if (detailEntity == null) {
|
||||||
|
return "该订单产品信息不存在,请刷新数据!";
|
||||||
|
}
|
||||||
|
if ("9".equals(detailEntity.getOrdItemStatus())) {
|
||||||
|
return "该订单产品信息已关闭,请刷新数据!";
|
||||||
|
}
|
||||||
|
detailEntity.setOrdItemStatus("9");
|
||||||
|
this.updateById(detailEntity);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -108,22 +108,27 @@ public class ProOrderServiceImpl extends ServiceImpl<ProOrderMapper, ProOrderEnt
|
|||||||
|
|
||||||
String orderNo = generaterSwapUtil.getBillNumber("scdd", false);
|
String orderNo = generaterSwapUtil.getBillNumber("scdd", false);
|
||||||
proOrder.setProNo(orderNo);
|
proOrder.setProNo(orderNo);
|
||||||
proOrder.setProDate(orderForm.getOrdDate());
|
proOrder.setProDate(orderForm.getProDate());
|
||||||
proOrder.setPlanBgDate(orderForm.getPlanBgDate());
|
proOrder.setPlanBgDate(orderForm.getPlanBgDate());
|
||||||
proOrder.setPlanEndDate(orderForm.getPlanEndDate());
|
proOrder.setPlanEndDate(orderForm.getPlanEndDate());
|
||||||
proOrder.setPlanQty(orderForm.getPlanQty());
|
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.setProcessFlow(orderForm.getProcessFlow());
|
||||||
proOrder.setPlanStatus("0");
|
proOrder.setPlanStatus("0");
|
||||||
proOrder.setIsAllLine(orderForm.getIsAllLine());
|
proOrder.setIsAllLine(orderForm.getIsAllLine());
|
||||||
|
// 物料信息从订单明细中获取
|
||||||
|
List<OrderDetailForm> orderItems = orderForm.getOrderItems();
|
||||||
|
OrderDetailForm orderDetailForm = orderItems.stream().findFirst().get();
|
||||||
|
if (orderDetailForm != null) {
|
||||||
|
OrderDetailEntity itemEntity = orderDetailService.getById(orderDetailForm.getItemId());
|
||||||
|
proOrder.setMaterialId(itemEntity.getMaterialId());
|
||||||
|
proOrder.setMaterialCode(itemEntity.getMaterialCode());
|
||||||
|
proOrder.setMaterialName(itemEntity.getMaterialName());
|
||||||
|
proOrder.setSpec(itemEntity.getSpec());
|
||||||
|
proOrder.setUnit(itemEntity.getUnit());
|
||||||
|
}
|
||||||
|
|
||||||
this.save(proOrder);
|
this.save(proOrder);
|
||||||
List<OrderDetailForm> orderItems = orderForm.getOrderItems();
|
|
||||||
for (OrderDetailForm orderItem : orderItems) {
|
for (OrderDetailForm orderItem : orderItems) {
|
||||||
OrderDetailEntity detailEntity = orderDetailService.getById(orderItem.getItemId());
|
OrderDetailEntity detailEntity = orderDetailService.getById(orderItem.getItemId());
|
||||||
ExampleOrderEntity orderEntity = orderService.getById(detailEntity.getSaleOrdId());
|
ExampleOrderEntity orderEntity = orderService.getById(detailEntity.getSaleOrdId());
|
||||||
@ -161,4 +166,27 @@ public class ProOrderServiceImpl extends ServiceImpl<ProOrderMapper, ProOrderEnt
|
|||||||
proOrderLineService.save(lineEntity);
|
proOrderLineService.save(lineEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String generateCheck(ExampleOrderForm proOrderForm) {
|
||||||
|
// 校验订单状态
|
||||||
|
List<OrderDetailForm> orderItems = proOrderForm.getOrderItems();
|
||||||
|
for (OrderDetailForm orderItem : orderItems) {
|
||||||
|
OrderDetailEntity detailEntity = orderDetailService.getById(orderItem.getItemId());
|
||||||
|
if (detailEntity == null) {
|
||||||
|
return "选择订单不存在,请刷新页面!";
|
||||||
|
}
|
||||||
|
ExampleOrderEntity orderEntity = orderService.getById(detailEntity.getSaleOrdId());
|
||||||
|
if (orderEntity == null) {
|
||||||
|
return "选择订单不存在,请刷新页面!";
|
||||||
|
}
|
||||||
|
if (!"3".equals(orderEntity.getOrdStatus())) {
|
||||||
|
return "选择订单(" + orderEntity.getSaleOrdNo() + " )非审批状态,请刷新界面";
|
||||||
|
}
|
||||||
|
if ("2".equals(detailEntity.getOrdItemStatus()) || "9".equals(detailEntity.getOrdItemStatus())) {
|
||||||
|
return "选择订单(" + orderEntity.getSaleOrdNo() + " )已关闭或全部转产,请刷新界面";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@ 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.*;
|
import jnpf.model.order.*;
|
||||||
|
import jnpf.model.orderdetail.OrderDetailForm;
|
||||||
|
import jnpf.service.OrderDetailService;
|
||||||
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;
|
||||||
@ -34,6 +36,10 @@ public class ProOrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProOrderService proOrderService;
|
private ProOrderService proOrderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrderDetailService orderDetailService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*
|
*
|
||||||
@ -71,7 +77,7 @@ 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("/generate")
|
@PostMapping("/generate")
|
||||||
@ -80,6 +86,32 @@ public class ProOrderController {
|
|||||||
return ActionResult.success(MsgCode.SU001.get());
|
return ActionResult.success(MsgCode.SU001.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "生成生产订单")
|
||||||
|
@SaCheckPermission("example.proOrder")
|
||||||
|
@Parameter(name = "proOrderForm", description = "实体模型", required = true)
|
||||||
|
@PostMapping("/generateCheck")
|
||||||
|
public ActionResult<ProOrderForm> generateCheck(@RequestBody ExampleOrderForm proOrderForm) {
|
||||||
|
String message = proOrderService.generateCheck(proOrderForm);
|
||||||
|
if (ObjectUtil.isNotEmpty(message)) {
|
||||||
|
return ActionResult.fail(message);
|
||||||
|
}
|
||||||
|
return ActionResult.success(MsgCode.SU001.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭订单
|
||||||
|
@Operation(summary = "关闭生产订单")
|
||||||
|
@SaCheckPermission("example.proOrder")
|
||||||
|
@Parameter(name = "proOrderForm", description = "实体模型", required = true)
|
||||||
|
@PostMapping("/close")
|
||||||
|
public ActionResult<ProOrderForm> close(@RequestBody OrderDetailForm proOrderForm) {
|
||||||
|
String message = orderDetailService.close(proOrderForm);
|
||||||
|
if (ObjectUtil.isNotEmpty(message)) {
|
||||||
|
return ActionResult.fail(message);
|
||||||
|
}
|
||||||
|
return ActionResult.success(MsgCode.SU001.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改
|
* 修改
|
||||||
*
|
*
|
||||||
|
|||||||
@ -138,21 +138,12 @@ public class ExampleOrderForm {
|
|||||||
|
|
||||||
private BigDecimal planQty;
|
private BigDecimal planQty;
|
||||||
|
|
||||||
private String materialName;
|
private Date proDate;
|
||||||
|
|
||||||
private String materialCode;
|
|
||||||
|
|
||||||
private String materialId;
|
|
||||||
|
|
||||||
private String spec;
|
|
||||||
|
|
||||||
private String unit;
|
|
||||||
|
|
||||||
private String processFlow;
|
private String processFlow;
|
||||||
|
|
||||||
private String isAllLine;
|
private String isAllLine;
|
||||||
|
|
||||||
|
|
||||||
private List<OrderDetailForm> orderItems;
|
private List<OrderDetailForm> orderItems;
|
||||||
|
|
||||||
private List<OrderLineForm> proLines;
|
private List<OrderLineForm> proLines;
|
||||||
|
|||||||
@ -7,10 +7,9 @@
|
|||||||
<el-button @click="resetProLine">重置</el-button>
|
<el-button @click="resetProLine">重置</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<JNPF-table
|
||||||
ref="proLineTable"
|
ref="proLineTable"
|
||||||
:data="proLineList"
|
:data="proLineList"
|
||||||
border
|
|
||||||
:height="300"
|
:height="300"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
@ -18,24 +17,19 @@
|
|||||||
<el-table-column prop="proLineCd" label="产线编码" align="center" />
|
<el-table-column prop="proLineCd" label="产线编码" align="center" />
|
||||||
<el-table-column prop="proLineName" label="产线名称" align="center" />
|
<el-table-column prop="proLineName" label="产线名称" align="center" />
|
||||||
<el-table-column prop="remark" label="备注" align="center" />
|
<el-table-column prop="remark" label="备注" align="center" />
|
||||||
</el-table>
|
</JNPF-table>
|
||||||
|
|
||||||
<div class="pagination-container">
|
<pagination
|
||||||
<el-pagination
|
:total="page.total"
|
||||||
@size-change="handleSizeChange"
|
:page.sync="page.currentPage"
|
||||||
@current-change="handleCurrentChange"
|
:limit.sync="page.pageSize"
|
||||||
:current-page="page.currentPage"
|
@pagination="loadProLineList"
|
||||||
:page-sizes="[10, 20, 50]"
|
/>
|
||||||
:page-size="page.pageSize"
|
|
||||||
:total="page.total"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template slot="footer" class="dialog-footer">
|
<template slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="confirmSelection">确 认</el-button>
|
<el-button type="primary" @click="confirmSelection">确 认</el-button>
|
||||||
<el-button @click="visible = false">取 消</el-button>
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -126,15 +120,7 @@ export default {
|
|||||||
this.loadProLineList();
|
this.loadProLineList();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSizeChange(val) {
|
|
||||||
this.page.pageSize = val;
|
|
||||||
this.loadProLineList();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleCurrentChange(val) {
|
|
||||||
this.page.currentPage = val;
|
|
||||||
this.loadProLineList();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleSelectionChange(val) {
|
handleSelectionChange(val) {
|
||||||
this.selectedLines = val;
|
this.selectedLines = val;
|
||||||
@ -148,14 +134,19 @@ export default {
|
|||||||
|
|
||||||
const selectedData = this.selectedLines.map(line => ({
|
const selectedData = this.selectedLines.map(line => ({
|
||||||
lineId: line.id || line.lineId || '',
|
lineId: line.id || line.lineId || '',
|
||||||
lineCode: line.proLineCd,
|
lineCode: line.lineCode || line.proLineCd || '',
|
||||||
lineName: line.proLineName,
|
lineName: line.lineName || line.proLineName || '',
|
||||||
remark: line.remark || ""
|
remark: line.remark || ""
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.$emit("confirm", selectedData);
|
this.$emit("confirm", selectedData);
|
||||||
this.$emit("update:visible", false);
|
this.$emit("update:visible", false);
|
||||||
this.selectedLines = [];
|
this.selectedLines = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClose() {
|
||||||
|
this.$emit("update:visible", false);
|
||||||
|
this.selectedLines = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -177,11 +168,7 @@ export default {
|
|||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pagination-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dialog-footer {
|
.dialog-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="generate-order-container">
|
<div class="generate-order-container">
|
||||||
<div class="page-header">
|
<!-- <div class="page-header">
|
||||||
<el-button @click="goBack" class="back-btn">
|
<el-button @click="goBack" class="back-btn">
|
||||||
<i class="el-icon-arrow-left"></i> 返回
|
<i class="el-icon-arrow-left"></i> 返回
|
||||||
</el-button>
|
</el-button>
|
||||||
<h2 class="page-title">生成订单</h2>
|
<h2 class="page-title">生成订单</h2>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="section">
|
<div class="section">
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<span class="section-title">基础信息</span>
|
<span class="section-title">基础信息</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-body">
|
<div class="section-body">
|
||||||
<el-form :model="baseForm" label-width="120px" class="base-form">
|
<el-form ref="formRef" :model="baseForm" :rules="dataRule" label-width="120px" class="base-form">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="8">
|
<el-col :span="8">
|
||||||
<el-form-item label="订单编号" prop="orderNo">
|
<el-form-item label="订单编号" prop="orderNo">
|
||||||
@ -116,7 +116,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-checkbox v-model="baseForm.isAllLine" @change="handleisAllLineChange" />
|
<el-checkbox v-model="baseForm.isAllLine" true-label="0" false-label="1" />
|
||||||
<span style="margin-left: 5px;">所有产线</span>
|
<span style="margin-left: 5px;">所有产线</span>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -182,13 +182,21 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="section-body">
|
<div class="section-body">
|
||||||
|
<div v-if="!allocateQtyMatch && lineList.length > 0" style="color: #e6a23c; margin-bottom: 10px; font-size: 14px;">
|
||||||
|
<i class="el-icon-warning"></i> 产线分配数量不等于计划数量,请确认!
|
||||||
|
</div>
|
||||||
<el-table :data="lineList" border :height="200">
|
<el-table :data="lineList" border :height="200">
|
||||||
<el-table-column prop="index" label="序号" align="center" type="index" />
|
<el-table-column prop="index" label="序号" align="center" type="index" />
|
||||||
<el-table-column prop="lineCode" label="产线编码" align="center" />
|
<el-table-column prop="lineCode" label="产线编码" align="center" />
|
||||||
<el-table-column prop="lineName" label="产线名称" align="center" />
|
<el-table-column prop="lineName" label="产线名称" align="center" />
|
||||||
<el-table-column prop="allocateQty" label="分配数量(件)" align="center">
|
<el-table-column prop="allocateQty" label="分配数量(*)" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model.number="scope.row.allocateQty" placeholder="分配数量" />
|
<el-input
|
||||||
|
v-model="scope.row.allocateQty"
|
||||||
|
placeholder="分配数量"
|
||||||
|
style="width: 120px;"
|
||||||
|
@input="handleAllocateQtyInput(scope.row)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="completedQty" label="已完成数量" align="center">
|
<el-table-column prop="completedQty" label="已完成数量" align="center">
|
||||||
@ -251,7 +259,7 @@ export default {
|
|||||||
lineModalVisible: false,
|
lineModalVisible: false,
|
||||||
baseForm: {
|
baseForm: {
|
||||||
orderNo: "",
|
orderNo: "",
|
||||||
proDate: new Date(),
|
proDate: "",
|
||||||
orderStatus: "0",
|
orderStatus: "0",
|
||||||
materialName: "",
|
materialName: "",
|
||||||
spec: "",
|
spec: "",
|
||||||
@ -261,14 +269,39 @@ export default {
|
|||||||
planBgDate: "",
|
planBgDate: "",
|
||||||
processFlow: "",
|
processFlow: "",
|
||||||
remark: "",
|
remark: "",
|
||||||
isAllLine: false
|
isAllLine: "1"
|
||||||
},
|
},
|
||||||
orderList: [],
|
orderList: [],
|
||||||
lineList: [],
|
lineList: [],
|
||||||
orderLoading: false,
|
orderLoading: false,
|
||||||
selectedLineCodes: [],
|
selectedLineCodes: [],
|
||||||
processFlowList: [],
|
processFlowList: [],
|
||||||
processFlowLoading: false
|
processFlowLoading: false,
|
||||||
|
allocateQtyMatch: true,
|
||||||
|
dataRule: {
|
||||||
|
proDate: [
|
||||||
|
{required: true, message: "请选择订单日期", trigger: "change"}
|
||||||
|
],
|
||||||
|
orderStatus: [
|
||||||
|
{required: true, message: "请选择订单状态", trigger: "change"}
|
||||||
|
],
|
||||||
|
materialName: [
|
||||||
|
{required: true, message: "请输入产品名称", trigger: "blur"}
|
||||||
|
],
|
||||||
|
spec: [
|
||||||
|
{required: true, message: "请输入规格型号", trigger: "blur"}
|
||||||
|
],
|
||||||
|
|
||||||
|
planBgDate: [
|
||||||
|
{required: true, message: "请选择开始日期", trigger: "change"}
|
||||||
|
],
|
||||||
|
planEndDate: [
|
||||||
|
{required: true, message: "请选择结束日期", trigger: "change"}
|
||||||
|
],
|
||||||
|
processFlow: [
|
||||||
|
{required: true, message: "请选择工艺流程", trigger: "change"}
|
||||||
|
]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -356,7 +389,7 @@ export default {
|
|||||||
handlePlanQtyInput(row) {
|
handlePlanQtyInput(row) {
|
||||||
if (row.planQty > row.remainingQty) {
|
if (row.planQty > row.remainingQty) {
|
||||||
row.planQty = row.remainingQty;
|
row.planQty = row.remainingQty;
|
||||||
this.$message.warning('转生产订单数量大于生产数量,请确认!');
|
this.$message.warning('转生产订单数量大于剩余数量,请确认!');
|
||||||
}
|
}
|
||||||
if (row.planQty < 0) {
|
if (row.planQty < 0) {
|
||||||
row.planQty = 0;
|
row.planQty = 0;
|
||||||
@ -370,6 +403,35 @@ export default {
|
|||||||
this.baseForm.planQty = total;
|
this.baseForm.planQty = total;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleAllocateQtyInput(row) {
|
||||||
|
let value = row.allocateQty;
|
||||||
|
if (!value) return;
|
||||||
|
value = value.toString().replace(/[^\d.]/g, '');
|
||||||
|
value = value.replace(/\.{2,}/g, '.');
|
||||||
|
value = value.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.');
|
||||||
|
const parts = value.split('.');
|
||||||
|
if (parts.length > 2) {
|
||||||
|
value = parts[0] + '.' + parts[1].slice(0, 2);
|
||||||
|
} else if (parts.length === 2 && parts[1].length > 2) {
|
||||||
|
value = parts[0] + '.' + parts[1].slice(0, 2);
|
||||||
|
}
|
||||||
|
if (value.startsWith('.')) {
|
||||||
|
value = '0' + value;
|
||||||
|
}
|
||||||
|
row.allocateQty = value;
|
||||||
|
this.checkAllocateQtyTotal();
|
||||||
|
},
|
||||||
|
|
||||||
|
checkAllocateQtyTotal() {
|
||||||
|
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);
|
||||||
|
if (totalPlanQty !== totalAllocateQty && totalAllocateQty > 0) {
|
||||||
|
this.allocateQtyMatch = false;
|
||||||
|
} else {
|
||||||
|
this.allocateQtyMatch = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getProStatusText(status) {
|
getProStatusText(status) {
|
||||||
const map = { '0': '正常', '1': '部分转生产', '2': '全部转生产' };
|
const map = { '0': '正常', '1': '部分转生产', '2': '全部转生产' };
|
||||||
return map[status] || status;
|
return map[status] || status;
|
||||||
@ -389,12 +451,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addLine() {
|
addLine() {
|
||||||
this.baseForm.isAllLine = "0";
|
this.baseForm.isAllLine = "1";
|
||||||
this.lineModalVisible = true;
|
this.lineModalVisible = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleisAllLineChange(val) {
|
handleisAllLineChange(val) {
|
||||||
this.baseForm.isAllLine = val ? "1" : "0";
|
this.baseForm.isAllLine = val ? "0" : "1";
|
||||||
|
this.lineList = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
handleProLineConfirm(selectedLines) {
|
handleProLineConfirm(selectedLines) {
|
||||||
@ -402,14 +465,14 @@ export default {
|
|||||||
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,
|
id: line.lineId,
|
||||||
lineCode: line.lineCode,
|
lineCode: line.lineCode,
|
||||||
lineName: line.lineName,
|
lineName: line.lineName,
|
||||||
allocateQty: null,
|
allocateQty: null,
|
||||||
completedQty: null,
|
completedQty: null,
|
||||||
planStartDate: "",
|
planStartDate: "",
|
||||||
planEndDate: "",
|
planEndDate: "",
|
||||||
remark: ""
|
remark: line.remark || ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -427,35 +490,70 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
if (!this.validateProLine()) return;
|
this.$refs.formRef.validate((valid) => {
|
||||||
if (!this.validateOrderPlanQty()) return;
|
if (valid) {
|
||||||
const submitData = this.prepareSubmitData();
|
if (!this.validateOrderPlanQty()) return;
|
||||||
submitData.orderStatus = "0";
|
if (this.baseForm.isAllLine !== "0" && (!this.lineList || this.lineList.length === 0)) {
|
||||||
request({
|
this.$message.warning("请选择产线信息!");
|
||||||
url: "/api/example/proOrder/generate",
|
return;
|
||||||
method: "post",
|
}
|
||||||
data: submitData
|
if (this.baseForm.isAllLine !== "0" && this.lineList.length > 0 && !this.validateAllocateQty()) return;
|
||||||
}).then(res => {
|
const submitData = this.prepareSubmitData();
|
||||||
if (res.code === 200) {
|
submitData.orderStatus = "0";
|
||||||
this.$message.success("保存成功");
|
this.generateCheck(submitData).then(() => {
|
||||||
this.goBack();
|
this.doGenerate(submitData);
|
||||||
|
}).catch(() => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
if (!this.validateProLine()) return;
|
if (this.baseForm.isAllLine !== "0" && (!this.lineList || this.lineList.length === 0)) {
|
||||||
if (!this.validateOrderPlanQty()) return;
|
this.$message.warning("生产订单下发必须指定产线,请确认!");
|
||||||
if (!this.validateAllocateQty()) return;
|
return;
|
||||||
const submitData = this.prepareSubmitData();
|
}
|
||||||
submitData.orderStatus = "1";
|
},
|
||||||
|
|
||||||
|
generateCheck(submitData) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
request({
|
||||||
|
url: "/api/example/proOrder/generateCheck",
|
||||||
|
method: "post",
|
||||||
|
data: submitData
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: "warning",
|
||||||
|
message: res.msg || "检查失败!",
|
||||||
|
});
|
||||||
|
reject(res.msg);
|
||||||
|
}
|
||||||
|
}).catch(err => {
|
||||||
|
this.$message({
|
||||||
|
type: "error",
|
||||||
|
message: "检查接口调用失败!",
|
||||||
|
});
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
doGenerate(submitData) {
|
||||||
request({
|
request({
|
||||||
url: "/api/example/proOrder/generate",
|
url: "/api/example/proOrder/generate",
|
||||||
method: "post",
|
method: "post",
|
||||||
data: submitData
|
data: submitData
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message.success("下发成功");
|
const message = submitData.orderStatus === "0" ? "保存成功!" : "下发成功!";
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: message,
|
||||||
|
});
|
||||||
this.goBack();
|
this.goBack();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -484,21 +582,42 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
validateAllocateQty() {
|
validateAllocateQty() {
|
||||||
const totalPlanQty = this.orderList.reduce((sum, item) => sum + Number(item.planQty || 0), 0);
|
if (this.lineList.length === 0) {
|
||||||
const totalAllocateQty = this.lineList.reduce((sum, item) => sum + Number(item.allocateQty || 0), 0);
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (totalPlanQty !== totalAllocateQty) {
|
let hasValidAllocateQty = false;
|
||||||
this.$message.warning("产线分配数量不等于计划数量,请确认!");
|
for (let item of this.lineList) {
|
||||||
|
const allocateQty = Number(item.allocateQty);
|
||||||
|
if (!isNaN(allocateQty) && allocateQty > 0) {
|
||||||
|
hasValidAllocateQty = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasValidAllocateQty) {
|
||||||
|
this.$message.error("至少需要有一条产线设置有效的分配数量");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let item of this.lineList) {
|
for (let item of this.lineList) {
|
||||||
if (!item.allocateQty || item.allocateQty <= 0) {
|
const allocateQty = Number(item.allocateQty);
|
||||||
this.$message.error("产线分配数量不能为空且必须大于0");
|
if (!isNaN(allocateQty) && allocateQty > 0) {
|
||||||
|
continue;
|
||||||
|
} else if (item.allocateQty !== null && item.allocateQty !== undefined && item.allocateQty !== '') {
|
||||||
|
this.$message.error("产线分配数量必须大于0");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
if (Math.abs(totalPlanQty - totalAllocateQty) > 0.0001) {
|
||||||
|
this.$message.warning("产线分配数量不等于计划数量,请确认!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -522,14 +641,10 @@ export default {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...this.baseForm,
|
...this.baseForm,
|
||||||
planBgDate: this.baseForm.startDate,
|
planBgDate: this.baseForm.planBgDate,
|
||||||
planEndDate: this.baseForm.endDate,
|
planEndDate: this.baseForm.planEndDate,
|
||||||
processFlow: this.baseForm.processFlow,
|
processFlow: this.baseForm.processFlow,
|
||||||
materialName: firstItem.materialName || '',
|
proDate: this.baseForm.proDate ? new Date(this.baseForm.proDate).toISOString() : '',
|
||||||
materialCode: firstItem.materialCode || '',
|
|
||||||
spec: firstItem.spec || '',
|
|
||||||
unit: firstItem.unit || '',
|
|
||||||
materialId: firstItem.materialId || firstItem.id || '',
|
|
||||||
orderItems: orderItems,
|
orderItems: orderItems,
|
||||||
proLines: proLines
|
proLines: proLines
|
||||||
};
|
};
|
||||||
@ -568,6 +683,7 @@ export default {
|
|||||||
.main-content {
|
.main-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
|
padding-bottom: 80px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,6 +716,12 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.base-form ::v-deep .el-input,
|
||||||
|
.base-form ::v-deep .el-select,
|
||||||
|
.base-form ::v-deep .el-date-picker {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.checkbox-label {
|
.checkbox-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -607,12 +729,17 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.page-footer {
|
.page-footer {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
padding: 16px 24px;
|
padding: 16px 24px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
|
||||||
|
z-index: 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-footer el-button {
|
.page-footer el-button {
|
||||||
|
|||||||
@ -125,7 +125,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<!-- <el-button type="text" @click="handleDetail(scope.row)">详情</el-button> -->
|
<el-button type="text" @click="handleClose(scope.row)">关 闭</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</JNPF-table>
|
</JNPF-table>
|
||||||
@ -264,7 +264,7 @@ export default {
|
|||||||
generateOrder() {
|
generateOrder() {
|
||||||
const selectedRows = this.selectedRows;
|
const selectedRows = this.selectedRows;
|
||||||
if (!selectedRows || selectedRows.length === 0) {
|
if (!selectedRows || selectedRows.length === 0) {
|
||||||
this.$message.warning("请选择要生成订单的记录");
|
this.$message.warning("请选择需要转生产的销售订单信息,请确认!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,12 +272,12 @@ export default {
|
|||||||
const specs = [...new Set(selectedRows.map(row => row.spec))];
|
const specs = [...new Set(selectedRows.map(row => row.spec))];
|
||||||
|
|
||||||
if (materialNames.length > 1) {
|
if (materialNames.length > 1) {
|
||||||
this.$message.error("只能选择同一产品名称的记录生成订单");
|
this.$message.error("必须选择产品名称和规格型号一致的产品,请确认!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (specs.length > 1) {
|
if (specs.length > 1) {
|
||||||
this.$message.error("只能选择同一规格型号的记录生成订单");
|
this.$message.error("必须选择产品名称和规格型号一致的产品,请确认!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,6 +305,36 @@ export default {
|
|||||||
getLabel(type, value) {
|
getLabel(type, value) {
|
||||||
return getLabel(type, value);
|
return getLabel(type, value);
|
||||||
},
|
},
|
||||||
|
handleClose(row) {
|
||||||
|
this.$confirm('确定要关闭该订单吗?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return request({
|
||||||
|
url: "/api/example/proOrder/close",
|
||||||
|
method: "post",
|
||||||
|
data: { id: row.itemId }
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: res.msg || "关闭成功!",
|
||||||
|
});
|
||||||
|
this.initData();
|
||||||
|
} else {
|
||||||
|
this.$message({
|
||||||
|
type: "warning",
|
||||||
|
message: res.msg || "操作失败!",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user