change - 问题120:销售订单增加逻辑删除(待发布工单且无采购订单绑定可删)、相关SQL添加is_flag = '1'

master
yinq 3 weeks ago
parent d2d556f923
commit b2db67ae91

@ -329,4 +329,8 @@ public class MesConstants {
/**生产工单派工类型*/
public static final String MES_PRODUCT_ORDER_DISPATCH_TYPE_PRODUCE="1";//产线
public static final String MES_PRODUCT_ORDER_DISPATCH_TYPE_ROUTE="2";//工艺路线
/**MES删除标识1否 0是*/
public static final String MES_IS_FLAG_YES="0";
public static final String MES_IS_FLAG_NO="1";
}

@ -87,6 +87,7 @@
<select id="selectMesSaleOrderList" parameterType="MesSaleOrder" resultMap="MesSaleOrderResult">
<include refid="selectMesSaleOrderVo"/>
<where>
is_flag = '1'
<if test="erpId != null ">and erp_id = #{erpId}</if>
<if test="fentryId != null ">and fentry_id = #{fentryId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and saleorder_code = #{saleorderCode}</if>
@ -112,7 +113,6 @@
<if test="beginDate != null ">and begin_date = #{beginDate}</if>
<if test="endDate != null ">and end_date = #{endDate}</if>
<if test="completeDate != null ">and complete_date = #{completeDate}</if>
<if test="isFlag != null and isFlag != ''">and is_flag = #{isFlag}</if>
<if test="auxPropId != null and auxPropId != ''">and aux_prop_id = #{auxPropId}</if>
<if test="stockId != null and stockId != ''">and stock_id = #{stockId}</if>
<if test="saleDeptId != null and saleDeptId != ''">and sale_dept_id = #{saleDeptId}</if>
@ -268,7 +268,7 @@
<select id="selectMaxErpModifyDate" resultType="String">
SELECT max(erp_modify_date) FROM mes_sale_order order by erp_id,fentry_id
SELECT max(erp_modify_date) FROM mes_sale_order where is_flag = '1' order by erp_id,fentry_id
</select>
<select id="selectMesSaleOrderByUI" resultMap="MesSaleOrderResult">

@ -169,9 +169,9 @@ public class MesSaleOrder extends BaseEntity {
private Date completeDate;
/**
* 1-0-
* 1 0
*/
@Excel(name = "是否标识1-是0-否")
@Excel(name = "删除标识")
private String isFlag;
private String tondBase;

@ -121,7 +121,16 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
*/
@Override
public int deleteMesSaleOrderBySaleOrderIds(Long[] saleOrderIds) {
return mesSaleOrderMapper.deleteMesSaleOrderBySaleOrderIds(saleOrderIds);
for (Long saleOrderId : saleOrderIds) {
MesSaleOrder mesSaleOrder = new MesSaleOrder();
mesSaleOrder.setSaleOrderId(saleOrderId);
mesSaleOrder.setIsFlag(MesConstants.MES_IS_FLAG_YES);//删除标识1否 0是
mesSaleOrder.setUpdateBy(SecurityUtils.getUsername());
mesSaleOrder.setUpdateTime(DateUtils.getNowDate());
mesSaleOrderMapper.updateMesSaleOrder(mesSaleOrder);
}
// return mesSaleOrderMapper.deleteMesSaleOrderBySaleOrderIds(saleOrderIds);
return 1;
}
/**

@ -150,6 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
<where>
mso.is_flag = '1'
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and mob.bind_amount &gt; mob.barcode_amount</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>

@ -469,6 +469,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_sale_order mso on mob.sale_order_id = mso.sale_order_id
<where>
mso.is_flag = '1'
<if test="mergeFlag != null and mergeFlag != ''"> and mob.bind_amount=1 and mob.barcode_amount=0 and mpo.order_amount=1 and mso.order_amount=1</if>
<if test="singleFlag != null and singleFlag != ''"> and (mob.bind_amount &gt; mob.barcode_amount or mbmi.always_flag='1')</if>
<if test="safeFlag != null and safeFlag != ''"> and mob.safe_flag = #{safeFlag}</if>

@ -80,6 +80,7 @@
<select id="selectMesSaleOrderList" parameterType="MesSaleOrder" resultMap="MesSaleOrderResult">
<include refid="selectMesSaleOrderVo"/>
<where>
is_flag = '1'
<if test="erpId != null ">and erp_id = #{erpId}</if>
<if test="fentryId != null ">and fentry_id = #{fentryId}</if>
<if test="saleorderCode != null and saleorderCode != ''">and saleorder_code = #{saleorderCode}</if>
@ -105,7 +106,6 @@
<if test="beginDate != null ">and begin_date = #{beginDate}</if>
<if test="endDate != null ">and end_date = #{endDate}</if>
<if test="completeDate != null ">and complete_date = #{completeDate}</if>
<if test="isFlag != null and isFlag != ''">and is_flag = #{isFlag}</if>
</where>
</select>
@ -263,6 +263,7 @@
((mso.material_id = mbmi.erp_id and (mso.sale_order_classfication='1' or mso.sale_order_classfication='3')) or (mso.material_id = mbmi.material_id and mso.sale_order_classfication='2'))
left join mes_project_info mpi on mso.tond_base=mpi.erp_id
<where>
mso.is_flag = '1'
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code like concat('%', #{saleorderCode},
'%')</if>
<if test="materialCode != null and materialCode != ''">and mbmi.material_code like concat('%', #{materialCode},
@ -279,7 +280,7 @@
<if test="saleOrderId != null">and mso.sale_order_id = #{saleOrderId}</if>
<if test="saleOrderClassfication != null and saleOrderClassfication != ''">and mso.sale_order_classfication = #{saleOrderClassfication}</if>
<if test="relateFlag != null and relateFlag != ''">and exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id and msor.sale_order_id=#{virtualSaleOrderId})</if>
<if test="selectFlag != null and selectFlag != ''">and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id)</if>
<if test="selectFlag != null and selectFlag != ''">and not exists (select 1 from mes_sale_order_relate msor where mso.sale_order_id = msor.relate_sale_order_id)</if>
<if test="parentIds != null and parentIds != ''">and exists (select 1 from mes_material_bom mmb where mmb.erp_material_id=mso.material_id and mmb.material_bom_id in (${parentIds}))</if>
<if test='overtimeFlag != null and overtimeFlag != "" and overtimeFlag == "1"'>and mso.is_release in ('0','1','2') and mso.plan_delivery_date is not null and mso.plan_delivery_date &lt; now() </if>
<if test='overtimeFlag != null and overtimeFlag != "" and overtimeFlag == "0"'>and mso.plan_delivery_date is not null and mso.plan_delivery_date >= now() </if>

@ -255,7 +255,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_product_plan mpp on mpp.plan_code = wpi.plan_code
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id
where wpi.product_type = '3'
where mso.is_flag = '1'
and wpi.product_type = '3'
and wpi.execute_status = '2'
and (wpi.erp_status is null or wpi.erp_status != '1')
and wpi.instock_amount > if(wpi.erp_amount is null, 0, wpi.erp_amount)

@ -332,7 +332,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_base_material_info mbmi on mbmi.material_id = wpo.product_id
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_sale_order mso on mso.sale_order_id = wpo.sale_order_id
where wpo.outstock_type = '1'
where mso.is_flag = '1'
and wpo.outstock_type = '1'
and wpo.outstock_qty > 0
and wpo.apply_qty >= wpo.outstock_qty
and wpo.outstock_qty > if(wpo.erp_amount is null, 0, wpo.erp_amount)

@ -278,7 +278,7 @@
left join wms_base_warehouse wbw on wps.warehouse_id=wbw.warehouse_id
left join mes_sale_order mso on wps.sale_order_id=mso.sale_order_id
<where>
wps.total_amount>0 and wps.stock_type='3'
mso.is_flag = '1' and wps.total_amount>0 and wps.stock_type='3'
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code = #{saleorderCode}</if>
<if test="warehouseId != null ">and wps.warehouse_id = #{warehouseId}</if>
<if test="productId != null ">and wps.product_id = #{productId}</if>

@ -145,11 +145,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select wpss.product_stock_saleorder_id, wpss.warehouse_id, wpss.warehouse_floor, wpss.stock_type, wpss.product_id, wpss.saleorder_code,
wpss.total_amount,wpss.apply_amount, wpss.occupy_amount,wpss.frozen_amount,wpss.outstock_amount, wpss.confirm_amount,
mso.order_amount,wbw.warehouse_name,mbmi.material_code,mbmi.material_name
from wms_product_stock_saleorder wpss left join mes_sale_order mso on wpss.sale_order_id = mso.sale_order_id
from wms_product_stock_saleorder wpss
left join mes_sale_order mso on wpss.sale_order_id = mso.sale_order_id
left join wms_base_warehouse wbw on wpss.warehouse_id=wbw.warehouse_id
left join mes_base_material_info mbmi on mbmi.material_id=wpss.product_id
<where>
mso.is_flag = '1'
<if test="saleorderCode != null and saleorderCode != ''"> and wpss.saleorder_code = #{saleorderCode}</if>
<if test="warehouseId != null ">and wpss.warehouse_id = #{warehouseId}</if>
<if test="productId != null ">and wpss.product_id = #{productId}</if>

@ -387,9 +387,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join mes_base_unit_info mbui on mbui.erp_id = mbmi.material_unit_id
left join mes_product_plan mpp on mpp.plan_code = wro.plan_code
left join mes_sale_order mso on mso.sale_order_id = mpp.sale_order_id
<where>
wro.real_outstock_amount > 0
mso.is_flag = '1'
and wro.real_outstock_amount > 0
and wro.outstock_amount >= wro.real_outstock_amount
and wro.real_outstock_amount > if(wro.erp_amount is null, 0, wro.erp_amount)
and mbmi.material_classfication = '1'

@ -325,6 +325,7 @@
left join mes_sale_order mso on wrs.sale_order_id = mso.sale_order_id
left join mes_base_unit_info mbui on mbmi.material_unit_id = mbui.erp_id
<where>
mso.is_flag = '1'
<if test="warehouseId != null ">and wrs.warehouse_id = #{warehouseId}</if>
<if test="locationCode != null and locationCode != ''">and wrs.location_code = #{locationCode}</if>
<if test="stockType != null and stockType != ''">and wrs.stock_type = #{stockType}</if>

@ -273,7 +273,7 @@
left join mes_sale_order mso on wst.sale_order_id = mso.sale_order_id
left join mes_base_unit_info mbui on mbmi.material_unit_id = mbui.erp_id
<where>
wst.total_amount > 0
mso.is_flag = '1' and wst.total_amount > 0
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="stockType != null and stockType != ''">and wst.stock_type = #{stockType}</if>
@ -327,6 +327,7 @@
left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id
left join mes_sale_order mso on wst.sale_order_id=mso.sale_order_id
<where>
mso.is_flag = '1'
<if test="warehouseId != null ">and wst.warehouse_id = #{warehouseId}</if>
<if test="warehouseFloor != null ">and wst.warehouse_floor = #{warehouseFloor}</if>
<if test="warehouseType != null and warehouseType != ''">and wbw.warehouse_type = #{warehouseType}</if>

@ -273,7 +273,14 @@
v-hasPermi="['mes:saleOrder:used']"
v-if="scope.row.saleOrderClassfication==='1' || scope.row.saleOrderClassfication==='3'"
>物料使用</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-if="scope.row.isRelease==='0'"
v-hasPermi="['mes:saleOrder:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
@ -458,7 +465,14 @@
</template>
<script>
import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrder } from "@/api/mes/saleOrder";
import {
listSaleOrder,
getSaleOrder,
delSaleOrder,
addSaleOrder,
updateSaleOrder,
listOrderBinds
} from "@/api/mes/saleOrder";
import saleOrderRelates from "@/views/mes/saleOrder/saleOrderRelates.vue";
import orderBinds from "@/views/mes/saleOrder/orderBinds.vue";
import {runJob} from "@/api/monitor/job";
@ -701,9 +715,14 @@ export default {
});
},
/** 删除按钮操作 */
handleDelete(row) {
async handleDelete(row) {
const saleOrderIds = row.saleOrderId || this.ids;
this.$modal.confirm('是否确认删除销售订单信息编号为"' + saleOrderIds + '"的数据项?').then(function() {
const bindRes = await listOrderBinds({ saleOrderId: row.saleOrderId });
if (bindRes.total > 0) {
this.$modal.msgWarning("此销售订单已有采购订单绑定!");
return;
}
await this.$modal.confirm('是否确认删除销售订单信息编号为"' + row.saleorderCode + '"的数据项?').then(function() {
return delSaleOrder(saleOrderIds);
}).then(() => {
this.getList();

Loading…
Cancel
Save