|
|
|
@ -1,73 +0,0 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderInfo;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPullingOrderPartInfo;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPullingOrderInfoRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesPullingOrderPartInfoRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.shiro.util.CollectionUtils;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
/**
|
|
|
|
|
* @Description : SPS拉动
|
|
|
|
|
* @Reference :
|
|
|
|
|
* @Author : junsheng.li
|
|
|
|
|
* @CreateDate 2024/10/22 9:29
|
|
|
|
|
* @Modify:
|
|
|
|
|
**/
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesPullingOrderInfoService {
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(MesPullingOrderInfoService.class);
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPullingOrderInfoRepository mesPullingOrderInfoRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesPullingOrderPartInfoRepository mesPullingOrderPartInfoRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String,Object> doSPSForEquipment(String assemblyLine, String pullingGroupCode, String organizeCode) {
|
|
|
|
|
Map<String,Object> resultMap = new HashMap();
|
|
|
|
|
//查询拉动单状态为已扫描=20的 拉动单
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PART_PULL_ORDER_TYPE.SPS_PULL.getValue(), "pullOrderType", seriesPackBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.PULL_ORDER_STATUS.JIS_PULL.getValue(), "pullOrderStatus", seriesPackBean);
|
|
|
|
|
seriesPackBean.setWhereAppend(seriesPackBean.getWhereAppend() + " order by modifyDatetime desc");
|
|
|
|
|
|
|
|
|
|
MesPullingOrderInfo mesPullingOrder = mesPullingOrderInfoRepository.getByProperty(seriesPackBean);
|
|
|
|
|
if (StringUtil.isEmpty(mesPullingOrder)) {
|
|
|
|
|
resultMap.put("success", false);
|
|
|
|
|
String message = "SPS拉动数据已扫描数据为空,请检查拉动单数据";
|
|
|
|
|
resultMap.put("message", message);
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
//更新主表状态 源系统为25配料完成 现在-【已发送设备-30】
|
|
|
|
|
mesPullingOrder.setPullOrderStatus(MesExtEnumUtil.PULL_ORDER_STATUS.SPS_PULL.getValue());
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesPullingOrder, "WS.SPS");
|
|
|
|
|
mesPullingOrderInfoRepository.update(mesPullingOrder);
|
|
|
|
|
String message = "更新SPS状态成功,已发送SPS信息给设备! id:" + mesPullingOrder.getId() + "Code:" + mesPullingOrder.getPullingOrderNo() + "产线" + assemblyLine + "拉动组" + pullingGroupCode + "";
|
|
|
|
|
//查询拉动组明细
|
|
|
|
|
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(mesPullingOrder.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesPullingOrder.getPullingOrderNo(), "pullingOrderNo", partPackBean);
|
|
|
|
|
List<MesPullingOrderPartInfo> pullingOrderPartInfos = mesPullingOrderPartInfoRepository.findByHqlWhere(partPackBean);
|
|
|
|
|
if (!CollectionUtils.isEmpty(pullingOrderPartInfos)) {
|
|
|
|
|
mesPullingOrder.setPartList(pullingOrderPartInfos);
|
|
|
|
|
}
|
|
|
|
|
resultMap.put("orderInfo", mesPullingOrder);
|
|
|
|
|
resultMap.put("success", true);
|
|
|
|
|
resultMap.put("message", message);
|
|
|
|
|
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
}
|