图纸版本号获取

master
yangwl 3 years ago
parent dc0bc98d11
commit 735c7fb6a9

@ -92,4 +92,5 @@ public class FileServiceImpl implements FileService {
return pathMap;
}
}

@ -5,6 +5,7 @@ import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@ -36,7 +37,7 @@ public interface SfcDispatchService extends IService<SfcDispatch> {
* @param paramMap
* @return
*/
List<SfcDispatchDto> findSfcDispatchList(Map paramMap);
List<SfcDispatchDto> findSfcDispatchList(Map paramMap) throws IOException;
/**
*
@ -108,7 +109,7 @@ public interface SfcDispatchService extends IService<SfcDispatch> {
* @param paramMap
* @return
*/
Map<String, Object> ganttList(String site, Map paramMap);
Map<String, Object> ganttList(String site, Map paramMap) throws IOException;
}

@ -8,18 +8,16 @@ import com.foreverwin.mesnac.common.constant.Constants;
import com.foreverwin.mesnac.common.dto.SfcDispatchDto;
import com.foreverwin.mesnac.common.enums.DispatchStatusEnum;
import com.foreverwin.mesnac.common.enums.HandleEnum;
import com.foreverwin.mesnac.common.ftp.CappFtpClient;
import com.foreverwin.mesnac.common.service.ProdReadyTaskService;
import com.foreverwin.mesnac.common.service.SfcDispatchCommonService;
import com.foreverwin.mesnac.common.util.DateUtil;
import com.foreverwin.mesnac.common.util.ExcelUtils;
import com.foreverwin.mesnac.common.util.StringUtil;
import com.foreverwin.mesnac.common.util.*;
import com.foreverwin.mesnac.dispatch.dto.RouterDTO;
import com.foreverwin.mesnac.dispatch.dto.SfcDispatchEmployeeDto;
import com.foreverwin.mesnac.dispatch.dto.WorkCenterWorkTimeDTO;
import com.foreverwin.mesnac.dispatch.mapper.SfcDispatchMapper;
import com.foreverwin.mesnac.dispatch.model.CallItem;
import com.foreverwin.mesnac.dispatch.model.SfcDispatch;
import com.foreverwin.mesnac.dispatch.model.SfcDispatchEmployee;
import com.foreverwin.mesnac.dispatch.model.UserResource;
import com.foreverwin.mesnac.dispatch.service.*;
import com.foreverwin.mesnac.meapi.dto.WorkCenterLinkDTO;
@ -30,6 +28,7 @@ import com.foreverwin.modular.core.exception.BaseException;
import com.foreverwin.modular.core.exception.BusinessException;
import com.foreverwin.modular.core.util.CommonMethods;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.net.ftp.FTPClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -40,7 +39,7 @@ import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.net.InetAddress;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@ -87,6 +86,8 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
private ProductionCalendarService productionCalendarService;
@Autowired
private SfcDispatchEmployeeService sfcDispatchEmployeeService;
@Autowired
private CappFtpClient cappFtpClient;
@Override
public List<SfcDispatch> findSfcDispatch(String site, String sfc, String operation, String stepId) {
@ -94,24 +95,11 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
@Override
public List<SfcDispatchDto> findSfcDispatchList(Map paramMap) {
public List<SfcDispatchDto> findSfcDispatchList(Map paramMap) throws IOException {
List<SfcDispatchDto> list = sfcDispatchMapper.findSfcDispatchList(paramMap);
if (list == null || list.size() <= 0) {
// List<SfcDispatchDto> sfcDispatchDtoList=new ArrayList<>();
// for(SfcDispatchDto sfcDispatchDto:list){
// Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(), sfcDispatchDto.getSfc()));
// if (sfcServiceById==null){
// sfcDispatchDto.setDrawingsRevision(null);
// }else {
// String itemBo = sfcServiceById.getItemBo();
// String path="/"+ StringUtil.trimHandle(itemBo)+"_"+StringUtil.trimRevision(itemBo)+"/";
// sfcDispatchDto.setDrawingsRevision(path);
// }
// sfcDispatchDtoList.add(sfcDispatchDto);
// }
return list;
}
//查询用户对应用户组
String site = CommonMethods.getSite();
String user = CommonMethods.getUser();
@ -136,11 +124,27 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
}
}
//赋值用户组
for (SfcDispatchDto sfcDispatch: list) {
GetDrawingVersionUtil getDrawingVersionUtil=new GetDrawingVersionUtil();
//登录Capp的FTP文件服务器
FTPClient connect = null;
try {
connect = cappFtpClient.login();
for (SfcDispatchDto sfcDispatch : list) {
if (sfcDispatch.getDrawingsRevision()==null||sfcDispatch.getDrawingsRevision()==""){
Sfc sfcServiceById = sfcService.getById(HandleEnum.SFC.getHandle(CommonMethods.getSite(), sfcDispatch.getSfc()));
String itemBo = sfcServiceById.getItemBo();
sfcDispatch.setDrawingsRevision(getDrawingVersionUtil.GetDrawingVerson(itemBo, connect));
sfcDispatch.setRole(role);
}
}
}catch (Exception e){
ExceptionUtil.throwException(e);
}finally {
if (connect!=null&&connect.isConnected()){
connect.logout();
connect.disconnect();
}
}
return list;
}
@ -216,7 +220,6 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
if (!DispatchStatusEnum.NEW.getCode().equals(status) && !DispatchStatusEnum.RELEASE.getCode().equals(status)) {
throw BusinessException.build("工单[" + shopOrder + "]的派工单[" + dispatchNo + "]派工状态不是新建或发布状态,不能变更为暂挂!");
}
sfcDispatch = new SfcDispatch();
sfcDispatch.setHandle(sfcDispatchDto.getHandle());
sfcDispatch.setDispatchStatus(DispatchStatusEnum.PAUSE.getCode());
@ -303,7 +306,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
@Override
public Map<String, Object> ganttList(String site, Map paramMap) {
public Map<String, Object> ganttList(String site, Map paramMap) throws IOException {
Map<String, Object> map = new HashMap<>();
//查询派工数据
@ -637,6 +640,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
sfcDispatch.setEmployee(employees);
sfcDispatch.setEmployeeDescription(sfcDispatchDto.getEmployeeDescription());
sfcDispatch.setRemark(sfcDispatchDto.getRemark());
sfcDispatch.setDrawingsRevision(sfcDispatchDto.getDrawingsRevision());
sfcDispatch.setBlankingSize(sfcDispatchDto.getBlankingSize());
sfcDispatch.setPlannedStartDate(sfcDispatchDto.getPlannedStartDate());
sfcDispatch.setPlannedCompDate(sfcDispatchDto.getPlannedCompDate());
@ -907,6 +911,4 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
return result;
}
}

@ -679,7 +679,7 @@
WHEN WIP.DISPATCH_STATUS = 'PAUSE' THEN N'暂停' WHEN WIP.DISPATCH_STATUS = 'RELEASE' THEN N'发布'
END AS STATUS_NAME, 'ADMINISTRATOR' AS ROLE
FROM (
SELECT SD.HANDLE, SD.SITE, SD.SHOP_ORDER, SD.DISPATCH_NO, SD.ROUTER_BO, C2.VALUE ITEM_NUMBER, C1.VALUE WORK_ORDER, IM.HANDLE ITEM_BO, IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, SD.SFC, SD.DISPATCH_STATUS,
SELECT SD.HANDLE, SD.SITE, SD.SHOP_ORDER, SD.DISPATCH_NO, SD.ROUTER_BO, C2.VALUE ITEM_NUMBER, C1.VALUE WORK_ORDER, IM.HANDLE ITEM_BO, IM.ITEM, IT.DESCRIPTION ITEM_DESCRIPTION, SD.SFC, SD.DISPATCH_STATUS,SD.DRAWINGS_REVISION,
SD.STEP_ID, SD.OPERATION, OT.DESCRIPTION OPERATION_DESCRIPTION, SD.RESOURCE_TYPE, SD.RESRCE, SD.EMPLOYEE, SD.EMPLOYEE USER_NAME, SD.DISPATCH_QTY, SD.PROD_HOURS, RS.DESCRIPTION RESOURCE_DESCRIPTION,
CASE WHEN SD.DISPATCH_STATUS = 'COMPLETE' THEN SD.DISPATCH_QTY ELSE 0 END COMPLETED_QTY, SD.PLANNED_START_DATE, SD.PLANNED_COMP_DATE, SD.WORK_CENTER, SD.IS_DISPATCH, SD.EMPLOYEE_DESCRIPTION,
SD.ACTUAL_START_DATE, SD.ACTUAL_COMPLETE_DATE, SD.REMARK, SD.DISPATCH_SEQ, SD.DISPATCH_SEQ-1 BEFORE_SEQ, SD.DISPATCH_SEQ+1 AFTER_SEQ, SD.EARLIEST_START_DATE, SD.LATEST_END_DATE,
@ -777,7 +777,7 @@
<if test="completeToDate != null">
AND SD.PLANNED_COMP_DATE &lt;= TO_DATE(#{completeToDate}|| '23:59:59', 'YYYY-MM-DD HH24:MI:SS')
</if>
GROUP BY SD.HANDLE, SD.SITE, SD.SHOP_ORDER, SD.DISPATCH_NO, SD.ROUTER_BO, C2.VALUE, C1.VALUE, IM.HANDLE, IM.ITEM, IT.DESCRIPTION, SD.SFC, SD.DISPATCH_STATUS,
GROUP BY SD.HANDLE, SD.SITE, SD.SHOP_ORDER, SD.DISPATCH_NO, SD.ROUTER_BO, C2.VALUE, C1.VALUE, IM.HANDLE, IM.ITEM, IT.DESCRIPTION, SD.SFC, SD.DISPATCH_STATUS,SD.DRAWINGS_REVISION,
SD.STEP_ID, SD.OPERATION, OT.DESCRIPTION, SD.RESOURCE_TYPE, SD.RESRCE, SD.EMPLOYEE, SD.EMPLOYEE, SD.DISPATCH_QTY, SD.PROD_HOURS, RS.DESCRIPTION,
SD.DISPATCH_STATUS, SD.DISPATCH_QTY, SD.PLANNED_START_DATE, SD.PLANNED_COMP_DATE, SD.WORK_CENTER, SD.IS_DISPATCH, SD.EMPLOYEE_DESCRIPTION,
SD.ACTUAL_START_DATE, SD.ACTUAL_COMPLETE_DATE, SD.REMARK, SD.DISPATCH_SEQ, SD.EARLIEST_START_DATE, SD.LATEST_END_DATE,

Loading…
Cancel
Save