点检、巡检、保养逻辑删除、生成编码重复BUG

highway
wws 12 months ago
parent 4bb2020255
commit 33c31ae564

@ -93,6 +93,6 @@ public class EquOrderController extends BaseController {
@Log(title = "计划工单", businessType = BusinessType.DELETE) @Log(title = "计划工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{orderIds}") @DeleteMapping("/{orderIds}")
public AjaxResult remove(@PathVariable String[] orderIds) { public AjaxResult remove(@PathVariable String[] orderIds) {
return toAjax(equOrderService.deleteEquOrderByOrderIds(orderIds)); return equOrderService.deleteEquOrderByOrderIds(orderIds);
} }
} }

@ -78,4 +78,10 @@ public interface EquOrderDetailMapper {
List<EquOrderDetail> selectEquOrderDetailByOrderCode(String orderCode); List<EquOrderDetail> selectEquOrderDetailByOrderCode(String orderCode);
int insertEquOrderDetails(@Param("list") List<EquPlanDetail> details); int insertEquOrderDetails(@Param("list") List<EquPlanDetail> details);
/**
* orderIds
* @param orderIds
*/
void delEquOrderDetailByorderIds(String[] orderIds);
} }

@ -155,4 +155,10 @@ public interface EquOrderMapper {
* @return * @return
*/ */
List<EquOrder> selectCheckListByRepairCode(EquOrder equOrder); List<EquOrder> selectCheckListByRepairCode(EquOrder equOrder);
/**
*
* @param orderIds
*/
void delEquOrderByOrderIds(String[] orderIds);
} }

@ -69,4 +69,10 @@ public interface EquOrderPersonMapper {
List<String> selectEquOrderPersonByOrderCode(String orderCode); List<String> selectEquOrderPersonByOrderCode(String orderCode);
int insertEquOrderPersons(@Param("list") List<EquPlanPerson> persons); int insertEquOrderPersons(@Param("list") List<EquPlanPerson> persons);
/**
* ids
* @param orderIds
*/
void delEquOrderPersonByorderIds(String[] orderIds);
} }

@ -96,4 +96,10 @@ public interface EquOrderStandardMapper {
* *
*/ */
void updateStandardAfterRepair(EquOrderStandard equOrderStandard); void updateStandardAfterRepair(EquOrderStandard equOrderStandard);
/**
* orderIds
* @param orderIds
*/
void delEquOrderStandardByorderIds(String[] orderIds);
} }

@ -74,5 +74,11 @@ public interface EquSpareApplyMapper {
* @param orderCode * @param orderCode
* @return * @return
*/ */
List<EquSpareApply> selectEquSpareApplyListByParentCode(String orderCode); List<EquSpareApply> selectEquSpareApplyListByWorkCode(String orderCode);
/**
* ids
* @param orderIds
*/
void delEquSpareApplyByorderIds(String[] orderIds);
} }

@ -73,4 +73,10 @@ public interface SparePartsLedgerMapper {
* @param apply * @param apply
*/ */
void updateSpareNumReduce(EquSpareApply apply); void updateSpareNumReduce(EquSpareApply apply);
/**
*
* @param apply
*/
void updateSpareNumAdd(EquSpareApply apply);
} }

@ -50,7 +50,7 @@ public interface IEquOrderService {
* @param orderIds * @param orderIds
* @return * @return
*/ */
public int deleteEquOrderByOrderIds(String[] orderIds); public AjaxResult deleteEquOrderByOrderIds(String[] orderIds);
/** /**
* *

@ -143,7 +143,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
// 备件 // 备件
List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode());
if (spareList != null) { if (spareList != null) {
order.setSpareList(spareList); order.setSpareList(spareList);
} }

@ -288,7 +288,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
apply.setSpareQuantity(spare.getApplyNum()); apply.setSpareQuantity(spare.getApplyNum());
apply.setFactoryCode(factory); apply.setFactoryCode(factory);
apply.setApplyPeople("job"); apply.setApplyPeople("job");
apply.setParentCode(orderCode); apply.setWorkCode(orderCode);
apply.setCreateBy("job"); apply.setCreateBy("job");
apply.setCreateTime(nowtime); apply.setCreateTime(nowtime);
apply.setSpareUseEquipment(plan.getEquipmentCode()); apply.setSpareUseEquipment(plan.getEquipmentCode());
@ -296,7 +296,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService {
// 插入备件信息 // 插入备件信息
equSpareApplyMapper.insertEquSpareApply(apply); equSpareApplyMapper.insertEquSpareApply(apply);
// TODO 减少备件仓库中备件数量 // 减少备件仓库中备件数量
sparePartsLedgerMapper.updateSpareNumReduce(apply); sparePartsLedgerMapper.updateSpareNumReduce(apply);
} }

@ -55,6 +55,8 @@ public class EquOrderServiceImpl implements IEquOrderService {
private EquPlanMapper equPlanMapper; private EquPlanMapper equPlanMapper;
@Autowired @Autowired
private EquSpareApplyMapper equSpareApplyMapper; private EquSpareApplyMapper equSpareApplyMapper;
@Autowired
private SparePartsLedgerMapper sparePartsLedgerMapper;
/** /**
* *
@ -91,7 +93,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
order.setDetailList(detailList); order.setDetailList(detailList);
// 备件 // 备件
List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode());
if (spareList.size() > 0) { if (spareList.size() > 0) {
order.setSpareList(spareList); order.setSpareList(spareList);
} }
@ -361,8 +363,32 @@ public class EquOrderServiceImpl implements IEquOrderService {
*/ */
@Override @Override
@DS("#header.poolName") @DS("#header.poolName")
public int deleteEquOrderByOrderIds(String[] orderIds) { public AjaxResult deleteEquOrderByOrderIds(String[] orderIds) {
return equOrderMapper.deleteEquOrderByOrderIds(orderIds); // 保养-备件逻辑
for (String orderId : orderIds) {
EquOrder order = equOrderMapper.selectEquOrderByOrderId(orderId);
if (!order.getOrderStatus().equals("0")) {
return error(500,"工单已进行修改!不可删除!");
}
if (order.getPlanType().equals("maintenance")) {
List<EquSpareApply> applyList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getWorkCode());
for (EquSpareApply apply : applyList) {
// 返回备件数量
sparePartsLedgerMapper.updateSpareNumAdd(apply);
}
}
}
// 逻辑删除工单
equOrderMapper.delEquOrderByOrderIds(orderIds);
// 逻辑删除获取人员
equOrderPersonMapper.delEquOrderPersonByorderIds(orderIds);
// 逻辑删除标准信息
equOrderStandardMapper.delEquOrderStandardByorderIds(orderIds);
// 逻辑删除检查项信息
equOrderDetailMapper.delEquOrderDetailByorderIds(orderIds);
// 逻辑删除备件信息
equSpareApplyMapper.delEquSpareApplyByorderIds(orderIds);
return success();
} }
/** /**

@ -130,7 +130,7 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
apply.setSpareQuantity(spare.getApplyNum()); apply.setSpareQuantity(spare.getApplyNum());
apply.setFactoryCode(factory); apply.setFactoryCode(factory);
apply.setApplyPeople(SecurityContextHolder.getUserName()); apply.setApplyPeople(SecurityContextHolder.getUserName());
apply.setParentCode(equOrder.getOrderCode()); apply.setWorkCode(equOrder.getOrderCode());
apply.setCreateBy(SecurityContextHolder.getUserName()); apply.setCreateBy(SecurityContextHolder.getUserName());
apply.setCreateTime(DateUtils.getNowDate()); apply.setCreateTime(DateUtils.getNowDate());
apply.setSpareUseEquipment(equOrder.getEquipmentCode()); apply.setSpareUseEquipment(equOrder.getEquipmentCode());

@ -68,7 +68,7 @@ public class InspectionWorkServiceImpl implements IInspectionWorkService {
} }
// 查询备件信息 // 查询备件信息
List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode()); List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode());
// 替换循环周期 // 替换循环周期
order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType())); order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType()));

@ -60,7 +60,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(detail_id)+1 AS serialNum SELECT COUNT(detail_id)+1 AS serialNum
FROM equ_check_item_detail FROM equ_check_item_detail
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and parent_code = #{itemCode} and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and parent_code = #{itemCode}
</select> </select>
<select id="selectEquCheckItemDetailByParentCode" parameterType="String" resultMap="EquCheckItemDetailResult"> <select id="selectEquCheckItemDetailByParentCode" parameterType="String" resultMap="EquCheckItemDetailResult">

@ -65,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(item_id)+1 AS serialNum SELECT COUNT(item_id)+1 AS serialNum
FROM equ_check_item FROM equ_check_item
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<select id="selectAllEquipmentList" resultType="com.op.device.domain.vo.EquCheckItemVO"> <select id="selectAllEquipmentList" resultType="com.op.device.domain.vo.EquCheckItemVO">

@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(fault_id)+1 AS serialNum SELECT COUNT(fault_id)+1 AS serialNum
FROM equ_fault_type FROM equ_fault_type
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<insert id="insertEquFaultType" parameterType="EquFaultType"> <insert id="insertEquFaultType" parameterType="EquFaultType">

@ -50,7 +50,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(id)+1 AS serialNum SELECT COUNT(id)+1 AS serialNum
FROM equ_item_equipment FROM equ_item_equipment
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<select id="selectEquipmentCodeList" resultType="java.lang.String"> <select id="selectEquipmentCodeList" resultType="java.lang.String">

@ -163,4 +163,13 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="delEquOrderDetailByorderIds" parameterType="String">
update equ_order_detail set del_flag = '1' where del_flag = '0' and order_code in ( select order_code from
equ_order where del_flag = '0' and order_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
)
</delete>
</mapper> </mapper>

@ -128,7 +128,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(order_id)+1 AS serialNum SELECT COUNT(order_id)+1 AS serialNum
FROM equ_order FROM equ_order
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<select id="changeLoopType" resultType="java.lang.String"> <select id="changeLoopType" resultType="java.lang.String">
@ -286,6 +286,13 @@
</foreach> </foreach>
</delete> </delete>
<delete id="delEquOrderByOrderIds">
update equ_order set del_flag = '1' where order_id in
<foreach item="orderId" collection="array" open="(" separator="," close=")">
#{orderId}
</foreach>
</delete>
<!-- 手持维修查询检查项--> <!-- 手持维修查询检查项-->
<select id="selectCheckListByWorkCode" parameterType="EquOrder" resultMap="EquOrderResult"> <select id="selectCheckListByWorkCode" parameterType="EquOrder" resultMap="EquOrderResult">
select select

@ -127,4 +127,15 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<delete id="delEquOrderPersonByorderIds" parameterType="String">
update equ_order_person
set del_flag = '1'
where del_flag = '0' and order_code in (
select order_code from equ_order where del_flag = '0' and order_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
)
</delete>
</mapper> </mapper>

@ -259,6 +259,16 @@
delete from base_file where source_id = #{sourceId} delete from base_file where source_id = #{sourceId}
</delete> </delete>
<delete id="delEquOrderStandardByorderIds" parameterType="String">
update equ_order_standard set del_flag = '1'
where del_flag = '0' and order_code in (
select order_code from equ_order where del_flag = '0' and order_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
)
</delete>
<select id="getBaseFileBatch" resultMap="BaseFileResult"> <select id="getBaseFileBatch" resultMap="BaseFileResult">
<include refid="selectBaseFileVo"/> <include refid="selectBaseFileVo"/>
where source_id = #{sourceId} where source_id = #{sourceId}

@ -97,7 +97,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(plan_id)+1 AS serialNum SELECT COUNT(plan_id)+1 AS serialNum
FROM equ_plan FROM equ_plan
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<select id="selectWorkCenter" resultType="com.op.device.domain.WorkCenter"> <select id="selectWorkCenter" resultType="com.op.device.domain.WorkCenter">

@ -167,6 +167,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<delete id="delEquSpareApplyByorderIds" parameterType="String">
update equ_spare_apply set del_flag = '1' where del_flag = '0' and work_code in ( select order_code from
equ_order where del_flag = '0' and order_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
)
</delete>
<select id="selectRepairSparePartsRecord" parameterType="EquRepairWorkOrder" resultMap="EquSpareApplyResult"> <select id="selectRepairSparePartsRecord" parameterType="EquRepairWorkOrder" resultMap="EquSpareApplyResult">
<include refid="selectEquSpareApplyVo"/> <include refid="selectEquSpareApplyVo"/>
<where> <where>
@ -179,12 +188,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSerialNumber" resultType="java.lang.Integer"> <select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(apply_id)+1 AS serialNum SELECT COUNT(apply_id)+1 AS serialNum
FROM equ_spare_apply FROM equ_spare_apply
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time) and del_flag = '0' WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
</select> </select>
<select id="selectEquSpareApplyListByParentCode" parameterType="String" resultMap="EquSpareApplyResult"> <select id="selectEquSpareApplyListByWorkCode" parameterType="String" resultMap="EquSpareApplyResult">
<include refid="selectEquSpareApplyVo"/> <include refid="selectEquSpareApplyVo"/>
where parent_code = #{orderCode} and del_flag = '0' where work_code = #{orderCode} and del_flag = '0'
</select> </select>
</mapper> </mapper>

@ -285,6 +285,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set amount = ( amount - #{spareQuantity} ) where material_code = #{spareCode} set amount = ( amount - #{spareQuantity} ) where material_code = #{spareCode}
</update> </update>
<update id="updateSpareNumAdd">
update wms_ods_mate_storage_news
set amount = ( amount + #{spareQuantity} ) where material_code = #{spareCode}
</update>
<delete id="deleteSparePartsLedgerByStorageId" parameterType="String"> <delete id="deleteSparePartsLedgerByStorageId" parameterType="String">
delete from wms_ods_mate_storage_news where storage_id = #{storageId} delete from wms_ods_mate_storage_news where storage_id = #{storageId}
</delete> </delete>

Loading…
Cancel
Save