问题修改

This commit is contained in:
jiang 2025-10-14 23:00:05 +08:00
parent 4d5c9b0abb
commit 23d5e6b4f6
12 changed files with 80 additions and 26 deletions

View File

@ -74,12 +74,20 @@ public class MaDevInfoController extends BaseController {
return AjaxResult.success(service.getDevice(maId));
}
@ApiOperation(value = "设备台账-获取单个设备详情")
@GetMapping("/getDeviceByMaIds/{maIds}")
public AjaxResult getDeviceByMaIds(@PathVariable String maIds) {
return service.getDeviceByMaIds(maIds);
}
@ApiOperation(value = "设备台账-删除")
@PostMapping("/delDevice/{ids}")
public AjaxResult delDevice(@PathVariable("ids") String[] ids) {
try {
Integer i = service.delDevice(ids);
return i > 0 ? AjaxResult.success("修改成功"): AjaxResult.error("修改失败");
return i > 0 ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
} catch (Exception e) {
logger.error("报错啦", e);
return AjaxResult.error("调用异常,请联系管理员");
@ -135,6 +143,4 @@ public class MaDevInfoController extends BaseController {
}
}

View File

@ -22,6 +22,8 @@ public class MaDevInfo {
* 设备id
*/
private Integer maId;
private Integer devId;
/**
* 类型id
*/
@ -308,7 +310,7 @@ public class MaDevInfo {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date startOrderCreateTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date endOrderCreateTime;
/**

View File

@ -42,5 +42,7 @@ public interface MaDevInfoMapper {
void insertDevInfoProperties(@Param("list") List<DevInfoPropertyVo> item, @Param("maId") Integer maId);
MaDevInfo getDevice(Integer maId);
List<MaDevInfo> getDeviceByMaIds(String[] maIdArray);
}

View File

@ -165,7 +165,7 @@ public class DevChangeServiceImpl implements DevChangeService {
String usUnit = mapper.getChangeUnit(list.get(0).getDevId());
vo.setUseUint(usUnit);
vo.setChangeUnit(usUnit);
vo.setChangeStatus("1");
vo.setChangeStatus("4");
vo.setDevNum(list.size() + "");
String proId = vo.getProCode();
int num = mapper.addChangeInfo(vo);
@ -221,12 +221,17 @@ public class DevChangeServiceImpl implements DevChangeService {
String usUnit = mapper.getChangeUnit(list.get(0).getDevId());
vo.setUseUint(usUnit);
vo.setChangeUnit(usUnit);
vo.setChangeStatus("5");
vo.setChangeStatus("1");
vo.setDevNum(list.size() + "");
String proId = vo.getProCode();
int num = mapper.addChangeInfo(vo);
if (num > 0) {
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo : list) {
CsDeviceChangeVo entity = new CsDeviceChangeVo();
entity.setDevId(deviceChangeDetailsVo.getDevId());
entity.setChangeStatus(deviceChangeDetailsVo.getStatus());
entity.setUseUint(usUnit);
entity.setChangeUnit(usUnit);
if ("1".equals(deviceChangeDetailsVo.getStatus())) {
updateDevDetails2(deviceChangeDetailsVo.getDevId(), proId, "1", deviceChangeDetailsVo.getNum());
} else {
@ -243,7 +248,7 @@ public class DevChangeServiceImpl implements DevChangeService {
vo.setUserName(null);
vo.setUserPhone(null);
vo.setProCode(null);
mapper.updateDevInfo(vo);
mapper.updateDevInfo(entity);
}
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.devchange.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.devchange.domain.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean;
import com.bonus.material.devchange.domain.MaDevInfo;
@ -27,4 +28,6 @@ public interface MaDevInfoService {
Integer updateDeviceApi(MaDevInfo o);
MaDevInfo getDevice(Integer maId);
AjaxResult getDeviceByMaIds(String maIds);
}

View File

@ -1,6 +1,7 @@
package com.bonus.material.devchange.service;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.devchange.domain.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean;
@ -109,6 +110,16 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
return item;
}
/**
* @param maIds
* @return
*/
@Override
public AjaxResult getDeviceByMaIds(String maIds) {
String[] maIdArray = maIds.split(",");
return AjaxResult.success(mapper.getDeviceByMaIds(maIdArray));
}
/**
* 将扁平列表构建成树并添加一个总的根节点
*/

View File

@ -170,4 +170,7 @@ public class OrderInfoDto {
@ApiModelProperty(value = "出库时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String preOutboundTime;
private String maIds;
}

View File

@ -33,10 +33,9 @@
<update id="updateDevInfo">
update ma_dev_info
set xq_unit=#{useUint},
user_info=#{userName},
user_phone=#{userPhone},
on_project=#{proCode},
change_status=#{changeStatus}
change_status=#{changeStatus},
ma_status = #{changeStatus}
where ma_id = #{devId}
</update>
<delete id="deleteDevChangeDetails">
@ -189,8 +188,7 @@
mt.childGx,
mt.devCategory,
mt.devSubcategory,
mt.devName,
mt.devModel,
dev.item_type_model AS devModel,
bci.company_name compName,
bci.operate_address orgName,
IFNULL(pro.pro_name, '-') proName,

View File

@ -371,7 +371,12 @@
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
</if>
<if test="status != null and status != ''">
and mdi.change_status = #{status}
<if test='status=="2"'>
and mdi.change_status in(2,3)
</if>
<if test='status!="2"'>
AND mdi.change_status=#{status}
</if>
</if>
</where>
@ -442,4 +447,20 @@
mdi.is_active = '1' AND mdi.ma_id =#{maId}
</where>
</select>
<select id="getDeviceByMaIds" resultType="com.bonus.material.devchange.domain.MaDevInfo">
SELECT ma_id AS devId,
device_name AS name,
item_type_model As specificationModel,
code AS code
from ma_dev_info
WHERE ma_id IN
<foreach collection="array"
item="maId"
open="("
separator=","
close=")">
#{maId}
</foreach>
</select>
</mapper>

View File

@ -9,8 +9,9 @@
c.company_name AS propertyUnit,
mdi.ma_id AS maId,
mdi.device_name AS name,
mdi.item_type_model AS specificationModel,
mdi.`code` AS code,
mdi.brand AS manufacturer,
ms.supplier_name AS manufacturer,
mdi.production_date AS productionDate,
mdi.expiration_time AS expirationTime,
IF(STR_TO_DATE(production_date, '%Y-%m-%d') IS NOT NULL AND STR_TO_DATE(expiration_time, '%Y-%m-%d') IS NOT
@ -44,12 +45,13 @@
ma_dev_info mdi
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
LEFT JOIN bm_company_info c ON sd.dept_id = c.company_id
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
WHERE mdi.is_active = 1 and mdi.entry_status = '1' and mdi.change_status in (1,5)
<if test="name != null and name != ''">
AND mdi.device_name like concat('%',#{deviceName},'%')
AND mdi.device_name like concat('%',#{name},'%')
</if>
<if test="manufacturer != null and manufacturer != ''">
AND mdi.manufacturer like concat('%',#{manufacturer},'%')
<if test="manufacturerId != null and manufacturerId != ''">
AND mdi.supplier_id like concat('%',#{manufacturerId},'%')
</if>
) a
<where>

View File

@ -183,7 +183,7 @@
<update id="updateChangeStatus">
<foreach collection="list" item="data" separator=";">
UPDATE ma_dev_info SET change_status = #{data.value} WHERE ma_id = #{data.key}
UPDATE ma_dev_info SET change_status ='1' WHERE ma_id = #{data.key}
</foreach>
</update>

View File

@ -143,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT
moi.code AS code,
GROUP_CONCAT(hh.id) AS ids,
GROUP_CONCAT(mdi.ma_id) AS maIds,
moi.order_time,
mdi.on_company as sellerCompany,
up.dept_name AS czcompanyName,
@ -165,9 +166,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join sys_dept up on up.dept_id = mdi.on_company
WHERE
mt.del_flag = '0'
<if test="keyWord!=null and keyWord!=''">
and moi.code like concat('%',#{keyWord},'%')
</if>
<if test="keyWord!=null and keyWord!=''">
and moi.code like concat('%',#{keyWord},'%')
</if>
<if test="buyerCompany != null">
AND moi.buyer_company = #{buyerCompany}
</if>
@ -195,11 +196,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND dept.dept_name like concat('%',#{companyName},'%')
</if>
GROUP BY
moi.buyer_company,
moi.`code`,
su.phonenumber,
moi.address,
moi.order_time
moi.buyer_company,
moi.`code`,
su.phonenumber,
moi.address,
moi.order_time
order by moi.order_time desc
</select>