|
|
|
@ -14,7 +14,14 @@ import com.foreverwin.mesnac.anomaly.service.AbnormalBillLogService;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.AbnormalBillService;
|
|
|
|
|
import com.foreverwin.mesnac.anomaly.service.AbnormalNcCodeService;
|
|
|
|
|
import com.foreverwin.mesnac.common.constant.Constants;
|
|
|
|
|
import com.foreverwin.mesnac.common.enums.HandleEnum;
|
|
|
|
|
import com.foreverwin.mesnac.common.util.StringUtil;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.mapper.NwaUserMapper;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.mapper.ShopOrderMapper;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.Router;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.model.ShopOrder;
|
|
|
|
|
import com.foreverwin.mesnac.meapi.service.RouterService;
|
|
|
|
|
import com.foreverwin.modular.core.exception.BusinessException;
|
|
|
|
|
import com.foreverwin.modular.core.util.CommonMethods;
|
|
|
|
|
import com.foreverwin.modular.core.util.FrontPage;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -53,6 +60,15 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
|
|
|
|
|
@Autowired
|
|
|
|
|
private AbnormalBillDisposeService abnormalBillDisposeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private RouterService routerService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private NwaUserMapper nwaUserMapper;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ShopOrderMapper shopOrderMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<AbnormalBillLog> selectPage(FrontPage<AbnormalBillLog> frontPage, AbnormalBillLog abnormalBillLog) {
|
|
|
|
|
QueryWrapper<AbnormalBillLog> queryWrapper = new QueryWrapper<>();
|
|
|
|
@ -71,6 +87,7 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
|
|
|
|
|
public void saveAndUpdate(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose, List<String> ncGroupAndNcCodes, List<String> dutyCauseType, List<String> dutyType) {
|
|
|
|
|
String user = CommonMethods.getUser();
|
|
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
String site = CommonMethods.getSite();
|
|
|
|
|
AbnormalBillLog abnormalBillLog = abnormalBillLogMapper.findAllByAbnormalNo(abnormalBill);
|
|
|
|
|
|
|
|
|
|
if(abnormalBillLogMapper.selectById(abnormalBillLog.getHandle()) == null){
|
|
|
|
@ -118,11 +135,41 @@ public class AbnormalBillLogServiceImpl extends ServiceImpl<AbnormalBillLogMappe
|
|
|
|
|
abnormalBillLog.setModifiedDateTime(now);
|
|
|
|
|
this.save(abnormalBillLog);;
|
|
|
|
|
}
|
|
|
|
|
// abnormalBillService.generateAbnormalBill(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType);
|
|
|
|
|
// abnormalBillService.saveOrUpdate(abnormalBill);
|
|
|
|
|
// abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose);
|
|
|
|
|
if(!StringUtil.isBlank(abnormalBillDispose.getRouterBo())){
|
|
|
|
|
//分割该工艺路线
|
|
|
|
|
String[] routerSplit = abnormalBillDispose.getRouterBo().split(",");
|
|
|
|
|
//判断该返修工艺是否正确
|
|
|
|
|
Router router = new Router();
|
|
|
|
|
router.setSite(site);
|
|
|
|
|
router.setRouter(routerSplit[1]);
|
|
|
|
|
router.setRouterType(routerSplit[2]);
|
|
|
|
|
router.setCurrentRevision("true");
|
|
|
|
|
List<Router> routers = routerService.selectList(router);
|
|
|
|
|
if(routers == null || routers.size() == 0){
|
|
|
|
|
throw BusinessException.build("该返修工艺不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//判断返修工单是否正确
|
|
|
|
|
if(!StringUtil.isBlank(abnormalBillDispose.getResolveShopOrder())){
|
|
|
|
|
ShopOrder shopOrder = shopOrderMapper.selectById(HandleEnum.SHOP_ORDER.getHandle(site, abnormalBillDispose.getResolveShopOrder()));
|
|
|
|
|
if(shopOrder == null){
|
|
|
|
|
throw BusinessException.build("该返修工单不存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//发送用户
|
|
|
|
|
String[] split = abnormalBillDispose.getResolveSendUser().split(",");
|
|
|
|
|
List<String> strings = Arrays.asList(split);
|
|
|
|
|
int length = nwaUserMapper.checkUser(site, strings);
|
|
|
|
|
if(length != strings.size()){
|
|
|
|
|
throw BusinessException.build("发送用户填报错误");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Constants.ABNORMAL_QUALITY.equals(abnormalBill.getType())){
|
|
|
|
|
abnormalBillService.anomalyReport(abnormalBill,abnormalBillDispose,ncGroupAndNcCodes,dutyCauseType,dutyType);
|
|
|
|
|
}else if(Constants.ABNORMAL_OTHER.equals(abnormalBill.getType())){
|
|
|
|
|
abnormalBillService.anomalyReportOther(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|