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

highway
wws 1 year ago
parent 4bb2020255
commit 33c31ae564

@ -93,6 +93,6 @@ public class EquOrderController extends BaseController {
@Log(title = "计划工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{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);
int insertEquOrderDetails(@Param("list") List<EquPlanDetail> details);
/**
* orderIds
* @param orderIds
*/
void delEquOrderDetailByorderIds(String[] orderIds);
}

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

@ -69,4 +69,10 @@ public interface EquOrderPersonMapper {
List<String> selectEquOrderPersonByOrderCode(String orderCode);
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);
/**
* orderIds
* @param orderIds
*/
void delEquOrderStandardByorderIds(String[] orderIds);
}

@ -74,5 +74,11 @@ public interface EquSpareApplyMapper {
* @param orderCode
* @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
*/
void updateSpareNumReduce(EquSpareApply apply);
/**
*
* @param apply
*/
void updateSpareNumAdd(EquSpareApply apply);
}

@ -50,7 +50,7 @@ public interface IEquOrderService {
* @param orderIds
* @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) {
order.setSpareList(spareList);
}

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

@ -55,6 +55,8 @@ public class EquOrderServiceImpl implements IEquOrderService {
private EquPlanMapper equPlanMapper;
@Autowired
private EquSpareApplyMapper equSpareApplyMapper;
@Autowired
private SparePartsLedgerMapper sparePartsLedgerMapper;
/**
*
@ -91,7 +93,7 @@ public class EquOrderServiceImpl implements IEquOrderService {
order.setDetailList(detailList);
// 备件
List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByParentCode(order.getOrderCode());
List<EquSpareApply> spareList = equSpareApplyMapper.selectEquSpareApplyListByWorkCode(order.getOrderCode());
if (spareList.size() > 0) {
order.setSpareList(spareList);
}
@ -361,8 +363,32 @@ public class EquOrderServiceImpl implements IEquOrderService {
*/
@Override
@DS("#header.poolName")
public int deleteEquOrderByOrderIds(String[] orderIds) {
return equOrderMapper.deleteEquOrderByOrderIds(orderIds);
public AjaxResult deleteEquOrderByOrderIds(String[] 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.setFactoryCode(factory);
apply.setApplyPeople(SecurityContextHolder.getUserName());
apply.setParentCode(equOrder.getOrderCode());
apply.setWorkCode(equOrder.getOrderCode());
apply.setCreateBy(SecurityContextHolder.getUserName());
apply.setCreateTime(DateUtils.getNowDate());
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()));

@ -60,7 +60,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(detail_id)+1 AS serialNum
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 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 COUNT(item_id)+1 AS serialNum
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 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 COUNT(fault_id)+1 AS serialNum
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>
<insert id="insertEquFaultType" parameterType="EquFaultType">

@ -50,7 +50,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(id)+1 AS serialNum
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 id="selectEquipmentCodeList" resultType="java.lang.String">

@ -163,4 +163,13 @@
#{id}
</foreach>
</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>

@ -128,7 +128,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(order_id)+1 AS serialNum
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 id="changeLoopType" resultType="java.lang.String">
@ -286,7 +286,14 @@
</foreach>
</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
eo.order_id,

@ -127,4 +127,15 @@
#{id}
</foreach>
</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>

@ -259,6 +259,16 @@
delete from base_file where source_id = #{sourceId}
</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">
<include refid="selectBaseFileVo"/>
where source_id = #{sourceId}

@ -97,7 +97,7 @@
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(plan_id)+1 AS serialNum
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 id="selectWorkCenter" resultType="com.op.device.domain.WorkCenter">

@ -167,6 +167,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</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">
<include refid="selectEquSpareApplyVo"/>
<where>
@ -179,12 +188,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectSerialNumber" resultType="java.lang.Integer">
SELECT COUNT(apply_id)+1 AS serialNum
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 id="selectEquSpareApplyListByParentCode" parameterType="String" resultMap="EquSpareApplyResult">
<select id="selectEquSpareApplyListByWorkCode" parameterType="String" resultMap="EquSpareApplyResult">
<include refid="selectEquSpareApplyVo"/>
where parent_code = #{orderCode} and del_flag = '0'
where work_code = #{orderCode} and del_flag = '0'
</select>
</mapper>

@ -285,6 +285,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
set amount = ( amount - #{spareQuantity} ) where material_code = #{spareCode}
</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 from wms_ods_mate_storage_news where storage_id = #{storageId}
</delete>

Loading…
Cancel
Save