update 外协虚拟工序计划下达自动发布

master
yinq 2 years ago
parent 0a67ae1ee6
commit 3cda55f5fc

@ -98,7 +98,7 @@ public interface ShopOrderReleaseService {
* @param sfcModel
* @param routerList
*/
void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList) throws IOException;
void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList, String isSplitSfc) throws IOException;
Boolean changerouterRevision(List<ShopOrderRelease> shopOrderRelease,StringBuffer message,String type);

@ -903,7 +903,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl<SfcDispatchMapper, SfcDi
}
shopOrderReleaseService.sfcDispatch(site, user, shopOrderModel, sfcModel, routerList);
shopOrderReleaseService.sfcDispatch(site, user, shopOrderModel, sfcModel, routerList, "true");
}
}

@ -41,6 +41,7 @@ import org.apache.commons.fileupload.FileItem;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.ibatis.exceptions.PersistenceException;
import org.apache.ibatis.executor.BatchExecutorException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -296,7 +297,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
Sfc sfcModel = new Sfc();
sfcModel.setSfc(releasedSfc.getSfc());
sfcModel.setQty(releasedSfc.getQuantity().doubleValue());
sfcDispatch(site, user, shopOrderModel, sfcModel, routerList);
sfcDispatch(site, user, shopOrderModel, sfcModel, routerList, "false");
}
return flag;
}
@ -305,7 +306,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
//------------------------------------------------------------------------------------------------------------------
/**派工--按工序**/
@Override
public void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList) throws IOException {
public void sfcDispatch(String site, String user, ShopOrder shopOrderModel, Sfc sfcModel, List<RouterDTO> routerList, String isSplitSfc) throws IOException {
LocalDateTime nowDate = LocalDateTime.now();
String router = routerList.get(0).getRouter();
@ -333,8 +334,11 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
String routerStepBo = entryRouterStepBo;
//首工序计划开始时间为工单计划开始时间
//LocalDateTime plannedStartDate = shopOrderModel.getPlannedStartDate();
//LocalDateTime plannedCompleteDate = shopOrderModel.getPlannedStartDate();
LocalDateTime plannedStartDate = shopOrderModel.getPlannedStartDate();
if (plannedStartDate == null){
plannedStartDate = nowDate;
}
LocalDateTime plannedCompleteDate;
//前置步骤&工序
String prepositionStepId = null;
@ -365,7 +369,7 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
Double prodHours = new Double(this.prodHoursCl(operation, routerDTO.getProdHours()));
//计算完成时间
//plannedCompleteDate = plannedStartDate.plusMinutes(prodHours.longValue());
plannedCompleteDate = plannedStartDate.plusMinutes(prodHours.longValue());
//查询工序所属车间
String workCenter = null;
@ -402,8 +406,10 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
sfcDispatchModel.setDispatchQty(sfcModel.getQty());
sfcDispatchModel.setProdHours(prodHours);
sfcDispatchModel.setTurnOperation("false");
//sfcDispatchModel.setPlannedStartDate(plannedStartDate);
//sfcDispatchModel.setPlannedCompleteDate(plannedCompleteDate);
if (operation.equals("WX_6106GX")) {
sfcDispatchModel.setPlannedStartDate(plannedStartDate);
sfcDispatchModel.setPlannedCompDate(plannedCompleteDate);
}
sfcDispatchModel.setSoReleasedDate(nowDate);
sfcDispatchModel.setIsDispatch(Constants.BOOL_FALSE);
sfcDispatchModel.setIsImport(Constants.BOOL_FALSE);
@ -439,6 +445,24 @@ public class ShopOrderReleaseServiceImpl implements ShopOrderReleaseService {
//批量插入工位&人员派工数据
try {
sfcDispatchService.saveBatch(sfcDispatchList);
//工单下达->外协虚拟工序自动发布
if ("false".equals(isSplitSfc)){
List<SfcDispatchDto> sfcDispatchDtoList = new ArrayList<>();
for (SfcDispatch sfcDispatch : sfcDispatchList) {
if (sfcDispatch.getOperation().equals("WX_6106GX")){
SfcDispatchDto sfcDispatchDto = new SfcDispatchDto();
BeanUtils.copyProperties(sfcDispatch,sfcDispatchDto);
sfcDispatchDto.setEmployee("WX000001");
sfcDispatchDto.setResrce("WX0000001");
sfcDispatchDto.setResourceDescription("虚拟资源");
sfcDispatchDto.setEmployeeDescription("外协虚拟");
sfcDispatchDtoList.add(sfcDispatchDto);
}
}
if (sfcDispatchDtoList.size() != 0){
sfcDispatchService.releaseDispatch(site,user,new StringBuffer("工单下达外协虚拟工序自动发布:"),sfcDispatchDtoList);
}
}
}catch (PersistenceException e){
throw new BaseException("此工单存在返修工序,返修工序步骤标识重复,请修改返修工艺的步骤标识数值!");
}

Loading…
Cancel
Save