Commit cd0f3424 authored by wanghao's avatar wanghao

1 更新NB码时,同时 更新卡批次号上去;

parent c6c677bd
package com.zehong.dao;
import com.zehong.entity.PCBADevices;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PCBADevicesMapper {
......@@ -12,6 +14,9 @@ public interface PCBADevicesMapper {
*/
List<PCBADevices> selectPcbaDeviceInfoByBoardCode(String motherboardCode);
List<PCBADevices> selectPcbaDeviceInfoByNbBoradCodeAndTasksNumber(@Param("nbMotherBoardCode") String nbMotherBoardCode,
@Param("pcbaProductionTasksNumber") String pcbaProductionTasksNumber);
/**
* 更新设备信息
* @param devices 设备信息
......
......@@ -150,8 +150,17 @@ public class ScanCodeResultServiceImpl implements ScanCodeResultService{
public int updateNbCodeByMainBoardCode(Map<String,Object> analysisResult){
PCBADevices devices = new PCBADevices();
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.setNbCode(analysisResult.get("nbCode").toString());
devices.setIotCardBatchNumber(iotCardBatchNumber);
devices.setCreateTime(new Date());
return pcbaDevicesMapper.updatePcbaDeviceInfoByMotherBoardCode(devices);
}
......
......@@ -26,6 +26,17 @@
t_pcba_devices
WHERE f_motherboard_code = #{ motherboardCode }
</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 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