Commit 7d1d945b authored by 耿迪迪's avatar 耿迪迪
parents 32d63943 cd0f3424
package com.zehong.dao; package com.zehong.dao;
import com.zehong.entity.PCBADevices; import com.zehong.entity.PCBADevices;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface PCBADevicesMapper { public interface PCBADevicesMapper {
...@@ -12,6 +14,9 @@ public interface PCBADevicesMapper { ...@@ -12,6 +14,9 @@ public interface PCBADevicesMapper {
*/ */
List<PCBADevices> selectPcbaDeviceInfoByBoardCode(String motherboardCode); List<PCBADevices> selectPcbaDeviceInfoByBoardCode(String motherboardCode);
List<PCBADevices> selectPcbaDeviceInfoByNbBoradCodeAndTasksNumber(@Param("nbMotherBoardCode") String nbMotherBoardCode,
@Param("pcbaProductionTasksNumber") String pcbaProductionTasksNumber);
/** /**
* 更新设备信息 * 更新设备信息
* @param devices 设备信息 * @param devices 设备信息
......
...@@ -165,8 +165,17 @@ public class ScanCodeResultServiceImpl implements ScanCodeResultService{ ...@@ -165,8 +165,17 @@ public class ScanCodeResultServiceImpl implements ScanCodeResultService{
private int updateNbCodeByMainBoardCode(Map<String,Object> analysisResult){ private int updateNbCodeByMainBoardCode(Map<String,Object> analysisResult){
PCBADevices devices = new PCBADevices(); PCBADevices devices = new PCBADevices();
List<String> mainCodes = (List<String>) analysisResult.get(PCBACodeRules.MAINBOARDCODE.name()); List<String> mainCodes = (List<String>) analysisResult.get(PCBACodeRules.MAINBOARDCODE.name());
List<PCBADevices> nbCode = pcbaDevicesMapper.selectPcbaDeviceInfoByNbBoradCodeAndTasksNumber(analysisResult.get("nbCode").toString(), mainCodes.get(0));
if(CollectionUtils.isEmpty(nbCode)) {
return 0;
}
PCBADevices pcbaDevices = nbCode.get(0);
String iotCardBatchNumber = pcbaDevices.getIotCardBatchNumber();
devices.setMotherboardCode(mainCodes.get(0)); devices.setMotherboardCode(mainCodes.get(0));
devices.setNbCode(analysisResult.get("nbCode").toString()); devices.setNbCode(analysisResult.get("nbCode").toString());
devices.setIotCardBatchNumber(iotCardBatchNumber);
devices.setCreateTime(new Date()); devices.setCreateTime(new Date());
return pcbaDevicesMapper.updatePcbaDeviceInfoByMotherBoardCode(devices); return pcbaDevicesMapper.updatePcbaDeviceInfoByMotherBoardCode(devices);
} }
......
...@@ -26,6 +26,17 @@ ...@@ -26,6 +26,17 @@
t_pcba_devices t_pcba_devices
WHERE f_motherboard_code = #{ motherboardCode } WHERE f_motherboard_code = #{ motherboardCode }
</select> </select>
<select id="selectPcbaDeviceInfoByNbBoradCodeAndTasksNumber" resultMap="PcbaDevicesResult">
SELECT
devices.iot_card_batch_number
FROM
t_pcba_devices devices
WHERE
devices.f_motherboard_code = #{nbMotherBoardCode}
AND devices.f_pcba_production_tasks_number =
(select f_pcba_production_tasks_number from t_pcba_devices where f_motherboard_code = #{pcbaProductionTasksNumber})
</select>
<update id="updatePcbaDeviceInfo" parameterType="PcbaDevices"> <update id="updatePcbaDeviceInfo" parameterType="PcbaDevices">
update t_pcba_devices update t_pcba_devices
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment