销售订单绑定采购订单和采购订单绑定销售订单,合并后的不能绑定,虚拟的也不能绑定
master
xs 4 weeks ago
parent 830e7c4698
commit e66705b1a4

@ -219,6 +219,8 @@ public class MesConstants {
* *
*/ */
public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购 public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购
public static final String MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE = "3";//采购完成
public static final String MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE = "4";//自动出库完成 public static final String MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE = "4";//自动出库完成
/** /**

@ -16,6 +16,7 @@ import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils; import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesOrderBind; import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.mapper.*; import com.hw.mes.mapper.*;
import com.hw.wms.api.RemoteWmsService; import com.hw.wms.api.RemoteWmsService;
@ -46,7 +47,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Autowired @Autowired
private MesSaleOrderMapper mesSaleOrderMapper; private MesSaleOrderRelateMapper mesSaleOrderRelateMapper;
@Autowired @Autowired
private MesOrderBindMapper mesOrderBindMapper; private MesOrderBindMapper mesOrderBindMapper;
@ -161,7 +162,27 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
throw new ServiceException("此物料为常备物料,不需要绑定"); throw new ServiceException("此物料为常备物料,不需要绑定");
} }
Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId(); Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId();
MesPurchaseOrder dbPurchaseOrder = mesPurchaseOrderMapper.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId);
if (dbPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE)) {
throw new ServiceException("此采购订单已经采购完成,无需再绑定");
}
if (dbPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE)) {
throw new ServiceException("此采购订单已经自动出库完成,无需再绑定");
}
//校验此采购订单有没有合并过
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setPurchaseOrderId(purchaseOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelates = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelate);
if (mesSaleOrderRelates != null && !mesSaleOrderRelates.isEmpty()) {
throw new ServiceException("此采购订单已经合并过,不能绑定");
}
MesOrderBind queryOrderBind = new MesOrderBind(); MesOrderBind queryOrderBind = new MesOrderBind();
queryOrderBind.setPurchaseOrderId(purchaseOrderId); queryOrderBind.setPurchaseOrderId(purchaseOrderId);
List<MesOrderBind> dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind); List<MesOrderBind> dbMesOrderBinds = mesOrderBindMapper.selectMesOrderBindList(queryOrderBind);
@ -217,11 +238,20 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
if (StringUtils.isEmpty(orderBind.getSafeFlag())) { if (StringUtils.isEmpty(orderBind.getSafeFlag())) {
throw new ServiceException("请全部选择安全标识"); throw new ServiceException("请全部选择安全标识");
} }
if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO) if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO)) {
&& orderBind.getSaleOrderId() == null) { if (orderBind.getSaleOrderId() == null) {
throw new ServiceException("安全库存标识为否的请选择销售订单"); throw new ServiceException("安全库存标识为否的请选择销售订单");
} }
//校验选择的销售订单有没有合并过
MesSaleOrderRelate querySaleOrderRelateBySale = new MesSaleOrderRelate();
querySaleOrderRelateBySale.setRelateSaleOrderId(orderBind.getSaleOrderId());
List<MesSaleOrderRelate> mesSaleOrderRelatesBySale = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateBySale);
if (mesSaleOrderRelatesBySale != null && !mesSaleOrderRelatesBySale.isEmpty()) {
throw new ServiceException("选择的销售订单已经合并过,不能绑定");
}
}
if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES) if (orderBind.getSafeFlag().equals(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES)
&& orderBind.getSaleOrderId() != null) { && orderBind.getSaleOrderId() != null) {
throw new ServiceException("安全库存标识为是的不需要选择销售订单"); throw new ServiceException("安全库存标识为是的不需要选择销售订单");
@ -301,6 +331,15 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
@Override @Override
@Transactional(rollbackFor = ServiceException.class) @Transactional(rollbackFor = ServiceException.class)
public int saveSalesBindPurchase(MesSaleOrder mesSaleOrder) { public int saveSalesBindPurchase(MesSaleOrder mesSaleOrder) {
Long saleOrderId = mesSaleOrder.getSaleOrderId();
MesSaleOrderRelate querySaleOrderRelateBySale = new MesSaleOrderRelate();
querySaleOrderRelateBySale.setRelateSaleOrderId(saleOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelatesBySale = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateBySale);
if (mesSaleOrderRelatesBySale != null && !mesSaleOrderRelatesBySale.isEmpty()) {
throw new ServiceException("此销售订单已经合并过,不能再绑定");
}
Date currentDate = new Date(); Date currentDate = new Date();
String userName = SecurityUtils.getUsername(); String userName = SecurityUtils.getUsername();
List<MesPurchaseOrder> mesPurchaseOrderList = mesSaleOrder.getMesPurchaseOrderList(); List<MesPurchaseOrder> mesPurchaseOrderList = mesSaleOrder.getMesPurchaseOrderList();
@ -312,6 +351,22 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
throw new ServiceException("数据有变化,请重新更新"); throw new ServiceException("数据有变化,请重新更新");
} }
if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_PURCHASE_COMPLETE)) {
throw new ServiceException("此采购订单已经采购完成,无需再绑定");
}
if (dbMesPurchaseOrder.getOrderStatus().equals(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE)) {
throw new ServiceException("此采购订单已经自动出库完成,无需再绑定");
}
MesSaleOrderRelate querySaleOrderRelateByPurchase = new MesSaleOrderRelate();
querySaleOrderRelateByPurchase.setPurchaseOrderId(purchaseOrderId);
List<MesSaleOrderRelate> mesSaleOrderRelatesByPurchase = mesSaleOrderRelateMapper.selectMesSaleOrderRelateList(querySaleOrderRelateByPurchase);
if (mesSaleOrderRelatesByPurchase != null && !mesSaleOrderRelatesByPurchase.isEmpty()) {
throw new ServiceException("序号: " + mesPurchaseOrder.getSerialNumber() + ",采购订单已经合并过,不能再绑定");
}
this.checkSaveSalesBindPurchase(mesPurchaseOrder); this.checkSaveSalesBindPurchase(mesPurchaseOrder);
this.updateOrderBind(mesSaleOrder, mesPurchaseOrder, userName, currentDate); this.updateOrderBind(mesSaleOrder, mesPurchaseOrder, userName, currentDate);
@ -477,7 +532,7 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
} }
} }
if (!autoStockPurchaseOrderList.isEmpty()) { if (!autoStockPurchaseOrderList.isEmpty()) {
for(MesPurchaseOrder mpo : autoStockPurchaseOrderList){ for (MesPurchaseOrder mpo : autoStockPurchaseOrderList) {
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(mpo.getMaterialId()); MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(mpo.getMaterialId());
mpo.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE); mpo.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE);

@ -308,6 +308,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mpo.po_no, mpo.po_no,
mpo.document_status, mpo.document_status,
mpo.material_id, mpo.material_id,
mpo.order_status,
mbmi.material_code, mbmi.material_code,
mbmi.material_name, mbmi.material_name,
mbmi.material_spec, mbmi.material_spec,

@ -253,7 +253,8 @@
mso.end_date, mso.end_date,
mso.complete_date, mso.complete_date,
mso.sale_order_classfication mso.sale_order_classfication
from mes_sale_order mso left join mes_base_material_info mbmi on (mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2') from mes_sale_order mso left join mes_base_material_info mbmi on
(mso.material_id = mbmi.erp_id and mso.sale_order_classfication='1') or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2')
<where> <where>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode}, <if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode},
'%')</if> '%')</if>

@ -88,6 +88,7 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="purchaseOrderList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="purchaseOrderList" @selection-change="handleSelectionChange">
<el-table-column label="采购订单ID" align="center" prop="purchaseOrderId"/>
<el-table-column label="采购订单编号" align="center" prop="poNo"/> <el-table-column label="采购订单编号" align="center" prop="poNo"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/> <el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/> <el-table-column label="物料名称" align="center" prop="materialName"/>
@ -145,7 +146,7 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['mes:purchaseOrder:bind']" v-hasPermi="['mes:purchaseOrder:bind']"
v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO" v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO && (scope.row.orderStatus === ORDER_STATUS.TO_PURCHASE || scope.row.orderStatus === ORDER_STATUS.PURCHASEING)"
>绑定 >绑定
</el-button> </el-button>
</template> </template>
@ -294,7 +295,12 @@ export default {
ALWAYS_FLAG: { ALWAYS_FLAG: {
YES: "1", YES: "1",
NO: "0" NO: "0"
},
ORDER_STATUS: {
TO_PURCHASE: "1",//
PURCHASEING: "2"//
} }
}; };
}, },
created() { created() {

@ -103,6 +103,7 @@ export default {
documentStatus: null, documentStatus: null,
factoryId: null, factoryId: null,
prodlineId: null, prodlineId: null,
saleOrderClassfication:'1',
materialId: null, materialId: null,
materialCode: null, materialCode: null,
materialName: null, materialName: null,

@ -192,6 +192,7 @@
:row-style="getRowStyle"> :row-style="getRowStyle">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="serialNumber"/> <el-table-column label="序号" align="center" prop="serialNumber"/>
<el-table-column label="订单ID" align="center" prop="purchaseOrderId"/>
<el-table-column label="订单编号" align="center" prop="poNo"/> <el-table-column label="订单编号" align="center" prop="poNo"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/> <el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/> <el-table-column label="物料名称" align="center" prop="materialName"/>

@ -191,6 +191,7 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleBindingPurchase(scope.row)" @click="handleBindingPurchase(scope.row)"
v-hasPermi="['mes:saleOrder:bind']" v-hasPermi="['mes:saleOrder:bind']"
v-if="scope.row.saleOrderClassfication==='1'"
>绑定</el-button> >绑定</el-button>
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->

@ -43,10 +43,10 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="" prop="locRow"> <el-form-item label="" prop="locRow">
<el-input <el-input
v-model="queryParams.locRow" v-model="queryParams.locRow"
placeholder="请输入" placeholder="请输入"
style="width: 100px" style="width: 100px"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
@ -255,7 +255,7 @@
<el-table-column label="库位编号" align="center" prop="locationCode"/> <el-table-column label="库位编号" align="center" prop="locationCode"/>
<el-table-column label="料箱编号" align="center" prop="containerCode"/> <el-table-column label="料箱编号" align="center" prop="containerCode"/>
<el-table-column label="仓库" align="center" prop="warehouseName"/> <el-table-column label="仓库" align="center" prop="warehouseName"/>
<el-table-column label="" align="center" prop="locRow"/> <el-table-column label="" align="center" prop="locRow"/>
<el-table-column label="列" align="center" prop="locColumn"/> <el-table-column label="列" align="center" prop="locColumn"/>
<el-table-column label="层" align="center" prop="layerNum"/> <el-table-column label="层" align="center" prop="layerNum"/>
<el-table-column label="深浅库位" align="center" prop="locDeep"> <el-table-column label="深浅库位" align="center" prop="locDeep">
@ -388,22 +388,22 @@
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">
<el-form-item label="层" prop="layerNum"> <el-form-item label="行" prop="locRow">
<el-input-number v-model="form.layerNum" placeholder="请输入层" :min="1" :max="10000"
style="width:130px;"/>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="排" prop="locRow">
<el-input-number v-model="form.locRow" placeholder="请输入排" :min="1" :max="10000" style="width:130px;"/> <el-input-number v-model="form.locRow" placeholder="请输入排" :min="1" :max="10000" style="width:130px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="7">
<el-form-item label="列" prop="locColumn"> <el-form-item label="列" prop="locColumn">
<el-input-number v-model="form.locColumn" placeholder="请输入列" :min="1" :max="10000" <el-input-number v-model="form.locColumn" placeholder="请输入列" :min="1" :max="10000"
style="width:130px;"/> style="width:130px;"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="7">
<el-form-item label="层" prop="layerNum">
<el-input-number v-model="form.layerNum" placeholder="请输入层" :min="1" :max="10000"
style="width:130px;"/>
</el-form-item>
</el-col>
</el-row> </el-row>

Loading…
Cancel
Save