问题修改

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

View File

@ -22,6 +22,8 @@ public class MaDevInfo {
* 设备id * 设备id
*/ */
private Integer maId; private Integer maId;
private Integer devId;
/** /**
* 类型id * 类型id
*/ */

View File

@ -42,5 +42,7 @@ public interface MaDevInfoMapper {
void insertDevInfoProperties(@Param("list") List<DevInfoPropertyVo> item, @Param("maId") Integer maId); void insertDevInfoProperties(@Param("list") List<DevInfoPropertyVo> item, @Param("maId") Integer maId);
MaDevInfo getDevice(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()); String usUnit = mapper.getChangeUnit(list.get(0).getDevId());
vo.setUseUint(usUnit); vo.setUseUint(usUnit);
vo.setChangeUnit(usUnit); vo.setChangeUnit(usUnit);
vo.setChangeStatus("1"); vo.setChangeStatus("4");
vo.setDevNum(list.size() + ""); vo.setDevNum(list.size() + "");
String proId = vo.getProCode(); String proId = vo.getProCode();
int num = mapper.addChangeInfo(vo); int num = mapper.addChangeInfo(vo);
@ -221,12 +221,17 @@ public class DevChangeServiceImpl implements DevChangeService {
String usUnit = mapper.getChangeUnit(list.get(0).getDevId()); String usUnit = mapper.getChangeUnit(list.get(0).getDevId());
vo.setUseUint(usUnit); vo.setUseUint(usUnit);
vo.setChangeUnit(usUnit); vo.setChangeUnit(usUnit);
vo.setChangeStatus("5"); vo.setChangeStatus("1");
vo.setDevNum(list.size() + ""); vo.setDevNum(list.size() + "");
String proId = vo.getProCode(); String proId = vo.getProCode();
int num = mapper.addChangeInfo(vo); int num = mapper.addChangeInfo(vo);
if (num > 0) { if (num > 0) {
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo : list) { 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())) { if ("1".equals(deviceChangeDetailsVo.getStatus())) {
updateDevDetails2(deviceChangeDetailsVo.getDevId(), proId, "1", deviceChangeDetailsVo.getNum()); updateDevDetails2(deviceChangeDetailsVo.getDevId(), proId, "1", deviceChangeDetailsVo.getNum());
} else { } else {
@ -243,7 +248,7 @@ public class DevChangeServiceImpl implements DevChangeService {
vo.setUserName(null); vo.setUserName(null);
vo.setUserPhone(null); vo.setUserPhone(null);
vo.setProCode(null); vo.setProCode(null);
mapper.updateDevInfo(vo); mapper.updateDevInfo(entity);
} }
} }
} }

View File

@ -1,5 +1,6 @@
package com.bonus.material.devchange.service; 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.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean; import com.bonus.material.devchange.domain.DeviceTreeBean;
import com.bonus.material.devchange.domain.MaDevInfo; import com.bonus.material.devchange.domain.MaDevInfo;
@ -27,4 +28,6 @@ public interface MaDevInfoService {
Integer updateDeviceApi(MaDevInfo o); Integer updateDeviceApi(MaDevInfo o);
MaDevInfo getDevice(Integer maId); MaDevInfo getDevice(Integer maId);
AjaxResult getDeviceByMaIds(String maIds);
} }

View File

@ -1,6 +1,7 @@
package com.bonus.material.devchange.service; package com.bonus.material.devchange.service;
import com.bonus.common.core.utils.StringUtils; 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.common.security.utils.SecurityUtils;
import com.bonus.material.devchange.domain.DeviceCountBean; import com.bonus.material.devchange.domain.DeviceCountBean;
import com.bonus.material.devchange.domain.DeviceTreeBean; import com.bonus.material.devchange.domain.DeviceTreeBean;
@ -109,6 +110,16 @@ public class MaDevInfoServiceImpl implements MaDevInfoService {
return item; 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 = "出库时间") @ApiModelProperty(value = "出库时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String preOutboundTime; private String preOutboundTime;
private String maIds;
} }

View File

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

View File

@ -371,7 +371,12 @@
and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate} and DATE_FORMAT(mdi.purchase_date,'%Y-%m-%d') between #{startPurchaseDate} and #{endPurchaseDate}
</if> </if>
<if test="status != null and status != ''"> <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> </if>
</where> </where>
@ -442,4 +447,20 @@
mdi.is_active = '1' AND mdi.ma_id =#{maId} mdi.is_active = '1' AND mdi.ma_id =#{maId}
</where> </where>
</select> </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> </mapper>

View File

@ -9,8 +9,9 @@
c.company_name AS propertyUnit, c.company_name AS propertyUnit,
mdi.ma_id AS maId, mdi.ma_id AS maId,
mdi.device_name AS name, mdi.device_name AS name,
mdi.item_type_model AS specificationModel,
mdi.`code` AS code, mdi.`code` AS code,
mdi.brand AS manufacturer, ms.supplier_name AS manufacturer,
mdi.production_date AS productionDate, mdi.production_date AS productionDate,
mdi.expiration_time AS expirationTime, 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 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 ma_dev_info mdi
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company 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 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) WHERE mdi.is_active = 1 and mdi.entry_status = '1' and mdi.change_status in (1,5)
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND mdi.device_name like concat('%',#{deviceName},'%') AND mdi.device_name like concat('%',#{name},'%')
</if> </if>
<if test="manufacturer != null and manufacturer != ''"> <if test="manufacturerId != null and manufacturerId != ''">
AND mdi.manufacturer like concat('%',#{manufacturer},'%') AND mdi.supplier_id like concat('%',#{manufacturerId},'%')
</if> </if>
) a ) a
<where> <where>

View File

@ -183,7 +183,7 @@
<update id="updateChangeStatus"> <update id="updateChangeStatus">
<foreach collection="list" item="data" separator=";"> <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> </foreach>
</update> </update>

View File

@ -143,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
moi.code AS code, moi.code AS code,
GROUP_CONCAT(hh.id) AS ids, GROUP_CONCAT(hh.id) AS ids,
GROUP_CONCAT(mdi.ma_id) AS maIds,
moi.order_time, moi.order_time,
mdi.on_company as sellerCompany, mdi.on_company as sellerCompany,
up.dept_name AS czcompanyName, up.dept_name AS czcompanyName,