Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
b35d42ff20
|
|
@ -212,4 +212,12 @@ public interface MachineMapper
|
|||
LeaseApplyInfo getBackParentId(Machine machine);
|
||||
|
||||
LeaseApplyInfo getBackUnitAndProject(LeaseApplyInfo leaseInfoBack);
|
||||
|
||||
|
||||
/**
|
||||
* 新增批量更新方法
|
||||
* @param samples
|
||||
* @return
|
||||
*/
|
||||
int batchUpdateSynchReport(@Param("list") List<SampleSync> samples);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import com.bonus.material.ma.mapper.MachineMapper;
|
|||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.ma.service.IMachineService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
|
@ -302,35 +303,40 @@ public class MachineServiceImpl implements IMachineService
|
|||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult synchReport(Machine machine)
|
||||
{
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult synchReport(Machine machine) {
|
||||
try {
|
||||
String pdfUrl = machine.getPdf();
|
||||
String checkTime = machine.getCheckTimeSynch()+ " 00:00:00";
|
||||
String nextCheckTime = machine.getNextCheckTimeSynch()+ " 00:00:00";
|
||||
String checkTime = machine.getCheckTimeSynch() + " 00:00:00";
|
||||
String nextCheckTime = machine.getNextCheckTimeSynch() + " 00:00:00";
|
||||
String reportName = machine.getReportName();
|
||||
String reportNum = machine.getReportNum();
|
||||
if(machine.getSamples()!=null && machine.getSamples().size()>0){
|
||||
int numAll = 0;
|
||||
for(SampleSync sample : machine.getSamples()){
|
||||
|
||||
List<SampleSync> samples = machine.getSamples();
|
||||
if(samples != null && !samples.isEmpty()){
|
||||
// 批量设置属性
|
||||
for(SampleSync sample : samples){
|
||||
sample.setCheckTimeSynch(checkTime);
|
||||
sample.setNextCheckTimeSynch(nextCheckTime);
|
||||
sample.setPdf(pdfUrl);
|
||||
sample.setReportName(reportName);
|
||||
sample.setReportNum(reportNum);
|
||||
int result = machineMapper.updateSynchReport(sample);
|
||||
numAll += result;
|
||||
}
|
||||
if(numAll>0){
|
||||
return success("同步成功");
|
||||
// 使用批量更新
|
||||
int numAll = machineMapper.batchUpdateSynchReport(samples);
|
||||
if(numAll > 0){
|
||||
return success("同步成功,更新了 " + numAll + " 条记录");
|
||||
}else{
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return error("同步失败,暂无相关的机具编码");
|
||||
}
|
||||
}
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return error("同步失败,暂无相关的机具编码");
|
||||
} catch (Exception e) {
|
||||
return error("同步报告失败:" + e.getMessage());
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error(e.getMessage());
|
||||
return error("同步报告失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ public class RepairInputDetailsServiceImpl implements IRepairInputDetailsService
|
|||
RepairInputInfo repairInputInfo = new RepairInputInfo();
|
||||
repairInputInfo.setTypeId(repairInputDetails.getTypeId());
|
||||
repairInputInfo.setInputNum(repairInputDetails.getInputNum());
|
||||
repairInputDetailsMapper.updateNum(repairInputInfo);
|
||||
// repairInputDetailsMapper.updateNum(repairInputInfo);
|
||||
Long newTaskId = insertTt(repairInputDetails.getTaskId());
|
||||
result += insertTta(newTaskId, repairInputDetails);
|
||||
result += insertWxTask(newTaskId, repairInputDetails);
|
||||
|
|
|
|||
|
|
@ -548,6 +548,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<update id="batchUpdateSynchReport" parameterType="java.util.List">
|
||||
UPDATE ma_machine
|
||||
SET
|
||||
check_man = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.tester}
|
||||
</foreach>
|
||||
END,
|
||||
inspect_man = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.tester}
|
||||
</foreach>
|
||||
END,
|
||||
this_check_time = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.checkTimeSynch}
|
||||
</foreach>
|
||||
END,
|
||||
next_check_time = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.nextCheckTimeSynch}
|
||||
</foreach>
|
||||
END,
|
||||
inspect_status = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.result}
|
||||
</foreach>
|
||||
END,
|
||||
ex_code = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.reportNum}
|
||||
</foreach>
|
||||
END,
|
||||
ex_url = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.pdf}
|
||||
</foreach>
|
||||
END,
|
||||
ex_name = CASE ma_code
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.selfCode} THEN #{item.reportName}
|
||||
</foreach>
|
||||
END,
|
||||
ex_up_time = NOW()
|
||||
WHERE ma_code IN (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{item.selfCode}
|
||||
</foreach>
|
||||
)
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectMachineByQrCode" resultType="com.bonus.material.ma.domain.Machine">
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@
|
|||
bui.unit_name AS backUnit,
|
||||
bpi.pro_name AS backPro,
|
||||
bai.CODE AS backCode,
|
||||
bai.back_person as backPerson,
|
||||
GROUP_CONCAT(DISTINCT mt2.type_name) as type,
|
||||
rd.level as level,
|
||||
GROUP_CONCAT(DISTINCT mt4.type_id) as firstId,
|
||||
|
|
@ -1168,7 +1169,7 @@
|
|||
update
|
||||
pa_person_storage
|
||||
set
|
||||
part_num = part_num - #{partNum}
|
||||
part_num = #{partNum}
|
||||
where
|
||||
id=#{id}
|
||||
</update>
|
||||
|
|
|
|||
Loading…
Reference in New Issue